diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-19 22:57:50 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-19 23:14:24 +0100 |
commit | 9261e1d61f81e868a1de820fbd118bfef332c132 (patch) | |
tree | 4b018a3f7a8382e44deaa83a91e08d2e13d6d5a0 /tests | |
parent | 2c12a7a4ae791c4f88927337a42a218aab76518b (diff) |
igt/gem_exec_flush: Seed a GGTT mappable address
Given aperture fragmentation execution with a fresh object would bind it
outside of the mappable aperture. On earlier gen, execbuf uses the global
GTT and so a subsequent pwrite would be move the idle object into the
mappable aperture, invalidating the existing reloc.presumed_offset - which
are supposed to be accurate as we pass NORELOC.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98109
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gem_exec_flush.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/gem_exec_flush.c b/tests/gem_exec_flush.c index cad99aaa..6b46f9c9 100644 --- a/tests/gem_exec_flush.c +++ b/tests/gem_exec_flush.c @@ -121,6 +121,7 @@ static void run(int fd, unsigned ring, int nchild, int timeout, struct drm_i915_gem_relocation_entry reloc1[1024]; struct drm_i915_gem_execbuffer2 execbuf; unsigned long cycles = 0; + bool snoop = false; uint32_t *ptr; uint32_t *map; int i; @@ -136,7 +137,8 @@ static void run(int fd, unsigned ring, int nchild, int timeout, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); } else { - gem_set_caching(fd, obj[0].handle, !!(flags & COHERENT)); + snoop = flags & COHERENT; + gem_set_caching(fd, obj[0].handle, snoop); map = gem_mmap__cpu(fd, obj[0].handle, 0, 4096, PROT_WRITE); gem_set_domain(fd, obj[0].handle, I915_GEM_DOMAIN_CPU, @@ -150,6 +152,13 @@ static void run(int fd, unsigned ring, int nchild, int timeout, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); + /* Prepara a mappable binding to prevent pread mighrating */ + if (!snoop) { + ptr = gem_mmap__gtt(fd, obj[0].handle, 4096, PROT_READ); + igt_assert_eq_u32(ptr[0], 0xabcdabcd); + munmap(ptr, 4096); + } + memset(&execbuf, 0, sizeof(execbuf)); execbuf.buffers_ptr = (uintptr_t)obj; execbuf.buffer_count = 3; @@ -241,6 +250,8 @@ static void run(int fd, unsigned ring, int nchild, int timeout, i = 16 * (idx % 64) + (idx / 64); obj[1].relocs_ptr = (uintptr_t)&reloc0[i]; obj[2].relocs_ptr = (uintptr_t)&reloc1[i]; + igt_assert_eq_u64(reloc0[i].presumed_offset, obj[0].offset); + igt_assert_eq_u64(reloc1[i].presumed_offset, obj[0].offset); execbuf.batch_start_offset = 64*i; overwrite: |