public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Wenjing Liu <wenjing.liu@amd.com>,
	Dillon Varone <dillon.varone@amd.com>,
	Stylon Wang <stylon.wang@amd.com>,
	Daniel Wheeler <daniel.wheeler@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Sasha Levin <sashal@kernel.org>,
	harry.wentland@amd.com, sunpeng.li@amd.com,
	Rodrigo.Siqueira@amd.com, christian.koenig@amd.com,
	Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch,
	alvin.lee2@amd.com, jun.lei@amd.com, Qingqing.Zhuo@amd.com,
	samson.tam@amd.com, aric.cyr@amd.com, chiawen.huang@amd.com,
	syedsaaem.rizvi@amd.com, moadhuri@amd.com,
	dmytro.laktyushkin@amd.com, Wesley.Chalmers@amd.com,
	chiahsuan.chung@amd.com, danny.wang@amd.com, george.shen@amd.com,
	aurabindo.pillai@amd.com, hanghong.ma@amd.com,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 6.6 06/40] drm/amd/display: add seamless pipe topology transition check
Date: Tue,  7 Nov 2023 07:16:08 -0500	[thread overview]
Message-ID: <20231107121837.3759358-6-sashal@kernel.org> (raw)
In-Reply-To: <20231107121837.3759358-1-sashal@kernel.org>

From: Wenjing Liu <wenjing.liu@amd.com>

[ Upstream commit 15c6798ae26d5c7a7776f4f7d0c1fa8c462688a2 ]

[why]
We have a few cases where we need to perform update topology update
in dc update interface. However some of the updates are not seamless
This could cause user noticible glitches. To enforce seamless transition
we are adding a checking condition and error logging so the corruption
as result of non seamless transition can be easily spotted.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  8 +++
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    | 52 +++++++++++++++++++
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.h    |  4 ++
 .../gpu/drm/amd/display/dc/dcn32/dcn32_init.c |  1 +
 .../gpu/drm/amd/display/dc/inc/hw_sequencer.h |  3 ++
 5 files changed, 68 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 3b9d6fa50d170..14c3c1907b953 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -4328,6 +4328,14 @@ bool dc_update_planes_and_stream(struct dc *dc,
 				update_type,
 				context);
 	} else {
+		if (!stream_update &&
+				dc->hwss.is_pipe_topology_transition_seamless &&
+				!dc->hwss.is_pipe_topology_transition_seamless(
+						dc, dc->current_state, context)) {
+
+			DC_LOG_ERROR("performing non-seamless pipe topology transition with surface only update!\n");
+			BREAK_TO_DEBUGGER();
+		}
 		commit_planes_for_stream(
 				dc,
 				srf_updates,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
index cae5e1e68c860..018376146d977 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
@@ -1619,3 +1619,55 @@ void dcn32_blank_phantom(struct dc *dc,
 	if (tg->funcs->is_tg_enabled(tg))
 		hws->funcs.wait_for_blank_complete(opp);
 }
+
+bool dcn32_is_pipe_topology_transition_seamless(struct dc *dc,
+		const struct dc_state *cur_ctx,
+		const struct dc_state *new_ctx)
+{
+	int i;
+	const struct pipe_ctx *cur_pipe, *new_pipe;
+	bool is_seamless = true;
+
+	for (i = 0; i < dc->res_pool->pipe_count; i++) {
+		cur_pipe = &cur_ctx->res_ctx.pipe_ctx[i];
+		new_pipe = &new_ctx->res_ctx.pipe_ctx[i];
+
+		if (resource_is_pipe_type(cur_pipe, FREE_PIPE) ||
+				resource_is_pipe_type(new_pipe, FREE_PIPE))
+			/* adding or removing free pipes is always seamless */
+			continue;
+		else if (resource_is_pipe_type(cur_pipe, OTG_MASTER)) {
+			if (resource_is_pipe_type(new_pipe, OTG_MASTER))
+				if (cur_pipe->stream->stream_id == new_pipe->stream->stream_id)
+				/* OTG master with the same stream is seamless */
+					continue;
+		} else if (resource_is_pipe_type(cur_pipe, OPP_HEAD)) {
+			if (resource_is_pipe_type(new_pipe, OPP_HEAD)) {
+				if (cur_pipe->stream_res.tg == new_pipe->stream_res.tg)
+					/*
+					 * OPP heads sharing the same timing
+					 * generator is seamless
+					 */
+					continue;
+			}
+		} else if (resource_is_pipe_type(cur_pipe, DPP_PIPE)) {
+			if (resource_is_pipe_type(new_pipe, DPP_PIPE)) {
+				if (cur_pipe->stream_res.opp == new_pipe->stream_res.opp)
+					/*
+					 * DPP pipes sharing the same OPP head is
+					 * seamless
+					 */
+					continue;
+			}
+		}
+
+		/*
+		 * This pipe's transition doesn't fall under any seamless
+		 * conditions
+		 */
+		is_seamless = false;
+		break;
+	}
+
+	return is_seamless;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.h b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.h
index 616d5219119e9..9992e40acd217 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.h
@@ -120,4 +120,8 @@ void dcn32_blank_phantom(struct dc *dc,
 		int width,
 		int height);
 
+bool dcn32_is_pipe_topology_transition_seamless(struct dc *dc,
+		const struct dc_state *cur_ctx,
+		const struct dc_state *new_ctx);
+
 #endif /* __DC_HWSS_DCN32_H__ */
diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c
index eb4227926006a..1edadff39a5ef 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c
@@ -116,6 +116,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = {
 	.update_dsc_pg = dcn32_update_dsc_pg,
 	.apply_update_flags_for_phantom = dcn32_apply_update_flags_for_phantom,
 	.blank_phantom = dcn32_blank_phantom,
+	.is_pipe_topology_transition_seamless = dcn32_is_pipe_topology_transition_seamless,
 };
 
 static const struct hwseq_private_funcs dcn32_private_funcs = {
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
index 7a702e216e530..66e680902c95c 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
@@ -401,6 +401,9 @@ struct hw_sequencer_funcs {
 			struct dc_state *context,
 			struct pipe_ctx *phantom_pipe);
 	void (*apply_update_flags_for_phantom)(struct pipe_ctx *phantom_pipe);
+	bool (*is_pipe_topology_transition_seamless)(struct dc *dc,
+			const struct dc_state *cur_ctx,
+			const struct dc_state *new_ctx);
 
 	void (*commit_subvp_config)(struct dc *dc, struct dc_state *context);
 	void (*enable_phantom_streams)(struct dc *dc, struct dc_state *context);
-- 
2.42.0


  parent reply	other threads:[~2023-11-07 12:28 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 12:16 [PATCH AUTOSEL 6.6 01/40] drm/gma500: Fix call trace when psb_gem_mm_init() fails Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 02/40] drm/amdkfd: ratelimited SQ interrupt messages Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 03/40] drm/komeda: drop all currently held locks if deadlock happens Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 04/40] drm/amd/display: Blank phantom OTG before enabling Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 05/40] drm/amd/display: Don't lock phantom pipe on disabling Sasha Levin
2023-11-07 12:16 ` Sasha Levin [this message]
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 07/40] drm/edid: Fixup h/vsync_end instead of h/vtotal Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 08/40] md: don't rely on 'mddev->pers' to be set in mddev_suspend() Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 09/40] drm/amdgpu: not to save bo in the case of RAS err_event_athub Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 10/40] drm/amdkfd: Fix a race condition of vram buffer unref in svm code Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 11/40] drm/amdgpu: update retry times for psp vmbx wait Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 12/40] drm/amd: Update `update_pcie_parameters` functions to use uint8_t arguments Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 13/40] drm/amd/display: use full update for clip size increase of large plane source Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 14/40] string.h: add array-wrappers for (v)memdup_user() Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 15/40] kernel: kexec: copy user-array safely Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 16/40] kernel: watch_queue: " Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 17/40] drm_lease.c: " Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 18/40] drm: vmwgfx_surface.c: " Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 19/40] drm/msm/dp: skip validity check for DP CTS EDID checksum Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 20/40] drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 21/40] drm/radeon: Fix UBSAN array-index-out-of-bounds for Radeon HD 5430 Sasha Levin
2023-11-07 13:38   ` Alex Deucher
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 22/40] drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 23/40] drm/amdgpu: Fix potential null pointer derefernce Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 24/40] drm/panel: fix a possible null pointer dereference Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 25/40] drm/panel/panel-tpo-tpg110: " Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 26/40] drm/radeon: " Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 27/40] drm/amdgpu/vkms: " Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 28/40] drm/panel: st7703: Pick different reset sequence Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 29/40] drm/amdkfd: Fix shift out-of-bounds issue Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 30/40] drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 31/40] drm/amd: Disable PP_PCIE_DPM_MASK when dynamic speed switching not supported Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 32/40] drm/amd/display: fix num_ways overflow error Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 33/40] drm/amd: check num of link levels when update pcie param Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 34/40] arm64: dts: renesas: r8a779f0: spider: Enable PCIe Host ch0 Sasha Levin
2023-11-07 18:50   ` Geert Uytterhoeven
2023-11-16 17:58     ` Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 35/40] soc: qcom: pmic: Fix resource leaks in a device_for_each_child_node() loop Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 36/40] arm64: dts: rockchip: add PCIe to rk3588s-indiedroid-nova Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 37/40] arm64: dts: rockchip: add USB2 to rk3588s-indiedroid Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 38/40] arm64: dts: rockchip: Add NanoPC T6 PCIe e-key support Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 39/40] arm64: dts: ls208xa: use a pseudo-bus to constrain usb dma size Sasha Levin
2023-11-07 12:16 ` [PATCH AUTOSEL 6.6 40/40] selftests/efivarfs: create-read: fix a resource leak Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231107121837.3759358-6-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Qingqing.Zhuo@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Wesley.Chalmers@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=alvin.lee2@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aric.cyr@amd.com \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=chiawen.huang@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=danny.wang@amd.com \
    --cc=dillon.varone@amd.com \
    --cc=dmytro.laktyushkin@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=george.shen@amd.com \
    --cc=hanghong.ma@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=jun.lei@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moadhuri@amd.com \
    --cc=samson.tam@amd.com \
    --cc=stable@vger.kernel.org \
    --cc=stylon.wang@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=syedsaaem.rizvi@amd.com \
    --cc=wenjing.liu@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox