panfrost: Pass sample_mask to the hardware
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 2 Jul 2020 14:07:08 +0000 (10:07 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 01:13:39 +0000 (01:13 +0000)
Gallium computes it for us.

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_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index d431afa45ae4e3d4b4d65d6f2f1187d3688b39a7..f3a4633e69b8d34af3d7a4ed10227a4f9bb9dc3d 100644 (file)
@@ -835,7 +835,9 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
 
         fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
 
-        fragmeta->coverage_mask = 0xFFFF;
+        bool msaa = ctx->rasterizer && ctx->rasterizer->base.multisample;
+        fragmeta->coverage_mask = (msaa ? ctx->sample_mask : ~0) & 0xF;
+
         fragmeta->unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x10;
         fragmeta->unknown2_4 = 0x4e0;
 
index 5514e29a4263011966be7019e5a18ffb3280f7af..b96aef2a11e6972fd836ea9ea4e17c29c35deb7f 100644 (file)
@@ -1168,6 +1168,8 @@ static void
 panfrost_set_sample_mask(struct pipe_context *pipe,
                          unsigned sample_mask)
 {
+        struct panfrost_context *ctx = pan_context(pipe);
+        ctx->sample_mask = sample_mask;
 }
 
 static void
@@ -1526,5 +1528,8 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
         panfrost_batch_init(ctx);
         panfrost_invalidate_frame(ctx);
 
+        /* By default mask everything on */
+        ctx->sample_mask = ~0;
+
         return gallium;
 }
index f54e163148333e131446f3310f5197036c389760..adf4adada97ba33d572a8d15639631efa50f09ad 100644 (file)
@@ -163,6 +163,7 @@ struct panfrost_context {
         struct pipe_blend_color blend_color;
         struct pipe_depth_stencil_alpha_state *depth_stencil;
         struct pipe_stencil_ref stencil_ref;
+        unsigned sample_mask;
 };
 
 /* Corresponds to the CSO */