dm_free(dc->current_context);
dc->current_context = NULL;
- dm_free(dc->temp_flip_context);
- dc->temp_flip_context = NULL;
dm_free(dc->ctx);
dc->ctx = NULL;
}
dc->current_context = dm_alloc(sizeof(*dc->current_context));
- dc->temp_flip_context = dm_alloc(sizeof(*dc->temp_flip_context));
- if (!dc->current_context || !dc->temp_flip_context) {
+ if (!dc->current_context) {
dm_error("%s: failed to create validate ctx\n", __func__);
goto val_ctx_fail;
}
}
resource_validate_ctx_destruct(core_dc->current_context);
+ dm_free(core_dc->current_context);
- if (core_dc->temp_flip_context != core_dc->current_context) {
- dm_free(core_dc->temp_flip_context);
- core_dc->temp_flip_context = core_dc->current_context;
- }
core_dc->current_context = context;
- memset(core_dc->temp_flip_context, 0, sizeof(*core_dc->temp_flip_context));
return (result == DC_OK);
new_surfaces[i] = srf_updates[i].surface;
/* initialize scratch memory for building context */
- context = core_dc->temp_flip_context;
+ context = dm_alloc(sizeof(*context));
resource_validate_ctx_copy_construct(
core_dc->current_context, context);
if (!resource_attach_surfaces_to_context(
new_surfaces, surface_count, dc_stream, context)) {
BREAK_TO_DEBUGGER();
- return;
+ goto fail;
}
} else {
context = core_dc->current_context;
if (update_type == UPDATE_TYPE_FULL) {
if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
BREAK_TO_DEBUGGER();
- return;
+ goto fail;
} else
core_dc->hwss.set_bandwidth(core_dc, context, false);
}
if (core_dc->current_context != context) {
resource_validate_ctx_destruct(core_dc->current_context);
- core_dc->temp_flip_context = core_dc->current_context;
+ dm_free(core_dc->current_context);
core_dc->current_context = context;
}
+ return;
+
+fail:
+ if (core_dc->current_context != context) {
+ resource_validate_ctx_destruct(context);
+ dm_free(context);
+ }
}
uint8_t dc_get_current_stream_count(const struct dc *dc)