diff options
author | Rob Clark <robclark@freedesktop.org> | 2016-11-18 08:39:32 -0500 |
---|---|---|
committer | Chad Versace <chadversary@chromium.org> | 2016-12-01 10:57:35 -0800 |
commit | 21b1acfcfe4e3dd5c1de225771ba1f284026fe72 (patch) | |
tree | 5b9544be1b906c0a4400764914970090bad69f22 | |
parent | 2ba4c7e1548c6251085cd75563c182cc6708eaab (diff) |
dri: extend fence extension to support native fd fences
Required to implement EGL_ANDROID_native_fence_sync.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Tested-by: Chad Versace <chadversary@chromium.org>
-rw-r--r-- | include/GL/internal/dri_interface.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index d0b1bc6683..c6ea464f18 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -340,12 +340,19 @@ struct __DRI2throttleExtensionRec { */ #define __DRI2_FENCE "DRI2_Fence" -#define __DRI2_FENCE_VERSION 1 +#define __DRI2_FENCE_VERSION 2 #define __DRI2_FENCE_TIMEOUT_INFINITE 0xffffffffffffffffllu #define __DRI2_FENCE_FLAG_FLUSH_COMMANDS (1 << 0) +/** + * \name Capabilities that might be returned by __DRI2fenceExtensionRec::get_capabilities + */ +/*@{*/ +#define __DRI_FENCE_CAP_NATIVE_FD 1 +/*@}*/ + struct __DRI2fenceExtensionRec { __DRIextension base; @@ -390,6 +397,41 @@ struct __DRI2fenceExtensionRec { * sense with this function (right now there are none) */ void (*server_wait_sync)(__DRIcontext *ctx, void *fence, unsigned flags); + + /** + * Query for general capabilities of the driver that concern fences. + * Returns a bitmask of __DRI_FENCE_CAP_x + * + * \since 2 + */ + unsigned (*get_capabilities)(__DRIscreen *screen); + + /** + * Create an fd (file descriptor) associated fence. If the fence fd + * is -1, this behaves similarly to create_fence() except that when + * rendering is flushed the driver creates a fence fd. Otherwise, + * the driver wraps an existing fence fd. + * + * This is used to implement the EGL_ANDROID_native_fence_sync extension. + * + * \since 2 + * + * \param ctx the context associated with the fence + * \param fd the fence fd or -1 + */ + void *(*create_fence_fd)(__DRIcontext *ctx, int fd); + + /** + * For fences created with create_fence_fd(), after rendering is flushed, + * this retrieves the native fence fd. Caller takes ownership of the + * fd and will close() it when it is no longer needed. + * + * \since 2 + * + * \param screen the screen associated with the fence + * \param fence the fence + */ + int (*get_fence_fd)(__DRIscreen *screen, void *fence); }; |