From: Guido Günther Date: Wed, 3 Apr 2019 11:08:47 +0000 (+0200) Subject: gallium: ddebug: Add missing fence related wrappers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a5e24dc41655a15a719a91fd0bdaafe37e0ac3e6;p=mesa.git gallium: ddebug: Add missing fence related wrappers 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 Reviewed-by: Lucas Stach --- diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c b/src/gallium/auxiliary/driver_ddebug/dd_context.c index 15efeccf879..53dd8b2517d 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) { @@ -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); 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);