Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> Signed-off-by: Jim Bride <jim.bride@xxxxxxxxxxxxxxx> --- tests/kms_psr_sink_crc.c | 53 ++++++++++-------------------------------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 8f6bdc0..1d9eb11 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -191,37 +191,6 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color) gem_bo_busy(data->drm_fd, handle); } -static bool psr_possible(data_t *data) -{ - char buf[512]; - - igt_debugfs_read("i915_edp_psr_status", buf); - - return running_with_psr_disabled || - strstr(buf, "Sink_Support: yes\n"); -} - -static bool psr_active(data_t *data) -{ - char buf[512]; - - igt_debugfs_read("i915_edp_psr_status", buf); - - return running_with_psr_disabled || - strstr(buf, "HW Enabled & Active bit: yes\n"); -} - -static bool wait_psr_entry(data_t *data) -{ - int timeout = 5; - while (timeout--) { - if (psr_active(data)) - return true; - sleep(1); - } - return false; -} - static void get_sink_crc(data_t *data, char *crc) { int ret; FILE *file; @@ -301,7 +270,7 @@ static void run_test(data_t *data) assert_or_manual(is_green(ref_crc), "screen GREEN"); /* Confirm screen stays Green after PSR got active */ - igt_assert(wait_psr_entry(data)); + igt_assert(igt_psr_await_status(true)); get_sink_crc(data, ref_crc); assert_or_manual(is_green(ref_crc), "screen GREEN"); @@ -315,7 +284,7 @@ static void run_test(data_t *data) igt_display_commit(&data->display); /* Confirm it is not Green anymore */ - igt_assert(wait_psr_entry(data)); + igt_assert(igt_psr_await_status(true)); get_sink_crc(data, ref_crc); if (data->test_plane == DRM_PLANE_TYPE_PRIMARY) assert_or_manual(!is_green(ref_crc), "screen WHITE"); @@ -513,7 +482,7 @@ int main(int argc, char *argv[]) igt_set_module_param_int("enable_psr", running_with_psr_disabled ? 0 : 1); - igt_skip_on(!psr_possible(&data)); + igt_skip_on(!igt_psr_possible()); data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096); igt_assert(data.bufmgr); @@ -524,7 +493,7 @@ int main(int argc, char *argv[]) igt_subtest("psr_basic") { setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); } for (op = PAGE_FLIP; op <= RENDER; op++) { @@ -532,7 +501,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = op; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -543,7 +512,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_OVERLAY; data.op = op; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -554,7 +523,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_CURSOR; data.op = op; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -564,7 +533,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = RENDER; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); dpms_off_on(data); @@ -579,7 +548,7 @@ int main(int argc, char *argv[]) dpms_off_on(data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } @@ -588,7 +557,7 @@ int main(int argc, char *argv[]) data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = PAGE_FLIP; setup_test_plane(&data); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); @@ -605,7 +574,7 @@ int main(int argc, char *argv[]) igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); - igt_assert(wait_psr_entry(&data)); + igt_assert(igt_psr_await_status(true)); run_test(&data); test_cleanup(&data); } -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx