[Intel-gfx] [PATCH i-g-t] i915/gem_exec_schedule: Replace vgem fence with sync_file
Chris Wilson
chris at chris-wilson.co.uk
Wed Oct 2 11:41:41 UTC 2019
Slightly more complicated conversion than the earlier mass conversion as
deep() open-codes the execbuf loop, but still pretty simple replacement
of the plug object with the in-fence.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111646
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
---
tests/i915/gem_exec_schedule.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
index ddcb1f21a..f99e5e15d 100644
--- a/tests/i915/gem_exec_schedule.c
+++ b/tests/i915/gem_exec_schedule.c
@@ -1159,12 +1159,12 @@ static void deep(int fd, unsigned ring)
struct timespec tv = {};
IGT_CORK_HANDLE(cork);
unsigned int nreq;
- uint32_t plug;
uint32_t result, dep[XS];
uint32_t read_buf[size / sizeof(uint32_t)];
uint32_t expected = 0;
uint32_t *ctx;
int dep_nreq;
+ int fence;
int n;
ctx = malloc(sizeof(*ctx) * MAX_CONTEXTS);
@@ -1206,34 +1206,35 @@ static void deep(int fd, unsigned ring)
gem_sync(fd, result);
}
- plug = igt_cork_plug(&cork, fd);
+ fence = igt_cork_plug(&cork, fd);
/* Create a deep dependency chain, with a few branches */
for (n = 0; n < nreq && igt_seconds_elapsed(&tv) < 2; n++) {
const int gen = intel_gen(intel_get_drm_devid(fd));
- struct drm_i915_gem_exec_object2 obj[3];
+ struct drm_i915_gem_exec_object2 obj[2];
struct drm_i915_gem_relocation_entry reloc;
struct drm_i915_gem_execbuffer2 eb = {
.buffers_ptr = to_user_pointer(obj),
- .buffer_count = 3,
- .flags = ring | (gen < 6 ? I915_EXEC_SECURE : 0),
+ .buffer_count = ARRAY_SIZE(obj),
+ .flags = ring |
+ (gen < 6 ? I915_EXEC_SECURE : 0) |
+ I915_EXEC_FENCE_IN,
.rsvd1 = ctx[n % MAX_CONTEXTS],
+ .rsvd2 = fence,
};
uint32_t batch[16];
int i;
memset(obj, 0, sizeof(obj));
- obj[0].handle = plug;
-
memset(&reloc, 0, sizeof(reloc));
reloc.presumed_offset = 0;
reloc.offset = sizeof(uint32_t);
reloc.delta = sizeof(uint32_t) * n;
reloc.read_domains = I915_GEM_DOMAIN_RENDER;
reloc.write_domain = I915_GEM_DOMAIN_RENDER;
- obj[2].handle = gem_create(fd, 4096);
- obj[2].relocs_ptr = to_user_pointer(&reloc);
- obj[2].relocation_count = 1;
+ obj[1].handle = gem_create(fd, 4096);
+ obj[1].relocs_ptr = to_user_pointer(&reloc);
+ obj[1].relocation_count = 1;
i = 0;
batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
@@ -1250,15 +1251,15 @@ static void deep(int fd, unsigned ring)
}
batch[++i] = eb.rsvd1;
batch[++i] = MI_BATCH_BUFFER_END;
- gem_write(fd, obj[2].handle, 0, batch, sizeof(batch));
+ gem_write(fd, obj[1].handle, 0, batch, sizeof(batch));
gem_context_set_priority(fd, eb.rsvd1, MAX_PRIO - nreq + n);
for (int m = 0; m < XS; m++) {
- obj[1].handle = dep[m];
- reloc.target_handle = obj[1].handle;
+ obj[0].handle = dep[m];
+ reloc.target_handle = obj[0].handle;
gem_execbuf(fd, &eb);
}
- gem_close(fd, obj[2].handle);
+ gem_close(fd, obj[1].handle);
}
igt_info("First deptree: %d requests [%.3fs]\n",
n * XS, 1e-9*igt_nsec_elapsed(&tv));
@@ -1278,7 +1279,7 @@ static void deep(int fd, unsigned ring)
n * XS, 1e-9*igt_nsec_elapsed(&tv));
unplug_show_queue(fd, &cork, ring);
- gem_close(fd, plug);
+ close(fence);
igt_require(expected); /* too slow */
for (n = 0; n < MAX_CONTEXTS; n++)
--
2.23.0
More information about the Intel-gfx
mailing list