From: Alyssa Rosenzweig Date: Mon, 7 Jun 2021 17:38:45 +0000 (-0400) Subject: panfrost: Remove scissor_culls_everything X-Git-Tag: upstream/21.2.3~2146 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d687cb65eabb2ebadb09be6f8e47496af22ec6f;p=platform%2Fupstream%2Fmesa.git panfrost: Remove scissor_culls_everything Based on a misunderstanding of how the scissor test works, and in particular breaks transform feedback and SSBO writes from vertex shaders. Replace it with a moral equivalent to rasterizer_discard so vertex shaders still run. Signed-off-by: Alyssa Rosenzweig Cc: mesa-stable Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index c2385ec..ac1bfa7 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -767,6 +767,8 @@ panfrost_emit_viewport(struct panfrost_batch *batch) } panfrost_batch_union_scissor(batch, minx, miny, maxx, maxy); + batch->scissor_culls_everything = (minx >= maxx || miny >= maxy); + return T.gpu; } @@ -2356,7 +2358,7 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, batch->indirect_draw_job_id : 0, 0, vertex_job, false); - if (ctx->rasterizer->base.rasterizer_discard) + if (ctx->rasterizer->base.rasterizer_discard || batch->scissor_culls_everything) return; panfrost_add_job(&batch->pool, &batch->scoreboard, diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index a0051f2..831ba1d 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -154,19 +154,6 @@ pan_draw_mode(enum pipe_prim_type mode) #undef DEFINE_CASE -static bool -panfrost_scissor_culls_everything(struct panfrost_context *ctx) -{ - const struct pipe_scissor_state *ss = &ctx->scissor; - - /* Check if we're scissoring at all */ - - if (!ctx->rasterizer->base.scissor) - return false; - - return (ss->minx == ss->maxx) || (ss->miny == ss->maxy); -} - /* Count generated primitives (when there is no geom/tess shaders) for * transform feedback */ @@ -740,13 +727,6 @@ panfrost_draw_vbo(struct pipe_context *pipe, struct panfrost_context *ctx = pan_context(pipe); struct panfrost_device *dev = pan_device(pipe->screen); - /* First of all, check the scissor to see if anything is drawn at all. - * If it's not, we drop the draw (mostly a conformance issue; - * well-behaved apps shouldn't hit this) */ - - if (panfrost_scissor_culls_everything(ctx)) - return; - if (!panfrost_render_condition_check(ctx)) return; diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 1a6dc0b..ac92dfe 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -76,6 +76,9 @@ struct panfrost_batch { unsigned minx, miny; unsigned maxx, maxy; + /* Acts as a rasterizer discard */ + bool scissor_culls_everything; + /* BOs referenced not in the pool */ struct hash_table *bos;