DRI3 version 1.2 adds support for creating DMA fences and
retrieving the file descriptor backing one.

Signed-off-by: Daniel Stone <dani...@collabora.com>
Signed-off-by: Louis-Francis Ratté-Boulianne <l...@collabora.com>
---
 dri3proto.h   | 45 ++++++++++++++++++++++++++++++++++++--
 dri3proto.txt | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 110 insertions(+), 5 deletions(-)

diff --git a/dri3proto.h b/dri3proto.h
index 5f86f19..fcef6d3 100644
--- a/dri3proto.h
+++ b/dri3proto.h
@@ -25,7 +25,7 @@
 
 #define DRI3_NAME                      "DRI3"
 #define DRI3_MAJOR                     1
-#define DRI3_MINOR                     1
+#define DRI3_MINOR                     2
 
 #define DRI3NumberErrors               0
 #define DRI3NumberEvents               0
@@ -42,7 +42,11 @@
 #define xDRI3PixmapFromBuffers         7
 #define xDRI3BuffersFromPixmap         8
 
-#define DRI3NumberRequests             9
+/* v1.2 */
+#define xDRI3FenceFromDMAFenceFD        9
+#define xDRI3DMAFenceFDFromFrence       10
+
+#define DRI3NumberRequests             11
 
 typedef struct {
     CARD8   reqType;
@@ -246,4 +250,41 @@ typedef struct {
 } xDRI3BuffersFromPixmapReply;
 #define sz_xDRI3BuffersFromPixmapReply   32
 
+/* v1.2 */
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  fence B32;
+} xDRI3FenceFromDMAFenceFDReq;
+
+#define sz_xDRI3FenceFromDMAFenceFDReq  12
+
+typedef struct {
+    CARD8   reqType;
+    CARD8   dri3ReqType;
+    CARD16  length B16;
+    CARD32  drawable B32;
+    CARD32  fence B32;
+} xDRI3DMAFenceFDFromFenceReq;
+
+#define sz_xDRI3DMAFenceFDFromFenceReq  12
+
+typedef struct {
+    BYTE    type;   /* X_Reply */
+    CARD8   nfd;    /* Number of file descriptors returned (1) */
+    CARD16  sequenceNumber B16;
+    CARD32  length B32;
+    CARD32  pad08 B32;
+    CARD32  pad12 B32;
+    CARD32  pad16 B32;
+    CARD32  pad20 B32;
+    CARD32  pad24 B32;
+    CARD32  pad28 B32;
+} xDRI3DMAFenceFDFromFenceReply;
+
+#define sz_xDRI3DMAFenceFDFromFenceReply   32
+
 #endif
diff --git a/dri3proto.txt b/dri3proto.txt
index 636c789..a9e9b14 100644
--- a/dri3proto.txt
+++ b/dri3proto.txt
@@ -1,6 +1,6 @@
                          The DRI3 Extension
-                            Version 1.1
-                             2017-06-27
+                            Version 1.2
+                             2017-09-22
       
                            Keith Packard
                          kei...@keithp.com
@@ -320,7 +320,40 @@ The name of this extension is "DRI3"
 
        If buffers cannot be exported from the the screen associated
        with 'pixmap', a Match error is returned.
- 
+
+┌───
+    DRI3FenceFromDMAFenceFD
+       drawable: DRAWABLE
+       fence: FENCE
+       fd: FD
+└───
+       Errors: IDChoice, Drawable
+
+       Creates a Sync extension Fence that provides the regular Sync
+       extension semantics. The Fence will begin untriggered, and
+       become triggered when the underlying dma-fence FD signals.
+       The resulting Sync Fence is a one-shot, and may not be
+       manually triggered, reset, or reused until it is destroyed.
+       Details about the mechanism used with this file descriptor are
+       outside the scope of the DRI3 extension.
+
+┌───
+    DRI3DMAFenceFDFromFence
+       drawable: DRAWABLE
+       fence: FENCE
+      ▶
+       fd: FD
+└───
+       Errors: IDChoice, Drawable, Match
+
+       Given a Sync extension Fence originally created by the
+       DRI3FenceFromDMAFenceFD request, return the underlying
+       dma-fence FD to the client. Details about the mechanism used
+       with this file descriptor are outside the scope of the DRI3
+       extension. 'drawable' must be associated with a direct
+       rendering device that 'fence' can work with, otherwise a Match
+       error results.
+
 
                             ❄ ❄ ❄  ❄  ❄ ❄ ❄ 
 
@@ -339,6 +372,8 @@ The DRI3 extension is adapted from the DRI2 extension.
        1.1: Add GetSupportedModifiers,
             PixmapFromBuffers, and BuffersFromPixmap requests.
 
+       1.2: Add FenceFromDMAFenceFD and DMAFenceFDFromFence requests.
+
                             ❄ ❄ ❄  ❄  ❄ ❄ ❄
 
 
@@ -565,6 +600,35 @@ A.2 Protocol Requests
        4       ListOfCARD32            offsets[num_buffers]
 └───
 
+┌───
+    DRI3FenceFromDMAFenceFD
+       1       CARD8                   major opcode
+       1       10                      DRI3 opcode
+       2       4                       length
+       4       Drawable                drawable
+       4       Fence                   fence
+       4                               unused
+
+       0       FD                      fence fd
+└───
+
+┌───
+    DRI3DMAFenceFDFromFence
+       1       CARD8                   major opcode
+       1       11                      DRI3 opcode
+       2       3                       length
+       4       Drawable                drawable
+       4       Fence                   fence
+      ▶
+       1       1                       Reply
+        1      1                       nfd
+       2       CARD16                  sequence number
+       4       0                       reply length
+       24                              unused
+
+       0       FD                      fence fd
+└───
+
 A.3 Protocol Events
 
 The DRI3 extension defines no events.
-- 
2.13.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to