gallium: ddebug: Add missing fence related wrappers
authorGuido Günther <agx@sigxcpu.org>
Wed, 3 Apr 2019 11:08:47 +0000 (13:08 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Thu, 4 Apr 2019 15:30:15 +0000 (17:30 +0200)
Without that `GALLIUM_DDEBUG=always kmscube -A` would segfault like

  #0  0x0000000000000000 in  ()
  #1  0x0000ffffa72a3c54 in dri2_get_fence_fd (_screen=0xaaaaed4f2090, _fence=0xaaaaed9ef880) at ../src/gallium/state_trackers/dri/dri_helpers.c:140
  #2  0x0000ffffa8744824 in dri2_dup_native_fence_fd (drv=0xaaaaed5010c0, disp=0xaaaaed5029a0, sync=0xaaaaed9ef7c0) at ../src/egl/drivers/dri2/egl_dri2.c:3050
  #3  0x0000ffffa87339b8 in eglDupNativeFenceFDANDROID (dpy=0xaaaaed5029a0, sync=0xaaaaed9ef7c0) at ../src/egl/main/eglapi.c:2107
  #4  0x0000aaaabd29ca90 in  ()
  #5  0x0000aaaabd401000 in  ()

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
src/gallium/auxiliary/driver_ddebug/dd_context.c
src/gallium/auxiliary/driver_ddebug/dd_screen.c

index 15efeccf87970cbf71d9b900e58f3d3c929eba30..53dd8b2517d8267b675783c72f3745cf1b74f131 100644 (file)
@@ -575,6 +575,31 @@ dd_context_set_stream_output_targets(struct pipe_context *_pipe,
    pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
 }
 
+
+static void
+dd_context_fence_server_sync(struct pipe_context *_pipe,
+                             struct pipe_fence_handle *fence)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->fence_server_sync(pipe, fence);
+}
+
+
+static void
+dd_context_create_fence_fd(struct pipe_context *_pipe,
+                           struct pipe_fence_handle **fence,
+                           int fd,
+                           enum pipe_fd_type type)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->create_fence_fd(pipe, fence, fd, type);
+}
+
+
 void
 dd_thread_join(struct dd_context *dctx)
 {
@@ -848,6 +873,8 @@ dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe)
    CTX_INIT(create_stream_output_target);
    CTX_INIT(stream_output_target_destroy);
    CTX_INIT(set_stream_output_targets);
+   CTX_INIT(create_fence_fd);
+   CTX_INIT(fence_server_sync);
    CTX_INIT(create_sampler_view);
    CTX_INIT(sampler_view_destroy);
    CTX_INIT(create_surface);
index a89af8a8d62663c652ed76c9e9e8ff3fba644aff..b2108adfa3257a85f55781455a011f3300a67d34 100644 (file)
@@ -348,6 +348,15 @@ dd_screen_fence_finish(struct pipe_screen *_screen,
    return screen->fence_finish(screen, ctx, fence, timeout);
 }
 
+static int
+dd_screen_fence_get_fd(struct pipe_screen *_screen,
+                       struct pipe_fence_handle *fence)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+   return screen->fence_get_fd(screen, fence);
+}
+
 /********************************************************************
  * memobj
  */
@@ -550,6 +559,7 @@ ddebug_screen_create(struct pipe_screen *screen)
    SCR_INIT(flush_frontbuffer);
    SCR_INIT(fence_reference);
    SCR_INIT(fence_finish);
+   SCR_INIT(fence_get_fd);
    SCR_INIT(memobj_create_from_handle);
    SCR_INIT(memobj_destroy);
    SCR_INIT(get_driver_query_info);