[PATCH i-g-t 11/13] NORELOC - gem_exec_capture - capture() & userptr() FIX
Andrzej Turko
andrzej.turko at linux.intel.com
Fri Apr 30 11:07:04 UTC 2021
From: Andrzej Turko <andrzej.turko at intel.com>
---
tests/i915/gem_exec_capture.c | 40 ++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
index 11b7b9d07..67e46eee8 100644
--- a/tests/i915/gem_exec_capture.c
+++ b/tests/i915/gem_exec_capture.c
@@ -76,26 +76,14 @@ static void __capture1(int fd, int dir, unsigned ring, uint64_t ahnd,
struct drm_i915_gem_execbuffer2 execbuf;
uint32_t *batch, *seqno;
int i;
- bool do_relocs = !gem_uses_ppgtt(fd);
+ bool do_relocs = gem_has_relocations(fd);
memset(obj, 0, sizeof(obj));
obj[SCRATCH].handle = gem_create(fd, 4096);
- obj[SCRATCH].offset = intel_allocator_alloc(ahnd, obj[SCRATCH].handle,
- 4096, ALIGNMENT);
obj[CAPTURE].handle = target;
- obj[CAPTURE].offset = intel_allocator_alloc(ahnd, target, target_size,
- ALIGNMENT);
obj[CAPTURE].flags = EXEC_OBJECT_CAPTURE;
obj[NOCAPTURE].handle = gem_create(fd, 4096);
- obj[NOCAPTURE].offset = intel_allocator_alloc(ahnd, obj[NOCAPTURE].handle,
- 4096, ALIGNMENT);
obj[BATCH].handle = gem_create(fd, 4096);
- obj[BATCH].offset = intel_allocator_alloc(ahnd, obj[BATCH].handle,
- 4096, ALIGNMENT);
- for (i = 0; i < 4; i++) {
- obj[i].flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
- obj[i].offset = CANONICAL(obj[i].offset);
- }
if (do_relocs) {
obj[BATCH].relocs_ptr = (uintptr_t)reloc;
@@ -103,22 +91,38 @@ static void __capture1(int fd, int dir, unsigned ring, uint64_t ahnd,
memset(reloc, 0, sizeof(reloc));
reloc[0].target_handle = obj[BATCH].handle; /* recurse */
- reloc[0].presumed_offset = obj[BATCH].offset;
+ reloc[0].presumed_offset = 0;
reloc[0].offset = 5*sizeof(uint32_t);
reloc[0].delta = 0;
reloc[0].read_domains = I915_GEM_DOMAIN_COMMAND;
reloc[0].write_domain = 0;
reloc[1].target_handle = obj[SCRATCH].handle; /* breadcrumb */
- reloc[1].presumed_offset = obj[SCRATCH].offset;
+ reloc[1].presumed_offset = 0;
reloc[1].offset = sizeof(uint32_t);
reloc[1].delta = 0;
reloc[1].read_domains = I915_GEM_DOMAIN_RENDER;
reloc[1].write_domain = I915_GEM_DOMAIN_RENDER;
} else {
+
+ obj[SCRATCH].offset = intel_allocator_alloc(ahnd,
+ obj[SCRATCH].handle,
+ 4096, ALIGNMENT);
+ obj[CAPTURE].offset = intel_allocator_alloc(ahnd, target,
+ target_size,
+ ALIGNMENT);
+ obj[NOCAPTURE].offset = intel_allocator_alloc(ahnd,
+ obj[NOCAPTURE].handle,
+ 4096, ALIGNMENT);
+ obj[BATCH].offset = intel_allocator_alloc(ahnd, obj[BATCH].handle,
+ 4096, ALIGNMENT);
+
obj[SCRATCH].flags |= EXEC_OBJECT_WRITE;
- for (i = 0; i < 4; i++)
- obj[i].flags |= EXEC_OBJECT_PINNED;
+ for (i = 0; i < 4; i++) {
+ obj[i].flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS |
+ EXEC_OBJECT_PINNED;
+ obj[i].offset = CANONICAL(obj[i].offset);
+ }
}
seqno = gem_mmap__wc(fd, obj[SCRATCH].handle, 0, 4096, PROT_READ);
@@ -200,7 +204,6 @@ static void capture(int fd, int dir, unsigned ring)
ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_SIMPLE);
handle = gem_create(fd, 4096);
- intel_allocator_alloc(ahnd, handle, 4096, ALIGNMENT);
__capture1(fd, dir, ring, ahnd, handle, 4096);
@@ -606,7 +609,6 @@ static void userptr(int fd, int dir)
ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_SIMPLE);
igt_assert(posix_memalign(&ptr, 4096, 4096) == 0);
igt_require(__gem_userptr(fd, ptr, 4096, 0, 0, &handle) == 0);
- intel_allocator_alloc(ahnd, handle, 4096, ALIGNMENT);
__capture1(fd, dir, 0, ahnd, handle, 4096);
--
2.25.1
More information about the Intel-gfx-trybot
mailing list