zink: pass ctx through query destroy paths

no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22493>
(cherry picked from commit 50e3974e25)
This commit is contained in:
Mike Blumenkrantz 2023-04-13 17:22:20 -04:00 committed by Eric Engestrom
parent f3969bf7df
commit 204995f16f
2 changed files with 12 additions and 12 deletions

View file

@ -724,7 +724,7 @@
"description": "zink: pass ctx through query destroy paths",
"nominated": false,
"nomination_type": null,
"resolution": 4,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -383,30 +383,31 @@ fail:
}
static void
unref_vk_pool(struct zink_screen *screen, struct zink_query_pool *pool)
unref_vk_pool(struct zink_context *ctx, struct zink_query_pool *pool)
{
if (!pool || --pool->refcount)
return;
VKSCR(DestroyQueryPool)(screen->dev, pool->query_pool, NULL);
VKCTX(DestroyQueryPool)(zink_screen(ctx->base.screen)->dev, pool->query_pool, NULL);
if (list_is_linked(&pool->list))
list_del(&pool->list);
FREE(pool);
}
static void
unref_vk_query(struct zink_screen *screen, struct zink_vk_query *vkq)
unref_vk_query(struct zink_context *ctx, struct zink_vk_query *vkq)
{
if (!vkq)
return;
unref_vk_pool(screen, vkq->pool);
unref_vk_pool(ctx, vkq->pool);
vkq->refcount--;
if (vkq->refcount == 0)
FREE(vkq);
}
static void
destroy_query(struct zink_screen *screen, struct zink_query *query)
destroy_query(struct zink_context *ctx, struct zink_query *query)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
assert(zink_screen_usage_check_completion(screen, query->batch_uses));
struct zink_query_buffer *qbo, *next;
@ -414,7 +415,7 @@ destroy_query(struct zink_screen *screen, struct zink_query *query)
unsigned num_starts = query->starts.capacity / sizeof(struct zink_query_start);
for (unsigned j = 0; j < num_starts; j++) {
for (unsigned i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++) {
unref_vk_query(screen, starts[j].vkq[i]);
unref_vk_query(ctx, starts[j].vkq[i]);
}
}
@ -482,7 +483,7 @@ query_pool_get_range(struct zink_context *ctx, struct zink_query *q)
vkq->query_id = pool->last_range;
}
unref_vk_query(zink_screen(ctx->base.screen), start->vkq[i]);
unref_vk_query(ctx, start->vkq[i]);
start->vkq[i] = vkq;
}
}
@ -534,7 +535,7 @@ zink_create_query(struct pipe_context *pctx,
}
return (struct pipe_query *)query;
fail:
destroy_query(screen, query);
destroy_query(zink_context(pctx), query);
return NULL;
}
@ -542,7 +543,6 @@ static void
zink_destroy_query(struct pipe_context *pctx,
struct pipe_query *q)
{
struct zink_screen *screen = zink_screen(pctx->screen);
struct zink_query *query = (struct zink_query *)q;
/* only destroy if this query isn't active on any batches,
@ -553,7 +553,7 @@ zink_destroy_query(struct pipe_context *pctx,
return;
}
destroy_query(screen, query);
destroy_query(zink_context(pctx), query);
}
void
@ -563,7 +563,7 @@ zink_prune_query(struct zink_screen *screen, struct zink_batch_state *bs, struct
return;
query->batch_uses = NULL;
if (query->dead)
destroy_query(screen, query);
destroy_query(bs->ctx, query);
}
static void