[igt-dev] [PATCH i-g-t 2/4] tests/psr: Prepare for moving PSR state checking functions into lib

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Fri Jul 13 23:29:33 UTC 2018


Change the function arguments to not rely on test specific data as
the following patches change kms_frontbuffer_tracking to reuse PSR
functions.

Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
 tests/kms_psr.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index aace884c..ded8346a 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -195,21 +195,21 @@ static bool sink_support(data_t *data)
 	return strstr(buf, "Sink_Support: yes\n");
 }
 
-static bool psr_active(data_t *data, bool check_active)
+static bool psr_active(int fd, bool check_active)
 {
 	bool active;
 	char buf[512];
 
-	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
+	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
 
 	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
 		 (strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
 	return check_active ? active : !active;
 }
 
-static bool wait_psr_entry(data_t *data)
+static bool wait_psr_entry(int fd)
 {
-	return igt_wait((psr_active(data, true)), 500, 1);
+	return igt_wait((psr_active(fd, true)), 500, 1);
 }
 
 static inline void manual(const char *expected)
@@ -237,7 +237,7 @@ static void run_test(data_t *data)
 	manual("screen GREEN");
 
 	/* Confirm screen stays Green after PSR got active */
-	igt_assert(wait_psr_entry(data));
+	igt_assert(wait_psr_entry(data->drm_fd));
 	manual("screen GREEN");
 
 	/* Setting a secondary fb/plane */
@@ -250,7 +250,7 @@ static void run_test(data_t *data)
 	else
 		manual("GREEN background with WHITE box");
 
-	igt_assert(wait_psr_entry(data));
+	igt_assert(wait_psr_entry(data->drm_fd));
 	switch (data->op) {
 	case PAGE_FLIP:
 		/* Only in use when testing primary plane */
@@ -298,7 +298,7 @@ static void run_test(data_t *data)
 		expected = "screen GREEN";
 		break;
 	}
-	igt_assert(psr_active(data, false));
+	igt_assert(psr_active(data->drm_fd, false));
 	manual(expected);
 }
 
@@ -408,13 +408,13 @@ igt_main
 
 	igt_subtest("basic") {
 		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(wait_psr_entry(data.drm_fd));
 		test_cleanup(&data);
 	}
 
 	igt_subtest("no_drrs") {
 		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(wait_psr_entry(data.drm_fd));
 		igt_assert(drrs_disabled(&data));
 		test_cleanup(&data);
 	}
@@ -423,7 +423,7 @@ igt_main
 		igt_subtest_f("primary_%s", op_str(op)) {
 			data.op = op;
 			setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(wait_psr_entry(data.drm_fd));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -433,7 +433,7 @@ igt_main
 		igt_subtest_f("sprite_%s", op_str(op)) {
 			data.op = op;
 			setup_test_plane(&data, DRM_PLANE_TYPE_OVERLAY);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(wait_psr_entry(data.drm_fd));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -443,7 +443,7 @@ igt_main
 		igt_subtest_f("cursor_%s", op_str(op)) {
 			data.op = op;
 			setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(wait_psr_entry(data.drm_fd));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -452,7 +452,7 @@ igt_main
 	igt_subtest_f("dpms") {
 		data.op = RENDER;
 		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(wait_psr_entry(data.drm_fd));
 		dpms_off_on(&data);
 		run_test(&data);
 		test_cleanup(&data);
@@ -461,10 +461,10 @@ igt_main
 	igt_subtest_f("suspend") {
 		data.op = PLANE_ONOFF;
 		setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(wait_psr_entry(data.drm_fd));
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(wait_psr_entry(data.drm_fd));
 		run_test(&data);
 		test_cleanup(&data);
 	}
-- 
2.17.1



More information about the igt-dev mailing list