panfrost: Implement alpha-to-coverage
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 2 Jul 2020 15:17:37 +0000 (11:17 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 01:13:39 +0000 (01:13 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5782>

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

index 518005c9f68916c7f5c5fec11c4831c468365d76..57e70d821483c7bd10ca60b0b149199c6f97e0e4 100644 (file)
@@ -107,7 +107,6 @@ panfrost_create_blend_state(struct pipe_context *pipe,
         so->base = *blend;
 
         /* TODO: The following features are not yet implemented */
-        assert(!blend->alpha_to_coverage);
         assert(!blend->alpha_to_one);
 
         for (unsigned c = 0; c < PIPE_MAX_COLOR_BUFS; ++c) {
index f3a4633e69b8d34af3d7a4ed10227a4f9bb9dc3d..d50121afb44701ebe1e734ef947b8c9bfd0650bc 100644 (file)
@@ -672,6 +672,9 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                 (dev->quirks & MIDGARD_SFBD) && ctx->blend &&
                 !ctx->blend->base.dither);
 
+        SET_BIT(fragmeta->unknown2_4, MALI_ALPHA_TO_COVERAGE,
+                        ctx->blend->base.alpha_to_coverage);
+
         /* Get blending setup */
         unsigned rt_count = MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
 
@@ -857,7 +860,8 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
 
                 SET_BIT(fragmeta->midgard1.flags_lo, MALI_EARLY_Z,
                         !fs->can_discard && !fs->writes_global &&
-                        !fs->writes_depth && !fs->writes_stencil);
+                        !fs->writes_depth && !fs->writes_stencil &&
+                        !ctx->blend->base.alpha_to_coverage);
 
                 /* Add the writes Z/S flags if needed. */
                 SET_BIT(fragmeta->midgard1.flags_lo, MALI_WRITES_Z, fs->writes_depth);
index 0f5757ae9796e14d4b5ef6900566acad08eeafb8..cd725ec5544a704fea7f1e9ecf9785b30e363362 100644 (file)
@@ -110,8 +110,7 @@ enum mali_func {
 /* Next flags to unknown2_4 */
 #define MALI_STENCIL_TEST              (1 << 0)
 
-/* What?! */
-#define MALI_SAMPLE_ALPHA_TO_COVERAGE_NO_BLEND_SHADER (1 << 1)
+#define MALI_ALPHA_TO_COVERAGE (1 << 1)
 
 #define MALI_NO_DITHER         (1 << 9)
 #define MALI_DEPTH_RANGE_A     (1 << 12)
index 263dce0eb90e3f4e2efde6a15f77f25d663e665a..928f5a77efba1e2afcbc5408145dcb3f5ef8adc3 100644 (file)
@@ -237,7 +237,7 @@ static const struct pandecode_flag_info u4_flag_info[] = {
         FLAG_INFO(DEPTH_RANGE_A),
         FLAG_INFO(DEPTH_RANGE_B),
         FLAG_INFO(STENCIL_TEST),
-        FLAG_INFO(SAMPLE_ALPHA_TO_COVERAGE_NO_BLEND_SHADER),
+        FLAG_INFO(ALPHA_TO_COVERAGE),
         {}
 };
 #undef FLAG_INFO