diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-29 16:15:38 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-29 16:37:20 +0100 |
commit | 95426dc206eee75a7092bc6f00a53572892ba0e5 (patch) | |
tree | e8b7716afc9bbb556fd9df50d6bbc7144d2ce34d | |
parent | ebfd01908f787876040a679fc7895828b23d268d (diff) |
tests/gem_(cpu|gtt)_concurrent_blit: Enable signals
In order to exercise the bug behind:
commit 22fd5ca947b58901927d100d2b1aa0f1672b3435
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri Jun 28 16:54:08 2013 +0100
drm/i915: Only clear write-domains after a successful wait-seqno
we need to check for concurrent access with the potential to be
interrupted by a signal. The framework for doing so is already in place,
so just enable it and repeat the tests for longer to give better chance
of being interrupted at just the wrong moment.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | tests/gem_cpu_concurrent_blit.c | 55 | ||||
-rw-r--r-- | tests/gem_gtt_concurrent_blit.c | 53 |
2 files changed, 61 insertions, 47 deletions
diff --git a/tests/gem_cpu_concurrent_blit.c b/tests/gem_cpu_concurrent_blit.c index 21cbdb07..99680842 100644 --- a/tests/gem_cpu_concurrent_blit.c +++ b/tests/gem_cpu_concurrent_blit.c @@ -54,7 +54,7 @@ set_bo(drm_intel_bo *bo, uint32_t val, int width, int height) int size = width * height; uint32_t *vaddr; - drm_intel_bo_map(bo, true); + do_or_die(drm_intel_bo_map(bo, true)); vaddr = bo->virtual; while (size--) *vaddr++ = val; @@ -67,7 +67,7 @@ cmp_bo(drm_intel_bo *bo, uint32_t val, int width, int height) int size = width * height; uint32_t *vaddr; - drm_intel_bo_map(bo, false); + do_or_die(drm_intel_bo_map(bo, false)); vaddr = bo->virtual; while (size--) assert(*vaddr++ == val); @@ -95,8 +95,7 @@ main(int argc, char **argv) int num_buffers = 128, max; drm_intel_bo *src[128], *dst[128], *dummy = NULL; int width = 512, height = 512; - int fd; - int i; + int i, loop, fd; drmtest_subtest_init(argc, argv); @@ -119,36 +118,44 @@ main(int argc, char **argv) } /* try to overwrite the source values */ + drmtest_fork_signal_helper(); if (drmtest_run_subtest("overwrite-source")) { - for (i = 0; i < num_buffers; i++) - intel_copy_bo(batch, dst[i], src[i], width, height); - for (i = num_buffers; i--; ) - set_bo(src[i], 0xdeadbeef, width, height); - for (i = 0; i < num_buffers; i++) - cmp_bo(dst[i], i, width, height); + for (loop = 0; loop < 10; loop++) { + for (i = 0; i < num_buffers; i++) + intel_copy_bo(batch, dst[i], src[i], width, height); + for (i = num_buffers; i--; ) + set_bo(src[i], 0xdeadbeef, width, height); + for (i = 0; i < num_buffers; i++) + cmp_bo(dst[i], i, width, height); + } } /* try to read the results before the copy completes */ if (drmtest_run_subtest("early-read")) { - for (i = num_buffers; i--; ) - set_bo(src[i], 0xdeadbeef, width, height); - for (i = 0; i < num_buffers; i++) - intel_copy_bo(batch, dst[i], src[i], width, height); - for (i = num_buffers; i--; ) - cmp_bo(dst[i], 0xdeadbeef, width, height); + for (loop = 0; loop < 10; loop++) { + for (i = num_buffers; i--; ) + set_bo(src[i], 0xdeadbeef, width, height); + for (i = 0; i < num_buffers; i++) + intel_copy_bo(batch, dst[i], src[i], width, height); + for (i = num_buffers; i--; ) + cmp_bo(dst[i], 0xdeadbeef, width, height); + } } /* and finally try to trick the kernel into loosing the pending write */ if (drmtest_run_subtest("gpu-read-after-write")) { - for (i = num_buffers; i--; ) - set_bo(src[i], 0xabcdabcd, width, height); - for (i = 0; i < num_buffers; i++) - intel_copy_bo(batch, dst[i], src[i], width, height); - for (i = num_buffers; i--; ) - intel_copy_bo(batch, dummy, dst[i], width, height); - for (i = num_buffers; i--; ) - cmp_bo(dst[i], 0xabcdabcd, width, height); + for (loop = 0; loop < 10; loop++) { + for (i = num_buffers; i--; ) + set_bo(src[i], 0xabcdabcd, width, height); + for (i = 0; i < num_buffers; i++) + intel_copy_bo(batch, dst[i], src[i], width, height); + for (i = num_buffers; i--; ) + intel_copy_bo(batch, dummy, dst[i], width, height); + for (i = num_buffers; i--; ) + cmp_bo(dst[i], 0xabcdabcd, width, height); + } } + drmtest_fork_signal_helper(); return 0; } diff --git a/tests/gem_gtt_concurrent_blit.c b/tests/gem_gtt_concurrent_blit.c index 8bd80f12..e0962f86 100644 --- a/tests/gem_gtt_concurrent_blit.c +++ b/tests/gem_gtt_concurrent_blit.c @@ -83,7 +83,7 @@ create_bo(drm_intel_bufmgr *bufmgr, uint32_t val, int width, int height) /* gtt map doesn't have a write parameter, so just keep the mapping * around (to avoid the set_domain with the gtt write domain set) and * manually tell the kernel when we start access the gtt. */ - drm_intel_gem_bo_map_gtt(bo); + do_or_die(drm_intel_gem_bo_map_gtt(bo)); set_bo(bo, val, width, height); @@ -98,8 +98,7 @@ main(int argc, char **argv) int num_buffers = 128, max; drm_intel_bo *src[128], *dst[128], *dummy = NULL; int width = 512, height = 512; - int fd; - int i; + int fd, loop, i; drmtest_subtest_init(argc, argv); @@ -122,36 +121,44 @@ main(int argc, char **argv) } /* try to overwrite the source values */ + drmtest_fork_signal_helper(); if (drmtest_run_subtest("overwrite-source")) { - for (i = 0; i < num_buffers; i++) - intel_copy_bo(batch, dst[i], src[i], width, height); - for (i = num_buffers; i--; ) - set_bo(src[i], 0xdeadbeef, width, height); - for (i = 0; i < num_buffers; i++) - cmp_bo(dst[i], i, width, height); + for (loop = 0; loop < 10; loop++) { + for (i = 0; i < num_buffers; i++) + intel_copy_bo(batch, dst[i], src[i], width, height); + for (i = num_buffers; i--; ) + set_bo(src[i], 0xdeadbeef, width, height); + for (i = 0; i < num_buffers; i++) + cmp_bo(dst[i], i, width, height); + } } /* try to read the results before the copy completes */ if (drmtest_run_subtest("early-read")) { - for (i = num_buffers; i--; ) - set_bo(src[i], 0xdeadbeef, width, height); - for (i = 0; i < num_buffers; i++) - intel_copy_bo(batch, dst[i], src[i], width, height); - for (i = num_buffers; i--; ) - cmp_bo(dst[i], 0xdeadbeef, width, height); + for (loop = 0; loop < 10; loop++) { + for (i = num_buffers; i--; ) + set_bo(src[i], 0xdeadbeef, width, height); + for (i = 0; i < num_buffers; i++) + intel_copy_bo(batch, dst[i], src[i], width, height); + for (i = num_buffers; i--; ) + cmp_bo(dst[i], 0xdeadbeef, width, height); + } } /* and finally try to trick the kernel into loosing the pending write */ if (drmtest_run_subtest("gpu-read-after-write")) { - for (i = num_buffers; i--; ) - set_bo(src[i], 0xabcdabcd, width, height); - for (i = 0; i < num_buffers; i++) - intel_copy_bo(batch, dst[i], src[i], width, height); - for (i = num_buffers; i--; ) - intel_copy_bo(batch, dummy, dst[i], width, height); - for (i = num_buffers; i--; ) - cmp_bo(dst[i], 0xabcdabcd, width, height); + for (loop = 0; loop < 10; loop++) { + for (i = num_buffers; i--; ) + set_bo(src[i], 0xabcdabcd, width, height); + for (i = 0; i < num_buffers; i++) + intel_copy_bo(batch, dst[i], src[i], width, height); + for (i = num_buffers; i--; ) + intel_copy_bo(batch, dummy, dst[i], width, height); + for (i = num_buffers; i--; ) + cmp_bo(dst[i], 0xabcdabcd, width, height); + } } + drmtest_stop_signal_helper(); return 0; } |