[PATCH i-g-t] lib/i915: Set NO_RELOC flag for spinners

Chris Wilson chris at chris-wilson.co.uk
Sun Jul 12 11:29:28 UTC 2020


We write the addresses into the batch and fill in the presumed_offset
and execobj.offset correctly, so we meet the no-relocation requirements
and so can normally avoid relocations. In order to let the kernel know
it can trust us, we should also set the I915_EXEC_NO_RELOC flags.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Acked-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>
---
 lib/igt_dummyload.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index f79f16dee..26ea154ac 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -121,11 +121,10 @@ emit_recursive_batch(igt_spin_t *spin,
 	}
 	igt_require(nengine);
 
-	memset(&spin->execbuf, 0, sizeof(spin->execbuf));
-	execbuf = &spin->execbuf;
-	memset(spin->obj, 0, sizeof(spin->obj));
-	obj = spin->obj;
 	memset(relocs, 0, sizeof(relocs));
+	execbuf = memset(&spin->execbuf, 0, sizeof(spin->execbuf));
+	execbuf->flags = I915_EXEC_NO_RELOC;
+	obj = memset(spin->obj, 0, sizeof(spin->obj));
 
 	obj[BATCH].handle = gem_create(fd, BATCH_SIZE);
 	batch = gem_mmap__device_coherent(fd, obj[BATCH].handle,
@@ -146,6 +145,7 @@ emit_recursive_batch(igt_spin_t *spin,
 		/* dummy write to dependency */
 		obj[SCRATCH].handle = opts->dependency;
 		obj[SCRATCH].offset = addr;
+		obj[SCRATCH].flags = EXEC_OBJECT_WRITE;
 
 		r->presumed_offset = obj[SCRATCH].offset;
 		r->target_handle = obj[SCRATCH].handle;
-- 
2.27.0



More information about the Intel-gfx-trybot mailing list