From 9865b79a882e6eb9bc38427bcff199da3d787b66 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 17 Jun 2019 09:26:34 -0700 Subject: panfrost: Drop draws with complete scissor The hardware support for scissoring requires minimally 1 pixel to be drawn. If the scissor culls *everything*, we need to drop the draw entirely early on. Signed-off-by: Alyssa Rosenzweig --- .../drivers/panfrost/ci/expected-failures.txt | 4 ---- src/gallium/drivers/panfrost/pan_context.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt b/src/gallium/drivers/panfrost/ci/expected-failures.txt index 8bfe988e99c..66ca0507cc3 100644 --- a/src/gallium/drivers/panfrost/ci/expected-failures.txt +++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt @@ -285,10 +285,6 @@ dEQP-GLES2.functional.fragment_ops.random.96 dEQP-GLES2.functional.fragment_ops.random.97 dEQP-GLES2.functional.fragment_ops.random.98 dEQP-GLES2.functional.fragment_ops.random.99 -dEQP-GLES2.functional.fragment_ops.scissor.clear_color -dEQP-GLES2.functional.fragment_ops.scissor.outside_render_line -dEQP-GLES2.functional.fragment_ops.scissor.outside_render_point -dEQP-GLES2.functional.fragment_ops.scissor.outside_render_tri dEQP-GLES2.functional.lifetime.attach.deleted_output.renderbuffer_framebuffer dEQP-GLES2.functional.lifetime.attach.deleted_output.texture_framebuffer dEQP-GLES2.functional.negative_api.shader.uniform_matrixfv_invalid_transpose diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 7ad20a80fb1..f7033006494 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1569,6 +1569,19 @@ panfrost_get_index_buffer_mapped(struct panfrost_context *ctx, const struct pipe } } +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 (!(ss && ctx->rasterizer && ctx->rasterizer->base.scissor)) + return false; + + return (ss->minx == ss->maxx) && (ss->miny == ss->maxy); +} + static void panfrost_draw_vbo( struct pipe_context *pipe, @@ -1576,6 +1589,13 @@ panfrost_draw_vbo( { struct panfrost_context *ctx = pan_context(pipe); + /* 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; + ctx->payload_vertex.draw_start = info->start; ctx->payload_tiler.draw_start = info->start; -- cgit v1.2.3