[PATCH] lib/igt_psr: Dump out PSR status if waiting PSR entry or update fails

Jouni Högander jouni.hogander at intel.com
Tue Nov 19 12:33:24 UTC 2024


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 at 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



More information about the igt-dev mailing list