panfrost: Add opaque midgard_blend XML
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 24 Aug 2020 16:06:04 +0000 (12:06 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Aug 2020 14:53:52 +0000 (14:53 +0000)
Just to ensure write ordering is sane.

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
src/panfrost/lib/midgard.xml

index 254543b21c259b9444493e0910d49d3b8e0454e4..5cadab71d13b9020e557ef0c5558a2a4c57af0e0 100644 (file)
@@ -435,7 +435,6 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
         unsigned rt_count = batch->key.nr_cbufs;
 
         struct bifrost_blend_rt *brts = rts;
         unsigned rt_count = batch->key.nr_cbufs;
 
         struct bifrost_blend_rt *brts = rts;
-        struct midgard_blend_rt *mrts = rts;
 
         /* Disable blending for depth-only on Bifrost */
 
 
         /* Disable blending for depth-only on Bifrost */
 
@@ -443,7 +442,7 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
                 brts[0].unk2 = 0x3;
 
         for (unsigned i = 0; i < rt_count; ++i) {
                 brts[0].unk2 = 0x3;
 
         for (unsigned i = 0; i < rt_count; ++i) {
-                unsigned flags = 0;
+                struct mali_blend_flags_packed flags = {};
 
                 pan_pack(&flags, BLEND_FLAGS, cfg) {
                         if (blend[i].no_colour) {
 
                 pan_pack(&flags, BLEND_FLAGS, cfg) {
                         if (blend[i].no_colour) {
@@ -462,7 +461,7 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
                 }
 
                 if (dev->quirks & IS_BIFROST) {
                 }
 
                 if (dev->quirks & IS_BIFROST) {
-                        brts[i].flags = flags;
+                        brts[i].flags = flags.opaque[0];
 
                         if (blend[i].is_shader) {
                                 /* The blend shader's address needs to be at
 
                         if (blend[i].is_shader) {
                                 /* The blend shader's address needs to be at
@@ -494,14 +493,18 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts,
                                 brts[i].shader_type = fs->blend_types[i];
                         }
                 } else {
                                 brts[i].shader_type = fs->blend_types[i];
                         }
                 } else {
-                        memcpy(&mrts[i].flags, &flags, sizeof(flags));
-
-                        if (blend[i].is_shader) {
-                                mrts[i].blend.shader = blend[i].shader.gpu | blend[i].shader.first_tag;
-                        } else {
-                                mrts[i].blend.equation = blend[i].equation.equation;
-                                mrts[i].blend.constant = blend[i].equation.constant;
+                        pan_pack(rts, MIDGARD_BLEND_OPAQUE, cfg) {
+                                cfg.flags = flags;
+
+                                if (blend[i].is_shader) {
+                                        cfg.shader = blend[i].shader.gpu | blend[i].shader.first_tag;
+                                } else {
+                                        cfg.equation = blend[i].equation.equation.opaque[0];
+                                        cfg.constant = blend[i].equation.constant;
+                                }
                         }
                         }
+
+                        rts += MALI_MIDGARD_BLEND_LENGTH;
                 }
         }
 }
                 }
         }
 }
index e145e7433c78bcec9fc1a8dfb32e91c402796aa0..1d9a2b72918e49f8ea7519c4fce3e472b40a3292 100644 (file)
     <field name="Dither disable" size="1" start="11" type="bool" default="false"/>
   </struct>
 
     <field name="Dither disable" size="1" start="11" type="bool" default="false"/>
   </struct>
 
+  <struct name="Midgard Blend" size="4" with_opaque="true">
+    <field name="Flags" size="32" start="0:0" type="Blend Flags"/>
+    <field name="Equation" size="32" start="2:0" type="uint"/> <!-- XXX -->
+    <field name="Constant" size="32" start="3:0" type="float"/>
+    <field name="Shader" size="64" start="2:0" type="address"/>
+  </struct>
+
   <struct name="Midgard Sampler">
     <field name="Magnify Nearest" size="1" start="0" type="bool" default="true"/>
     <field name="Minify Nearest" size="1" start="1" type="bool" default="true"/>
   <struct name="Midgard Sampler">
     <field name="Magnify Nearest" size="1" start="0" type="bool" default="true"/>
     <field name="Minify Nearest" size="1" start="1" type="bool" default="true"/>