From c39e3319cab54392e1795a16a3a556d5dc1cd5e8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 28 Mar 2023 09:47:45 -0400 Subject: [PATCH] zink: avoid recursion during msrtss blits from flushing clears if an attachment other than the msrtss blit attachment has clears pending, unbinding the other attachment will trigger a clear flush, which will then recurse into the msrtss blit that's being triggered instead, save/restore these clears around the msrtss blit since they can be executed during the normal renderpass (cherry picked from commit 82add9f2e992be166c60551cfc5baaea0fd0d3a3) Part-of: --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_render_pass.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 64b166a542a..db79cc5a2fb 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -112,7 +112,7 @@ "description": "zink: avoid recursion during msrtss blits from flushing clears", "nominated": false, "nomination_type": null, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_render_pass.c b/src/gallium/drivers/zink/zink_render_pass.c index 7a503ec2462..60b973624ac 100644 --- a/src/gallium/drivers/zink/zink_render_pass.c +++ b/src/gallium/drivers/zink/zink_render_pass.c @@ -797,10 +797,19 @@ zink_begin_render_pass(struct zink_context *ctx) ctx->blitting = false; zink_blit_barriers(ctx, zink_resource(src), zink_resource(dst_view->texture), true); ctx->blitting = true; + unsigned clear_mask = i == PIPE_MAX_COLOR_BUFS ? + (BITFIELD_MASK(PIPE_MAX_COLOR_BUFS) << 2) : + (PIPE_CLEAR_DEPTHSTENCIL | ((BITFIELD_MASK(PIPE_MAX_COLOR_BUFS) & ~BITFIELD_BIT(i)) << 2)); + unsigned clears_enabled = ctx->clears_enabled & clear_mask; + unsigned rp_clears_enabled = ctx->rp_clears_enabled & clear_mask; + ctx->clears_enabled &= ~clear_mask; + ctx->rp_clears_enabled &= ~clear_mask; util_blitter_blit_generic(ctx->blitter, dst_view, &dstbox, src_view, &dstbox, ctx->fb_state.width, ctx->fb_state.height, PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL, false, false, 0); + ctx->clears_enabled = clears_enabled; + ctx->rp_clears_enabled = rp_clears_enabled; ctx->blitting = false; if (blitting) { zink_blit_barriers(ctx, NULL, zink_resource(dst_view->texture), true);