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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29123>
(cherry picked from commit 67a356742f)
This commit is contained in:
Mike Blumenkrantz 2024-05-09 09:30:04 -04:00 committed by Eric Engestrom
parent 57a534364f
commit fe050bd235
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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);
}