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: <alex.hung@amd.com>, <sunpeng.li@amd.com>,
	<chiahsuan.chung@amd.com>, <ray.wu@amd.com>
Subject: [PATCH i-g-t 1/2] lib/igt_amd: add helper to disable Panel Replay on all eDPs
Date: Tue, 2 Jun 2026 14:41:21 +0800	[thread overview]
Message-ID: <20260602064543.58586-2-ray.wu@amd.com> (raw)
In-Reply-To: <20260602064543.58586-1-ray.wu@amd.com>

[Why & How]
Add igt_amd_disallow_replay_on_all_edp() as a batch counterpart of
igt_amd_disallow_edp_enter_replay(). It toggles the
disallow_edp_enter_replay debugfs flag on every connected Panel
Replay capable eDP, wrapped in a DPMS off/on sequence, and returns
whether anything was reconfigured.

The filter matches "Sink support: yes" + "Driver support: yes" in
replay_capability; "Config support" is intentionally skipped because
it flips to "no" after disallow=1 and would break the restore pass.

Also change igt_amd_disallow_edp_enter_replay() to log and return on
missing debugfs instead of skipping the whole test.

Signed-off-by: Ray Wu <ray.wu@amd.com>
---
 lib/igt_amd.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--
 lib/igt_amd.h |  1 +
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 004bd2fe8..47e587e54 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -1395,8 +1395,11 @@ void igt_amd_disallow_edp_enter_replay(int drm_fd, char *connector_name, bool en
 	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 (ret < 0) {
+		igt_info("output %s: debugfs %s not supported, skipping\n",
+			 connector_name, DEBUGFS_DISALLOW_EDP_ENTER_REPLAY);
+		return;
+	}
 
 	if (enable) {
 		wr_len = write(ret, allow_edp_replay, strlen(allow_edp_replay));
@@ -1409,6 +1412,52 @@ void igt_amd_disallow_edp_enter_replay(int drm_fd, char *connector_name, bool en
 	close(ret);
 }
 
+/**
+ * igt_amd_disallow_replay_on_all_edp: toggle Panel Replay entry on every
+ * connected Replay-capable eDP connector on @display.
+ * @drm_fd: DRM file descriptor
+ * @display: target display (already initialised via igt_display_require)
+ * @disallow: true to disable Panel Replay entry (e.g. during a test that
+ *            cannot tolerate self-refresh), false to restore.
+ *
+ * Returns true if at least one eDP was reconfigured, so callers can cache
+ * the value and decide whether a restore call is needed later.
+ */
+bool igt_amd_disallow_replay_on_all_edp(int drm_fd, igt_display_t *display, bool disallow)
+{
+	igt_output_t *output;
+	bool changed = false;
+
+	if (!is_amdgpu_device(drm_fd))
+		return false;
+
+	for_each_connected_output(display, output) {
+		char buf[128];
+
+		if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+
+		if (igt_debugfs_read_connector_file(drm_fd, output->name,
+						    DEBUGFS_EDP_REPLAY_CAP,
+						    buf, sizeof(buf)) < 0 ||
+		    !strstr(buf, "Sink support: yes") ||
+		    !strstr(buf, "Driver support: yes"))
+			continue;
+
+		igt_info("%s AMD Panel Replay on %s\n",
+			 disallow ? "Disabling" : "Restoring", output->name);
+
+		kmstest_set_connector_dpms(drm_fd, output->config.connector,
+					   DRM_MODE_DPMS_OFF);
+		igt_amd_disallow_edp_enter_replay(drm_fd, output->name, disallow);
+		kmstest_set_connector_dpms(drm_fd, output->config.connector,
+					   DRM_MODE_DPMS_ON);
+		changed = true;
+	}
+
+	return changed;
+}
+
 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 90ec45828..27a06f6f3 100644
--- a/lib/igt_amd.h
+++ b/lib/igt_amd.h
@@ -237,6 +237,7 @@ 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);
+bool igt_amd_disallow_replay_on_all_edp(int drm_fd, igt_display_t *display, bool disallow);
 
 /* DM interface helpers */
 bool igt_amd_has_visual_confirm(int drm_fd);
-- 
2.43.0


  reply	other threads:[~2026-06-02  6:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  6:41 [PATCH i-g-t 0/2] kms_cursor_legacy: avoid AMD Panel Replay interference Ray Wu
2026-06-02  6:41 ` Ray Wu [this message]
2026-06-04  2:30   ` [PATCH i-g-t 1/2] lib/igt_amd: add helper to disable Panel Replay on all eDPs Tom Chung
2026-06-02  6:41 ` [PATCH i-g-t 2/2] tests/kms_cursor_legacy: disable AMD Panel Replay during test Ray Wu
2026-06-04  2:31   ` Tom Chung
2026-06-02  7:47 ` ✓ Xe.CI.BAT: success for kms_cursor_legacy: avoid AMD Panel Replay interference Patchwork
2026-06-02  8:07 ` ✓ i915.CI.BAT: " Patchwork
2026-06-02 14:07 ` ✗ i915.CI.Full: failure " Patchwork
2026-06-02 14:44 ` ✗ 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=20260602064543.58586-2-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=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