From d9fb72e26698562367df53909ade0d34520f88f0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Fri, 13 Jul 2012 10:35:11 +0200 Subject: tests: improve concurrent blit tests By adding another testcase that follows up with a gpu read. This checks whether the kernel properly tracks the pending write and doesn't lose it (or sync up to the wrong seqno). For some odd reason only the cpu mmap variant blows up, the gtt one works here. I need to look into that some more. Signed-Off-by: Daniel Vetter --- tests/gem_cpu_concurrent_blit.c | 13 ++++++++++++- tests/gem_gtt_concurrent_blit.c | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/gem_cpu_concurrent_blit.c b/tests/gem_cpu_concurrent_blit.c index ff18f15..fd517d0 100644 --- a/tests/gem_cpu_concurrent_blit.c +++ b/tests/gem_cpu_concurrent_blit.c @@ -93,7 +93,7 @@ main(int argc, char **argv) drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; int num_buffers = 128, max; - drm_intel_bo *src[128], *dst[128]; + drm_intel_bo *src[128], *dst[128], *dummy; int width = 512, height = 512; int fd; int i; @@ -112,6 +112,7 @@ main(int argc, char **argv) src[i] = create_bo(bufmgr, i, width, height); dst[i] = create_bo(bufmgr, ~i, width, height); } + dummy = create_bo(bufmgr, 0, width, height); /* try to overwrite the source values */ for (i = 0; i < num_buffers; i++) @@ -127,5 +128,15 @@ main(int argc, char **argv) for (i = num_buffers; i--; ) cmp_bo(dst[i], 0xdeadbeef, width, height); + /* and finally try to trick the kernel into loosing the pending 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); + return 0; } diff --git a/tests/gem_gtt_concurrent_blit.c b/tests/gem_gtt_concurrent_blit.c index 4a315cf..c68af7b 100644 --- a/tests/gem_gtt_concurrent_blit.c +++ b/tests/gem_gtt_concurrent_blit.c @@ -96,7 +96,7 @@ main(int argc, char **argv) drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; int num_buffers = 128, max; - drm_intel_bo *src[128], *dst[128]; + drm_intel_bo *src[128], *dst[128], *dummy; int width = 512, height = 512; int fd; int i; @@ -115,6 +115,7 @@ main(int argc, char **argv) src[i] = create_bo(bufmgr, i, width, height); dst[i] = create_bo(bufmgr, ~i, width, height); } + dummy = create_bo(bufmgr, 0, width, height); /* try to overwrite the source values */ for (i = 0; i < num_buffers; i++) @@ -130,5 +131,15 @@ main(int argc, char **argv) for (i = num_buffers; i--; ) cmp_bo(dst[i], 0xdeadbeef, width, height); + /* and finally try to trick the kernel into loosing the pending 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); + return 0; } -- cgit v1.2.3