panfrost: Identify additional SFBD flags
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 21 Aug 2020 13:12:54 +0000 (09:12 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 25 Aug 2020 15:05:36 +0000 (17:05 +0200)
These are analogues to the flags we have in the blend structure on
T760+, which enables us to fix shaderless and sRGB operation on T720.

Closes #2771

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: a64599a303e ("panfrost: Pass the sampler view format when creating a tex descriptor")
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6440>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/panfrost/include/panfrost-job.h

index 620425196ba5ce1f9540b2e9fc733e69414eedd7..1a170f6ee3b0d939437f89345ddf1f4de729f094 100644 (file)
@@ -723,6 +723,14 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx,
                  * need to signal CAN_DISCARD for nontrivial blend modes (so
                  * we're able to read back the destination buffer) */
 
+                if (blend[0].no_colour)
+                        return;
+
+                fragmeta->unknown2_4 |= MALI_SFBD_ENABLE;
+
+                SET_BIT(fragmeta->unknown2_4, MALI_SFBD_SRGB,
+                                util_format_is_srgb(ctx->pipe_framebuffer.cbufs[0]->format));
+
                 SET_BIT(fragmeta->unknown2_3, MALI_HAS_BLEND_SHADER,
                         blend[0].is_shader);
 
@@ -737,7 +745,6 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx,
                 SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD,
                         blend[0].load_dest);
 
-                fragmeta->unknown2_4 |= 0x10;
                 SET_BIT(fragmeta->unknown2_4, MALI_NO_DITHER, !ctx->blend->base.dither);
         } else if (!(dev->quirks & IS_BIFROST)) {
                 /* Bug where MRT-capable hw apparently reads the last blend
index e2267069860b1028362b515208c623b15c6a32c6..18dbb95ed96ad600dc513fccd0325c66c85d0780 100644 (file)
@@ -80,6 +80,8 @@ typedef uint64_t mali_ptr;
 
 #define MALI_ALPHA_TO_COVERAGE (1 << 1)
 
+#define MALI_SFBD_ENABLE        (1 << 4)
+#define MALI_SFBD_SRGB          (1 << 8)
 #define MALI_NO_DITHER         (1 << 9)
 #define MALI_DEPTH_RANGE_A     (1 << 12)
 #define MALI_DEPTH_RANGE_B     (1 << 13)