Skip to contentSkip to conversation

drm/i915: Extract the in-fence from a dma-buf reservation object

RFC Superseded Chris Wilson 2 participants 3 messages Feb 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 drm/i915: Extract the in-fence from a dma-buf reservation object

The dma-buf holds an array of fences, which unlike the sync_file are not sealed and may be modified at runtime. For the purpose of computing dependencies, we can take a snapshot of the fences within the dma-buf's reservation object (converting them into a fence-array) and uses that as our input fence to this execbuf. It also provides a means for us to pass in an array of fences and ask to only wait on the first being signaled.

In short, it allows dma-buf to be used as a *reusable* container for multiple signaling objects, and for scheduling execbuf between clients.

Cc Tvrtko Ursulin <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Gustavo Padovan <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c            |  1 +
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 57 ++++++++++++++++++++++++++++--
 include/uapi/drm/i915_drm.h                | 26 ++++++++++++--
 3 files changed, 78 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index 43da9cf65233..de8f40b0bd58 100644
@@ -352,6 +352,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_EXEC_SOFTPIN:
 	case I915_PARAM_HAS_EXEC_ASYNC:
 	case I915_PARAM_HAS_EXEC_FENCE:
+	case I915_PARAM_HAS_EXEC_FENCE_DMABUF:
 		/* For the time being all of these are always true;
 		 * if some supported hardware does not have one of these
 		 * features this value needs to be provided from
drivers/gpu/drm/i915/i915_gem_execbuffer.c +54 -3

75 lines not on this page · raw message

include/uapi/drm/i915_drm.h +23 -3
index 3554495bef13..ebc7641b5252 100644
@@ -412,6 +412,12 @@ typedef struct drm_i915_irq_wait {
  */
 #define I915_PARAM_HAS_EXEC_FENCE	 44
 
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports using a dma-buf fd as the
+ * in-fence for explicit fence support. See I915_EXEC_FENCE_IN and
+ * I915_EXEC_FENCE_ANY.
+ */
+#define I915_PARAM_HAS_EXEC_FENCE_DMABUF 45
+
 typedef struct drm_i915_getparam {
 	__s32 param;
 	/*
@@ -865,8 +871,8 @@ struct drm_i915_gem_execbuffer2 {
 #define I915_EXEC_RESOURCE_STREAMER     (1<<15)
 
 /* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent
- * a sync_file fd to wait upon (in a nonblocking manner) prior to executing
- * the batch.
+ * a sync_file or dma-buf fd to wait upon (in a nonblocking manner) prior
+ * to executing the batch.
  *
  * Returns -EINVAL if the sync_file fd cannot be found.
  */
@@ -889,7 +895,21 @@ struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_FENCE_OUT		(1<<17)
 
-#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_OUT<<1))
+/* If the I915_EXEC_FENCE_IN refers to a dma-buf fd, a fence is created from
+ * its reservation object and it may contain just the exclusive fence, or
+ * an array of all shared fences. Setting I915_EXEC_FENCE_EXCL implies that
+ * the execbuf should only wait for the current exclusive fence to be signaled
+ * before execution.
+ */
+#define I915_EXEC_FENCE_EXCL		(1<<18)
+
+/* If the I915_EXEC_FENCE_IN refers to a dma-buf fd, a fence is created from
+ * its reservation object and it may either be signaled on the first fence
+ * within to complet or it may wait for all fences within to be complete.
+ */
+#define I915_EXEC_FENCE_ANY		(1<<19)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ANY<<1))
 
 #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RFC v2 1/1 drm/i915: Extract the in-fence from a dma-buf reservation object

The dma-buf holds an array of fences, which unlike the sync_file are not sealed and may be modified at runtime. For the purpose of computing dependencies, we can take a snapshot of the fences within the dma-buf's reservation object (converting them into a fence-array) and uses that as our input fence to this execbuf. It also provides a means for us to pass in an array of fences and ask to only wait on the first being signaled.

In short, it allows dma-buf to be used as a *reusable* container for multiple signaling objects, and for scheduling execbuf between clients.

Cc Tvrtko Ursulin <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Jason Ekstrand <[email protected]>
Cc Gustavo Padovan <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c            |  1 +
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 62 ++++++++++++++++++++++++++++--
 include/uapi/drm/i915_drm.h                | 26 +++++++++++--
 3 files changed, 83 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index 43da9cf65233..de8f40b0bd58 100644
@@ -352,6 +352,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 	case I915_PARAM_HAS_EXEC_SOFTPIN:
 	case I915_PARAM_HAS_EXEC_ASYNC:
 	case I915_PARAM_HAS_EXEC_FENCE:
+	case I915_PARAM_HAS_EXEC_FENCE_DMABUF:
 		/* For the time being all of these are always true;
 		 * if some supported hardware does not have one of these
 		 * features this value needs to be provided from
drivers/gpu/drm/i915/i915_gem_execbuffer.c +59 -3

80 lines not on this page · raw message

include/uapi/drm/i915_drm.h +23 -3
index 3554495bef13..ebc7641b5252 100644
@@ -412,6 +412,12 @@ typedef struct drm_i915_irq_wait {
  */
 #define I915_PARAM_HAS_EXEC_FENCE	 44
 
+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports using a dma-buf fd as the
+ * in-fence for explicit fence support. See I915_EXEC_FENCE_IN and
+ * I915_EXEC_FENCE_ANY.
+ */
+#define I915_PARAM_HAS_EXEC_FENCE_DMABUF 45
+
 typedef struct drm_i915_getparam {
 	__s32 param;
 	/*
@@ -865,8 +871,8 @@ struct drm_i915_gem_execbuffer2 {
 #define I915_EXEC_RESOURCE_STREAMER     (1<<15)
 
 /* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent
- * a sync_file fd to wait upon (in a nonblocking manner) prior to executing
- * the batch.
+ * a sync_file or dma-buf fd to wait upon (in a nonblocking manner) prior
+ * to executing the batch.
  *
  * Returns -EINVAL if the sync_file fd cannot be found.
  */
@@ -889,7 +895,21 @@ struct drm_i915_gem_execbuffer2 {
  */
 #define I915_EXEC_FENCE_OUT		(1<<17)
 
-#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_OUT<<1))
+/* If the I915_EXEC_FENCE_IN refers to a dma-buf fd, a fence is created from
+ * its reservation object and it may contain just the exclusive fence, or
+ * an array of all shared fences. Setting I915_EXEC_FENCE_EXCL implies that
+ * the execbuf should only wait for the current exclusive fence to be signaled
+ * before execution.
+ */
+#define I915_EXEC_FENCE_EXCL		(1<<18)
+
+/* If the I915_EXEC_FENCE_IN refers to a dma-buf fd, a fence is created from
+ * its reservation object and it may either be signaled on the first fence
+ * within to complet or it may wait for all fences within to be complete.
+ */
+#define I915_EXEC_FENCE_ANY		(1<<19)
+
+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ANY<<1))
 
 #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)
 #define i915_execbuffer2_set_context_id(eb2, context) \
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✓ Fi.CI.BAT: success for drm/i915: Extract the in-fence from a dma-buf reservation object (rev2)

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Extract the in-fence from a dma-buf reservation object (rev2)
URL : https://patchwork.freedesktop.org/series/19874/
State : success

== Summary ==

Series 19874v2 drm/i915: Extract the in-fence from a dma-buf reservation object
https://patchwork.freedesktop.org/api/1.0/series/19874/revisions/2/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-a:
                pass       -> DMESG-WARN (fi-ivb-3520m) fdo#99847

fdo#99847 https://bugs.freedesktop.org/show_bug.cgi?id=99847

fi-bdw-5557u     total:252  pass:241  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:252  pass:213  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:252  pass:233  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:252  pass:225  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:252  pass:221  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:252  pass:202  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:252  pass:233  dwarn:1   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:252  pass:235  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:252  pass:230  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:252  pass:224  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:252  pass:223  dwarn:0   dfail:0   fail:0   skip:29 

d13370a042e9d05329bcac34eb43c64e4f6704e0 drm-tip: 2017y-02m-17d-21h-23m-28s UTC integration manifest 3696557 drm/i915: Extract the in-fence from a dma-buf reservation object

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3891/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx