Mesa (main): zink: always invalidate descriptor sets on pool free

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 19 18:21:04 UTC 2021


Module: Mesa
Branch: main
Commit: 6a852e4e06943b429382ac938c8b8fb94e834e06
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a852e4e06943b429382ac938c8b8fb94e834e06

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Oct 14 10:08:49 2021 -0400

zink: always invalidate descriptor sets on pool free

this used to be bad and only for debugging, but now it's good and useful
for saving memory

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13430>

---

 src/gallium/drivers/zink/zink_descriptors.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c
index feefdde9e46..7bd25aaa3fb 100644
--- a/src/gallium/drivers/zink/zink_descriptors.c
+++ b/src/gallium/drivers/zink/zink_descriptors.c
@@ -252,13 +252,14 @@ descriptor_set_invalidate(struct zink_descriptor_set *zds)
    }
 }
 
-#ifndef NDEBUG
 static void
 descriptor_pool_clear(struct hash_table *ht)
 {
-   _mesa_hash_table_clear(ht, NULL);
+   hash_table_foreach(ht, entry) {
+      struct zink_descriptor_set *zds = entry->data;
+      descriptor_set_invalidate(zds);
+   }
 }
-#endif
 
 static void
 descriptor_pool_free(struct zink_screen *screen, struct zink_descriptor_pool *pool)
@@ -269,12 +270,10 @@ descriptor_pool_free(struct zink_screen *screen, struct zink_descriptor_pool *po
       VKSCR(DestroyDescriptorPool)(screen->dev, pool->descpool, NULL);
 
    simple_mtx_lock(&pool->mtx);
-#ifndef NDEBUG
    if (pool->desc_sets)
       descriptor_pool_clear(pool->desc_sets);
    if (pool->free_desc_sets)
       descriptor_pool_clear(pool->free_desc_sets);
-#endif
    if (pool->desc_sets)
       _mesa_hash_table_destroy(pool->desc_sets, NULL);
    if (pool->free_desc_sets)



More information about the mesa-commit mailing list