panfrost: Set MALI_BIFROST_EARLY_Z as necessary
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 26 May 2020 23:48:25 +0000 (19:48 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 20:49:44 +0000 (16:49 -0400)
Fixes blending.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5232>

src/gallium/drivers/panfrost/pan_cmdstream.c

index fa5c7e2da5db6908100647c7a78a6f20ecf6275a..c77afaedc0d41a31111ce390dde632d35b01e2ef 100644 (file)
@@ -332,7 +332,7 @@ panfrost_shader_meta_init(struct panfrost_context *ctx,
                 else {
                         /* First clause ATEST |= 0x4000000.
                          * Less than 32 regs |= 0x200 */
-                        meta->bifrost1.unk1 = 0x958020;
+                        meta->bifrost1.unk1 = 0x950020;
                 }
 
                 meta->bifrost1.uniform_buffer_count = panfrost_ubo_count(ctx, st);
@@ -730,6 +730,16 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                 return;
         }
 
+        if (dev->quirks & IS_BIFROST) {
+                bool no_blend = true;
+
+                for (unsigned i = 0; i < rt_count; ++i)
+                        no_blend &= (blend[i].no_blending | blend[i].no_colour);
+
+                SET_BIT(fragmeta->bifrost1.unk1, MALI_BIFROST_EARLY_Z,
+                        !fs->can_discard && !fs->writes_depth && no_blend);
+        }
+
         /* Additional blend descriptor tacked on for jobs using MFBD */
 
         for (unsigned i = 0; i < rt_count; ++i) {