Commit 9a3afbb3 authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher

drm/amd/display: dc_validate_ctx refocunt fixes.

In dc_resource_validate_ctx_copy_construct don't override dst
context refcount.

Remove extra retain to new ctx in dc_update_surfaces_and_stream
Signed-off-by: default avatarAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 189f73e3
...@@ -424,6 +424,7 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc) ...@@ -424,6 +424,7 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc)
static void destruct(struct core_dc *dc) static void destruct(struct core_dc *dc)
{ {
dc_release_validate_context(dc->current_context); dc_release_validate_context(dc->current_context);
dc->current_context = NULL;
destroy_links(dc); destroy_links(dc);
...@@ -441,9 +442,6 @@ static void destruct(struct core_dc *dc) ...@@ -441,9 +442,6 @@ static void destruct(struct core_dc *dc)
if (dc->ctx->logger) if (dc->ctx->logger)
dal_logger_destroy(&dc->ctx->logger); dal_logger_destroy(&dc->ctx->logger);
dm_free(dc->current_context);
dc->current_context = NULL;
dm_free(dc->ctx); dm_free(dc->ctx);
dc->ctx = NULL; dc->ctx = NULL;
} }
...@@ -1656,7 +1654,6 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1656,7 +1654,6 @@ void dc_update_surfaces_and_stream(struct dc *dc,
if (core_dc->current_context != context) { if (core_dc->current_context != context) {
dc_release_validate_context(core_dc->current_context); dc_release_validate_context(core_dc->current_context);
dc_retain_validate_context(context);
core_dc->current_context = context; core_dc->current_context = context;
} }
return; return;
......
...@@ -2166,6 +2166,7 @@ void dc_resource_validate_ctx_copy_construct( ...@@ -2166,6 +2166,7 @@ void dc_resource_validate_ctx_copy_construct(
struct validate_context *dst_ctx) struct validate_context *dst_ctx)
{ {
int i, j; int i, j;
int ref_count = dst_ctx->ref_count;
*dst_ctx = *src_ctx; *dst_ctx = *src_ctx;
...@@ -2186,6 +2187,10 @@ void dc_resource_validate_ctx_copy_construct( ...@@ -2186,6 +2187,10 @@ void dc_resource_validate_ctx_copy_construct(
dc_surface_retain( dc_surface_retain(
dst_ctx->stream_status[i].surfaces[j]); 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( struct clock_source *dc_resource_find_first_free_pll(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment