Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ray Wu <ray.wu@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: <jani.nikula@linux.intel.com>, <kamil.konieczny@linux.intel.com>,
	<alex.hung@amd.com>, <sunpeng.li@amd.com>,
	<chiahsuan.chung@amd.com>, Ray Wu <ray.wu@amd.com>
Subject: [PATCH i-g-t v2 6/6] tests/amdgpu/amd_replay: Check sink Replay error status
Date: Mon, 16 Nov 2026 10:24:47 +0800	[thread overview]
Message-ID: <20261116022447.3981877-7-ray.wu@amd.com> (raw)
In-Reply-To: <20261116022447.3981877-1-ray.wu@amd.com>

DPCD 0x378 is only checked for non-zero. Also fail on the state
transition error, the desync error when enabled in 0x37B, and sink
device status 0x7, following the amdgpu DC bit layout.

Signed-off-by: Ray Wu <ray.wu@amd.com>
---
 tests/amdgpu/amd_replay.c | 53 +++++++++++++++++++++++++++++++--------
 1 file changed, 42 insertions(+), 11 deletions(-)

diff --git a/tests/amdgpu/amd_replay.c b/tests/amdgpu/amd_replay.c
index d97efbf1a..c2eb8ec04 100644
--- a/tests/amdgpu/amd_replay.c
+++ b/tests/amdgpu/amd_replay.c
@@ -16,6 +16,19 @@ IGT_TEST_DESCRIPTION("Basic test for enabling Panel Replay for eDP displays");
 #define REPLAY_SETTLE_DELAY 10
 #define FLIP_FRAME_BEFORE_TEST 60
 
+/*
+ * FreeSync Replay sink DPCDs, aligned with amdgpu kernel
+ * 'union dpcd_replay_configuration' and
+ * 'union replay_enable_and_configuration' in dc_dp_types.h
+ */
+#define DP_SINK_PR_REPLAY_STATUS		0x378
+#define DP_SINK_PR_ENABLE_AND_CONFIGURATION	0x37B
+#define REPLAY_STATUS_STATE_TRANSITION_ERROR	(1 << 0)
+#define REPLAY_STATUS_DESYNC_ERROR		(1 << 1)
+#define REPLAY_STATUS_SINK_DEVICE_STATUS(x)	(((x) >> 2) & 0x7)
+#define REPLAY_SINK_DEVICE_STATUS_ERROR		0x7
+#define REPLAY_CONFIG_DESYNC_ERROR_VERIFY	(1 << 1)
+
 /* Common test data. */
 struct test_data {
 	igt_display_t display;
@@ -201,12 +214,36 @@ static bool dpcd_read_byte(int drm_fd,
 	return false;
 }
 
+/* Check sink Replay status (DPCD 0x378) reports no error */
+static void check_sink_status(struct test_data *data, igt_output_t *output)
+{
+	uint8_t status = 0, config = 0, error_mask;
+
+	igt_assert_f(dpcd_read_byte(data->fd, output->config.connector,
+		     DP_SINK_PR_ENABLE_AND_CONFIGURATION, &config),
+		     "Failed to read DPCD 0x37B\n");
+	igt_assert_f(dpcd_read_byte(data->fd, output->config.connector,
+		     DP_SINK_PR_REPLAY_STATUS, &status),
+		     "Failed to read DPCD 0x378\n");
+	igt_debug("DPCD 0x378 = 0x%02X, 0x37B = 0x%02X\n", status, config);
+
+	/* Desync error is only reported when desync verification is enabled */
+	error_mask = REPLAY_STATUS_STATE_TRANSITION_ERROR;
+	if (config & REPLAY_CONFIG_DESYNC_ERROR_VERIFY)
+		error_mask |= REPLAY_STATUS_DESYNC_ERROR;
+
+	igt_fail_on_f(status & error_mask,
+		      "Sink reported Replay error, DPCD 0x378 = 0x%02X\n", status);
+	igt_fail_on_f(REPLAY_STATUS_SINK_DEVICE_STATUS(status) == REPLAY_SINK_DEVICE_STATUS_ERROR,
+		      "Sink reported device error, DPCD 0x378 = 0x%02X\n", status);
+	igt_fail_on_f(status == 0, "Panel is not in replay mode\n");
+}
+
 static void page_flip_test(struct test_data *data, igt_output_t *output,
 						 enum test_mode test_mode, uint32_t frame_num)
 {
 	int ret, frame_count;
 	enum replay_state replay_state;
-	uint8_t panel_dpcd = 0;
 
 	if (!data || data->ref_fb.fb_id == 0 || data->ref_fb2.fb_id == 0
 	    || frame_num <= 5) {
@@ -225,11 +262,10 @@ static void page_flip_test(struct test_data *data, igt_output_t *output,
 				&& frame_count > 5) {
 			/* Panel Replay state needs few frame to enter the live mode */
 			replay_state = igt_amd_read_replay_state(data->fd, output->name);
-			dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
 			igt_debug("replay_state live mode = 0x%X\n", replay_state);
 			igt_fail_on_f(replay_state < REPLAY_STATE_4 || replay_state >= REPLAY_STATE_5,
 					"State should be REPLAY_STATE_4 (Active with single frame update)\n");
-			igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
+			check_sink_status(data, output);
 		}
 
 		if (frame_count % 2 == 0)
@@ -244,7 +280,6 @@ static void run_check_replay(struct test_data *data, enum test_mode test_mode)
 	int edp_idx;
 	enum replay_state replay_state;
 	igt_output_t *output;
-	uint8_t panel_dpcd = 0;
 
 	test_init(data);
 
@@ -292,11 +327,10 @@ static void run_check_replay(struct test_data *data, enum test_mode test_mode)
 			sleep(1);
 
 			replay_state = igt_amd_read_replay_state(data->fd, output->name);
-			dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
 			igt_debug("replay_state static mode = 0x%X\n", replay_state);
 			igt_fail_on_f(replay_state < REPLAY_STATE_3 || replay_state >= REPLAY_STATE_4,
 				 "State should be REPLAY_STATE_3 (Active)\n");
-			igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
+			check_sink_status(data, output);
 		}
 
 		/* Do another page flip if we do the replay_intermittent_live test */
@@ -307,12 +341,11 @@ static void run_check_replay(struct test_data *data, enum test_mode test_mode)
 			sleep(1);
 
 			replay_state = igt_amd_read_replay_state(data->fd, output->name);
-			dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
 			igt_debug("replay_state TEST_MODE_INTERMITTENT_LIVE after flip = 0x%X\n",
 				 replay_state);
 			igt_fail_on_f(replay_state < REPLAY_STATE_3 || replay_state >= REPLAY_STATE_4,
 				 "State should be REPLAY_STATE_3 (Active)\n");
-			igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
+			check_sink_status(data, output);
 		}
 
 		igt_remove_fb(data->fd, &data->ref_fb);
@@ -327,7 +360,6 @@ static void run_check_replay_suspend(struct test_data *data)
 	int edp_idx;
 	enum replay_state replay_state;
 	igt_output_t *output;
-	uint8_t panel_dpcd = 0;
 
 	test_init(data);
 
@@ -363,11 +395,10 @@ static void run_check_replay_suspend(struct test_data *data)
 		sleep(REPLAY_SETTLE_DELAY);
 
 		replay_state = igt_amd_read_replay_state(data->fd, output->name);
-		dpcd_read_byte(data->fd, output->config.connector, 0x378, &panel_dpcd);
 		igt_debug("replay_state static mode = 0x%X\n", replay_state);
 		igt_fail_on_f(replay_state < REPLAY_STATE_3 || replay_state >= REPLAY_STATE_4,
 			 "State should be REPLAY_STATE_3 (Active)\n");
-		igt_fail_on_f(panel_dpcd == 0, "Panel is not in replay mode\n");
+		check_sink_status(data, output);
 
 		igt_remove_fb(data->fd, &data->ref_fb);
 		igt_remove_fb(data->fd, &data->ref_fb2);
-- 
2.43.0


  parent reply	other threads:[~2026-11-16  2:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  2:24 [PATCH i-g-t v2 0/6] tests/amdgpu/amd_replay: Fix state and sink status checks Ray Wu
2026-11-16  2:24 ` [PATCH i-g-t v2 1/6] tests/amdgpu/amd_replay: Read DPCD at the target offset Ray Wu
2026-11-16  2:24 ` [PATCH i-g-t v2 2/6] tests/amdgpu/amd_replay: Fix test_mode checks Ray Wu
2026-11-16  2:24 ` [PATCH i-g-t v2 3/6] tests/amdgpu/amd_replay: Fix inverted Replay state range checks Ray Wu
2026-11-16  2:24 ` [PATCH i-g-t v2 4/6] tests/amdgpu/amd_replay: Require REPLAY_STATE_3 after settle Ray Wu
2026-11-16  2:24 ` [PATCH i-g-t v2 5/6] tests/amdgpu/amd_replay: Fail on page flip errors Ray Wu
2026-11-16  2:24 ` Ray Wu [this message]
2026-11-16  3:25 ` ✓ Xe.CI.BAT: success for tests/amdgpu/amd_replay: Fix state and sink status checks (rev2) Patchwork
2026-11-16  3:45 ` ✗ i915.CI.BAT: failure " Patchwork
2026-11-16  5:28 ` ✗ Xe.CI.FULL: " Patchwork

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=20261116022447.3981877-7-ray.wu@amd.com \
    --to=ray.wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=sunpeng.li@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