mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-16 20:06:50 +07:00
drm/amd/display: fix memory leak
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com> Reviewed-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
d4e745e3db
commit
de37e273df
@ -918,7 +918,6 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
|
|||||||
int i;
|
int i;
|
||||||
struct core_dc *core_dc = DC_TO_CORE(dc);
|
struct core_dc *core_dc = DC_TO_CORE(dc);
|
||||||
struct validate_context *context = dm_alloc(sizeof(struct validate_context));
|
struct validate_context *context = dm_alloc(sizeof(struct validate_context));
|
||||||
bool result = true;
|
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
dm_error("%s: failed to create validate ctx\n", __func__);
|
dm_error("%s: failed to create validate ctx\n", __func__);
|
||||||
@ -927,28 +926,29 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
|
|||||||
dc_resource_validate_ctx_copy_construct(core_dc->current_context, context);
|
dc_resource_validate_ctx_copy_construct(core_dc->current_context, context);
|
||||||
|
|
||||||
post_surface_trace(dc);
|
post_surface_trace(dc);
|
||||||
|
|
||||||
for (i = 0; i < context->res_ctx.pool->pipe_count; i++)
|
for (i = 0; i < context->res_ctx.pool->pipe_count; i++)
|
||||||
if (context->res_ctx.pipe_ctx[i].stream == NULL) {
|
if (context->res_ctx.pipe_ctx[i].stream == NULL) {
|
||||||
context->res_ctx.pipe_ctx[i].pipe_idx = i;
|
context->res_ctx.pipe_ctx[i].pipe_idx = i;
|
||||||
core_dc->hwss.power_down_front_end(
|
core_dc->hwss.power_down_front_end(
|
||||||
core_dc, &context->res_ctx.pipe_ctx[i]);
|
core_dc, &context->res_ctx.pipe_ctx[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
|
if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
|
||||||
BREAK_TO_DEBUGGER();
|
BREAK_TO_DEBUGGER();
|
||||||
result = false;
|
dc_resource_validate_ctx_destruct(context);
|
||||||
goto cleanup;
|
dm_free(context);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
core_dc->hwss.set_bandwidth(core_dc, context, true);
|
core_dc->hwss.set_bandwidth(core_dc, context, true);
|
||||||
|
|
||||||
dc_resource_validate_ctx_copy_construct(context, core_dc->current_context);
|
if (core_dc->current_context) {
|
||||||
|
dc_resource_validate_ctx_destruct(core_dc->current_context);
|
||||||
|
dm_free(core_dc->current_context);
|
||||||
|
}
|
||||||
|
core_dc->current_context = context;
|
||||||
|
|
||||||
cleanup:
|
return true;
|
||||||
dc_resource_validate_ctx_destruct(context);
|
|
||||||
dm_free(context);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dc_commit_surfaces_to_stream(
|
bool dc_commit_surfaces_to_stream(
|
||||||
@ -1440,10 +1440,8 @@ void dc_update_surfaces_and_stream(struct dc *dc,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (core_dc->current_context != context) {
|
dc_resource_validate_ctx_destruct(context);
|
||||||
dc_resource_validate_ctx_destruct(context);
|
dm_free(context);
|
||||||
dm_free(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t dc_get_current_stream_count(const struct dc *dc)
|
uint8_t dc_get_current_stream_count(const struct dc *dc)
|
||||||
|
Loading…
Reference in New Issue
Block a user