Mesa (master): winsys/svga/drm: Create winsys interface for Fence FD

Brian Paul brianp at kemper.freedesktop.org
Mon Jul 17 16:08:47 UTC 2017


Module: Mesa
Branch: master
Commit: 4da543e30acbc8fdbb7f67f57f728e8e6f2c9e91
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4da543e30acbc8fdbb7f67f57f728e8e6f2c9e91

Author: Sinclair Yeh <syeh at vmware.com>
Date:   Mon Jul 17 10:03:48 2017 -0600

winsys/svga/drm: Create winsys interface for Fence FD

The new interfaces will be used to enable
EGL_ANDROID_native_fence_sync.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/drivers/svga/svga_winsys.h | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index c785b4f748..e74d1ca4d7 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -86,7 +86,8 @@ struct winsys_handle;
 #define SVGA_QUERY_FLAG_SET        (1 << 0)
 #define SVGA_QUERY_FLAG_REF        (1 << 1)
 
-#define SVGA_HINT_FLAG_CAN_PRE_FLUSH (1 << 0)  /* Can preemptively flush */
+#define SVGA_HINT_FLAG_CAN_PRE_FLUSH   (1 << 0)  /* Can preemptively flush */
+#define SVGA_HINT_FLAG_EXPORT_FENCE_FD (1 << 1)  /* Export a Fence FD */
 
 /**
  * SVGA mks statistics info
@@ -374,6 +375,11 @@ struct svga_winsys_context
    uint32 hints;
 
    /**
+    * File descriptor for imported fence
+    */
+   int32 imported_fence_fd;
+
+   /**
     ** BEGIN new functions for guest-backed surfaces.
     **/
 
@@ -635,6 +641,31 @@ struct svga_winsys_screen
                         uint64_t timeout,
                         unsigned flag );
 
+   /**
+    * Get the file descriptor associated with the fence
+    * \param duplicate duplicate the fd before returning it
+    * \return zero on success.
+    */
+   int (*fence_get_fd)( struct svga_winsys_screen *sws,
+                        struct pipe_fence_handle *fence,
+                        boolean duplicate );
+
+   /**
+    * Create a fence using the given file descriptor
+    * \return zero on success.
+    */
+   void (*fence_create_fd)( struct svga_winsys_screen *sws,
+                            struct pipe_fence_handle **fence,
+                            int32_t fd );
+
+   /**
+    * Accumulates fence FD from other devices into the current context
+    * \param context_fd FD the context will be waiting on
+    * \return zero on success
+    */
+   int (*fence_server_sync)( struct svga_winsys_screen *sws,
+                             int32_t *context_fd,
+                             struct pipe_fence_handle *fence );
 
    /**
     ** BEGIN new functions for guest-backed surfaces.
@@ -726,6 +757,7 @@ struct svga_winsys_screen
    boolean have_generate_mipmap_cmd;
    boolean have_set_predication_cmd;
    boolean have_transfer_from_buffer_cmd;
+   boolean have_fence_fd;
 };
 
 




More information about the mesa-commit mailing list