From 8c8b178899bb34e5d599e15207a1ba14827b435e Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Fri, 28 Mar 2025 13:32:23 +0100 Subject: [PATCH] r600: fix clear_depth_stencil refcnt imbalance After ca09c173f6e, util_blitter_clear_render_target() requires a call to util_blitter_save_fragment_constant_buffer_slot(). The r600 implementation was using the same sequence with util_blitter_clear_depth_stencil() which does not need this call. This was the cause of the refcnt imbalance. For instance, this issue is triggered with: "piglit/bin/ext_clear_texture-stencil -auto -fbo" while setting GALLIUM_REFCNT_LOG=refcnt.log. Fixes: ca09c173f6e ("gallium/u_blitter: remove UTIL_BLITTER_ATTRIB_COLOR, use a constant buffer") Signed-off-by: Patrick Lerda Part-of: --- src/gallium/drivers/r600/r600_blit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index ba91fcbcb43..9f54885f672 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -31,7 +31,9 @@ enum r600_blitter_op /* bitmask */ R600_DECOMPRESS = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND, - R600_COLOR_RESOLVE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER + R600_COLOR_RESOLVE = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER, + + R600_DEPTH_STENCIL = R600_SAVE_FRAGMENT_STATE | R600_SAVE_FRAMEBUFFER }; static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op) @@ -552,7 +554,7 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, { struct r600_context *rctx = (struct r600_context *)ctx; - r600_blitter_begin(ctx, R600_CLEAR_SURFACE | + r600_blitter_begin(ctx, R600_DEPTH_STENCIL | (render_condition_enabled ? 0 : R600_DISABLE_RENDER_COND)); util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height);