From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andi Shyti <andi.shyti@intel.com>,
IGT dev <igt-dev@lists.freedesktop.org>
Cc: Andi Shyti <andi@etezian.org>
Subject: Re: [igt-dev] [PATCH v15 2/5] lib: ioctl_wrappers: reach engines by index as well
Date: Thu, 21 Mar 2019 16:45:57 +0000 [thread overview]
Message-ID: <0246acff-1e57-feb7-ac58-6805264c3542@linux.intel.com> (raw)
In-Reply-To: <20190321160528.4131-3-andi.shyti@intel.com>
On 21/03/2019 16:05, Andi Shyti wrote:
> With the new engine query method engines are reachable through
> an index and context they are combined with.
>
> The 'gem_has_ring()' becomes 'gem_context_has_engine()' that
> requires the index that the engine is mapped within the driver.
> The function has been moved from lib/ioctl_wappers to
> lib/i915/gem_context where it is more appropriate.
>
> The previous 'gem_has_ring()' function becomes a wrapper to the
> new 'gem_context_has_engine()'.
>
> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/i915/gem_context.c | 21 +++++++++++++++++++++
> lib/i915/gem_context.h | 2 ++
> lib/ioctl_wrappers.c | 19 -------------------
> lib/ioctl_wrappers.h | 3 ++-
> 4 files changed, 25 insertions(+), 20 deletions(-)
>
> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
> index 16004685e920..94ccb74b6aea 100644
> --- a/lib/i915/gem_context.c
> +++ b/lib/i915/gem_context.c
> @@ -275,3 +275,24 @@ void gem_context_set_priority(int fd, uint32_t ctx_id, int prio)
> {
> igt_assert(__gem_context_set_priority(fd, ctx_id, prio) == 0);
> }
> +
> +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 */
Can you add the comment here as I suggested in the previous round?
Something like:
"
Engine can be either execbuf flags engine selector, or context map
index, but in the following case we can still safely check against
I915_EXEC_BSD since we don't expect 1 << 13 or more engines in the map.
"
Regards,
Tvrtko
> + 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);
> +
> #endif /* GEM_CONTEXT_H */
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index a66eb4bc0f4f..3f8f0874bc4b 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1253,25 +1253,6 @@ void igt_require_gem(int fd)
> igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
> }
>
> -bool gem_has_ring(int fd, unsigned ring)
> -{
> - 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 ((ring & ~(3<<13)) == I915_EXEC_BSD) {
> - if (ring & (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 = ring;
> - return __gem_execbuf(fd, &execbuf) == -ENOENT;
> -}
> -
> /**
> * gem_require_ring:
> * @fd: open i915 drm file descriptor
> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
> index ad93daffcfd5..e712f1973142 100644
> --- a/lib/ioctl_wrappers.h
> +++ b/lib/ioctl_wrappers.h
> @@ -142,11 +142,12 @@ bool gem_has_exec_fence(int fd);
>
> /* check functions which auto-skip tests by calling igt_skip() */
> void gem_require_caching(int fd);
> -bool gem_has_ring(int fd, unsigned ring);
> void gem_require_ring(int fd, unsigned ring);
> bool gem_has_mocs_registers(int fd);
> void gem_require_mocs_registers(int fd);
>
> +#define gem_has_ring(f, r) gem_context_has_engine(f, 0, r)
> +
> /* prime */
> struct local_dma_buf_sync {
> uint64_t flags;
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-21 16:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-21 16:05 [igt-dev] [PATCH v15 0/5] new engine discovery interface Andi Shyti
2019-03-21 16:05 ` [igt-dev] [PATCH v15 1/5] lib/igt_gt: remove unnecessary argument Andi Shyti
2019-03-21 16:05 ` [igt-dev] [PATCH v15 2/5] lib: ioctl_wrappers: reach engines by index as well Andi Shyti
2019-03-21 16:08 ` Chris Wilson
2019-03-21 16:14 ` Andi Shyti
2019-03-21 16:16 ` Chris Wilson
2019-03-21 16:45 ` Tvrtko Ursulin [this message]
2019-03-21 16:05 ` [igt-dev] [PATCH v15 3/5] include/drm-uapi: import i915_drm.h header file Andi Shyti
2019-03-21 16:05 ` [igt-dev] [PATCH v15 4/5] lib/i915: add gem_engine_topology library and for_each loop definition Andi Shyti
2019-03-22 7:47 ` Tvrtko Ursulin
2019-03-22 7:59 ` Chris Wilson
2019-03-22 9:56 ` Tvrtko Ursulin
2019-03-22 9:59 ` Chris Wilson
2019-03-22 10:03 ` Andi Shyti
2019-03-22 9:51 ` Andi Shyti
2019-03-22 10:10 ` Tvrtko Ursulin
2019-03-22 9:58 ` Tvrtko Ursulin
2019-03-22 10:06 ` Andi Shyti
2019-03-22 10:46 ` Tvrtko Ursulin
2019-03-21 16:05 ` [igt-dev] [PATCH v15 5/5] tests: gem_exec_basic: add "exec-ctx" buffer execution demo test Andi Shyti
2019-03-21 17:08 ` [igt-dev] ✓ Fi.CI.BAT: success for new engine discovery interface Patchwork
2019-03-22 9:02 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0246acff-1e57-feb7-ac58-6805264c3542@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=andi.shyti@intel.com \
--cc=andi@etezian.org \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox