aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/util/u_tests.c7
-rw-r--r--src/gallium/auxiliary/util/u_threaded_context.c5
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_fence.c4
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_fence.h3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_fence.c4
-rw-r--r--src/gallium/drivers/freedreno/freedreno_fence.h3
-rw-r--r--src/gallium/drivers/radeonsi/si_fence.c5
-rw-r--r--src/gallium/drivers/svga/svga_pipe_flush.c4
-rw-r--r--src/gallium/include/pipe/p_context.h8
-rw-r--r--src/gallium/include/pipe/p_defines.h5
-rw-r--r--src/gallium/state_trackers/dri/dri_helpers.c2
11 files changed, 35 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c
index cb337a255ae..e8599e32031 100644
--- a/src/gallium/auxiliary/util/u_tests.c
+++ b/src/gallium/auxiliary/util/u_tests.c
@@ -502,6 +502,7 @@ test_sync_file_fences(struct pipe_context *ctx)
{
struct pipe_screen *screen = ctx->screen;
bool pass = true;
+ enum pipe_fd_type fd_type = PIPE_FD_TYPE_NATIVE_SYNC;
if (!screen->get_param(screen, PIPE_CAP_NATIVE_FENCE_FD))
return;
@@ -536,9 +537,9 @@ test_sync_file_fences(struct pipe_context *ctx)
/* (Re)import all fences. */
struct pipe_fence_handle *re_buf_fence = NULL, *re_tex_fence = NULL;
struct pipe_fence_handle *merged_fence = NULL;
- ctx->create_fence_fd(ctx, &re_buf_fence, buf_fd);
- ctx->create_fence_fd(ctx, &re_tex_fence, tex_fd);
- ctx->create_fence_fd(ctx, &merged_fence, merged_fd);
+ ctx->create_fence_fd(ctx, &re_buf_fence, buf_fd, fd_type);
+ ctx->create_fence_fd(ctx, &re_tex_fence, tex_fd, fd_type);
+ ctx->create_fence_fd(ctx, &merged_fence, merged_fd, fd_type);
pass = pass && re_buf_fence && re_tex_fence && merged_fence;
/* Run another clear after waiting for everything. */
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index ffa824744e5..3ea1797a9ef 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1835,13 +1835,14 @@ tc_set_log_context(struct pipe_context *_pipe, struct u_log_context *log)
static void
tc_create_fence_fd(struct pipe_context *_pipe,
- struct pipe_fence_handle **fence, int fd)
+ struct pipe_fence_handle **fence, int fd,
+ enum pipe_fd_type type)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
- pipe->create_fence_fd(pipe, fence, fd);
+ pipe->create_fence_fd(pipe, fence, fd, type);
}
static void
diff --git a/src/gallium/drivers/etnaviv/etnaviv_fence.c b/src/gallium/drivers/etnaviv/etnaviv_fence.c
index d82708eacbe..22a964ad282 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_fence.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_fence.c
@@ -76,8 +76,10 @@ etna_screen_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
void
etna_create_fence_fd(struct pipe_context *pctx,
- struct pipe_fence_handle **pfence, int fd)
+ struct pipe_fence_handle **pfence, int fd,
+ enum pipe_fd_type type)
{
+ assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
*pfence = etna_fence_create(pctx, dup(fd));
}
diff --git a/src/gallium/drivers/etnaviv/etnaviv_fence.h b/src/gallium/drivers/etnaviv/etnaviv_fence.h
index cd68a428d3f..8b8bb63e3ef 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_fence.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_fence.h
@@ -32,7 +32,8 @@
void
etna_create_fence_fd(struct pipe_context *pctx,
- struct pipe_fence_handle **pfence, int fd);
+ struct pipe_fence_handle **pfence, int fd,
+ enum pipe_fd_type type);
void
etna_fence_server_sync(struct pipe_context *pctx,
diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c b/src/gallium/drivers/freedreno/freedreno_fence.c
index 928972003c6..1925f726a25 100644
--- a/src/gallium/drivers/freedreno/freedreno_fence.c
+++ b/src/gallium/drivers/freedreno/freedreno_fence.c
@@ -120,8 +120,10 @@ static struct pipe_fence_handle * fence_create(struct fd_context *ctx,
}
void fd_create_fence_fd(struct pipe_context *pctx,
- struct pipe_fence_handle **pfence, int fd)
+ struct pipe_fence_handle **pfence, int fd,
+ enum pipe_fd_type type)
{
+ assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
*pfence = fence_create(fd_context(pctx), NULL, 0, dup(fd));
}
diff --git a/src/gallium/drivers/freedreno/freedreno_fence.h b/src/gallium/drivers/freedreno/freedreno_fence.h
index c1a9fd3f1cc..0842a1d618d 100644
--- a/src/gallium/drivers/freedreno/freedreno_fence.h
+++ b/src/gallium/drivers/freedreno/freedreno_fence.h
@@ -41,7 +41,8 @@ boolean fd_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *pfence,
uint64_t timeout);
void fd_create_fence_fd(struct pipe_context *pctx,
- struct pipe_fence_handle **pfence, int fd);
+ struct pipe_fence_handle **pfence, int fd,
+ enum pipe_fd_type type);
void fd_fence_server_sync(struct pipe_context *pctx,
struct pipe_fence_handle *fence);
int fd_fence_get_fd(struct pipe_screen *pscreen,
diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c
index 47d68dbc337..d3a68e50e1c 100644
--- a/src/gallium/drivers/radeonsi/si_fence.c
+++ b/src/gallium/drivers/radeonsi/si_fence.c
@@ -298,12 +298,15 @@ static boolean si_fence_finish(struct pipe_screen *screen,
}
static void si_create_fence_fd(struct pipe_context *ctx,
- struct pipe_fence_handle **pfence, int fd)
+ struct pipe_fence_handle **pfence, int fd,
+ enum pipe_fd_type type)
{
struct si_screen *sscreen = (struct si_screen*)ctx->screen;
struct radeon_winsys *ws = sscreen->ws;
struct si_multi_fence *rfence;
+ assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
+
*pfence = NULL;
if (!sscreen->info.has_fence_to_handle)
diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c
index 85ec34f3145..1f4eebc124a 100644
--- a/src/gallium/drivers/svga/svga_pipe_flush.c
+++ b/src/gallium/drivers/svga/svga_pipe_flush.c
@@ -85,10 +85,12 @@ static void svga_flush( struct pipe_context *pipe,
static void
svga_create_fence_fd(struct pipe_context *pipe,
struct pipe_fence_handle **fence,
- int fd)
+ int fd,
+ enum pipe_fd_type type)
{
struct svga_winsys_screen *sws = svga_winsys_screen(pipe->screen);
+ assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
sws->fence_create_fd(sws, fence, fd);
}
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index b74e6492196..1c7f52cfc59 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -505,17 +505,19 @@ struct pipe_context {
unsigned flags);
/**
- * Create a fence from a native sync fd.
+ * Create a fence from a 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
+ * \param fd fd representing the fence object
+ * \param type indicates which fence types backs fd
*/
void (*create_fence_fd)(struct pipe_context *pipe,
struct pipe_fence_handle **fence,
- int fd);
+ int fd,
+ enum pipe_fd_type type);
/**
* Insert commands to have GPU wait for fence to be signaled.
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index b34e7a8570a..60546f55d98 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -1084,6 +1084,11 @@ struct pipe_driver_query_group_info
unsigned num_queries;
};
+enum pipe_fd_type
+{
+ PIPE_FD_TYPE_NATIVE_SYNC,
+};
+
enum pipe_debug_type
{
PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1,
diff --git a/src/gallium/state_trackers/dri/dri_helpers.c b/src/gallium/state_trackers/dri/dri_helpers.c
index 37ab2c2f404..f1501bfb815 100644
--- a/src/gallium/state_trackers/dri/dri_helpers.c
+++ b/src/gallium/state_trackers/dri/dri_helpers.c
@@ -119,7 +119,7 @@ dri2_create_fence_fd(__DRIcontext *_ctx, int fd)
stapi->flush(stapi, ST_FLUSH_FENCE_FD, &fence->pipe_fence);
} else {
/* importing a foreign fence fd: */
- ctx->create_fence_fd(ctx, &fence->pipe_fence, fd);
+ ctx->create_fence_fd(ctx, &fence->pipe_fence, fd, PIPE_FD_TYPE_NATIVE_SYNC);
}
if (!fence->pipe_fence) {
FREE(fence);