From ff6a911fd4e9004f044e96ab47baf356c6df1f01 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 12 Jan 2023 20:56:23 -0500 Subject: [PATCH] panfrost: Fix clears with conditional rendering batch can be invalidated by the render condition check. Fixes nv_conditional_render-clear. Fixes: 638b22354e7 ("panfrost: Clear with a quad to avoid flushing") Signed-off-by: Alyssa Rosenzweig Part-of: (cherry picked from commit 02f9cddb6174f50bb01a12bf926da3fca1fa7b17) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_context.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 4372dfceef0..dc11b9d1f02 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4711,7 +4711,7 @@ "description": "panfrost: Fix clears with conditional rendering", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "638b22354e75fa31551f776a2cd2bbf752db1ad5" }, diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 30f30ed261d..7dd8f179ccc 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -61,12 +61,15 @@ panfrost_clear( const union pipe_color_union *color, double depth, unsigned stencil) { + if (!panfrost_render_condition_check(pan_context(pipe))) + return; + + /* Only get batch after checking the render condition, since the check can + * cause the batch to be flushed. + */ struct panfrost_context *ctx = pan_context(pipe); struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - if (!panfrost_render_condition_check(ctx)) - return; - /* At the start of the batch, we can clear for free */ if (!batch->scoreboard.first_job) { panfrost_batch_clear(batch, buffers, color, depth, stencil);