zink: use correct surface ref function for context destroy

the regular surface reference function can never be used in the driver
if it is possible that a surface may be destroyed, as this may reference
a previously-destroyed context

Fixes: 92a5ea13fc ("zink: implement a global framebuffer cache")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9787>
This commit is contained in:
Mike Blumenkrantz 2021-03-28 21:27:44 -04:00 committed by Marge Bot
parent cbe9e95a96
commit c39295a24b

View File

@ -293,7 +293,9 @@ zink_context_destroy(struct pipe_context *pctx)
debug_printf("vkQueueWaitIdle failed\n");
util_blitter_destroy(ctx->blitter);
util_copy_framebuffer_state(&ctx->fb_state, NULL);
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++)
zink_surface_reference(screen, (struct zink_surface**)&ctx->fb_state.cbufs[i], NULL);
zink_surface_reference(screen, (struct zink_surface**)&ctx->fb_state.zsbuf, NULL);
pipe_resource_reference(&ctx->dummy_vertex_buffer, NULL);
pipe_resource_reference(&ctx->dummy_xfb_buffer, NULL);