From bfd3ae35c9713a827adc4568be0725740884f3ff Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 18 Aug 2021 22:12:02 +0000 Subject: [PATCH] pan/bi: Use ST_TILE for multisampled blend output ST_TILE lets us specify an explicit sample, whereas BLEND replicates to all samples. This fully fixes the interaction between blend shaders and multisampling on Bifrost, manifesting as dEQP-GLES3.functional.fragment_ops.random.* failures with the configuration rgba8888d24s8ms4. Signed-off-by: Alyssa Rosenzweig Cc: mesa-stable Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 47f62f84d3b..73976566619 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -507,11 +507,17 @@ static void bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T, unsigned rt) { /* Reads 2 or 4 staging registers to cover the input */ - unsigned sr_count = (nir_alu_type_get_type_size(T) <= 16) ? 2 : 4; - - if (b->shader->inputs->is_blend) { - uint64_t blend_desc = b->shader->inputs->blend.bifrost_blend_desc; + unsigned size = nir_alu_type_get_type_size(T); + unsigned sr_count = (size <= 16) ? 2 : 4; + const struct panfrost_compile_inputs *inputs = b->shader->inputs; + uint64_t blend_desc = inputs->blend.bifrost_blend_desc; + if (inputs->is_blend && inputs->blend.nr_samples > 1) { + /* Conversion descriptor comes from the compile inputs, pixel + * indices derived at run time based on sample ID */ + bi_st_tile(b, rgba, bi_pixel_indices(b, rt), bi_register(60), + bi_imm_u32(blend_desc >> 32), BI_VECSIZE_V4); + } else if (b->shader->inputs->is_blend) { /* Blend descriptor comes from the compile inputs */ /* Put the result in r0 */ bi_blend_to(b, bi_register(0), rgba,