Mesa (master): zink: explicitly unref old fb object when setting new one

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 22:07:27 UTC 2020


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Apr 27 13:44:08 2020 -0400

zink: explicitly unref old fb object when setting new one

this object has a ref from being created, and its lifetime is expected to
be a single frame, so remove that initial ref when we expect to stop
using it

Closes: #2648
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4768>

---

 src/gallium/drivers/zink/zink_context.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 32a0a1f82e6..4c2fe44da53 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -638,7 +638,11 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
 
    util_copy_framebuffer_state(&ctx->fb_state, state);
 
-   struct zink_framebuffer *fb = create_framebuffer(ctx);
+   struct zink_framebuffer *fb = ctx->framebuffer;
+   /* explicitly unref previous fb to ensure it gets destroyed */
+   if (fb)
+      zink_framebuffer_reference(screen, &fb, NULL);
+   fb = create_framebuffer(ctx);
    zink_framebuffer_reference(screen, &ctx->framebuffer, fb);
    zink_render_pass_reference(screen, &ctx->gfx_pipeline_state.render_pass, fb->rp);
 



More information about the mesa-commit mailing list