When plugging the device, we need to submit batches at highest priority so that they cannot be gazumped by the queued requests. On older kernels that do not support the user changing context priority, all contexts therefore have max priority and we can ignore the error. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- tests/gem_exec_schedule.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c index f701c4ae..0b1925f1 100644 --- a/tests/gem_exec_schedule.c +++ b/tests/gem_exec_schedule.c @@ -152,33 +152,32 @@ static void unplug(struct cork *c) close(c->device); } -static void unplug_show_queue(int fd, struct cork *c, unsigned int engine) +static uint32_t create_highest_priority(int fd) { - igt_spin_t *spin; - uint32_t ctx; + uint32_t ctx = gem_context_create(fd); - ctx = gem_context_create(fd); + /* If no priority support, all contexts have equal and max priority */ __ctx_set_priority(fd, ctx, MAX_PRIO); - spin = igt_spin_batch_new(fd, ctx, engine, 0); - for (int n = 0; n < BUSY_QLEN; n++) { - struct drm_i915_gem_exec_object2 obj = { - .handle = spin->handle, - }; - struct drm_i915_gem_execbuffer2 execbuf = { - .buffers_ptr = to_user_pointer(&obj), - .buffer_count = 1, - .flags = engine, - }; - gem_execbuf(fd, &execbuf); + return ctx; +} + +static void unplug_show_queue(int fd, struct cork *c, unsigned int engine) +{ + igt_spin_t *spin[BUSY_QLEN]; + + for (int n = 0; n < ARRAY_SIZE(spin); n++) { + uint32_t ctx = create_highest_priority(fd); + spin[n] = igt_spin_batch_new(fd, ctx, engine, 0); + gem_context_destroy(fd, ctx); } unplug(c); /* batches will now be queued on the engine */ - igt_debugfs_dump(fd, "i915_engine_info"); - igt_spin_batch_free(fd, spin); - gem_context_destroy(fd, ctx); + for (int n = 0; n < ARRAY_SIZE(spin); n++) + igt_spin_batch_free(fd, spin[n]); + } static void fifo(int fd, unsigned ring) -- 2.14.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx