panfrost: Emit explicit REPLACE for disabled colour writeout
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 26 Aug 2020 13:44:12 +0000 (09:44 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Aug 2020 14:53:52 +0000 (14:53 +0000)
Likewise zero for Bifrost. Avoids UB behaviour in next commit.

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

src/gallium/drivers/panfrost/pan_cmdstream.c

index 5cadab71d13b9020e557ef0c5558a2a4c57af0e0..259478f0adab897c76e37ef9df23795746be6049 100644 (file)
@@ -436,10 +436,18 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
 
         struct bifrost_blend_rt *brts = rts;
 
-        /* Disable blending for depth-only on Bifrost */
+        /* Disable blending for depth-only */
 
-        if (rt_count == 0 && dev->quirks & IS_BIFROST)
-                brts[0].unk2 = 0x3;
+        if (rt_count == 0) {
+                if (dev->quirks & IS_BIFROST) {
+                        memset(brts, 0, sizeof(*brts));
+                        brts[0].unk2 = 0x3;
+                } else {
+                        pan_pack(rts, MIDGARD_BLEND_OPAQUE, cfg) {
+                                cfg.equation = 0xf0122122; /* Replace */
+                        }
+                }
+        }
 
         for (unsigned i = 0; i < rt_count; ++i) {
                 struct mali_blend_flags_packed flags = {};
@@ -461,6 +469,7 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
                 }
 
                 if (dev->quirks & IS_BIFROST) {
+                        memset(brts + i, 0, sizeof(brts[i]));
                         brts[i].flags = flags.opaque[0];
 
                         if (blend[i].is_shader) {