diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-07-02 11:51:29 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-07-03 11:23:05 +0100 |
commit | 3e765840129a17b462565f7b48dfe9d9792b292f (patch) | |
tree | 20203c2eb56b1db253d5b62bacc8e27161e0ee83 | |
parent | 76bc11bd3c5eae50165c35edc17473e69e432fdf (diff) |
igt/gem_exec_whisper: Preallocate locations in GTT for whisper
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | tests/gem_exec_whisper.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/gem_exec_whisper.c b/tests/gem_exec_whisper.c index 24c258f6..ec179304 100644 --- a/tests/gem_exec_whisper.c +++ b/tests/gem_exec_whisper.c @@ -117,6 +117,7 @@ static bool ignore_engine(int gen, unsigned engine) static void whisper(int fd, unsigned engine, unsigned flags) { + const uint32_t bbe = MI_BATCH_BUFFER_END; const int gen = intel_gen(intel_get_drm_devid(fd)); struct drm_i915_gem_exec_object2 batches[1024]; struct drm_i915_gem_relocation_entry inter[1024]; @@ -169,8 +170,6 @@ static void whisper(int fd, unsigned engine, unsigned flags) reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION; { - uint32_t bbe = MI_BATCH_BUFFER_END; - tmp[0] = scratch; tmp[1] = store; gem_write(fd, store.handle, 0, &bbe, sizeof(bbe)); @@ -217,13 +216,34 @@ static void whisper(int fd, unsigned engine, unsigned flags) memset(batches, 0, sizeof(batches)); for (n = 0; n < 1024; n++) { batches[n].handle = gem_create(fd, 4096); - batches[n].offset = store.offset; + gem_write(fd, batches[n].handle, 0, &bbe, sizeof(bbe)); + } + execbuf.buffers_ptr = (uintptr_t)batches; + execbuf.buffer_count = 1024; + gem_execbuf(fd, &execbuf); + + execbuf.buffers_ptr = (uintptr_t)tmp; + execbuf.buffer_count = 2; + + old_offset = store.offset; + for (n = 0; n < 1024; n++) { + if (gen >= 8) { + batch[1] = old_offset + loc; + batch[2] = (old_offset + loc) >> 32; + } else if (gen >= 4) { + batch[2] = old_offset + loc; + } else { + batch[1] = old_offset + loc; + } + inter[n] = reloc; - inter[n].presumed_offset = store.offset; + inter[n].presumed_offset = old_offset; inter[n].delta = loc; batches[n].relocs_ptr = (uintptr_t)&inter[n]; batches[n].relocation_count = 1; gem_write(fd, batches[n].handle, 0, batch, sizeof(batch)); + + old_offset = batches[n].offset; } intel_detect_and_clear_missed_interrupts(fd); |