From 16cd5e0244f5725914c61e5b1dd675d4086b38b5 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Thu, 28 Aug 2025 12:40:30 -0400 Subject: [PATCH] zink: Make sparse always wait on pending gfx commands We need to make sure that earlier gfx commands don't see the committed resource. Also, the commit doesn't necessarily happen atomically, because the kernel has to unmap the NULL page and then map the BO page, so earlier gfx submits could race with the kernel an see an unmapped page and fault. This is the same race when uncommitting but in reverse. Part-of: --- src/gallium/drivers/zink/zink_bo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c index e3ba593f9b6..4b9a212c441 100644 --- a/src/gallium/drivers/zink/zink_bo.c +++ b/src/gallium/drivers/zink/zink_bo.c @@ -777,8 +777,8 @@ init_timeline_wait(struct zink_context *ctx, struct zink_resource *res, bool com if (*wait) return timeline; - /* commit || no usage = no wait */ - if (commit || !zink_resource_has_usage(res) || zink_resource_usage_check_completion_fast(screen, res, ZINK_RESOURCE_ACCESS_RW)) + /* no usage = no wait */ + if (!zink_resource_has_usage(res) || zink_resource_usage_check_completion_fast(screen, res, ZINK_RESOURCE_ACCESS_RW)) return timeline; if (zink_resource_usage_is_unflushed(res) && !zink_resource_usage_matches(res, ctx->bs)) {