Commit 0bb24555 authored by Sung Joon Kim's avatar Sung Joon Kim Committed by Alex Deucher

drm/amd/display: retain/release at proper places in link_enc assignment

[why]
Need to keep track of number of
references to stream pointer.

[how]
Call stream retain/release whenever
necessary in link_enc table assignment
sequence.
Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: default avatarSung Joon Kim <sungkim@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4f48034b
...@@ -808,6 +808,10 @@ void dc_stream_set_static_screen_params(struct dc *dc, ...@@ -808,6 +808,10 @@ void dc_stream_set_static_screen_params(struct dc *dc,
static void dc_destruct(struct dc *dc) static void dc_destruct(struct dc *dc)
{ {
// reset link encoder assignment table on destruct
if (dc->res_pool->funcs->link_encs_assign)
link_enc_cfg_init(dc, dc->current_state);
if (dc->current_state) { if (dc->current_state) {
dc_release_state(dc->current_state); dc_release_state(dc->current_state);
dc->current_state = NULL; dc->current_state = NULL;
......
...@@ -151,6 +151,7 @@ static void add_link_enc_assignment( ...@@ -151,6 +151,7 @@ static void add_link_enc_assignment(
.ep_type = stream->link->ep_type}, .ep_type = stream->link->ep_type},
.eng_id = eng_id, .eng_id = eng_id,
.stream = stream}; .stream = stream};
dc_stream_retain(stream);
state->res_ctx.link_enc_cfg_ctx.link_enc_avail[eng_idx] = ENGINE_ID_UNKNOWN; state->res_ctx.link_enc_cfg_ctx.link_enc_avail[eng_idx] = ENGINE_ID_UNKNOWN;
stream->link_enc = stream->ctx->dc->res_pool->link_encoders[eng_idx]; stream->link_enc = stream->ctx->dc->res_pool->link_encoders[eng_idx];
break; break;
...@@ -247,7 +248,10 @@ static void clear_enc_assignments(const struct dc *dc, struct dc_state *state) ...@@ -247,7 +248,10 @@ static void clear_enc_assignments(const struct dc *dc, struct dc_state *state)
for (i = 0; i < MAX_PIPES; i++) { for (i = 0; i < MAX_PIPES; i++) {
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].valid = false; state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].valid = false;
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; if (state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream != NULL) {
dc_stream_release(state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream);
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream = NULL;
}
} }
for (i = 0; i < dc->res_pool->res_cap->num_dig_link_enc; i++) { for (i = 0; i < dc->res_pool->res_cap->num_dig_link_enc; i++) {
......
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