AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: stylon.wang@amd.com, Dillon Varone <dillon.varone@amd.com>,
	Sunpeng.Li@amd.com, Harry.Wentland@amd.com,
	qingqing.zhuo@amd.com, Rodrigo.Siqueira@amd.com,
	roman.li@amd.com, Wenjing Liu <wenjing.liu@amd.com>,
	solomon.chiu@amd.com, Aurabindo.Pillai@amd.com,
	wayne.lin@amd.com, Bhawanpreet.Lakha@amd.com,
	agustin.gutierrez@amd.com, pavle.kotarac@amd.com
Subject: [PATCH 18/19] drm/amd/display: fix incorrect odm change detection logic
Date: Wed, 20 Sep 2023 11:16:23 +0800	[thread overview]
Message-ID: <20230920031624.3129206-19-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20230920031624.3129206-1-Wayne.Lin@amd.com>

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

[why]
The current ODM change detection only compares first two ODM slices.
If there are 4 ODM slices and the change is within the last two slices, the
logic fails to detect ODM change and cause us to skip ODM programming
unexpectedly.

[how]
Add a is ODM topology changed resource interface to check any ODM
topology changes with a more generic method.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
---
 .../gpu/drm/amd/display/dc/core/dc_resource.c | 23 +++++++++++++++++++
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    |  8 ++-----
 drivers/gpu/drm/amd/display/dc/inc/resource.h | 10 ++++++++
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 614a1fb08809..e9837c0ce7f6 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1925,6 +1925,29 @@ bool resource_is_pipe_topology_changed(const struct dc_state *state_a,
 	return false;
 }
 
+bool resource_is_odm_topology_changed(const struct pipe_ctx *otg_master_a,
+		const struct pipe_ctx *otg_master_b)
+{
+	const struct pipe_ctx *opp_head_a = otg_master_a;
+	const struct pipe_ctx *opp_head_b = otg_master_b;
+
+	if (!resource_is_pipe_type(otg_master_a, OTG_MASTER) ||
+			!resource_is_pipe_type(otg_master_b, OTG_MASTER))
+		return true;
+
+	while (opp_head_a && opp_head_b) {
+		if (opp_head_a->stream_res.opp != opp_head_b->stream_res.opp)
+			return true;
+		if ((opp_head_a->next_odm_pipe && !opp_head_b->next_odm_pipe) ||
+				(!opp_head_a->next_odm_pipe && opp_head_b->next_odm_pipe))
+			return true;
+		opp_head_a = opp_head_a->next_odm_pipe;
+		opp_head_b = opp_head_b->next_odm_pipe;
+	}
+
+	return false;
+}
+
 /*
  * Sample log:
  *    pipe topology update
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
index f2b20319f0bb..5738a5f00b56 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
@@ -1430,13 +1430,9 @@ static void dcn20_detect_pipe_changes(struct pipe_ctx *old_pipe, struct pipe_ctx
 	}
 
 	/* Detect top pipe only changes */
-	if (!new_pipe->top_pipe && !new_pipe->prev_odm_pipe) {
+	if (resource_is_pipe_type(new_pipe, OTG_MASTER)) {
 		/* Detect odm changes */
-		if ((old_pipe->next_odm_pipe && new_pipe->next_odm_pipe
-			&& old_pipe->next_odm_pipe->pipe_idx != new_pipe->next_odm_pipe->pipe_idx)
-				|| (!old_pipe->next_odm_pipe && new_pipe->next_odm_pipe)
-				|| (old_pipe->next_odm_pipe && !new_pipe->next_odm_pipe)
-				|| old_pipe->stream_res.opp != new_pipe->stream_res.opp)
+		if (resource_is_odm_topology_changed(new_pipe, old_pipe))
 			new_pipe->update_flags.bits.odm = 1;
 
 		/* Detect global sync changes */
diff --git a/drivers/gpu/drm/amd/display/dc/inc/resource.h b/drivers/gpu/drm/amd/display/dc/inc/resource.h
index 170d6ab81aef..00230a7fbe25 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/resource.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/resource.h
@@ -447,6 +447,16 @@ int resource_get_odm_slice_index(const struct pipe_ctx *opp_head);
 bool resource_is_pipe_topology_changed(const struct dc_state *state_a,
 		const struct dc_state *state_b);
 
+/*
+ * determine if the two OTG master pipes have the same ODM topology
+ * return
+ * false - if pipes passed in are not OTG masters or ODM topology is
+ * changed.
+ * true - otherwise
+ */
+bool resource_is_odm_topology_changed(const struct pipe_ctx *otg_master_a,
+		const struct pipe_ctx *otg_master_b);
+
 /* log the pipe topology update in state */
 void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state);
 
-- 
2.37.3


  parent reply	other threads:[~2023-09-20  3:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20  3:16 [PATCH 00/19] DC Patches September 22, 2023 Wayne Lin
2023-09-20  3:16 ` [PATCH 01/19] drm/amd/display: remove unused mmhub_reg_offsets Wayne Lin
2023-09-20  3:16 ` [PATCH 02/19] drm/amd/display: determine fast update only before commit minimal transition state Wayne Lin
2023-09-20  3:16 ` [PATCH 03/19] drm/amd/display: reset stream slice count for new ODM policy Wayne Lin
2023-09-20  3:16 ` [PATCH 04/19] drm/amd/display: add new windowed mpo odm minimal transition sequence Wayne Lin
2023-09-20  3:16 ` [PATCH 05/19] drm/amd/display: remove guaranteed viewports limitation for odm Wayne Lin
2023-09-20  3:16 ` [PATCH 06/19] drm/amd/display: Improve x86 and dmub ips handshake Wayne Lin
2023-09-20  3:16 ` [PATCH 07/19] drm/amd/display: Fix DP2.0 timing sync Wayne Lin
2023-09-20  3:16 ` [PATCH 08/19] drm/amd/display: block MPO if it prevents pstate support Wayne Lin
2023-09-20  3:16 ` [PATCH 09/19] drm/amd/display: skip audio config for virtual signal Wayne Lin
2023-09-20  3:16 ` [PATCH 10/19] drm/amd/display: Improve code style on bios_parser2 Wayne Lin
2023-09-20  3:16 ` [PATCH 11/19] drm/amd/display: augment display clock in dc_cap structure Wayne Lin
2023-09-20  3:16 ` [PATCH 12/19] drm/amd/display: Update OPP counter from new interface Wayne Lin
2023-09-20  3:16 ` [PATCH 13/19] drm/amd/display: Break after finding supported vlevel for repopulate Wayne Lin
2023-09-20  3:16 ` [PATCH 14/19] drm/amd/display: Rename DisableMinDispClkODM in dc_config Wayne Lin
2023-09-20  3:16 ` [PATCH 15/19] drm/amd/display: add missing function pointer for DCN321 resource Wayne Lin
2023-09-20  3:16 ` [PATCH 16/19] drm/amd/display: add get primary dpp pipe resource interface Wayne Lin
2023-09-20  3:16 ` [PATCH 17/19] drm/amd/display: add primary pipe check when building slice table for dcn3x Wayne Lin
2023-09-20  3:16 ` Wayne Lin [this message]
2023-09-20  3:16 ` [PATCH 19/19] drm/amd/display: 3.2.253 Wayne Lin

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=20230920031624.3129206-19-Wayne.Lin@amd.com \
    --to=wayne.lin@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dillon.varone@amd.com \
    --cc=pavle.kotarac@amd.com \
    --cc=qingqing.zhuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=solomon.chiu@amd.com \
    --cc=stylon.wang@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