Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/igt_psr: Dump out PSR status if waiting PSR entry or update fails
@ 2024-11-19 12:33 Jouni Högander
  2024-11-19 23:57 ` ✓ CI.xeBAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jouni Högander @ 2024-11-19 12:33 UTC (permalink / raw)
  To: igt-dev; +Cc: Jouni Högander

Currently we are receiving reports from CI testing indication PSR entry of
update are failing. It would ease making conclusions on the reports if PSR
status when failure happened would be available. Solve this by printing out
PSR status if waiting PSR entry or update fails.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 lib/igt_psr.c | 39 +++++++++++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 8 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 83c21e6ba..61feea9aa 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -88,10 +88,9 @@ static bool sink_status_checks(void)
 	return env && atoi(env);
 }
 
-static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *output)
+static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *output, char *buf, int buf_len)
 {
 	char debugfs_file[128] = {0};
-	char buf[PSR_STATUS_MAX_LEN];
 	drmModeConnector *c;
 	const char *state;
 	bool active;
@@ -113,7 +112,7 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *o
 
 	SET_DEBUGFS_PATH(output, debugfs_file);
 	ret = igt_debugfs_simple_read(debugfs_fd, debugfs_file,
-				     buf, sizeof(buf));
+				     buf, buf_len);
 	if (ret < 0) {
 		igt_info("Could not read i915_edp_psr_status: %s\n",
 			 strerror(-ret));
@@ -137,11 +136,22 @@ static bool psr_active_check(int debugfs_fd, enum psr_mode mode, igt_output_t *o
  */
 bool psr_wait_entry(int debugfs_fd, enum psr_mode mode, igt_output_t *output)
 {
-	return igt_wait(psr_active_check(debugfs_fd, mode, output), 500, 20);
+	char buf[PSR_STATUS_MAX_LEN];
+	int ret;
+
+	ret = igt_wait(psr_active_check(debugfs_fd, mode, output, buf, sizeof(buf)), 500, 20);
+
+	if (!ret)
+		igt_info("PSR not active within timeout. PSR status at the end of the wait:\n%s", buf);
+
+	return ret;
 }
 
 bool psr_wait_update(int debugfs_fd, enum psr_mode mode, igt_output_t *output)
 {
+	char buf[PSR_STATUS_MAX_LEN];
+	int ret;
+
 	/*
 	 * TODO: After enabling Panel Replay on DP2.1, observe that the SRD status
 	 * remains in the SRDENT_ON state. Remove the polling mechanism for the SRD
@@ -149,13 +159,21 @@ bool psr_wait_update(int debugfs_fd, enum psr_mode mode, igt_output_t *output)
 	 */
 	if (output != NULL &&
 	    output->config.connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
-		return igt_wait(psr_active_check(debugfs_fd, mode, output), 40, 1);
+		ret = igt_wait(psr_active_check(debugfs_fd, mode, output, buf, sizeof(buf)), 40, 1);
 	else
-		return igt_wait(!psr_active_check(debugfs_fd, mode, output), 40, 1);
+		ret = igt_wait(!psr_active_check(debugfs_fd, mode, output, buf, sizeof(buf)), 40, 1);
+
+	if (!ret)
+		igt_info("PSR not inactive for update within timeout. PSR status at the end of the wait:\n %s", buf);
+
+	return ret;
 }
 
 bool psr_long_wait_update(int debugfs_fd, enum psr_mode mode, igt_output_t *output)
 {
+	char buf[PSR_STATUS_MAX_LEN];
+	int ret;
+
 	/*
 	 * TODO: After enabling Panel Replay on DP2.1, observe that the SRD status
 	 * remains in the SRDENT_ON state. Remove the polling mechanism for the SRD
@@ -163,9 +181,14 @@ bool psr_long_wait_update(int debugfs_fd, enum psr_mode mode, igt_output_t *outp
 	 */
 	if (output != NULL &&
 	    output->config.connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)
-		return igt_wait(psr_active_check(debugfs_fd, mode, output), 500, 1);
+		ret = igt_wait(psr_active_check(debugfs_fd, mode, output, buf, sizeof(buf)), 500, 1);
 	else
-		return igt_wait(!psr_active_check(debugfs_fd, mode, output), 500, 1);
+		ret = igt_wait(!psr_active_check(debugfs_fd, mode, output, buf, sizeof(buf)), 500, 1);
+
+	if (!ret)
+		igt_info("PSR not inactive for update within timeout. PSR status at the end of the wait:\n %s", buf);
+
+	return ret;
 }
 
 static ssize_t psr_write(int debugfs_fd, const char *buf, igt_output_t *output)
-- 
2.34.1


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

end of thread, other threads:[~2024-11-22 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19 12:33 [PATCH] lib/igt_psr: Dump out PSR status if waiting PSR entry or update fails Jouni Högander
2024-11-19 23:57 ` ✓ CI.xeBAT: success for " Patchwork
2024-11-20  0:10 ` ✓ Fi.CI.BAT: " Patchwork
2024-11-22 17:01 ` ✗ i915.CI.Full: failure " Patchwork

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