[igt-dev] [PATCH igt] igt/kms_frontbuffer_tracking: Wait for PSR to be disabled

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 20 14:33:08 UTC 2018


PSR may not exit instantaneously, so while asserting that PSR is
disabled after an action, we may have to wait a short while. Currently
that wait is waiting for PSR to enabled and expecting to timeout; this
fails when we start the assertion with PSR already enabled. Fix the wait
to wait until PSR is disabled rather than timeout.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/kms_frontbuffer_tracking.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 6c4071de..57ae047b 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -1002,6 +1002,11 @@ static bool psr_wait_until_enabled(void)
 	return igt_wait(psr_is_enabled(), 5000, 1);
 }
 
+static bool psr_wait_until_disabled(void)
+{
+	return igt_wait(!psr_is_enabled(), 5000, 1);
+}
+
 static bool drrs_wait_until_rr_switch_to_low(void)
 {
 	return igt_wait(is_drrs_low(), 5000, 1);
@@ -1845,10 +1850,13 @@ static void do_status_assertions(int flags)
 	if (flags & ASSERT_PSR_ENABLED) {
 		if (!psr_wait_until_enabled()) {
 			psr_print_status();
-			igt_assert_f(psr_is_enabled(), "PSR disabled\n");
+			igt_assert_f(psr_is_enabled(), "PSR still disabled\n");
 		}
 	} else if (flags & ASSERT_PSR_DISABLED) {
-		igt_assert(!psr_wait_until_enabled());
+		if (!psr_wait_until_disabled()) {
+			psr_print_status();
+			igt_assert_f(!psr_is_enabled(), "PSR still enabled\n");
+		}
 	}
 }
 
-- 
2.16.1



More information about the igt-dev mailing list