[Intel-gfx] [PATCH IGT 3/5] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives

Jim Bride jim.bride at linux.intel.com
Fri May 5 21:04:47 UTC 2017


Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
Signed-off-by: Jim Bride <jim.bride at linux.intel.com>
---
 tests/kms_psr_sink_crc.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 1a03719..8d26b68 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -192,35 +192,22 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)
 	gem_bo_busy(data->drm_fd, handle);
 }
 
-static bool psr_possible(data_t *data)
+static inline bool psr_possible(data_t *data)
 {
-	char buf[512];
-
-	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
-
 	return running_with_psr_disabled ||
-		strstr(buf, "Sink_Support: yes\n");
+		igt_psr_sink_support(data->drm_fd);
 }
 
-static bool psr_active(data_t *data)
+static inline bool psr_active(data_t *data)
 {
-	char buf[512];
-
-	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
-
 	return running_with_psr_disabled ||
-		strstr(buf, "HW Enabled & Active bit: yes\n");
+		igt_psr_active(data->drm_fd);
 }
 
-static bool wait_psr_entry(data_t *data)
+static inline bool wait_psr_entry(data_t *data)
 {
-	int timeout = 5;
-	while (timeout--) {
-		if (psr_active(data))
-			return true;
-		sleep(1);
-	}
-	return false;
+	return running_with_psr_disabled ||
+		igt_psr_await_status(data->drm_fd, true);
 }
 
 static void get_sink_crc(data_t *data, char *crc) {
@@ -517,6 +504,7 @@ int main(int argc, char *argv[])
 		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
 
 		display_init(&data);
+		igt_skip_on(!psr_possible(&data));
 	}
 
 	igt_subtest("psr_basic") {
-- 
2.7.4



More information about the Intel-gfx mailing list