mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-25 02:40:46 +02:00
drivers/svga: Connect driver-side fence_* functions
Connect fence_get_fd, fence_create_fd, and fence_server_sync. Return PIPE_CAP_NATIVE_FENCE_FD capability based on what the winsys reports Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
parent
4da543e30a
commit
56a6e890f3
2 changed files with 56 additions and 1 deletions
|
|
@ -42,6 +42,9 @@ static void svga_flush( struct pipe_context *pipe,
|
|||
*/
|
||||
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);
|
||||
|
|
@ -71,7 +74,45 @@ static void svga_flush( struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,6 +337,9 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|||
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:
|
||||
|
|
@ -380,7 +383,6 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|||
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;
|
||||
|
|
@ -863,6 +865,16 @@ svga_fence_finish(struct pipe_screen *screen,
|
|||
}
|
||||
|
||||
|
||||
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,
|
||||
|
|
@ -1024,6 +1036,8 @@ svga_screen_create(struct svga_winsys_screen *sws)
|
|||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue