zink: pass ctx through query destroy paths

no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22493>
This commit is contained in:
Mike Blumenkrantz
2023-04-13 17:22:20 -04:00
committed by Marge Bot
parent cb83606279
commit 50e3974e25
+11 -11
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]);
}
}
@@ -486,7 +487,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;
}
}
@@ -538,7 +539,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;
}
@@ -546,7 +547,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,
@@ -557,7 +557,7 @@ zink_destroy_query(struct pipe_context *pctx,
return;
}
destroy_query(screen, query);
destroy_query(zink_context(pctx), query);
}
void
@@ -567,7 +567,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