[igt-dev] [PATCH i-g-t 2/2] tests/kms_psr_sink_crc: Test PSR source HW status.

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Mon Jul 2 23:35:59 UTC 2018


We make use of the status MMIO to tell whether the HW entered and
exited.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
 tests/kms_psr_sink_crc.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index d36be7dd..08d0ce9a 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -195,7 +195,7 @@ static bool sink_support(data_t *data)
 		strstr(buf, "Sink_Support: yes\n");
 }
 
-static bool psr_enabled(data_t *data)
+static bool psr_hw_enabled(data_t *data)
 {
 	char buf[512];
 
@@ -205,15 +205,23 @@ static bool psr_enabled(data_t *data)
 		strstr(buf, "HW Enabled & Active bit: yes\n");
 }
 
+static bool psr_hw_status(data_t *data, bool active)
+{
+	char buf[512];
+
+	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
+
+	/* TODO: Update the checks for PSR2 */
+	return strstr(buf, "Source PSR status:") &&
+	       (active ? !!strstr(buf, "SRDENT") : !strstr(buf, "SRDENT"));
+}
+
 static bool wait_psr_entry(data_t *data)
 {
-	int timeout = 5;
-	while (timeout--) {
-		if (psr_enabled(data))
-			return true;
-		sleep(1);
-	}
-	return false;
+	if (!psr_hw_enabled(data))
+		return false;
+
+	return igt_wait(psr_hw_status(data, true), 500, 1);
 }
 
 static inline void manual(const char *expected)
@@ -303,6 +311,7 @@ static void run_test(data_t *data)
 		expected = "screen GREEN";
 		break;
 	}
+	igt_assert(psr_hw_status(data, false));
 	manual(expected);
 }
 
-- 
2.14.1



More information about the igt-dev mailing list