Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Maintain consistent mode of operation during encoder assignment

[Why]
While applying a state to hardware, there is a transition period where
the back-end is reset using the old state; then enabled using the new
state.

Generally, the link encoder configuration module queries
stream-to-encoder assignments in either the new or old state based on a
mode variable. During the transition there is a need to query both
states, however toggling this mode variable can lead to incorrect
programming of encoders.

[How]
- Add new function to explicity query stream-to-encoder assignment
in the current state rather than intermittently switch the mode
of operation of the link encoder assignment module.
- Add additional checks for encoder assignment defects.
- Explicitly reset the mode of operation if application of state
to hardware ends prematurely.

Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Jimmy Kizito <Jimmy.Kizito@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jimmy Kizito and committed by
Alex Deucher
6366b003 e73b386e

+44 -5
+4 -1
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1750 1750 1751 1751 result = dc->hwss.apply_ctx_to_hw(dc, context); 1752 1752 1753 - if (result != DC_OK) 1753 + if (result != DC_OK) { 1754 + /* Application of dc_state to hardware stopped. */ 1755 + dc->current_state->res_ctx.link_enc_cfg_ctx.mode = LINK_ENC_CFG_STEADY; 1754 1756 return result; 1757 + } 1755 1758 1756 1759 dc_trigger_sync(dc, context); 1757 1760
+3 -4
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 3015 3015 if (pipe_ctx_old->stream->ctx->dc->res_pool->funcs->link_encs_assign) { 3016 3016 bool need_reprogram = false; 3017 3017 struct dc *dc = pipe_ctx_old->stream->ctx->dc; 3018 - enum link_enc_cfg_mode mode = dc->current_state->res_ctx.link_enc_cfg_ctx.mode; 3018 + struct link_encoder *link_enc_prev = 3019 + link_enc_cfg_get_link_enc_used_by_stream_current(dc, pipe_ctx_old->stream); 3019 3020 3020 - dc->current_state->res_ctx.link_enc_cfg_ctx.mode = LINK_ENC_CFG_STEADY; 3021 - if (link_enc_cfg_get_link_enc_used_by_stream(dc, pipe_ctx_old->stream) != pipe_ctx->stream->link_enc) 3021 + if (link_enc_prev != pipe_ctx->stream->link_enc) 3022 3022 need_reprogram = true; 3023 - dc->current_state->res_ctx.link_enc_cfg_ctx.mode = mode; 3024 3023 3025 3024 return need_reprogram; 3026 3025 }