zink: always defer query pool deletion

this feels dumb, but I can't think of a simpler way to do it that
would more accurately handle deletion while also guaranteeing
pool longevity

Fixes: 7da78ffb69 ("zink: create/use query pools dynamically")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22493>
This commit is contained in:
Mike Blumenkrantz
2023-04-13 17:06:35 -04:00
committed by Marge Bot
parent 50e3974e25
commit 7119a344f3
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -111,6 +111,9 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs)
struct zink_query *query = (void*)entry->key;
zink_prune_query(screen, bs, query);
}
util_dynarray_foreach(&bs->dead_querypools, VkQueryPool, pool)
VKSCR(DestroyQueryPool)(screen->dev, *pool, NULL);
util_dynarray_clear(&bs->dead_querypools);
/* framebuffers are appended to the batch state in which they are destroyed
* to ensure deferred deletion without destroying in-use objects
@@ -267,6 +270,7 @@ zink_batch_state_destroy(struct zink_screen *screen, struct zink_batch_state *bs
free(bs->real_objs.objs);
free(bs->slab_objs.objs);
free(bs->sparse_objs.objs);
util_dynarray_fini(&bs->dead_querypools);
util_dynarray_fini(&bs->swapchain_obj);
util_dynarray_fini(&bs->zombie_samplers);
util_dynarray_fini(&bs->dead_framebuffers);
@@ -327,6 +331,7 @@ create_batch_state(struct zink_context *ctx)
SET_CREATE_OR_FAIL(&bs->programs);
SET_CREATE_OR_FAIL(&bs->active_queries);
util_dynarray_init(&bs->wait_semaphores, NULL);
util_dynarray_init(&bs->dead_querypools, NULL);
util_dynarray_init(&bs->wait_semaphore_stages, NULL);
util_dynarray_init(&bs->zombie_samplers, NULL);
util_dynarray_init(&bs->dead_framebuffers, NULL);
+1 -1
View File
@@ -387,7 +387,7 @@ unref_vk_pool(struct zink_context *ctx, struct zink_query_pool *pool)
{
if (!pool || --pool->refcount)
return;
VKCTX(DestroyQueryPool)(zink_screen(ctx->base.screen)->dev, pool->query_pool, NULL);
util_dynarray_append(&ctx->batch.state->dead_querypools, VkQueryPool, pool->query_pool);
if (list_is_linked(&pool->list))
list_del(&pool->list);
FREE(pool);
+1
View File
@@ -596,6 +596,7 @@ struct zink_batch_state {
struct util_dynarray dead_framebuffers;
struct set active_queries; /* zink_query objects which were active at some point in this batch */
struct util_dynarray dead_querypools;
struct zink_batch_descriptor_data dd;