All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v8 07/13] drm/i915: introduce a mechanism to extend execbuf2
Date: Tue,  9 Jul 2019 15:33:45 +0300	[thread overview]
Message-ID: <20190709123351.5645-8-lionel.g.landwerlin@intel.com> (raw)
In-Reply-To: <20190709123351.5645-1-lionel.g.landwerlin@intel.com>

We're planning to use this for a couple of new feature where we need
to provide additional parameters to execbuf.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 32 ++++++++++++++++++-
 include/uapi/drm/i915_drm.h                   | 25 +++++++++++++--
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 1c5dfbfad71b..9887fa9e3ac8 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -23,6 +23,7 @@
 #include "i915_gem_clflush.h"
 #include "i915_gem_context.h"
 #include "i915_trace.h"
+#include "i915_user_extensions.h"
 #include "intel_drv.h"
 
 enum {
@@ -271,6 +272,10 @@ struct i915_execbuffer {
 	 */
 	int lut_size;
 	struct hlist_head *buckets; /** ht for relocation handles */
+
+	struct {
+		u64 flags; /** Available extensions parameters */
+	} extensions;
 };
 
 #define exec_entry(EB, VMA) (&(EB)->exec[(VMA)->exec_flags - (EB)->flags])
@@ -1969,7 +1974,7 @@ static bool i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
 		return false;
 
 	/* Kernel clipping was a DRI1 misfeature */
-	if (!(exec->flags & I915_EXEC_FENCE_ARRAY)) {
+	if (!(exec->flags & (I915_EXEC_FENCE_ARRAY | I915_EXEC_EXT))) {
 		if (exec->num_cliprects || exec->cliprects_ptr)
 			return false;
 	}
@@ -2347,6 +2352,27 @@ signal_fence_array(struct i915_execbuffer *eb,
 	}
 }
 
+static const i915_user_extension_fn execbuf_extensions[] = {
+};
+
+static int
+parse_execbuf2_extensions(struct drm_i915_gem_execbuffer2 *args,
+			  struct i915_execbuffer *eb)
+{
+	eb->extensions.flags = 0;
+
+	if (!(args->flags & I915_EXEC_EXT))
+		return 0;
+
+	if (args->num_cliprects != 0)
+		return -EINVAL;
+
+	return i915_user_extensions(u64_to_user_ptr(args->cliprects_ptr),
+				    execbuf_extensions,
+				    ARRAY_SIZE(execbuf_extensions),
+				    eb);
+}
+
 static int
 i915_gem_do_execbuffer(struct drm_device *dev,
 		       struct drm_file *file,
@@ -2393,6 +2419,10 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 	if (args->flags & I915_EXEC_IS_PINNED)
 		eb.batch_flags |= I915_DISPATCH_PINNED;
 
+	err = parse_execbuf2_extensions(args, &eb);
+	if (err)
+		return err;
+
 	if (args->flags & I915_EXEC_FENCE_IN) {
 		in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
 		if (!in_fence)
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index ea02b168ac3a..7d61f53a1c15 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -1014,6 +1014,10 @@ struct drm_i915_gem_exec_fence {
 	__u32 flags;
 };
 
+enum drm_i915_gem_execbuffer_ext {
+	DRM_I915_GEM_EXECBUFFER_EXT_MAX /* non-ABI */
+};
+
 struct drm_i915_gem_execbuffer2 {
 	/**
 	 * List of gem_exec_object2 structs
@@ -1030,8 +1034,14 @@ struct drm_i915_gem_execbuffer2 {
 	__u32 num_cliprects;
 	/**
 	 * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY
-	 * is not set.  If I915_EXEC_FENCE_ARRAY is set, then this is a
-	 * struct drm_i915_gem_exec_fence *fences.
+	 * & I915_EXEC_EXT are not set.
+	 *
+	 * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array
+	 * of struct drm_i915_gem_exec_fence and num_cliprects is the length
+	 * of the array.
+	 *
+	 * If I915_EXEC_EXT is set, then this is a pointer to a single struct
+	 * drm_i915_gem_base_execbuffer_ext and num_cliprects is 0.
 	 */
 	__u64 cliprects_ptr;
 #define I915_EXEC_RING_MASK              (0x3f)
@@ -1149,7 +1159,16 @@ struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_FENCE_SUBMIT		(1 << 20)
 
-#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1))
+/*
+ * Setting I915_EXEC_EXT implies that drm_i915_gem_execbuffer2.cliprects_ptr
+ * is treated as a pointer to an linked list of i915_user_extension. Each
+ * i915_user_extension node is the base of a larger structure. The list of
+ * supported structures are listed in the drm_i915_gem_execbuffer_ext
+ * enum.
+ */
+#define I915_EXEC_EXT		(1 << 21)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_EXT<<1))
 
 #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
-- 
2.22.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-07-09 12:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 12:33 [PATCH v8 00/13] drm/i915: Vulkan performance query support Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 01/13] drm/i915/perf: ensure we keep a reference on the driver Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 02/13] drm/i915/perf: add missing delay for OA muxes configuration Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 03/13] drm/i915/perf: introduce a versioning of the i915-perf uapi Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 04/13] drm/i915/perf: allow for CS OA configs to be created lazily Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 05/13] drm/i915: enumerate scratch fields Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 06/13] drm/i915/perf: implement active wait for noa configurations Lionel Landwerlin
2019-07-10 23:43   ` Umesh Nerlige Ramappa
     [not found]     ` <156282659660.12280.4199368775706498585@skylake-alporthouse-com>
2019-07-11  7:47       ` Lionel Landwerlin
2019-07-09 12:33 ` Lionel Landwerlin [this message]
2019-07-09 12:33 ` [PATCH v8 08/13] drm/i915: add syncobj timeline support Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 09/13] drm/i915: add a new perf configuration execbuf parameter Lionel Landwerlin
2019-07-09 12:53   ` Lionel Landwerlin
2019-07-09 13:10     ` Chris Wilson
2019-07-09 13:13       ` Chris Wilson
2019-07-10 11:09   ` Chris Wilson
2019-07-09 12:33 ` [PATCH v8 10/13] drm/i915: add infrastructure to hold off preemption on a request Lionel Landwerlin
2019-07-09 14:18   ` Chris Wilson
2019-07-09 12:33 ` [PATCH v8 11/13] drm/i915/perf: allow holding preemption on filtered ctx Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 12/13] drm/i915/perf: execute OA configuration from command stream Lionel Landwerlin
2019-07-09 12:33 ` [PATCH v8 13/13] drm/i915: add support for perf configuration queries Lionel Landwerlin
2019-07-10 11:04   ` Chris Wilson
2019-07-09 13:08 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Vulkan performance query support (rev8) Patchwork
2019-07-09 13:15 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-09 13:27 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-09 20:30 ` [PATCH v8 00/13] drm/i915: Vulkan performance query support Chris Wilson
2019-07-10  9:06   ` Lionel Landwerlin
2019-07-10  1:20 ` ✗ Fi.CI.IGT: failure for drm/i915: Vulkan performance query support (rev8) 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=20190709123351.5645-8-lionel.g.landwerlin@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.