From 20b67778f58f7f615b7fa59584b4c2aff4d54f6c Mon Sep 17 00:00:00 2001 From: Dhinakaran Pandiyan Date: Thu, 12 Jul 2018 01:09:42 -0700 Subject: tests/kms_psr_sink_crc: Test PSR source HW status before PSR entry. Wait for PSR HW status to show active before starting an PSR exit action. Cc: Rodrigo Vivi Signed-off-by: Dhinakaran Pandiyan Reviewed-by: Rodrigo Vivi --- tests/kms_psr_sink_crc.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 4a18609a..4eca51da 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -197,33 +197,24 @@ static bool sink_support(data_t *data) strstr(buf, "Sink_Support: yes\n"); } -static bool psr_enabled(data_t *data) +static bool psr_active(data_t *data, bool check_active) { + bool active; char buf[512]; igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf); - return data->with_psr_disabled || - strstr(buf, "HW Enabled & Active bit: yes\n"); + 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) { - int timeout = 5; - while (timeout--) { - if (psr_enabled(data)) - return true; - sleep(1); - } - return false; -} + if (data->with_psr_disabled) + return true; -static bool psr_inactive(data_t *data) -{ - char buf[512]; - - igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf); - return !(strstr(buf, "SRDENT") || strstr("SLEEP")); + return igt_wait((psr_active(data, true)), 500, 1); } static inline void manual(const char *expected) @@ -312,7 +303,7 @@ static void run_test(data_t *data) expected = "screen GREEN"; break; } - assert(psr_inactive(data)); + igt_assert(psr_active(data, false)); manual(expected); } -- cgit v1.2.3