Mesa (staging/21.2): pan/bi: Use ST_TILE for multisampled blend output

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 23 17:44:11 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 17324031ed096a235d43046ecaed71672e59749e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=17324031ed096a235d43046ecaed71672e59749e

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Aug 18 22:12:02 2021 +0000

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 <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12478>
(cherry picked from commit bfd3ae35c9713a827adc4568be0725740884f3ff)

---

 .pick_status.json                      |  2 +-
 src/panfrost/bifrost/bifrost_compile.c | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 06bb411a09f..17109a390c2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
         "description": "pan/bi: Use ST_TILE for multisampled blend output",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 1402e46a017..326dc0915d5 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -480,11 +480,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,



More information about the mesa-commit mailing list