From d1a1c21e7621b5177febf191fcd3d3b8ef69dc96 Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Mon, 29 Aug 2016 23:13:45 +0000 Subject: virgl: native fence fd support Following the support for fences on the virtio driver add support for native fence on virgl. This was somewhat based on the freedeno one. Signed-off-by: Gustavo Padovan Signed-off-by: Robert Foss Reviewed-by: Emil Velikov --- src/gallium/drivers/virgl/virgl_screen.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/virgl/virgl_screen.c') diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index e71883b06f1..8addbea9e4c 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -340,7 +340,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VIDEO_MEMORY: return 0; case PIPE_CAP_NATIVE_FENCE_FD: - return 0; + return !!vscreen->vws->supports_fences; default: return u_pipe_screen_get_param_defaults(screen, param); } @@ -721,6 +721,15 @@ static boolean virgl_fence_finish(struct pipe_screen *screen, return vws->fence_wait(vws, fence, timeout); } +static int virgl_fence_get_fd(struct pipe_screen *screen, + struct pipe_fence_handle *fence) +{ + struct virgl_screen *vscreen = virgl_screen(screen); + struct virgl_winsys *vws = vscreen->vws; + + return vws->fence_get_fd(vws, fence); +} + static uint64_t virgl_get_timestamp(struct pipe_screen *_screen) { @@ -765,6 +774,7 @@ virgl_create_screen(struct virgl_winsys *vws) screen->base.fence_reference = virgl_fence_reference; //screen->base.fence_signalled = virgl_fence_signalled; screen->base.fence_finish = virgl_fence_finish; + screen->base.fence_get_fd = virgl_fence_get_fd; virgl_init_screen_resource_functions(&screen->base); -- cgit v1.2.3