From f5dd258cc7276be30d699d68f7c6952b04067529 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 12 May 2015 10:02:59 +0100 Subject: [PATCH] igt/gem_streaming_writes: Build in a self-test Use the first pass to write all values prior to the initial execbuf to verify that the copy itself is true. Subsequent passes then focus on verifying that writing values whilst the GPU is reading from neighbouring values is then correct. Signed-off-by: Chris Wilson --- tests/gem_streaming_writes.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/gem_streaming_writes.c b/tests/gem_streaming_writes.c index da13dab3..d42a184a 100644 --- a/tests/gem_streaming_writes.c +++ b/tests/gem_streaming_writes.c @@ -171,12 +171,19 @@ static void test_streaming(int fd, int mode) int domain = mode ? I915_GEM_DOMAIN_GTT : I915_GEM_DOMAIN_CPU; gem_set_domain(fd, src, domain, domain); + if (pass == 0) { + for (i = 0; i < OBJECT_SIZE/4; i++) + s[i] = i; + } + /* Now copy from the src to the dst in 32byte chunks */ for (offset = 0; offset < OBJECT_SIZE; offset += CHUNK_SIZE) { int b; - for (i = 0; i < CHUNK_SIZE/4; i++) - s[offset/4 + i] = (OBJECT_SIZE*pass + offset)/4 + i; + if (pass) { + for (i = 0; i < CHUNK_SIZE/4; i++) + s[offset/4 + i] = (OBJECT_SIZE*pass + offset)/4 + i; + } b = offset / CHUNK_SIZE / 64; n = offset / CHUNK_SIZE % 64;