| From b45c2182509cd88bac42ea82e27dc05ab1fbfc95 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 23 Feb 2024 15:17:39 -0500 |
| Subject: drm/amd/display: Lock all enabled otg pipes even with no planes |
| |
| From: Wenjing Liu <wenjing.liu@amd.com> |
| |
| [ Upstream commit 94040c2cbb1a872ff779da06bf034ccfee0f9cba ] |
| |
| [WHY] |
| On DCN32 we support dynamic ODM even when OTG is blanked. When ODM |
| configuration is dynamically changed and the OTG is on blank pattern, |
| we will need to reprogram OPP's test pattern based on new ODM |
| configuration. Therefore we need to lock the OTG pipe to avoid temporary |
| corruption when we are reprogramming OPP blank patterns. |
| |
| [HOW] |
| Add a new interdependent update lock implementation to lock all enabled |
| OTG pipes even when there is no plane on the OTG for DCN32. |
| |
| Cc: Mario Limonciello <mario.limonciello@amd.com> |
| Cc: Alex Deucher <alexander.deucher@amd.com> |
| Cc: stable@vger.kernel.org |
| Reviewed-by: Alvin Lee <alvin.lee2@amd.com> |
| Acked-by: Alex Hung <alex.hung@amd.com> |
| Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> |
| Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> |
| Signed-off-by: Alex Deucher <alexander.deucher@amd.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 23 +++++++++++++++++++ |
| .../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 2 ++ |
| .../amd/display/dc/hwss/dcn32/dcn32_init.c | 2 +- |
| 3 files changed, 26 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c |
| index b890db0bfc46b..c0b526cf17865 100644 |
| --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c |
| +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c |
| @@ -1785,3 +1785,26 @@ void dcn32_prepare_bandwidth(struct dc *dc, |
| context->bw_ctx.bw.dcn.clk.p_state_change_support = p_state_change_support; |
| } |
| } |
| + |
| +void dcn32_interdependent_update_lock(struct dc *dc, |
| + struct dc_state *context, bool lock) |
| +{ |
| + unsigned int i; |
| + struct pipe_ctx *pipe; |
| + struct timing_generator *tg; |
| + |
| + for (i = 0; i < dc->res_pool->pipe_count; i++) { |
| + pipe = &context->res_ctx.pipe_ctx[i]; |
| + tg = pipe->stream_res.tg; |
| + |
| + if (!resource_is_pipe_type(pipe, OTG_MASTER) || |
| + !tg->funcs->is_tg_enabled(tg) || |
| + dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_PHANTOM) |
| + continue; |
| + |
| + if (lock) |
| + dc->hwss.pipe_control_lock(dc, pipe, true); |
| + else |
| + dc->hwss.pipe_control_lock(dc, pipe, false); |
| + } |
| +} |
| diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h |
| index 069e20bc87c0a..f55c11fc56ec7 100644 |
| --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h |
| +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h |
| @@ -129,4 +129,6 @@ bool dcn32_is_pipe_topology_transition_seamless(struct dc *dc, |
| void dcn32_prepare_bandwidth(struct dc *dc, |
| struct dc_state *context); |
| |
| +void dcn32_interdependent_update_lock(struct dc *dc, |
| + struct dc_state *context, bool lock); |
| #endif /* __DC_HWSS_DCN32_H__ */ |
| diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c |
| index e8ac94a005b83..03253faeaeac6 100644 |
| --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c |
| +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c |
| @@ -58,7 +58,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = { |
| .disable_plane = dcn20_disable_plane, |
| .disable_pixel_data = dcn20_disable_pixel_data, |
| .pipe_control_lock = dcn20_pipe_control_lock, |
| - .interdependent_update_lock = dcn10_lock_all_pipes, |
| + .interdependent_update_lock = dcn32_interdependent_update_lock, |
| .cursor_lock = dcn10_cursor_lock, |
| .prepare_bandwidth = dcn32_prepare_bandwidth, |
| .optimize_bandwidth = dcn20_optimize_bandwidth, |
| -- |
| 2.43.0 |
| |