crocus: fix refcnt imbalance related to framebuffer

Indeed, the hardcoded framebuffer cleanup doesn't handle "resolve".

For instance, this issue is triggered with "piglit/bin/glx-copy-sub-buffer -samples=2 -auto"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Fixes: f5bde99cbd ("gallium: plumb resolve attachments through from frontends -> pipe_framebuffer_state")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22554>
(cherry picked from commit c39a2d67ea)
This commit is contained in:
Patrick Lerda 2023-03-15 13:21:05 +01:00 committed by Eric Engestrom
parent 4811f46d83
commit 1314f03123
2 changed files with 4 additions and 5 deletions

View file

@ -1714,7 +1714,7 @@
"description": "crocus: fix refcnt imbalance related to framebuffer",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "f5bde99cbdd208916795dc463663ddd97428ecc1"
},

View file

@ -8285,6 +8285,8 @@ crocus_upload_compute_state(struct crocus_context *ice,
static void
crocus_destroy_state(struct crocus_context *ice)
{
struct pipe_framebuffer_state *cso = &ice->state.framebuffer;
pipe_resource_reference(&ice->draw.draw_params.res, NULL);
pipe_resource_reference(&ice->draw.derived_draw_params.res, NULL);
@ -8294,10 +8296,7 @@ crocus_destroy_state(struct crocus_context *ice)
pipe_so_target_reference(&ice->state.so_target[i], NULL);
}
for (unsigned i = 0; i < ice->state.framebuffer.nr_cbufs; i++) {
pipe_surface_reference(&ice->state.framebuffer.cbufs[i], NULL);
}
pipe_surface_reference(&ice->state.framebuffer.zsbuf, NULL);
util_unreference_framebuffer_state(cso);
for (int stage = 0; stage < MESA_SHADER_STAGES; stage++) {
struct crocus_shader_state *shs = &ice->state.shaders[stage];