[RFC,v6,3/4] lib: ioctl_wrappers: reach engines by index as well

Submitted by Andi Shyti on Feb. 6, 2019, 9:18 a.m.

Details

Message ID 20190206091850.2078-4-andi.shyti@intel.com
State New
Series "new engine discovery interface"
Headers show

Commit Message

Andi Shyti Feb. 6, 2019, 9:18 a.m.
With the new engine query method engines are reachable through
an index and context they are combined with.

The 'gem_has_ring()' becomes 'gem_has_ring_by_idx()' that
requires the index that the engine is mapped with in the driver.

The previous function becomes a wrapper to the new
'gem_has_ring_by_idx()'.
---
 lib/ioctl_wrappers.c | 10 ++++++----
 lib/ioctl_wrappers.h |  4 +++-
 2 files changed, 9 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 57ed8c51bea5..5c908f4a35a5 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1468,14 +1468,14 @@  void igt_require_gem(int fd)
 	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
 }
 
-bool gem_has_ring(int fd, unsigned ring)
+bool gem_has_ring_by_idx(int fd, unsigned flags, unsigned rsvd1)
 {
 	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))
+	if ((flags & ~(3<<13)) == I915_EXEC_BSD) {
+		if (flags & (3 << 13) && !gem_has_bsd2(fd))
 			return false;
 	}
 
@@ -1483,7 +1483,9 @@  bool gem_has_ring(int fd, unsigned ring)
 	memset(&execbuf, 0, sizeof(execbuf));
 	execbuf.buffers_ptr = to_user_pointer(&exec);
 	execbuf.buffer_count = 1;
-	execbuf.flags = ring;
+	execbuf.flags = flags;
+	execbuf.rsvd1 = rsvd1;
+
 	return __gem_execbuf(fd, &execbuf) == -ENOENT;
 }
 
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index b22b36b0b2dd..19abcdb9ad1d 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -164,11 +164,13 @@  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);
+bool gem_has_ring_by_idx(int fd, unsigned flags, unsigned rsvd1);
 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(fd, ring) gem_has_ring_by_idx(fd, ring, 0)
+
 /* prime */
 struct local_dma_buf_sync {
 	uint64_t flags;

Comments

Chris Wilson Feb. 6, 2019, 9:33 a.m.
Quoting Andi Shyti (2019-02-06 09:18:49)
> With the new engine query method engines are reachable through
> an index and context they are combined with.
> 
> The 'gem_has_ring()' becomes 'gem_has_ring_by_idx()' that
> requires the index that the engine is mapped with in the driver.
> 
> The previous function becomes a wrapper to the new
> 'gem_has_ring_by_idx()'.
> ---
>  lib/ioctl_wrappers.c | 10 ++++++----
>  lib/ioctl_wrappers.h |  4 +++-
>  2 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 57ed8c51bea5..5c908f4a35a5 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1468,14 +1468,14 @@ void igt_require_gem(int fd)
>         igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
>  }
>  
> -bool gem_has_ring(int fd, unsigned ring)
> +bool gem_has_ring_by_idx(int fd, unsigned flags, unsigned rsvd1)

Don't conflate the ABIs? We either use index or the mismash.
by_index *does* not use the flags...
-Chris