From 3edb0a0a5310beff1a790f5267b69c7042bc4254 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Sun, 9 May 2021 14:14:53 -0400 Subject: [PATCH] zink: destroy lazy descriptor pools during batch reset when unused this should keep resource usage a bit lower Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_descriptors_lazy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_descriptors_lazy.c b/src/gallium/drivers/zink/zink_descriptors_lazy.c index 038188eec32..62743f2d415 100644 --- a/src/gallium/drivers/zink/zink_descriptors_lazy.c +++ b/src/gallium/drivers/zink/zink_descriptors_lazy.c @@ -517,8 +517,15 @@ zink_batch_descriptor_reset_lazy(struct zink_screen *screen, struct zink_batch_s return; for (unsigned i = 0; i < ZINK_DESCRIPTOR_TYPES; i++) { hash_table_foreach(&bdd_lazy(bs)->pools[i], entry) { + const struct zink_descriptor_layout_key *key = entry->key; struct zink_descriptor_pool *pool = (void*)entry->data; - pool->set_idx = 0; + if (key->use_count) + pool->set_idx = 0; + else { + vkDestroyDescriptorPool(screen->dev, pool->pool, NULL); + ralloc_free(pool); + _mesa_hash_table_remove(&bdd_lazy(bs)->pools[i], entry); + } } } for (unsigned i = 0; i < 2; i++) {