Mesa (master): panfrost: Don't set CAN_DISCARD for MFBD

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


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

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

panfrost: Don't set CAN_DISCARD for MFBD

It's likely harmless but let's match the blob.

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_cmdstream.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 59a1799bc86..0d96f842fa8 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -647,6 +647,8 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                                 void *rts)
 {
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
+        struct panfrost_shader_state *fs;
+        fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
 
         SET_BIT(fragmeta->unknown2_4, MALI_NO_DITHER,
                 (dev->quirks & MIDGARD_SFBD) && ctx->blend &&
@@ -721,7 +723,7 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                 }
 
                 SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD,
-                        !blend[0].no_blending);
+                        !blend[0].no_blending || fs->can_discard); 
                 return;
         }
 
@@ -730,8 +732,6 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
         for (unsigned i = 0; i < rt_count; ++i) {
                 if (dev->quirks & IS_BIFROST) {
                         struct bifrost_blend_rt *brts = rts;
-                        struct panfrost_shader_state *fs;
-                        fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
 
                         brts[i].flags = 0x200;
                         if (blend[i].is_shader) {
@@ -825,17 +825,11 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
                 SET_BIT(fragmeta->midgard1.flags_lo, MALI_HELPER_INVOCATIONS,
                         fs->helper_invocations);
 
-                /* CAN_DISCARD should be set if the fragment shader possibly contains a
-                 * 'discard' instruction. It is likely this is related to optimizations
-                 * related to forward-pixel kill, as per "Mali Performance 3: Is
-                 * EGL_BUFFER_PRESERVED a good thing?" by Peter Harris */
-
                 const struct pipe_depth_stencil_alpha_state *zsa = ctx->depth_stencil;
 
                 bool depth_enabled = fs->writes_depth ||
                    (zsa && zsa->depth.enabled && zsa->depth.func != PIPE_FUNC_ALWAYS);
 
-                SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD, fs->can_discard);
                 SET_BIT(fragmeta->midgard1.flags_lo, 0x400, !depth_enabled && fs->can_discard);
                 SET_BIT(fragmeta->midgard1.flags_lo, MALI_READS_ZS, depth_enabled && fs->can_discard);
         }



More information about the mesa-commit mailing list