From 0d4b4253ad6d9faacdc52fd30ae056ef167c4f94 Mon Sep 17 00:00:00 2001 From: Jimmy Kizito Date: Thu, 2 Sep 2021 10:01:02 -0400 Subject: drm/amd/display: Fix dynamic encoder reassignment [Why] Incorrect encoder assignments were being used while applying a new state to hardware. (1) When committing a new state to hardware requires resetting the back-end, the encoder assignments of the current or old state should be used when disabling the back-end; and the encoder assignments for the next or new state should be used when re-enabling the back-end. (2) Link training on hot plug could take over an encoder already in use by another stream without first disabling it. [How] (1) Introduce a resource context 'link_enc_cfg_context' which includes: - a mode to indicate when transitioning from current to next state. - transient encoder assignments to use during this state transition. Update the encoder configuration interface to respond to queries about encoder assignment based on the mode of operation. (2) Check if an encoder is already in use before attempting to perform link training on hot plug. Reviewed-by: Jun Lei Acked-by: Rodrigo Siqueira Signed-off-by: Jimmy Kizito Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c') diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c index 1872c456e2c9..3c388afa06dc 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c @@ -1610,10 +1610,9 @@ static void get_pixel_clock_parameters( */ if (link->is_dig_mapping_flexible && link->dc->res_pool->funcs->link_encs_assign) { - link_enc = link_enc_cfg_get_link_enc_used_by_stream(stream->link->dc->current_state, stream); + link_enc = link_enc_cfg_get_link_enc_used_by_stream(stream->ctx->dc, stream); if (link_enc == NULL) - link_enc = link_enc_cfg_get_next_avail_link_enc(stream->link->dc, - stream->link->dc->current_state); + link_enc = link_enc_cfg_get_next_avail_link_enc(stream->ctx->dc); } else link_enc = stream->link->link_enc; ASSERT(link_enc); -- cgit