[Intel-gfx] [PATCH igt] igt/gem_exec_schedule: Ignore set-priority failures on old kernels
Michał Winiarski
michal.winiarski at intel.com
Tue Sep 26 14:11:15 UTC 2017
On Mon, Sep 25, 2017 at 09:21:15PM +0100, Chris Wilson wrote:
> 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.
All context have equal priority, we can ignore the error, it's not MAX.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> tests/gem_exec_schedule.c | 39 +++++++++++++++++++--------------------
> 1 file changed, 19 insertions(+), 20 deletions(-)
>
> diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c
> index e9b928f1..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 uint32_t create_highest_priority(int fd)
> +{
> + uint32_t ctx = gem_context_create(fd);
> +
> + /* If no priority support, all contexts have equal and max priority */
Same here. It's DEFAULT (0), not MAX. We still do PI for display AFAICS.
That's just to handle fifo test even if we don't have userspace control, right?
Reviewed-by: Michał Winiarski <michal.winiarski at intel.com>
-Michał
> + __ctx_set_priority(fd, ctx, MAX_PRIO);
> +
> + return ctx;
> +}
> +
> static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)
> {
> - igt_spin_t *spin;
> - uint32_t ctx;
> -
> - ctx = gem_context_create(fd);
> - 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);
> + 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list