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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37065>
This commit is contained in:
Connor Abbott
2025-08-28 12:40:30 -04:00
committed by Marge Bot
parent 0bae67b02b
commit 16cd5e0244
+2 -2
View File
@@ -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)) {