From f23cdd4f72d1f2d48c5968ccb6f4a3525bf87c0e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 2 Jul 2020 10:07:08 -0400 Subject: [PATCH] panfrost: Pass sample_mask to the hardware Gallium computes it for us. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 4 +++- src/gallium/drivers/panfrost/pan_context.c | 5 +++++ src/gallium/drivers/panfrost/pan_context.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index d431afa45ae..f3a4633e69b 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -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; diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 5514e29a426..b96aef2a11e 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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; } diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index f54e1631483..adf4adada97 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -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 */ -- 2.30.2