From a0c936cfc128dfea6c58c4eef1e56cc29df21406 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 21 Feb 2014 15:14:08 +0000 Subject: [PATCH] kms_flip: Skip tests that try to inject GPU hangs if already terminally wedged Signed-off-by: Chris Wilson --- tests/kms_flip.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index a42b4469..e0197864 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -757,6 +757,14 @@ static uint32_t hang_gpu(int fd) return gem_exec.handle; } +static bool is_hung(int fd) +{ + if (drmIoctl(fd, DRM_IOCTL_I915_GEM_THROTTLE, 0) == 0) + return false; + + return errno == EIO; +} + static int set_mode(struct test_output *o, uint32_t fb, int x, int y) { int n; @@ -869,8 +877,10 @@ static unsigned int run_test_step(struct test_output *o) igt_info("."); fflush(stdout); - if (do_flip && (o->flags & TEST_HANG)) + if (do_flip && (o->flags & TEST_HANG)) { hang = hang_gpu(drm_fd); + igt_assert_f(hang, "failed to exercise page flip hang recovery\n"); + } if (do_flip) do_or_die(do_page_flip(o, new_fb_id, !(o->flags & TEST_NOEVENT))); @@ -925,9 +935,6 @@ static unsigned int run_test_step(struct test_output *o) if (hang) unhang_gpu(drm_fd, hang); - igt_assert_f(!(do_flip && (o->flags & TEST_HANG)) || hang, - "failed to exercise page flip hang recovery\n"); - return completed_events; } @@ -1303,6 +1310,8 @@ static int run_test(int duration, int flags) struct test_output o; int i, n, modes = 0; + igt_require((flags & TEST_HANG) == 0 || !is_hung(drm_fd)); + resources = drmModeGetResources(drm_fd); igt_assert(resources); @@ -1358,6 +1367,8 @@ static int run_pair(int duration, int flags) struct test_output o; int i, j, m, n, modes = 0; + igt_require((flags & TEST_HANG) == 0 || !is_hung(drm_fd)); + resources = drmModeGetResources(drm_fd); igt_assert(resources);