From e77e4d5c176e95482673d2c8b4c8b16c48d79747 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 2 May 2025 22:18:38 +0200 Subject: [PATCH] panfrost: change tie-breaking rule for 16x MSAA When using 16x MSAA, we have two sample-positions on the negative boundary of the unit-square covering the pixel. This causes problems when using the default tie-breaking rule, where we miss some sample-positions when rasterizing primitives covering the entire viewport. This works fine on Bifrost and later, but this setting is ignored on those GPUs, and they assume the default (e.g MINUS_180_OUT_0_IN). Because we'd prefer for rasterization to match between Midgard and Bifrost when we can, we only apply this when we have 16x MSAA. As an added bonus, this behavior matches what the DDK does. Fixes these tests when 16x MSAA is enabled: - dEQP-GLES31.functional.texture.multisample.samples_16.use_texture_* - dEQP-GLES3.functional.multisample.fbo_max_samples.proportionality_alpha_to_coverage Reviewed-by: Eric R. Smith Part-of: --- src/panfrost/lib/pan_desc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index 901ab89c8e6..1eae31a7362 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -874,7 +874,10 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx, cfg.bound_max_y = fb->height - 1; cfg.effective_tile_size = fb->tile_size; - cfg.tie_break_rule = MALI_TIE_BREAK_RULE_MINUS_180_IN_0_OUT; + /* Ensure we cover the samples on the edge for 16x MSAA */ + cfg.tie_break_rule = fb->nr_samples == 16 ? + MALI_TIE_BREAK_RULE_MINUS_180_OUT_0_IN : + MALI_TIE_BREAK_RULE_MINUS_180_IN_0_OUT; cfg.render_target_count = MAX2(fb->rt_count, 1); /* Default to 24 bit depth if there's no surface. */