diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index e81c9d57b3d17c597904291201b2b3e5d1750f86..8e580ac91b2a418abbcff00544390a290e751b2e 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -424,6 +424,7 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc) static void destruct(struct core_dc *dc) { dc_release_validate_context(dc->current_context); + dc->current_context = NULL; destroy_links(dc); @@ -441,9 +442,6 @@ static void destruct(struct core_dc *dc) if (dc->ctx->logger) dal_logger_destroy(&dc->ctx->logger); - dm_free(dc->current_context); - dc->current_context = NULL; - dm_free(dc->ctx); dc->ctx = NULL; } @@ -1656,7 +1654,6 @@ void dc_update_surfaces_and_stream(struct dc *dc, if (core_dc->current_context != context) { dc_release_validate_context(core_dc->current_context); - dc_retain_validate_context(context); core_dc->current_context = context; } return; diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 5a5ed37474bf5a6b01a52d930607fa525fba01f5..78ba5c6d9ac2803eebde221abd152d9cd4c57d63 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -2166,6 +2166,7 @@ void dc_resource_validate_ctx_copy_construct( struct validate_context *dst_ctx) { int i, j; + int ref_count = dst_ctx->ref_count; *dst_ctx = *src_ctx; @@ -2186,6 +2187,10 @@ void dc_resource_validate_ctx_copy_construct( dc_surface_retain( dst_ctx->stream_status[i].surfaces[j]); } + + /* context refcount should not be overridden */ + dst_ctx->ref_count = ref_count; + } struct clock_source *dc_resource_find_first_free_pll(