util/blitter: fix util_blitter_clear_buffer() refcnt imbalance

Indeed, the vertex state was restored using a specific
condition at the util_blitter_restore_vertex_states()
level. This change ensures that the condition is the
same when the vertex state is saved.

The function util_blitter_clear_buffer() is only called
by the r600 driver on pre-evergreen gpus.

This issue is triggered on a rv770 gpu with "piglit/bin/fbo-1d -auto -fbo"
or "piglit/bin/draw_buffers_gles2 -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Fixes: 5f566faa46 ("radeonsi: don't save and restore vertex buffers and elements for u_blitter")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23721>
This commit is contained in:
Patrick Lerda 2023-06-13 15:23:53 +02:00 committed by Marge Bot
parent 3d22bcb790
commit 23c003b88c

View file

@ -2633,7 +2633,10 @@ void util_blitter_clear_buffer(struct blitter_context *blitter,
blitter_check_saved_vertex_states(ctx);
blitter_disable_render_cond(ctx);
pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, 0, false, &vb);
if (ctx->base.saved_vertex_buffer.buffer.resource) {
pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, 0, false, &vb);
}
pipe->bind_vertex_elements_state(pipe,
ctx->velem_state_readbuf[num_channels-1]);
bind_vs_pos_only(ctx, num_channels);