Mesa (master): broadcom/vc5: Work around scissor w/h==0 bug same as rasterizer discard.

Eric Anholt anholt at kemper.freedesktop.org
Thu Mar 29 00:49:05 UTC 2018


Module: Mesa
Branch: master
Commit: 2f4c4e10c268a8b9a013b422d85439c5933d8075
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f4c4e10c268a8b9a013b422d85439c5933d8075

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Mar 27 21:30:42 2018 -0700

broadcom/vc5: Work around scissor w/h==0 bug same as rasterizer discard.

The 7268 HW apparently lets some rendering through in this case.  Fixes
GTF-GLES2.gtf.GL2FixedTests.scissor.scissor

---

 src/gallium/drivers/vc5/vc5_emit.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/vc5/vc5_emit.c b/src/gallium/drivers/vc5/vc5_emit.c
index deb46228da..0d11d7e1ad 100644
--- a/src/gallium/drivers/vc5/vc5_emit.c
+++ b/src/gallium/drivers/vc5/vc5_emit.c
@@ -308,6 +308,7 @@ v3dX(emit_state)(struct pipe_context *pctx)
 {
         struct vc5_context *vc5 = vc5_context(pctx);
         struct vc5_job *job = vc5->job;
+        bool rasterizer_discard = vc5->rasterizer->base.rasterizer_discard;
 
         if (vc5->dirty & (VC5_DIRTY_SCISSOR | VC5_DIRTY_VIEWPORT |
                           VC5_DIRTY_RASTERIZER)) {
@@ -344,6 +345,18 @@ v3dX(emit_state)(struct pipe_context *pctx)
                         clip.clip_window_bottom_pixel_coordinate = miny;
                         clip.clip_window_width_in_pixels = maxx - minx;
                         clip.clip_window_height_in_pixels = maxy - miny;
+
+#if V3D_VERSION < 41
+                        /* The HW won't entirely clip out when scissor w/h is
+                         * 0.  Just treat it the same as rasterizer discard.
+                         */
+                        if (clip.clip_window_width_in_pixels == 0 ||
+                            clip.clip_window_height_in_pixels == 0) {
+                                rasterizer_discard = true;
+                                clip.clip_window_width_in_pixels = 1;
+                                clip.clip_window_height_in_pixels = 1;
+                        }
+#endif
                 }
 
                 job->draw_min_x = MIN2(job->draw_min_x, minx);
@@ -358,11 +371,11 @@ v3dX(emit_state)(struct pipe_context *pctx)
                           VC5_DIRTY_COMPILED_FS)) {
                 cl_emit(&job->bcl, CONFIGURATION_BITS, config) {
                         config.enable_forward_facing_primitive =
-                                !vc5->rasterizer->base.rasterizer_discard &&
+                                !rasterizer_discard &&
                                 !(vc5->rasterizer->base.cull_face &
                                   PIPE_FACE_FRONT);
                         config.enable_reverse_facing_primitive =
-                                !vc5->rasterizer->base.rasterizer_discard &&
+                                !rasterizer_discard &&
                                 !(vc5->rasterizer->base.cull_face &
                                   PIPE_FACE_BACK);
                         /* This seems backwards, but it's what gets the




More information about the mesa-commit mailing list