Mesa (main): zink: stop leaking descriptor pool references

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


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Oct 13 09:56:06 2021 -0400

zink: stop leaking descriptor pool references

this never really mattered before, but now these need to actually
get freed

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, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c
index e814d1c89b4..8c6a4547adc 100644
--- a/src/gallium/drivers/zink/zink_descriptors.c
+++ b/src/gallium/drivers/zink/zink_descriptors.c
@@ -598,8 +598,11 @@ descriptor_pool_get(struct zink_context *ctx, enum zink_descriptor_type type,
 
       hash = hash_descriptor_pool(&key);
       struct hash_entry *he = _mesa_hash_table_search_pre_hashed(ctx->dd->descriptor_pools[type], hash, &key);
-      if (he)
-         return (void*)he->data;
+      if (he) {
+         struct zink_descriptor_pool *pool = he->data;
+         pipe_reference(NULL, &pool->reference);
+         return pool;
+      }
    }
    struct zink_descriptor_pool *pool = descriptor_pool_create(zink_screen(ctx->base.screen), type, layout_key, sizes, num_type_sizes);
    if (type != ZINK_DESCRIPTOR_TYPES)
@@ -1086,7 +1089,7 @@ zink_descriptor_program_init(struct zink_context *ctx, struct zink_program *pg)
       struct zink_descriptor_pool *pool = descriptor_pool_get(ctx, i, pg->dd->layout_key[i], size, num_sizes);
       if (!pool)
          return false;
-      zink_descriptor_pool_reference(ctx, &pdd_cached(pg)->pool[i], pool);
+      pdd_cached(pg)->pool[i] = pool;
 
       if (screen->info.have_KHR_descriptor_update_template &&
           screen->descriptor_mode != ZINK_DESCRIPTOR_MODE_NOTEMPLATES)



More information about the mesa-commit mailing list