Commit 60d671db authored by Jerry Zuo's avatar Jerry Zuo Committed by Alex Deucher

drm/amd/display: Fix ref_count messed up issue

In the full update type, need to add ref_count to the newly
created dc_state->stream. It made mistake to add ref_count to
dc->current_state->stream which keeps adding up without release.
Signed-off-by: default avatarJerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: default avatarRoman Li <Roman.Li@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2e1cc334
...@@ -1322,6 +1322,7 @@ void dc_commit_updates_for_stream(struct dc *dc, ...@@ -1322,6 +1322,7 @@ void dc_commit_updates_for_stream(struct dc *dc,
const struct dc_stream_status *stream_status; const struct dc_stream_status *stream_status;
enum surface_update_type update_type; enum surface_update_type update_type;
struct dc_state *context; struct dc_state *context;
struct dc_context *dc_ctx = dc->ctx;
int i; int i;
stream_status = dc_stream_get_status(stream); stream_status = dc_stream_get_status(stream);
...@@ -1334,8 +1335,17 @@ void dc_commit_updates_for_stream(struct dc *dc, ...@@ -1334,8 +1335,17 @@ void dc_commit_updates_for_stream(struct dc *dc,
update_surface_trace(dc, srf_updates, surface_count); update_surface_trace(dc, srf_updates, surface_count);
if (update_type >= UPDATE_TYPE_FULL) if (update_type >= UPDATE_TYPE_FULL) {
/* initialize scratch memory for building context */
context = dc_create_state();
if (context == NULL) {
DC_ERROR("Failed to allocate new validate context!\n");
return;
}
dc_resource_state_copy_construct(state, context); dc_resource_state_copy_construct(state, context);
}
for (i = 0; i < surface_count; i++) { for (i = 0; i < surface_count; i++) {
...@@ -1361,6 +1371,15 @@ void dc_commit_updates_for_stream(struct dc *dc, ...@@ -1361,6 +1371,15 @@ void dc_commit_updates_for_stream(struct dc *dc,
dc_post_update_surfaces_to_stream(dc); dc_post_update_surfaces_to_stream(dc);
if (dc->current_state != context) {
struct dc_state *old = dc->current_state;
dc->current_state = context;
dc_release_state(old);
}
return; return;
} }
......
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