[Mesa-dev] [PATCH] gallium: ddebug: Add missing fence related wrappers

Lucas Stach l.stach at pengutronix.de
Wed Apr 3 10:43:05 UTC 2019


Hi Guido,

Am Montag, den 01.04.2019, 14:19 +0200 schrieb Guido Günther:
> 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 at sigxcpu.org>
> ---
> This is similar in spirit to the patches for GALLIUM_TRACE send out earlier.
> 
> 
>  .../auxiliary/driver_ddebug/dd_context.c      | 40 +++++++++++++++++++
>  .../auxiliary/driver_ddebug/dd_screen.c       | 10 +++++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c b/src/gallium/auxiliary/driver_ddebug/dd_context.c
> index 4ea0b16de6f..3152c664630 100644
> --- a/src/gallium/auxiliary/driver_ddebug/dd_context.c
> +++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c
> @@ -575,6 +575,43 @@ dd_context_set_stream_output_targets(struct pipe_context *_pipe,
>     pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
>  }
>  
> +
> +static void
> +dd_context_flush(struct pipe_context *_pipe,
> +                 struct pipe_fence_handle **fence,
> +                 unsigned flags)
> +{
> +   struct dd_context *dctx = dd_context(_pipe);
> +   struct pipe_context *pipe = dctx->pipe;
> +
> +   pipe->flush(pipe, fence, flags);
> +}

dd_context_flush() is already implemented in dd_draw.c

Regards,
Lucas

> +
> +
> +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)
>  {
> @@ -867,6 +904,9 @@ 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(flush);
> +   CTX_INIT(create_fence_fd);
> +   CTX_INIT(fence_server_sync);
>     CTX_INIT(create_sampler_view);
>     CTX_INIT(sampler_view_destroy);
>     CTX_INIT(create_surface);
> diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
> index a89af8a8d62..b2108adfa32 100644
> --- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c
> +++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
> @@ -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);


More information about the mesa-dev mailing list