Mesa (master): panfrost: Cleanup default blend mode

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 17 17:47:17 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Jun 17 10:22:37 2019 -0700

panfrost: Cleanup default blend mode

Just encode the Mali magic number for `replace` rather than awkwardly
forcing Gallium structures through.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_blending.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_blending.c b/src/gallium/drivers/panfrost/pan_blending.c
index f38868afec2..14f99f64edd 100644
--- a/src/gallium/drivers/panfrost/pan_blending.c
+++ b/src/gallium/drivers/panfrost/pan_blending.c
@@ -344,29 +344,21 @@ panfrost_make_constant(unsigned *factors, unsigned num_factors, const struct pip
  * representating, return false to handle degenerate cases with a blend shader
  */
 
-static const struct pipe_rt_blend_state default_blend = {
-        .blend_enable = 1,
-
-        .rgb_func = PIPE_BLEND_ADD,
-        .rgb_src_factor = PIPE_BLENDFACTOR_ONE,
-        .rgb_dst_factor = PIPE_BLENDFACTOR_ZERO,
-
-        .alpha_func = PIPE_BLEND_ADD,
-        .alpha_src_factor = PIPE_BLENDFACTOR_ONE,
-        .alpha_dst_factor = PIPE_BLENDFACTOR_ZERO,
-
-        .colormask = PIPE_MASK_RGBA
-};
-
 bool
 panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct panfrost_blend_state *so, unsigned colormask, const struct pipe_blend_color *blend_color)
 {
         struct mali_blend_equation *out = &so->equation;
 
+        /* Gallium and Mali represent colour masks identically. XXX: Static assert for future proof */
+        out->color_mask = colormask;
+
         /* If no blending is enabled, default back on `replace` mode */
 
-        if (!blend->blend_enable)
-                return panfrost_make_fixed_blend_mode(&default_blend, so, colormask, blend_color);
+        if (!blend->blend_enable) {
+                out->rgb_mode = 0x122;
+                out->alpha_mode = 0x122;
+                return true;
+        }
 
         /* We have room only for a single float32 constant between the four
          * components. If we need more, spill to the programmable pipeline. */
@@ -395,8 +387,5 @@ panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct p
         out->rgb_mode = rgb_mode;
         out->alpha_mode = alpha_mode;
 
-        /* Gallium and Mali represent colour masks identically. XXX: Static assert for future proof */
-        out->color_mask = colormask;
-
         return true;
 }




More information about the mesa-commit mailing list