zink: rework query pool overflow
now when a query pool is full, a new query pool can be created and the previous one can be dropped from reuse to be freed at a later time this has the added benefit of avoiding yet another place where a renderpass might get split Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21534>
This commit is contained in:
committed by
Marge Bot
parent
7da78ffb69
commit
e5d517f362
@@ -23,7 +23,6 @@ struct zink_query_pool {
|
|||||||
VkQueryPool query_pool;
|
VkQueryPool query_pool;
|
||||||
unsigned last_range;
|
unsigned last_range;
|
||||||
unsigned refcount;
|
unsigned refcount;
|
||||||
bool overflow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct zink_query_buffer {
|
struct zink_query_buffer {
|
||||||
@@ -151,16 +150,10 @@ static void
|
|||||||
reset_vk_query_pool(struct zink_context *ctx, struct zink_vk_query *vkq)
|
reset_vk_query_pool(struct zink_context *ctx, struct zink_vk_query *vkq)
|
||||||
{
|
{
|
||||||
struct zink_batch *batch = &ctx->batch;
|
struct zink_batch *batch = &ctx->batch;
|
||||||
if (vkq->pool->overflow) {
|
if (vkq->needs_reset) {
|
||||||
zink_batch_no_rp(ctx);
|
|
||||||
/* this pool has overflowed: reset all queries once to avoid splitting renderpasses later */
|
|
||||||
VKCTX(CmdResetQueryPool)(batch->state->cmdbuf, vkq->pool->query_pool, 0, NUM_QUERIES);
|
|
||||||
|
|
||||||
} else if (vkq->needs_reset) {
|
|
||||||
VKCTX(CmdResetQueryPool)(batch->state->barrier_cmdbuf, vkq->pool->query_pool, vkq->query_id, 1);
|
VKCTX(CmdResetQueryPool)(batch->state->barrier_cmdbuf, vkq->pool->query_pool, vkq->query_id, 1);
|
||||||
batch->state->has_barriers = true;
|
batch->state->has_barriers = true;
|
||||||
}
|
}
|
||||||
vkq->pool->overflow = false;
|
|
||||||
vkq->needs_reset = false;
|
vkq->needs_reset = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,6 +467,11 @@ query_pool_get_range(struct zink_context *ctx, struct zink_query *q)
|
|||||||
} else {
|
} else {
|
||||||
struct zink_query_pool *pool = find_or_allocate_qp(ctx, q, pool_idx);
|
struct zink_query_pool *pool = find_or_allocate_qp(ctx, q, pool_idx);
|
||||||
pool->refcount++;
|
pool->refcount++;
|
||||||
|
pool->last_range++;
|
||||||
|
if (pool->last_range == NUM_QUERIES) {
|
||||||
|
list_del(&pool->list);
|
||||||
|
pool = find_or_allocate_qp(ctx, q, pool_idx);
|
||||||
|
}
|
||||||
vkq = CALLOC_STRUCT(zink_vk_query);
|
vkq = CALLOC_STRUCT(zink_vk_query);
|
||||||
|
|
||||||
vkq->refcount = 1;
|
vkq->refcount = 1;
|
||||||
@@ -482,11 +480,6 @@ query_pool_get_range(struct zink_context *ctx, struct zink_query *q)
|
|||||||
vkq->started = false;
|
vkq->started = false;
|
||||||
vkq->query_id = pool->last_range;
|
vkq->query_id = pool->last_range;
|
||||||
|
|
||||||
pool->last_range++;
|
|
||||||
if (pool->last_range == NUM_QUERIES) {
|
|
||||||
pool->last_range = 0;
|
|
||||||
pool->overflow = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unref_vk_query(zink_screen(ctx->base.screen), start->vkq[i]);
|
unref_vk_query(zink_screen(ctx->base.screen), start->vkq[i]);
|
||||||
start->vkq[i] = vkq;
|
start->vkq[i] = vkq;
|
||||||
|
|||||||
Reference in New Issue
Block a user