summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-13 10:35:11 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-13 10:35:11 +0200
commitd9fb72e26698562367df53909ade0d34520f88f0 (patch)
tree761144f72f5cfe8eb88d0077a1abfc97479c97f3
parentfbd6d0495969ffab5902e3e8e39dc4687806ae0c (diff)
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 <daniel.vetter@ffwll.ch>
-rw-r--r--tests/gem_cpu_concurrent_blit.c13
-rw-r--r--tests/gem_gtt_concurrent_blit.c13
2 files changed, 24 insertions, 2 deletions
diff --git a/tests/gem_cpu_concurrent_blit.c b/tests/gem_cpu_concurrent_blit.c
index ff18f150..fd517d00 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 4a315cf6..c68af7b5 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;
}