From 6bf190f73f628512447708f78233a0d20099f3bd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Sat, 23 Aug 2025 07:32:32 -0400 Subject: [PATCH] zink: pass ctx to sparse bind functions no functional changes cc: mesa-stable Part-of: (cherry picked from commit 2cf626d17d6d8d14067986681d44a4bddf08e7b3) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_bo.c | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d2543e13c91..84e6ef654d1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4684,7 +4684,7 @@ "description": "zink: pass ctx to sparse bind functions", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c index fee3aa2a660..98df0bf5ff1 100644 --- a/src/gallium/drivers/zink/zink_bo.c +++ b/src/gallium/drivers/zink/zink_bo.c @@ -762,8 +762,9 @@ track_freed_sparse_bo(struct zink_context *ctx, struct zink_sparse_backing *back } static VkSemaphore -buffer_commit_single(struct zink_screen *screen, struct zink_resource *res, struct zink_bo *bo, uint32_t bo_offset, uint32_t offset, uint32_t size, bool commit, VkSemaphore wait) +buffer_commit_single(struct zink_context *ctx, struct zink_resource *res, struct zink_bo *bo, uint32_t bo_offset, uint32_t offset, uint32_t size, bool commit, VkSemaphore wait) { + struct zink_screen *screen = zink_screen(ctx->base.screen); VkSemaphore sem = zink_create_semaphore(screen); VkBindSparseInfo sparse = {0}; sparse.sType = VK_STRUCTURE_TYPE_BIND_SPARSE_INFO; @@ -838,7 +839,7 @@ buffer_bo_commit(struct zink_context *ctx, struct zink_resource *res, uint32_t o ok = false; goto out; } - cur_sem = buffer_commit_single(screen, res, backing->bo, backing_start, + cur_sem = buffer_commit_single(ctx, res, backing->bo, backing_start, (uint64_t)span_va_page * ZINK_SPARSE_BUFFER_PAGE_SIZE, (uint64_t)backing_size * ZINK_SPARSE_BUFFER_PAGE_SIZE, true, cur_sem); if (cur_sem) { @@ -875,7 +876,7 @@ buffer_bo_commit(struct zink_context *ctx, struct zink_resource *res, uint32_t o } if (!done) { - cur_sem = buffer_commit_single(screen, res, NULL, 0, + cur_sem = buffer_commit_single(ctx, res, NULL, 0, (uint64_t)base_page * ZINK_SPARSE_BUFFER_PAGE_SIZE, (uint64_t)(end_va_page - base_page) * ZINK_SPARSE_BUFFER_PAGE_SIZE, false, cur_sem); if (cur_sem) { @@ -917,8 +918,9 @@ out: } static VkSemaphore -texture_commit_single(struct zink_screen *screen, struct zink_resource *res, VkSparseImageMemoryBind *ibind, unsigned num_binds, bool commit, VkSemaphore wait) +texture_commit_single(struct zink_context *ctx, struct zink_resource *res, VkSparseImageMemoryBind *ibind, unsigned num_binds, bool commit, VkSemaphore wait) { + struct zink_screen *screen = zink_screen(ctx->base.screen); VkSemaphore sem = zink_create_semaphore(screen); VkBindSparseInfo sparse = {0}; sparse.sType = VK_STRUCTURE_TYPE_BIND_SPARSE_INFO; @@ -942,8 +944,9 @@ texture_commit_single(struct zink_screen *screen, struct zink_resource *res, VkS } static VkSemaphore -texture_commit_miptail(struct zink_screen *screen, struct zink_resource *res, struct zink_bo *bo, uint32_t bo_offset, uint32_t offset, bool commit, VkSemaphore wait) +texture_commit_miptail(struct zink_context *ctx, struct zink_resource *res, struct zink_bo *bo, uint32_t bo_offset, uint32_t offset, bool commit, VkSemaphore wait) { + struct zink_screen *screen = zink_screen(ctx->base.screen); VkSemaphore sem = zink_create_semaphore(screen); VkBindSparseInfo sparse = {0}; sparse.sType = VK_STRUCTURE_TYPE_BIND_SPARSE_INFO; @@ -1083,7 +1086,7 @@ zink_bo_commit(struct zink_context *ctx, struct zink_resource *res, unsigned lev } if (level >= res->sparse.imageMipTailFirstLod) { uint32_t offset = res->sparse.imageMipTailOffset; - cur_sem = texture_commit_miptail(screen, res, backing[i]->bo, backing_start[i], offset, commit, cur_sem); + cur_sem = texture_commit_miptail(ctx, res, backing[i]->bo, backing_start[i], offset, commit, cur_sem); if (cur_sem) { util_dynarray_append(&ctx->bs->tracked_semaphores, VkSemaphore, cur_sem); res->obj->miptail_commits++; @@ -1139,7 +1142,7 @@ zink_bo_commit(struct zink_context *ctx, struct zink_resource *res, unsigned lev assert(res->obj->miptail_commits); res->obj->miptail_commits--; if (!res->obj->miptail_commits) { - cur_sem = texture_commit_miptail(screen, res, NULL, 0, offset, commit, cur_sem); + cur_sem = texture_commit_miptail(ctx, res, NULL, 0, offset, commit, cur_sem); if (cur_sem) util_dynarray_append(&ctx->bs->tracked_semaphores, VkSemaphore, cur_sem); else @@ -1158,7 +1161,7 @@ zink_bo_commit(struct zink_context *ctx, struct zink_resource *res, unsigned lev } } if (i == ARRAY_SIZE(ibind)) { - cur_sem = texture_commit_single(screen, res, ibind, ARRAY_SIZE(ibind), commit, cur_sem); + cur_sem = texture_commit_single(ctx, res, ibind, ARRAY_SIZE(ibind), commit, cur_sem); if (cur_sem) { util_dynarray_append(&ctx->bs->tracked_semaphores, VkSemaphore, cur_sem); } else { @@ -1179,7 +1182,7 @@ zink_bo_commit(struct zink_context *ctx, struct zink_resource *res, unsigned lev } } if (commits_pending) { - cur_sem = texture_commit_single(screen, res, ibind, i, commit, cur_sem); + cur_sem = texture_commit_single(ctx, res, ibind, i, commit, cur_sem); if (cur_sem) { util_dynarray_append(&ctx->bs->tracked_semaphores, VkSemaphore, cur_sem); } else {