From fe050bd235a2d4865088507734cfadd72a1a030e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 9 May 2024 09:30:04 -0400 Subject: [PATCH] zink: add a batch ref for committed sparse resources this ensures that the sparse commit will complete before the resource is destroyed cc: mesa-stable Part-of: (cherry picked from commit 67a356742fd3ff0f03abac07161da6e5c2e1daca) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_context.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 6f63148af13..ed915fd9857 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -304,7 +304,7 @@ "description": "zink: add a batch ref for committed sparse resources", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 77b60828366..f9bc2026047 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -4860,8 +4860,11 @@ zink_resource_commit(struct pipe_context *pctx, struct pipe_resource *pres, unsi VkSemaphore sem = VK_NULL_HANDLE; bool ret = zink_bo_commit(ctx, res, level, box, commit, &sem); if (ret) { - if (sem) + if (sem) { zink_batch_add_wait_semaphore(&ctx->batch, sem); + zink_batch_reference_resource_rw(&ctx->batch, res, true); + ctx->batch.has_work = true; + } } else { check_device_lost(ctx); }