summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>2018-07-12 01:09:42 -0700
committerRodrigo Vivi <rodrigo.vivi@intel.com>2018-07-13 15:30:17 -0700
commit20b67778f58f7f615b7fa59584b4c2aff4d54f6c (patch)
tree75c6be28cd956a359441c3ef9c5dfd5e2dcc53fe /tests
parent79a6c2dab5d46d55fff0e9f075c4de2a1fd131a2 (diff)
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 <rodrigo.vivi@intel.com> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_psr_sink_crc.c27
1 files 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);
}