public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/amdgpu/amd_ilr: add disallow replay debugfs and fix CRC read timeout
@ 2026-03-13  8:57 Ray Wu
  2026-03-13 10:24 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ray Wu @ 2026-03-13  8:57 UTC (permalink / raw)
  To: igt-dev; +Cc: alex.hung, sunpeng.li, chiahsuan.chung, Ray Wu

[Why]
On eDP panels that support Panel Replay, the kernel enables replay during
link training. This causes the eDP Rx CRC read to time out because the
panel enters replay mode and stops sending CRC data normally.

[How]
1. Add igt_amd_disallow_edp_enter_replay() helper in lib/igt_amd that
   writes to the disallow_edp_enter_replay debugfs node, following the
   same pattern as igt_amd_disallow_edp_enter_psr().

2. In amd_ilr test_flow():
   - Call igt_amd_disallow_edp_enter_replay() with enable=true before
     reading eDP Rx CRC to prevent the panel from entering replay mode.
   - Call igt_amd_disallow_edp_enter_replay() with enable=false after
     reading CRC to restore normal replay behavior.

Cc: Leo Li <sunpeng.li@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
---
 lib/igt_amd.c          | 44 ++++++++++++++++++++++
 lib/igt_amd.h          |  2 +
 tests/amdgpu/amd_ilr.c | 83 +++++++++++++++++++++++++++++++-----------
 3 files changed, 108 insertions(+), 21 deletions(-)

diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 3ddb5f403..a97adad43 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -1365,6 +1365,50 @@ void igt_amd_disallow_edp_enter_psr(int drm_fd, char *connector_name, bool enabl
 	close(ret);
 }
 
+/**
+ * igt_amd_disallow_edp_enter_replay: notify kernel skip edp replay setup and enable
+ * @drm_fd: DRM file descriptor
+ * @connector_name: The connector's name
+ * @enable: skip kernel eDP replay setup and enable -- disallow edp enter replay
+ * example usage: disallow replay
+ * echo 0x1 >
+ * /sys/kernel/debug/dri/0/eDP-1/disallow_edp_enter_replay
+ *
+ * expected IGT sequence is as below:
+ * 1. disable eDP PHY and notify eDP rx with dpcd 0x600 = 2.
+ *    for example, kmstest_set_connector_dpms off will do this.
+ * 2. echo 0x1 /sys/kernel/debug/dri/0/eDP-X/disallow_edp_enter_replay
+ * 3. enable eDP PHY and notify eDP rx with dpcd 0x600 = 1 but
+ *    without dpcd 0x37b.
+ * 4. read crc from rx dpcd 0x270, 0x246, etc.
+ *    igt_pipe_crc_collect_crc will do this.
+ * 5. echo 0x0 /sys/kernel/debug/dri/0/eDP-X/disallow_edp_enter_replay.
+ *    this will let eDP back to normal with replay setup.
+ */
+void igt_amd_disallow_edp_enter_replay(int drm_fd, char *connector_name, bool enable)
+{
+	int fd, ret, wr_len;
+	const char *allow_edp_replay = "1";
+	const char *dis_allow_edp_replay = "0";
+
+	fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY);
+	igt_assert(fd >= 0);
+	ret = openat(fd, DEBUGFS_DISALLOW_EDP_ENTER_REPLAY, O_WRONLY);
+	close(fd);
+	igt_skip_on_f(ret < 0, "Skip test: Debugfs %s not supported\n",
+		      DEBUGFS_DISALLOW_EDP_ENTER_REPLAY);
+
+	if (enable) {
+		wr_len = write(ret, allow_edp_replay, strlen(allow_edp_replay));
+		igt_assert_eq(wr_len, strlen(allow_edp_replay));
+	} else {
+		wr_len = write(ret, dis_allow_edp_replay, strlen(dis_allow_edp_replay));
+		igt_assert_eq(wr_len, strlen(dis_allow_edp_replay));
+	}
+
+	close(ret);
+}
+
 static bool get_dm_capabilities(int drm_fd, char *buf, size_t size)
 {
 	int ret, fd;
diff --git a/lib/igt_amd.h b/lib/igt_amd.h
index bce4657cb..a45122b68 100644
--- a/lib/igt_amd.h
+++ b/lib/igt_amd.h
@@ -53,6 +53,7 @@
 #define DEBUGFS_EDP_PSR_STATE	"psr_state"
 #define DEBUGFS_ALLOW_EDP_HOTPLUG_DETECT "allow_edp_hotplug_detection"
 #define DEBUGFS_DISALLOW_EDP_ENTER_PSR "disallow_edp_enter_psr"
+#define DEBUGFS_DISALLOW_EDP_ENTER_REPLAY "disallow_edp_enter_replay"
 
 /* amdgpu DM interface entries */
 #define DEBUGFS_DM_VISUAL_CONFIRM "amdgpu_dm_visual_confirm"
@@ -235,6 +236,7 @@ bool igt_amd_output_has_psr_state(int drm_fd, char *connector_name);
 int  igt_amd_read_psr_state(int drm_fd, char *connector_name);
 void igt_amd_allow_edp_hotplug_detect(int drm_fd, char *connector_name, bool enable);
 void igt_amd_disallow_edp_enter_psr(int drm_fd, char *connector_name, bool enable);
+void igt_amd_disallow_edp_enter_replay(int drm_fd, char *connector_name, bool enable);
 
 /* DM interface helpers */
 bool igt_amd_has_visual_confirm(int drm_fd);
diff --git a/tests/amdgpu/amd_ilr.c b/tests/amdgpu/amd_ilr.c
index 5dd467b43..f7f480e66 100644
--- a/tests/amdgpu/amd_ilr.c
+++ b/tests/amdgpu/amd_ilr.c
@@ -203,10 +203,12 @@ static void test_flow(data_t *data, enum sub_test option)
 		}
 
 		/* states under /sys/kernel/debug/dri/0/eDP-1:
-		 * psr_capability.driver_support (drv_support_psr): yes
+		 * psr_capability.driver_support (drv_support_psr): yes/no
+		 * replay_capability.driver_support (drv_support_replay): yes/no
 		 * ilr_setting (intermediate link rates capabilities,
 		 * ilr_cap): yes/no
 		 * kernel driver disallow_edp_enter_psr (dis_psr): no
+		 * kernel driver disallow_edp_enter_repay (dis_replay): no
 		 */
 
 		/* Init only eDP */
@@ -216,9 +218,10 @@ static void test_flow(data_t *data, enum sub_test option)
 		 * DPMS on/off will not take effect until
 		 * next igt_display_commit_atomic.
 		 * eDP enter power saving mode within test_init
-		 * drv_support_psr: yes; ilr_cap: no; dis_psr: no
+		 * drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: no;
+		 * dis_psr: no, dis_replay: no
 		 */
-
 		mode = igt_output_get_mode(output);
 		igt_assert(mode);
 
@@ -228,11 +231,16 @@ static void test_flow(data_t *data, enum sub_test option)
 				      0, &data->fb);
 		igt_plane_set_fb(data->primary, &data->fb);
 
-		/* drv_support_psr: yes; ilr_cap: no; dis_psr: no
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: no;
+		 * dis_psr: no & dis_replay: no
 		 * commit stream. eDP exit power saving mode.
 		 */
 		igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
-		/* drv_support_psr: yes; ilr_cap: yes; dis_psr: no */
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: yes;
+		 * dis_psr: no & dis_replay: no;
+		 */
 
 		/* igt_amd_output_has_ilr_setting only checks if debugfs
 		 * exist. ilr settings could be all 0s -- not supported.
@@ -247,23 +255,35 @@ static void test_flow(data_t *data, enum sub_test option)
 
 		igt_info("Testing on output: %s\n", output->name);
 
-		/* drv_support_psr: yes; ilr_cap: yes; dis_psr: no */
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: yes;
+		 * dis_psr: no & dis_replay: no
+		 */
 		kmstest_set_connector_dpms(data->drm_fd,
 			output->config.connector, DRM_MODE_DPMS_OFF);
 		/* eDP enter power saving mode.
-		 * drv_support_psr: yes; ilr_cap: no; dis_psr: no.
+		 * drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: no;
+		 * dis_psr: no & dis_replay: no;
 		 */
 
-		/* Disable eDP PSR to avoid timeout when reading CRC */
+		/* Disable eDP PSR / Replay to avoid timeout when reading CRC */
 		igt_amd_disallow_edp_enter_psr(data->drm_fd, output->name, true);
-		/* drv_support_psr: yes; ilr_cap: no: dis_psr: yes */
+		igt_amd_disallow_edp_enter_replay(data->drm_fd, output->name, true);
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: no;
+		 * dis_psr: yes & dis_replay: yes;
+		 */
 
 		/* eDP exit power saving mode and setup psr */
 		kmstest_set_connector_dpms(data->drm_fd,
 			output->config.connector, DRM_MODE_DPMS_ON);
-		/* drv_support_psr: no; ilr_cap: yes: dis_psr: yes
-		 * With dis_psr yes, drm kernel driver
-		 * disable psr, psr_en is set to no.
+		/* drv_support_replay: no & drv_support_psr: no;
+		 * ilr_cap: yes;
+		 * dis_psr: yes & dis_replay: yes;
+		 * With dis_psr yes and dis_replay yes,
+		 * drm kernel driver disable psr/replay,
+		 * psr_en & replay_en are set to no.
 		 */
 
 		/* Collect info of Reported Lane Count & ILR */
@@ -282,33 +302,54 @@ static void test_flow(data_t *data, enum sub_test option)
 				break;
 		}
 
-		/* drv_support_psr: no; ilr_cap: yes; dis_psr: yes */
+		/* drv_support_replay: no & drv_support_psr: no;
+		 * ilr_cap: yes;
+		 * dis_psr: yes & dis_replay: yes;
+		 */
 		kmstest_set_connector_dpms(data->drm_fd,
 			output->config.connector, DRM_MODE_DPMS_OFF);
 		/* eDP enter power saving mode.
-		 * drv_support_psr: no; ilr_cap: no; dis_psr: yes.
+		 * drv_support_replay: no & drv_support_psr: no;
+		 * ilr_cap: no;
+		 * dis_psr: yes & dis_replay: yes;
 		 */
 
-		/* Enable PSR after reading eDP Rx CRC */
+		/* Enable PSR / Replay after reading eDP Rx CRC */
 		igt_amd_disallow_edp_enter_psr(data->drm_fd, output->name, false);
-		/* drv_support_psr: no; ilr_cap: no: dis_psr: no */
+		igt_amd_disallow_edp_enter_replay(data->drm_fd, output->name, false);
+		/* drv_support_replay: no & drv_support_psr: no;
+		 * ilr_cap: no;
+		 * dis_psr: no & dis_replay: no;
+		 */
 
-		/* eDP exit power saving mode and setup psr */
+		/* eDP exit power saving mode and setup psr/replay */
 		kmstest_set_connector_dpms(data->drm_fd,
 			output->config.connector, DRM_MODE_DPMS_ON);
-		/* drv_support_psr: yes; ilr_cap: yes: dis_psr: no */
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: yes;
+		 * dis_psr: no & dis_replay: no;
+		 */
 
 		/* Reset preferred link settings*/
 		memset(data->supported_ilr, 0, sizeof(data->supported_ilr));
 		igt_amd_write_ilr_setting(data->drm_fd, output->name, 0, 0);
-		/* drv_support_psr: yes; ilr_cap: yes; dis_psr: no */
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: yes;
+		 * dis_psr: no, dis_replay: no;
+		 */
 
 		/* commit 0 stream. eDP enter power saving mode */
 		igt_remove_fb(data->drm_fd, &data->fb);
-		/* drv_support_psr: yes; ilr_cap: no; dis_psr: no */
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: no;
+		 * dis_psr: no & dis_replay: no;
+		 */
 
 		test_fini(data);
-		/* drv_support_psr: yes; ilr_cap: no; dis_psr: no */
+		/* drv_support_replay: yes | drv_support_psr: yes;
+		 * ilr_cap: no;
+		 * dis_psr: no & dis_replay: no;
+		 */
 	}
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-17  5:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13  8:57 [PATCH i-g-t] tests/amdgpu/amd_ilr: add disallow replay debugfs and fix CRC read timeout Ray Wu
2026-03-13 10:24 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-03-13 10:52 ` ✓ i915.CI.BAT: " Patchwork
2026-03-14 10:44 ` ✓ i915.CI.Full: " Patchwork
2026-03-14 12:26 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-17  5:56 ` [PATCH i-g-t] " Tom Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox