summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-07-09 10:07:25 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-07-09 10:08:23 +0100
commit97fa5c87cf610137b85178634868358d87cbd388 (patch)
tree5bf2c623f5351c32b2dad52fba4296f48be87951 /tests
parent2962c5164878ca09dcee4627db1433f7489d0b13 (diff)
igt/gem_busy: Include a hangcheck
Ensure that we eventually report idle if we call gem_busy() in a tight loop on a hanging batch. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/gem_busy.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/gem_busy.c b/tests/gem_busy.c
index 4696898e..2b1c1b79 100644
--- a/tests/gem_busy.c
+++ b/tests/gem_busy.c
@@ -223,6 +223,7 @@ static void semaphore(int fd, unsigned ring, uint32_t flags)
}
#define PARALLEL 1
+#define HANG 2
static void one(int fd, unsigned ring, uint32_t flags, unsigned test_flags)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
@@ -235,7 +236,7 @@ static void one(int fd, unsigned ring, uint32_t flags, unsigned test_flags)
uint32_t read[2], write[2];
struct timespec tv;
uint32_t *batch, *bbe;
- int i, count;
+ int i, count, timeout;
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = (uintptr_t)obj;
@@ -329,8 +330,12 @@ static void one(int fd, unsigned ring, uint32_t flags, unsigned test_flags)
}
}
- *bbe = MI_BATCH_BUFFER_END;
- __sync_synchronize();
+ timeout = 120;
+ if ((test_flags & HANG) == 0) {
+ *bbe = MI_BATCH_BUFFER_END;
+ __sync_synchronize();
+ timeout = 1;
+ }
igt_assert_eq(write[SCRATCH], ring);
igt_assert_eq_u32(read[SCRATCH], 1 << ring);
@@ -341,7 +346,7 @@ static void one(int fd, unsigned ring, uint32_t flags, unsigned test_flags)
/* Calling busy in a loop should be enough to flush the rendering */
memset(&tv, 0, sizeof(tv));
while (gem_busy(fd, obj[BATCH].handle))
- igt_assert(igt_seconds_elapsed(&tv) < 10);
+ igt_assert(igt_seconds_elapsed(&tv) < timeout);
igt_assert(!gem_busy(fd, obj[SCRATCH].handle));
munmap(batch, size);
@@ -403,6 +408,16 @@ igt_main
one(fd, e->exec_id, e->flags, 0);
gem_quiescent_gpu(fd);
}
+
+ igt_subtest_f("hang-%s", e->name) {
+ gem_require_ring(fd, e->exec_id | e->flags);
+ igt_skip_on_f(gen == 6 &&
+ e->exec_id == I915_EXEC_BSD,
+ "MI_STORE_DATA broken on gen6 bsd\n");
+ gem_quiescent_gpu(fd);
+ one(fd, e->exec_id, e->flags, HANG);
+ gem_quiescent_gpu(fd);
+ }
}
for (e = intel_execution_engines; e->name; e++) {