*/
svga_surfaces_flush( svga );
+ if (flags & PIPE_FLUSH_FENCE_FD)
+ svga->swc->hints |= SVGA_HINT_FLAG_EXPORT_FENCE_FD;
+
/* Flush command queue.
*/
svga_context_flush(svga, fence);
}
+/**
+ * svga_create_fence_fd
+ *
+ * Wraps a SVGA fence around an imported file descriptor. This
+ * fd represents a fence from another process/device. The fence created
+ * here can then be fed into fence_server_sync() so SVGA can synchronize
+ * with an external process
+ */
+static void
+svga_create_fence_fd(struct pipe_context *pipe,
+ struct pipe_fence_handle **fence,
+ int fd)
+{
+ struct svga_winsys_screen *sws = svga_winsys_screen(pipe->screen);
+
+ sws->fence_create_fd(sws, fence, fd);
+}
+
+
+/**
+ * svga_fence_server_sync
+ *
+ * This function imports a fence from another process/device into the current
+ * software context so that SVGA can synchronize with it.
+ */
+static void
+svga_fence_server_sync(struct pipe_context *pipe,
+ struct pipe_fence_handle *fence)
+{
+ struct svga_winsys_screen *sws = svga_winsys_screen(pipe->screen);
+ struct svga_context *svga = svga_context(pipe);
+
+ sws->fence_server_sync(sws, &svga->swc->imported_fence_fd, fence);
+}
+
+
void svga_init_flush_functions( struct svga_context *svga )
{
svga->pipe.flush = svga_flush;
+ svga->pipe.create_fence_fd = svga_create_fence_fd;
+ svga->pipe.fence_server_sync = svga_fence_server_sync;
}
case PIPE_CAP_GENERATE_MIPMAP:
return sws->have_generate_mipmap_cmd;
+ case PIPE_CAP_NATIVE_FENCE_FD:
+ return sws->have_fence_fd;
+
/* Unsupported features */
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
case PIPE_CAP_PCI_DEVICE:
case PIPE_CAP_PCI_FUNCTION:
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
- case PIPE_CAP_NATIVE_FENCE_FD:
return 0;
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
return 64;
}
+static int
+svga_fence_get_fd(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence)
+{
+ struct svga_winsys_screen *sws = svga_screen(screen)->sws;
+
+ return sws->fence_get_fd(sws, fence, TRUE);
+}
+
+
static int
svga_get_driver_query_info(struct pipe_screen *screen,
unsigned index,
screen->context_create = svga_context_create;
screen->fence_reference = svga_fence_reference;
screen->fence_finish = svga_fence_finish;
+ screen->fence_get_fd = svga_fence_get_fd;
+
screen->get_driver_query_info = svga_get_driver_query_info;
svgascreen->sws = sws;