summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-04-01 16:10:42 -0400
committerRob Clark <[email protected]>2016-12-01 20:16:31 -0500
commit026a7223a6c9dcd7c59b95dbaf5e64b7258f8700 (patch)
tree46aad710a20e5eb98c3ec7f21994f47f7ad3367e /src/gallium/include/pipe
parent72cc1ca58d12495cc5a72fb9b9c316db94eb66cd (diff)
gallium: support for native fence fd's
This enables gallium support for EGL_ANDROID_native_fence_sync, for drivers which support PIPE_CAP_NATIVE_FENCE_FD. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/include/pipe')
-rw-r--r--src/gallium/include/pipe/p_context.h13
-rw-r--r--src/gallium/include/pipe/p_defines.h2
-rw-r--r--src/gallium/include/pipe/p_screen.h10
3 files changed, 25 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index ee8a5113caa..171dc570ba0 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -475,6 +475,19 @@ struct pipe_context {
unsigned flags);
/**
+ * Create a fence from a native sync fd.
+ *
+ * This is used for importing a foreign/external fence fd.
+ *
+ * \param fence if not NULL, an old fence to unref and transfer a
+ * new fence reference to
+ * \param fd native fence fd
+ */
+ void (*create_fence_fd)(struct pipe_context *pipe,
+ struct pipe_fence_handle **fence,
+ int fd);
+
+ /**
* Insert commands to have GPU wait for fence to be signaled.
*/
void (*fence_server_sync)(struct pipe_context *pipe,
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 46e9039a9ec..f1dd7935a78 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -350,6 +350,7 @@ enum pipe_flush_flags
{
PIPE_FLUSH_END_OF_FRAME = (1 << 0),
PIPE_FLUSH_DEFERRED = (1 << 1),
+ PIPE_FLUSH_FENCE_FD = (1 << 2),
};
/**
@@ -741,6 +742,7 @@ enum pipe_cap
PIPE_CAP_TGSI_ARRAY_COMPONENTS,
PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
PIPE_CAP_TGSI_CAN_READ_OUTPUTS,
+ PIPE_CAP_NATIVE_FENCE_FD,
};
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 255647ed273..f04c2ed83ab 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -265,6 +265,16 @@ struct pipe_screen {
uint64_t timeout);
/**
+ * For fences created with PIPE_FLUSH_FENCE_FD (exported fd) or
+ * by create_fence_fd() (imported fd), return the native fence fd
+ * associated with the fence. This may return -1 for fences
+ * created with PIPE_FLUSH_DEFERRED if the fence command has not
+ * been flushed yet.
+ */
+ int (*fence_get_fd)(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence);
+
+ /**
* Returns a driver-specific query.
*
* If \p info is NULL, the number of available queries is returned.