Mesa (main): zink: remove fb surface resource refs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 7 00:31:25 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue May 11 09:39:11 2021 -0400

zink: remove fb surface resource refs

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

---

 src/gallium/drivers/zink/zink_context.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 055201a7a74..698fe8f8839 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1686,7 +1686,7 @@ begin_render_pass(struct zink_context *ctx)
    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]);
-         zink_batch_reference_resource_rw(batch, zink_resource(surf->base.texture), true);
+         zink_batch_resource_usage_set(batch, zink_resource(surf->base.texture), true);
          zink_batch_usage_set(&surf->batch_uses, batch->state);
 
          struct zink_resource *res = zink_resource(surf->base.texture);
@@ -1949,7 +1949,10 @@ unbind_fb_surface(struct zink_context *ctx, struct pipe_surface *surf, bool chan
          zink_batch_reference_surface(&ctx->batch, zink_surface(surf));
       ctx->rp_changed = true;
    }
-   zink_resource(surf->texture)->fb_binds--;
+   struct zink_resource *res = zink_resource(surf->texture);
+   res->fb_binds--;
+   if (!res->fb_binds)
+      check_resource_for_batch_ref(ctx, res);
 }
 
 static void



More information about the mesa-commit mailing list