From f2c04c93786526c9a550e2e6adf8dfee0d41daf9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 6 Aug 2021 02:36:09 -0400 Subject: [PATCH] gallium/noop: implement fences Acked-By: Mike Blumenkrantz Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/auxiliary/driver_noop/noop_pipe.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c index a98567b..29a52d3 100644 --- a/src/gallium/auxiliary/driver_noop/noop_pipe.c +++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c @@ -310,8 +310,13 @@ static void noop_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, unsigned flags) { - if (fence) - *fence = NULL; + if (fence) { + struct pipe_reference *f = MALLOC_STRUCT(pipe_reference); + f->count = 1; + + ctx->screen->fence_reference(ctx->screen, fence, NULL); + *fence = (struct pipe_fence_handle*)f; + } } static void noop_destroy_context(struct pipe_context *ctx) @@ -488,6 +493,11 @@ static void noop_fence_reference(struct pipe_screen *screen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { + if (pipe_reference((struct pipe_reference*)*ptr, + (struct pipe_reference*)fence)) + FREE(*ptr); + + *ptr = fence; } static bool noop_fence_finish(struct pipe_screen *screen, -- 2.7.4