+
+void fd_create_fence_fd(struct pipe_context *pctx,
+ 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));
+}
+
+void fd_fence_server_sync(struct pipe_context *pctx,
+ struct pipe_fence_handle *fence)
+{
+ struct fd_context *ctx = fd_context(pctx);
+ struct fd_batch *batch = ctx->batch;
+
+ fence_flush(fence);
+
+ if (sync_accumulate("freedreno", &batch->in_fence_fd, fence->fence_fd)) {
+ /* error */
+ }
+}
+
+int fd_fence_get_fd(struct pipe_screen *pscreen,
+ struct pipe_fence_handle *fence)
+{
+ fence_flush(fence);
+ return dup(fence->fence_fd);
+}
+
+struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch)
+{
+ return fence_create(batch->ctx, batch, 0, -1);
+}