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: Aric Cyr <Aric.Cyr@amd.com> Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com> Signed-off-by: Sung Joon Kim <sungkim@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
4f48034b7f
commit
0bb2455585
@ -808,6 +808,10 @@ void dc_stream_set_static_screen_params(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) {
|
||||
dc_release_state(dc->current_state);
|
||||
dc->current_state = NULL;
|
||||
|
@ -151,6 +151,7 @@ static void add_link_enc_assignment(
|
||||
.ep_type = stream->link->ep_type},
|
||||
.eng_id = eng_id,
|
||||
.stream = stream};
|
||||
dc_stream_retain(stream);
|
||||
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];
|
||||
break;
|
||||
@ -247,7 +248,10 @@ static void clear_enc_assignments(const struct dc *dc, struct dc_state *state)
|
||||
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].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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user