From d9276ca6d0ec053b044e505f17f5469a5d10e38d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 14 Jul 2022 11:23:18 -0400 Subject: [PATCH] zink: rework unordered_exec handling previously this would opportunistically promote barriers to the unordered cmdbuf only if a renderpass was active or there was no access, which was the wrong approach instead, opportunistically promote barriers to the unordered cmdbuf any time it's possible to do so, which is when one of these conditions is true: * when there is no access to the resource on the current cmdbuf * when the only access to the resource is in the unordered cmdbuf Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 27f581b82f9..83105dcfd1e 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3125,14 +3125,14 @@ resource_check_defer_buffer_barrier(struct zink_context *ctx, struct zink_resour static inline VkCommandBuffer get_cmdbuf(struct zink_context *ctx, struct zink_resource *res) { - if ((res->obj->access && !res->obj->unordered_exec) || !ctx->batch.in_rp || (zink_debug & ZINK_DEBUG_NOREORDER) > 0) { - zink_batch_no_rp(ctx); - res->obj->unordered_exec = false; - return ctx->batch.state->cmdbuf; + if (!zink_resource_usage_matches(res, ctx->batch.state) || res->obj->unordered_exec || (zink_debug & ZINK_DEBUG_NOREORDER) == 0) { + res->obj->unordered_exec = true; + ctx->batch.state->has_barriers = true; + return ctx->batch.state->barrier_cmdbuf; } - res->obj->unordered_exec = true; - ctx->batch.state->has_barriers = true; - return ctx->batch.state->barrier_cmdbuf; + zink_batch_no_rp(ctx); + res->obj->unordered_exec = false; + return ctx->batch.state->cmdbuf; } static void