drm/amd/display: Clear encoder assignments when state cleared.
[Why] State can be cleared without removing individual streams (by calling dc_remove_stream_from_ctx()). This can leave the encoder assignment module in an incoherent state and cause future assignments to be incorrect. [How] Clear encoder assignments when committing 0 streams or re-initializing hardware. Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Jimmy Kizito <Jimmy.Kizito@amd.com> Reviewed-by: Jun Lei <Jun.Lei@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
0b55313cbd
commit
589bd2f03f
|
@ -236,6 +236,23 @@ static struct link_encoder *get_link_enc_used_by_link(
|
|||
|
||||
return link_enc;
|
||||
}
|
||||
/* Clear all link encoder assignments. */
|
||||
static void clear_enc_assignments(struct dc_state *state)
|
||||
{
|
||||
int i;
|
||||
enum engine_id eng_id;
|
||||
struct dc_stream_state *stream;
|
||||
|
||||
for (i = 0; i < MAX_PIPES; i++) {
|
||||
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].valid = false;
|
||||
eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].eng_id;
|
||||
stream = state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream;
|
||||
if (eng_id != ENGINE_ID_UNKNOWN)
|
||||
state->res_ctx.link_enc_cfg_ctx.link_enc_avail[eng_id - ENGINE_ID_DIGA] = eng_id;
|
||||
if (stream)
|
||||
stream->link_enc = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void link_enc_cfg_init(
|
||||
struct dc *dc,
|
||||
|
@ -250,6 +267,8 @@ void link_enc_cfg_init(
|
|||
state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i] = ENGINE_ID_UNKNOWN;
|
||||
}
|
||||
|
||||
clear_enc_assignments(state);
|
||||
|
||||
state->res_ctx.link_enc_cfg_ctx.mode = LINK_ENC_CFG_STEADY;
|
||||
}
|
||||
|
||||
|
@ -265,6 +284,9 @@ void link_enc_cfg_link_encs_assign(
|
|||
|
||||
ASSERT(state->stream_count == stream_count);
|
||||
|
||||
if (stream_count == 0)
|
||||
clear_enc_assignments(state);
|
||||
|
||||
/* Release DIG link encoder resources before running assignment algorithm. */
|
||||
for (i = 0; i < stream_count; i++)
|
||||
dc->res_pool->funcs->link_enc_unassign(state, streams[i]);
|
||||
|
|
Loading…
Reference in New Issue