[igt-dev] [PATCH i-g-t 1/2] tests/psr: Wait for PSR exit

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Fri Sep 28 04:19:25 UTC 2018


PSR appears to not exit immediately after the test commits a page flip,
give some leeway for PSR to idle. Let's set the timeout at 40 ms with a
5 ms interval between each status read.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
 lib/igt_psr.c                    | 7 ++++++-
 lib/igt_psr.h                    | 2 +-
 tests/kms_frontbuffer_tracking.c | 3 +--
 tests/kms_psr.c                  | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index c2bae95b..355fe627 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -25,7 +25,7 @@
 #include "igt_sysfs.h"
 #include <errno.h>
 
-bool psr_active(int debugfs_fd, bool check_active)
+static bool psr_active(int debugfs_fd, bool check_active)
 {
 	bool active;
 	char buf[512];
@@ -42,6 +42,11 @@ bool psr_wait_entry(int debugfs_fd)
 	return igt_wait(psr_active(debugfs_fd, true), 500, 1);
 }
 
+bool psr_wait_exit(int debugfs_fd)
+{
+	return igt_wait(psr_active(debugfs_fd, false), 40, 10);
+}
+
 static ssize_t psr_write(int debugfs_fd, const char *buf)
 {
 	return igt_sysfs_write(debugfs_fd, "i915_edp_psr_debug", buf,
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index 7c846afb..b9693822 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -29,7 +29,7 @@
 #include "igt_aux.h"
 
 bool psr_wait_entry(int debugfs_fd);
-bool psr_active(int debugfs_fd, bool check_active);
+bool psr_wait_exit(int debugfs_fd);
 bool psr_enable(int debugfs_fd);
 bool psr_disable(int debugfs_fd);
 
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 265c313a..356e5b6d 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1634,8 +1634,7 @@ static void do_status_assertions(int flags)
 		igt_assert_f(psr_wait_entry(drm.debugfs),
 			     "PSR still disabled\n");
 	else if (flags & ASSERT_PSR_DISABLED)
-		igt_assert_f(psr_active(drm.debugfs, false),
-			     "PSR still enabled\n");
+		igt_assert_f(psr_wait_exit(drm.debugfs), "PSR still enabled\n");
 }
 
 static void __do_assertions(const struct test_mode *t, int flags,
diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index fcc04770..ebd64d46 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -294,7 +294,7 @@ static void run_test(data_t *data)
 		expected = "screen GREEN";
 		break;
 	}
-	igt_assert(psr_active(data->debugfs_fd, false));
+	igt_assert(psr_wait_exit(data->debugfs_fd));
 	manual(expected);
 }
 
-- 
2.17.1



More information about the igt-dev mailing list