From fafa71b6ad41c5e98c8bfe9215686566fcae6f6c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 24 Oct 2024 09:00:35 -0400 Subject: [PATCH] zink: use internal map flag for qbos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DONTBLOCK is sort of almost good enough except that the api frontend can also use this and it can't use the full power of Trust Me Buddy™ that qbo maps require this causes unnecessary ioctl syncs, which annihilates perf in games that constantly check query results Part-of: --- src/gallium/drivers/zink/zink_query.c | 2 +- src/gallium/drivers/zink/zink_resource.c | 2 ++ src/gallium/drivers/zink/zink_resource.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index 25ede954780..767b75e93c4 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -662,7 +662,7 @@ get_query_result(struct pipe_context *pctx, unsigned flags = PIPE_MAP_READ; if (!wait) - flags |= PIPE_MAP_DONTBLOCK; + flags |= ZINK_MAP_QBO; if (query->base.flushed) /* this is not a context-safe operation; ensure map doesn't use slab alloc */ flags |= PIPE_MAP_THREAD_SAFE; diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index d09a641b6ca..0e38ebfce43 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -2362,6 +2362,8 @@ zink_buffer_map(struct pipe_context *pctx, /* At this point, the buffer is always idle (we checked it above). */ usage |= PIPE_MAP_UNSYNCHRONIZED; } + } else if (usage & ZINK_MAP_QBO) { + usage |= PIPE_MAP_UNSYNCHRONIZED; } else if (usage & PIPE_MAP_DONTBLOCK) { /* sparse/device-local will always need to wait since it has to copy */ if (!res->obj->host_visible) diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h index 096effebf1f..fda6b5ae553 100644 --- a/src/gallium/drivers/zink/zink_resource.h +++ b/src/gallium/drivers/zink/zink_resource.h @@ -27,6 +27,7 @@ #include "zink_types.h" #define ZINK_MAP_TEMPORARY (PIPE_MAP_DRV_PRV << 0) +#define ZINK_MAP_QBO (PIPE_MAP_DRV_PRV << 1) #define ZINK_BIND_DESCRIPTOR (1u << 27) #define ZINK_BIND_MUTABLE (1u << 28) #define ZINK_BIND_DMABUF (1u << 29)