v3d: Rewrite the color write masks to match CLIF format.
authorEric Anholt <eric@anholt.net>
Wed, 27 Jun 2018 22:25:03 +0000 (15:25 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 29 Jun 2018 20:36:28 +0000 (13:36 -0700)
The render_target_* fields gave us pretty(ish) printing, but meant we were
incompatible with CLIF, and had much more verbose code generating them.

src/broadcom/cle/v3d_packet_v33.xml
src/gallium/drivers/v3d/v3dx_emit.c

index 5fa5ddd530bb00b2f3d045f97a4a9dc07c49144b..9ffc07b9845fbbd9ef3482948164c40d37a97fbd 100644 (file)
   </packet>
 
   <packet code="87" name="Colour Write Masks">
-    <field name="Reserved" size="16" start="16" type="uint"/>
-    <field name="Render Target 3 per colour component write masks" size="4" start="12" type="uint"/>
-    <field name="Render Target 2 per colour component write masks" size="4" start="8" type="uint"/>
-    <field name="Render Target 1 per colour component write masks" size="4" start="4" type="uint"/>
-    <field name="Render Target 0 per colour component write masks" size="4" start="0" type="uint"/>
+    <field name="Mask" size="32" start="0" type="uint"/>
   </packet>
 
   <packet code="88" name="Zero All Centroid Flags" min_ver="41"/>
index d5549bb945cb66024626e1e684f188d2b429c2ca..03e47d6615627ac38c18c89361bcf08fbded8bf1 100644 (file)
@@ -496,24 +496,12 @@ v3dX(emit_state)(struct pipe_context *pctx)
                 struct pipe_blend_state *blend = v3d->blend;
 
                 cl_emit(&job->bcl, COLOUR_WRITE_MASKS, mask) {
-                        if (blend->independent_blend_enable) {
-                                mask.render_target_0_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[0].colormask, 0);
-                                mask.render_target_1_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[1].colormask, 1);
-                                mask.render_target_2_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[2].colormask, 2);
-                                mask.render_target_3_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[3].colormask, 3);
-                        } else {
-                                mask.render_target_0_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[0].colormask, 0);
-                                mask.render_target_1_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[0].colormask, 1);
-                                mask.render_target_2_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[0].colormask, 2);
-                                mask.render_target_3_per_colour_component_write_masks =
-                                        translate_colormask(v3d, blend->rt[0].colormask, 3);
+                        for (int i = 0; i < 4; i++) {
+                                int rt = blend->independent_blend_enable ? i : 0;
+                                int rt_mask = blend->rt[rt].colormask;
+
+                                mask.mask |= translate_colormask(v3d, rt_mask,
+                                                                 i) << (4 * i);
                         }
                 }
         }