panfrost: Drop draws with complete scissor
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 17 Jun 2019 16:26:34 +0000 (09:26 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 17 Jun 2019 16:29:09 +0000 (09:29 -0700)
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 <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/ci/expected-failures.txt
src/gallium/drivers/panfrost/pan_context.c

index 8bfe988e99ce99b8bd3359c7fbc3f399f99256da..66ca0507cc331350a095905d276c6f4c8ca42632 100644 (file)
@@ -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
index 7ad20a80fb19ef4aac1cf031cb4885de80599c8a..f70330064948e8e67090d4e5005a5cadd3fff11a 100644 (file)
@@ -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;