[igt-dev] [PATCH v15 2/5] lib: ioctl_wrappers: reach engines by index as well
Chris Wilson
chris at chris-wilson.co.uk
Thu Mar 21 16:08:49 UTC 2019
Quoting Andi Shyti (2019-03-21 16:05:25)
> +bool gem_context_has_engine(int fd, uint32_t ctx, uint32_t engine)
> +{
> + struct drm_i915_gem_execbuffer2 execbuf;
> + struct drm_i915_gem_exec_object2 exec;
> +
> + /* silly ABI, the kernel thinks everyone who has BSD also has BSD2 */
> + if ((engine & ~(3<<13)) == I915_EXEC_BSD) {
> + if (engine & (3 << 13) && !gem_has_bsd2(fd))
> + return false;
> + }
> +
> + memset(&exec, 0, sizeof(exec));
> + memset(&execbuf, 0, sizeof(execbuf));
> + execbuf.buffers_ptr = to_user_pointer(&exec);
> + execbuf.buffer_count = 1;
> + execbuf.flags = engine;
> + execbuf.rsvd1 = ctx;
> +
> + return __gem_execbuf(fd, &execbuf) == -ENOENT;
> +}
> diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
> index aef68dda6b26..dd64ebf17fbd 100644
> --- a/lib/i915/gem_context.h
> +++ b/lib/i915/gem_context.h
> @@ -45,4 +45,6 @@ int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p);
> int __gem_context_set_priority(int fd, uint32_t ctx, int prio);
> void gem_context_set_priority(int fd, uint32_t ctx, int prio);
>
> +bool gem_context_has_engine(int fd, unsigned engine, unsigned ctx);
Hmm. Do we have ILP64 or LP64? I think we're LP64. Let's see what CI
thinks.
-Chris
More information about the igt-dev
mailing list