From 229cd042d3a53e9057b3e8052ae47959deb7c647 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 25 Mar 2019 14:59:44 +0100 Subject: [PATCH] zink: move cmdbuf-resetting into a helper Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_cmdbuf.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/zink_cmdbuf.c b/src/gallium/drivers/zink/zink_cmdbuf.c index 8d868558dfb..df55b2377f5 100644 --- a/src/gallium/drivers/zink/zink_cmdbuf.c +++ b/src/gallium/drivers/zink/zink_cmdbuf.c @@ -6,16 +6,22 @@ #include "util/u_debug.h" +static void +reset_cmdbuf(struct zink_screen *screen, struct zink_cmdbuf *cmdbuf) +{ + // cmdbuf hasn't been submitted before + if (!cmdbuf->fence) + return; + + zink_fence_finish(screen, cmdbuf->fence, PIPE_TIMEOUT_INFINITE); + zink_fence_reference(screen, &cmdbuf->fence, NULL); +} + struct zink_cmdbuf * zink_start_cmdbuf(struct zink_context *ctx) { struct zink_cmdbuf *cmdbuf = &ctx->cmdbuf; - - if (cmdbuf->fence) { - struct zink_screen *screen = zink_screen(ctx->base.screen); - zink_fence_finish(screen, cmdbuf->fence, PIPE_TIMEOUT_INFINITE); - zink_fence_reference(screen, &cmdbuf->fence, NULL); - } + reset_cmdbuf(zink_screen(ctx->base.screen), cmdbuf); VkCommandBufferBeginInfo cbbi = {}; cbbi.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; -- 2.30.2