From 020d145f4afd72734faf7c75fcd2db1676645890 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 9 May 2024 10:48:45 -0400 Subject: [PATCH] u_blitter: stop leaking saved blitter states on no-op blits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drivers expect blitter to clean up after itself cc: mesa-stable Reviewed-by: Marek Olšák Part-of: (cherry picked from commit cd004defd4920243b5b1ad2ca4f8a79e67e5900f) --- .pick_status.json | 2 +- src/gallium/auxiliary/util/u_blitter.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index bc713350320..72c86e847ad 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -274,7 +274,7 @@ "description": "u_blitter: stop leaking saved blitter states on no-op blits", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index be24ec084aa..3300a0f776c 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -2014,6 +2014,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, unsigned dst_sample) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + unsigned count = 0; struct pipe_context *pipe = ctx->base.pipe; enum pipe_texture_target src_target = src->target; unsigned src_samples = src->texture->nr_samples; @@ -2038,7 +2039,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, /* Return if there is nothing to do. */ if (!dst_has_color && !dst_has_depth && !dst_has_stencil) { - return; + goto out; } bool is_scaled = dstbox->width != abs(srcbox->width) || @@ -2170,7 +2171,6 @@ void util_blitter_blit_generic(struct blitter_context *blitter, } /* Set samplers. */ - unsigned count = 0; if (src_has_depth && src_has_stencil && (dst_has_color || (dst_has_depth && dst_has_stencil))) { /* Setup two samplers, one for depth and the other one for stencil. */ @@ -2223,7 +2223,8 @@ void util_blitter_blit_generic(struct blitter_context *blitter, do_blits(ctx, dst, dstbox, src, src_width0, src_height0, srcbox, dst_has_depth || dst_has_stencil, use_txf, sample0_only, dst_sample); - + util_blitter_unset_running_flag(blitter); +out: util_blitter_restore_vertex_states(blitter); util_blitter_restore_fragment_states(blitter); util_blitter_restore_textures_internal(blitter, count); @@ -2232,7 +2233,6 @@ void util_blitter_blit_generic(struct blitter_context *blitter, pipe->set_scissor_states(pipe, 0, 1, &ctx->base.saved_scissor); } util_blitter_restore_render_cond(blitter); - util_blitter_unset_running_flag(blitter); } void