Mesa (master): panfrost: Disable tib read/write when colourmask = 0x0

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 21 20:05:36 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Wed May 20 12:56:01 2020 -0400

panfrost: Disable tib read/write when colourmask = 0x0

There might still be Z/S updates so we can't drop the whole shader but
we can shortcircuit the colour pipeline.

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

---

 src/gallium/drivers/panfrost/pan_blend.h     |  6 ++++--
 src/gallium/drivers/panfrost/pan_blend_cso.c |  2 ++
 src/gallium/drivers/panfrost/pan_cmdstream.c | 18 ++++++++++--------
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_blend.h b/src/gallium/drivers/panfrost/pan_blend.h
index 1b1cb9df31d..1dfb0776207 100644
--- a/src/gallium/drivers/panfrost/pan_blend.h
+++ b/src/gallium/drivers/panfrost/pan_blend.h
@@ -99,10 +99,12 @@ struct panfrost_blend_final {
         /* Set for a shader, clear for an equation */
         bool is_shader;
 
-        /* Set if the destination needs to be loaded from the tilebuffer,
-         * basically (for an equation) or if a shader is present */
+        /* Clear if the destination needs to be loaded from the tilebuffer */
         bool no_blending;
 
+        /* Set if the colour mask is 0x0 (nothing is written) */
+        bool no_colour;
+
         union {
                 struct panfrost_blend_shader_final shader;
                 struct panfrost_blend_equation_final equation;
diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c
index d0824ed488f..a68a9911b57 100644
--- a/src/gallium/drivers/panfrost/pan_blend_cso.c
+++ b/src/gallium/drivers/panfrost/pan_blend_cso.c
@@ -255,6 +255,8 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
                                 (rt->equation.alpha_mode == 0x122) &&
                                 (rt->equation.color_mask == 0xf);
 
+                        final.no_colour = (rt->equation.color_mask == 0x0);
+
                         return final;
                 }
         }
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 21ab118085d..caf01663a48 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -725,16 +725,18 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                 } else {
                         struct midgard_blend_rt *mrts = rts;
 
-                        mrts[i].flags = 0x200;
+                        if (!blend[i].no_colour) {
+                                mrts[i].flags = 0x200;
 
-                        bool is_srgb = (ctx->pipe_framebuffer.nr_cbufs > i) &&
-                                       (ctx->pipe_framebuffer.cbufs[i]) &&
-                                       util_format_is_srgb(ctx->pipe_framebuffer.cbufs[i]->format);
+                                bool is_srgb = (ctx->pipe_framebuffer.nr_cbufs > i) &&
+                                               (ctx->pipe_framebuffer.cbufs[i]) &&
+                                               util_format_is_srgb(ctx->pipe_framebuffer.cbufs[i]->format);
 
-                        SET_BIT(mrts[i].flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
-                        SET_BIT(mrts[i].flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
-                        SET_BIT(mrts[i].flags, MALI_BLEND_SRGB, is_srgb);
-                        SET_BIT(mrts[i].flags, MALI_BLEND_NO_DITHER, !ctx->blend->base.dither);
+                                SET_BIT(mrts[i].flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
+                                SET_BIT(mrts[i].flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
+                                SET_BIT(mrts[i].flags, MALI_BLEND_SRGB, is_srgb);
+                                SET_BIT(mrts[i].flags, MALI_BLEND_NO_DITHER, !ctx->blend->base.dither);
+                        }
 
                         if (blend[i].is_shader) {
                                 mrts[i].blend.shader = blend[i].shader.gpu | blend[i].shader.first_tag;



More information about the mesa-commit mailing list