zink: pass ctx to sparse bind functions

no functional changes

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36954>
(cherry picked from commit 2cf626d17d)
This commit is contained in:
Mike Blumenkrantz 2025-08-23 07:32:32 -04:00 committed by Eric Engestrom
parent af83e46d28
commit 6bf190f73f
2 changed files with 13 additions and 10 deletions

View file

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

View file

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