[Mesa-dev] [PATCH v2] gallium: ddebug: Add missing fence related wrappers
Marek Olšák
maraeo at gmail.com
Wed Apr 3 13:44:13 UTC 2019
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, Apr 3, 2019 at 7:08 AM Guido Günther <agx at sigxcpu.org> wrote:
> 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>
>
> ---
> Changes from v1:
> - Drop duplicate dd_context_flush() as noticed by Lucas Stach
> ---
> .../auxiliary/driver_ddebug/dd_context.c | 27 +++++++++++++++++++
> .../auxiliary/driver_ddebug/dd_screen.c | 10 +++++++
> 2 files changed, 37 insertions(+)
>
> diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c
> b/src/gallium/auxiliary/driver_ddebug/dd_context.c
> index 4ea0b16de6f..ab3043a8b87 100644
> --- a/src/gallium/auxiliary/driver_ddebug/dd_context.c
> +++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c
> @@ -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)
> {
> @@ -867,6 +892,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);
> 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);
> --
> 2.20.1
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190403/344adc95/attachment.html>
More information about the mesa-dev
mailing list