summaryrefslogtreecommitdiff
path: root/tests/i915/gem_exec_schedule.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-05-26 15:22:38 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-05-26 21:15:30 +0100
commitf1e62e330a6e2de7b3cbf7cf02d71ae00cc6adcc (patch)
tree4fbe4efb7afac689cb006802fd1894662ef172d0 /tests/i915/gem_exec_schedule.c
parentcc8de46ae02233b8978963d0ce74c6e61375853a (diff)
i915/gem_exec_schedule: Reduce relocation risk for store-dword
The cmd-parser causes a disturbance in our priority scheme. It uses a CPU worker that does not inherit the context priority and so may use a simple FIFO that causes the requests to be ready (and so executed) in parser order rather than our expected inherited priority order. If we do not need to wait for relocations, the cmdparser is run inline, i.e. before the test unleashes the fence holding the requests back. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_exec_schedule.c')
-rw-r--r--tests/i915/gem_exec_schedule.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index 0dfeb39f..c551e23e 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -116,12 +116,16 @@ static uint32_t __store_dword(int fd, uint32_t ctx, unsigned ring,
memset(obj, 0, sizeof(obj));
obj[0].handle = cork;
+ obj[0].offset = cork << 20;
obj[1].handle = target;
+ obj[1].offset = target << 20;
obj[2].handle = gem_create(fd, 4096);
+ obj[2].offset = 256 << 10;
+ obj[2].offset += (random() % 128) << 12;
memset(&reloc, 0, sizeof(reloc));
reloc.target_handle = obj[1].handle;
- reloc.presumed_offset = 0;
+ reloc.presumed_offset = obj[1].offset;
reloc.offset = sizeof(uint32_t);
reloc.delta = offset;
reloc.read_domains = I915_GEM_DOMAIN_INSTRUCTION;
@@ -132,15 +136,15 @@ static uint32_t __store_dword(int fd, uint32_t ctx, unsigned ring,
i = 0;
batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
if (gen >= 8) {
- batch[++i] = offset;
+ batch[++i] = reloc.presumed_offset + reloc.delta;
batch[++i] = 0;
} else if (gen >= 4) {
batch[++i] = 0;
- batch[++i] = offset;
+ batch[++i] = reloc.presumed_offset + reloc.delta;
reloc.offset += sizeof(uint32_t);
} else {
batch[i]--;
- batch[++i] = offset;
+ batch[++i] = reloc.presumed_offset + reloc.delta;
}
batch[++i] = value;
batch[++i] = MI_BATCH_BUFFER_END;