rbug: implement missing explicit sync related fence functions
authorLucas Stach <l.stach@pengutronix.de>
Mon, 16 Sep 2019 13:07:07 +0000 (15:07 +0200)
committerLucas Stach <dev@lynxeye.de>
Fri, 18 Oct 2019 10:12:07 +0000 (10:12 +0000)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
src/gallium/auxiliary/driver_rbug/rbug_context.c
src/gallium/auxiliary/driver_rbug/rbug_screen.c

index f089765858d4c60e211cfa0effa023f657bc8250..20b6f9755b2f1c5d9b5bc5f60c4e280283cfc1b2 100644 (file)
@@ -1004,6 +1004,31 @@ rbug_flush(struct pipe_context *_pipe,
    mtx_unlock(&rb_pipe->call_mutex);
 }
 
+static void
+rbug_create_fence_fd(struct pipe_context *_pipe,
+                     struct pipe_fence_handle **fence, int fd,
+                     enum pipe_fd_type type)
+{
+   struct rbug_context *rb_pipe = rbug_context(_pipe);
+   struct pipe_context *pipe = rb_pipe->pipe;
+
+   mtx_lock(&rb_pipe->call_mutex);
+   pipe->create_fence_fd(pipe, fence, fd, type);
+   mtx_unlock(&rb_pipe->call_mutex);
+}
+
+static void
+rbug_fence_server_sync(struct pipe_context *_pipe,
+                       struct pipe_fence_handle *fence)
+{
+   struct rbug_context *rb_pipe = rbug_context(_pipe);
+   struct pipe_context *pipe = rb_pipe->pipe;
+
+   mtx_lock(&rb_pipe->call_mutex);
+   pipe->fence_server_sync(pipe, fence);
+   mtx_unlock(&rb_pipe->call_mutex);
+}
+
 static struct pipe_sampler_view *
 rbug_context_create_sampler_view(struct pipe_context *_pipe,
                                  struct pipe_resource *_resource,
@@ -1256,6 +1281,8 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
    rb_pipe->base.clear_render_target = rbug_clear_render_target;
    rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil;
    rb_pipe->base.flush = rbug_flush;
+   rb_pipe->base.create_fence_fd = rbug_create_fence_fd;
+   rb_pipe->base.fence_server_sync = rbug_fence_server_sync;
    rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view;
    rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy;
    rb_pipe->base.create_surface = rbug_context_create_surface;
index a85d4e60e5b7489c5b47284cfc9f7a38024da1a9..62ee8001767bf7b8f37aa746a6468d9af8f050ca 100644 (file)
@@ -314,6 +314,16 @@ rbug_screen_fence_finish(struct pipe_screen *_screen,
    return screen->fence_finish(screen, ctx, fence, timeout);
 }
 
+static int
+rbug_screen_fence_get_fd(struct pipe_screen *_screen,
+                         struct pipe_fence_handle *fence)
+{
+   struct rbug_screen *rb_screen = rbug_screen(_screen);
+   struct pipe_screen *screen = rb_screen->screen;
+
+   return screen->fence_get_fd(screen, fence);
+}
+
 bool
 rbug_enabled()
 {
@@ -362,6 +372,7 @@ rbug_screen_create(struct pipe_screen *screen)
    rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer;
    rb_screen->base.fence_reference = rbug_screen_fence_reference;
    rb_screen->base.fence_finish = rbug_screen_fence_finish;
+   rb_screen->base.fence_get_fd = rbug_screen_fence_get_fd;
 
    rb_screen->screen = screen;