Commit 4cbe435d authored by Sung Joon Kim's avatar Sung Joon Kim Committed by Alex Deucher

drm/amd/display: retain/release stream pointer in link enc table

[why]
At every reference to stream pointer, we need to increment/decrement the
kref_count.  Not doing so will result in invalid stream pointer still
alive after hibernate cycle.

[how]
Call stream retain/release whenever the link encoder assignment is set
to true/false since it indicates if we want to reference the stream
pointer or not.
Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
Acked-by: default avatarAnson Jacob <Anson.Jacob@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarSung Joon Kim <sungkim@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e43098f6
...@@ -122,6 +122,7 @@ static void remove_link_enc_assignment( ...@@ -122,6 +122,7 @@ static void remove_link_enc_assignment(
stream->link_enc = NULL; stream->link_enc = NULL;
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].eng_id = ENGINE_ID_UNKNOWN; state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].eng_id = ENGINE_ID_UNKNOWN;
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream = NULL; state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream = NULL;
dc_stream_release(stream);
break; break;
} }
} }
...@@ -144,6 +145,7 @@ static void add_link_enc_assignment( ...@@ -144,6 +145,7 @@ static void add_link_enc_assignment(
*/ */
for (i = 0; i < state->stream_count; i++) { for (i = 0; i < state->stream_count; i++) {
if (stream == state->streams[i]) { if (stream == state->streams[i]) {
dc_stream_retain(stream);
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i] = (struct link_enc_assignment){ state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i] = (struct link_enc_assignment){
.valid = true, .valid = true,
.ep_id = (struct display_endpoint_id) { .ep_id = (struct display_endpoint_id) {
......
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