Module: Mesa
Branch: staging/23.0
Commit: 8881d4e36f427f78cf6ae320b5332c54f7a5b66c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8881d4e36f427f78cf6ae320b5332c54f7a5b66c

Author: Patrick Lerda <[email protected]>
Date:   Wed Mar 29 21:55:47 2023 +0200

lima: fix refcnt imbalance related to framebuffer

Indeed, the current framebuffer hardcoded cleanup
is not sufficient.

For instance, this issue is triggered with:
"piglit/bin/fbo-depthstencil clear default_fb -samples=2 -auto"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

cc: mesa-stable

Signed-off-by: Patrick Lerda <[email protected]>
Reviewed-by: Erico Nunes <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22234>
(cherry picked from commit 035b84f3085a2ce8b0d0769b66f24df70c95b024)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/lima/lima_context.c | 1 +
 src/gallium/drivers/lima/lima_state.c   | 3 ---
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 81d646b08e6..22b6206a2e6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2964,7 +2964,7 @@
         "description": "lima: fix refcnt imbalance related to framebuffer",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/gallium/drivers/lima/lima_context.c 
b/src/gallium/drivers/lima/lima_context.c
index d4f1552e0e9..802f308f48e 100644
--- a/src/gallium/drivers/lima/lima_context.c
+++ b/src/gallium/drivers/lima/lima_context.c
@@ -147,6 +147,7 @@ lima_context_destroy(struct pipe_context *pctx)
 
    lima_program_fini(ctx);
    lima_state_fini(ctx);
+   util_unreference_framebuffer_state(&ctx->framebuffer.base);
 
    if (ctx->blitter)
       util_blitter_destroy(ctx->blitter);
diff --git a/src/gallium/drivers/lima/lima_state.c 
b/src/gallium/drivers/lima/lima_state.c
index badd815a8b5..a7dc87747fb 100644
--- a/src/gallium/drivers/lima/lima_state.c
+++ b/src/gallium/drivers/lima/lima_state.c
@@ -473,7 +473,4 @@ lima_state_fini(struct lima_context *ctx)
 
    util_set_vertex_buffers_mask(so->vb, &so->enabled_mask, NULL,
                                 0, 0, ARRAY_SIZE(so->vb), false);
-
-   pipe_surface_reference(&ctx->framebuffer.base.cbufs[0], NULL);
-   pipe_surface_reference(&ctx->framebuffer.base.zsbuf, NULL);
 }

Reply via email to