Mesa (main): zink: stop referencing framebuffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 19:38:42 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Jun  9 17:11:42 2021 -0400

zink: stop referencing framebuffers

this is a waste of cycles now that surfaces are accurately tracked;
no-attachment fbs are still deferred to avoid premature deletion

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

---

 src/gallium/drivers/zink/zink_batch.c   | 18 ------------------
 src/gallium/drivers/zink/zink_batch.h   |  5 -----
 src/gallium/drivers/zink/zink_context.c |  1 -
 3 files changed, 24 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index c4074b09175..383e06fba5f 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -80,12 +80,6 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs)
       }
    }
 
-   set_foreach(bs->fbs, entry) {
-      struct zink_framebuffer *fb = (void*)entry->key;
-      zink_framebuffer_reference(screen, &fb, NULL);
-      _mesa_set_remove(bs->fbs, entry);
-   }
-
    pipe_resource_reference(&bs->flush_res, NULL);
 
    bs->resource_size = 0;
@@ -145,7 +139,6 @@ zink_batch_state_destroy(struct zink_screen *screen, struct zink_batch_state *bs
    if (bs->cmdpool)
       vkDestroyCommandPool(screen->dev, bs->cmdpool, NULL);
 
-   _mesa_set_destroy(bs->fbs, NULL);
    util_dynarray_fini(&bs->zombie_samplers);
    util_dynarray_fini(&bs->dead_framebuffers);
    _mesa_set_destroy(bs->surfaces, NULL);
@@ -189,7 +182,6 @@ create_batch_state(struct zink_context *ctx)
    bs->ctx = ctx;
    pipe_reference_init(&bs->reference, 1);
 
-   SET_CREATE_OR_FAIL(bs->fbs);
    SET_CREATE_OR_FAIL(bs->resources);
    SET_CREATE_OR_FAIL(bs->surfaces);
    SET_CREATE_OR_FAIL(bs->bufferviews);
@@ -674,16 +666,6 @@ zink_batch_reference_sampler_view(struct zink_batch *batch,
       zink_batch_reference_surface(batch, sv->image_view);
 }
 
-void
-zink_batch_reference_framebuffer(struct zink_batch *batch,
-                                 struct zink_framebuffer *fb)
-{
-   bool found;
-   _mesa_set_search_or_add(batch->state->fbs, fb, &found);
-   if (!found)
-      pipe_reference(NULL, &fb->reference);
-}
-
 void
 zink_batch_reference_program(struct zink_batch *batch,
                              struct zink_program *pg)
diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h
index 178ff6db9ce..0dc894ee34a 100644
--- a/src/gallium/drivers/zink/zink_batch.h
+++ b/src/gallium/drivers/zink/zink_batch.h
@@ -41,7 +41,6 @@ struct pipe_reference;
 struct zink_buffer_view;
 struct zink_context;
 struct zink_descriptor_set;
-struct zink_framebuffer;
 struct zink_image_view;
 struct zink_program;
 struct zink_render_pass;
@@ -77,7 +76,6 @@ struct zink_batch_state {
 
    struct pipe_resource *flush_res;
 
-   struct set *fbs;
    struct set *programs;
 
    struct set *resources;
@@ -139,9 +137,6 @@ zink_batch_state_clear_resources(struct zink_screen *screen, struct zink_batch_s
 void
 zink_reset_batch(struct zink_context *ctx, struct zink_batch *batch);
 void
-zink_batch_reference_framebuffer(struct zink_batch *batch,
-                                 struct zink_framebuffer *fb);
-void
 zink_start_batch(struct zink_context *ctx, struct zink_batch *batch);
 
 void
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 3b6b4e8927b..1ff2edbaa42 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1728,7 +1728,6 @@ begin_render_pass(struct zink_context *ctx)
 
    assert(ctx->gfx_pipeline_state.render_pass && ctx->framebuffer);
 
-   zink_batch_reference_framebuffer(batch, ctx->framebuffer);
    for (int i = 0; i < ctx->framebuffer->state.num_attachments; i++) {
       if (ctx->framebuffer->surfaces[i]) {
          struct zink_surface *surf = zink_surface(ctx->framebuffer->surfaces[i]);



More information about the mesa-commit mailing list