Mesa (master): anv/descriptor_set: Don't fully destroy sets in pool destroy/reset

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 26 06:20:51 UTC 2019


Module: Mesa
Branch: master
Commit: 934f178341f7ec3bb10e3fa1499198e7988b086f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=934f178341f7ec3bb10e3fa1499198e7988b086f

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Apr 25 14:15:26 2019 -0500

anv/descriptor_set: Don't fully destroy sets in pool destroy/reset

In 105002bd2d617, we fixed a memory leak bug where we weren't properly
destroying descriptor when destroying/resetting a descriptor pool.
However, the only real leak that happened was that we we take a
reference to the descriptor set layout in the descriptor set and we
weren't dropping our reference.  Everything else in the descriptor set
is tied to the pool itself and doesn't need to be freed on a per-set
basis.  This commit changes the destroy/reset functions to only bother
walking the list of sets to unref the layouts and otherwise we just
assume that the whole-pool destroy/reset takes care of the rest.

Now that we're doing more non-trivial things with descriptor sets such
as allocating things with util_vma_heap, per-set destruction is starting
to show up on perf traces.  This takes reset back to where it's supposed
to be as a cheap whole-pool operation.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

---

 src/intel/vulkan/anv_descriptor_set.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 7ffdb1cceff..dc33cc6d9a8 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -747,7 +747,7 @@ void anv_DestroyDescriptorPool(
 
    list_for_each_entry_safe(struct anv_descriptor_set, set,
                             &pool->desc_sets, pool_link) {
-      anv_descriptor_set_destroy(device, pool, set);
+      anv_descriptor_set_layout_unref(device, set->layout);
    }
 
    if (pool->bo.size) {
@@ -771,8 +771,9 @@ VkResult anv_ResetDescriptorPool(
 
    list_for_each_entry_safe(struct anv_descriptor_set, set,
                             &pool->desc_sets, pool_link) {
-      anv_descriptor_set_destroy(device, pool, set);
+      anv_descriptor_set_layout_unref(device, set->layout);
    }
+   list_inithead(&pool->desc_sets);
 
    pool->next = 0;
    pool->free_list = EMPTY;




More information about the mesa-commit mailing list