Mesa (staging/20.1): panfrost: Fix background showing when using discard
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 25 14:53:23 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: b62f3a931af7b2736deaa9323cc53fdf6246a432
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b62f3a931af7b2736deaa9323cc53fdf6246a432
Author: Icecream95 <ixn at keemail.me>
Date: Tue May 12 14:08:09 2020 +1200
panfrost: Fix background showing when using discard
This fixes problems in a number of games, including SuperTuxKart,
OpenMW and RVGL.
v2: Use MALI_READS_ZS | 0x20 instead of MALI_WRITES_Z to match with
the blob. Keep using 0x400 | 0x20 when depth is disabled.
Closes: #2620
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
(cherry picked from commit 0dd24b381c52e0b20fe70041e95611aad6b0d258)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5193>
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 6c667d2017d..42d77ca09f0 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -742,8 +742,14 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
* 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, 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);
panfrost_frag_meta_rasterizer_update(ctx, fragmeta);
panfrost_frag_meta_zsa_update(ctx, fragmeta);
More information about the mesa-commit
mailing list