Mesa (main): zink: unref descriptor pools in hybrid mode when they explode

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


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Oct 13 10:15:37 2021 -0400

zink: unref descriptor pools in hybrid mode when they explode

these will no longer be used, so unref them so they can be deleted to
free up some vram in the driver

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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c
index 8b491df3827..feefdde9e46 100644
--- a/src/gallium/drivers/zink/zink_descriptors.c
+++ b/src/gallium/drivers/zink/zink_descriptors.c
@@ -106,6 +106,7 @@ batch_add_desc_set(struct zink_batch *batch, struct zink_descriptor_set *zds)
        !batch_ptr_add_usage(batch, batch->state->dd->desc_sets, zds))
       return false;
    pipe_reference(NULL, &zds->reference);
+   pipe_reference(NULL, &zds->pool->reference);
    zink_batch_usage_set(&zds->batch_uses, batch->state);
    return true;
 }
@@ -1471,6 +1472,8 @@ zink_descriptors_update(struct zink_context *ctx, bool is_compute)
                VKCTX(CmdBindDescriptorSets)(batch->state->cmdbuf, bp,
                                             pg->layout, h + 1, 1, &desc_set,
                                             0, NULL);
+               if (pdd_cached(pg)->cache_misses[h] == MAX_CACHE_MISSES)
+                  zink_descriptor_pool_reference(ctx, &pdd_cached(pg)->pool[h], NULL);
             }
          } else {
             zink_descriptors_update_lazy_masked(ctx, is_compute, BITFIELD_BIT(h), 0);
@@ -1508,6 +1511,10 @@ zink_batch_descriptor_reset(struct zink_screen *screen, struct zink_batch_state
        */
       pipe_reference(&zds->reference, NULL);
       zink_descriptor_set_recycle(zds);
+      if (zds->reference.count == 1) {
+         struct zink_descriptor_pool *pool = zds->pool;
+         zink_descriptor_pool_reference(bs->ctx, &pool, NULL);
+      }
       _mesa_set_remove(bs->dd->desc_sets, entry);
    }
    zink_batch_descriptor_reset_lazy(screen, bs);



More information about the mesa-commit mailing list