kms_flip: Skip tests that try to inject GPU hangs if already terminally wedged
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 21 Feb 2014 15:14:08 +0000 (15:14 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 21 Feb 2014 15:28:43 +0000 (15:28 +0000)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
tests/kms_flip.c

index a42b446..e019786 100644 (file)
@@ -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);