Mesa (master): pan/midgard: Add blend shader selection bits for MRT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 13 17:44:52 UTC 2019


Module: Mesa
Branch: master
Commit: fd81916ee5d9336e81d9f7598dc1c98b715f3358
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd81916ee5d9336e81d9f7598dc1c98b715f3358

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Tue Nov 12 14:19:52 2019 -0500

pan/midgard: Add blend shader selection bits for MRT

This is less complicated than previously thought. Note we have no way of
specifying the work register count for blend shaders; it must be
strictly less than the work register count of the corresponding fragment
shader (which is fine since we force the fragment shader to report a
count of 16 with a blend shader as a major hack until we get register
pressure down for blend shaders).

TODO: pandecode the flags.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 .gitlab-ci/deqp-panfrost-t760-fails.txt    |  6 ------
 src/gallium/drivers/panfrost/pan_context.c | 29 +++++------------------------
 src/panfrost/include/panfrost-job.h        |  8 ++++++++
 3 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/.gitlab-ci/deqp-panfrost-t760-fails.txt b/.gitlab-ci/deqp-panfrost-t760-fails.txt
index 0aa2595ac4d..efade45201a 100644
--- a/.gitlab-ci/deqp-panfrost-t760-fails.txt
+++ b/.gitlab-ci/deqp-panfrost-t760-fails.txt
@@ -25,12 +25,6 @@ dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_depthbuffer.rbo_rgb565_depth_component16 Fail
 dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgba_depth_component16 Fail
 dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgb_depth_component16 Fail
-dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.add_dst_color_one_minus_src_color Fail
-dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_alpha Fail
-dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_color Fail
-dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_one Fail
-dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_src_color_one_minus_src_alpha Fail
-dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_src_color_one_minus_src_color Fail
 dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.6  Fail
 dEQP-GLES2.functional.polygon_offset.default_render_with_units Fail
 dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units Fail
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index c9aace9f982..09a319ec2fb 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1083,36 +1083,17 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
                         struct midgard_blend_rt rts[4];
 
                         for (unsigned i = 0; i < rt_count; ++i) {
-                                unsigned blend_count = 0x200;
-
-                                if (blend[i].is_shader) {
-                                        /* For a blend shader, the bottom nibble corresponds to
-                                         * the number of work registers used, which signals the
-                                         * -existence- of a blend shader */
-
-                                        assert(blend[i].shader.work_count >= 2);
-                                        blend_count |= MIN2(blend[i].shader.work_count, 3);
-                                } else {
-                                        /* Otherwise, the bottom bit simply specifies if
-                                         * blending (anything other than REPLACE) is enabled */
-
-                                        if (!blend[i].no_blending)
-                                                blend_count |= 0x1;
-                                }
-
+                                rts[i].flags = 0x200;
 
                                 bool is_srgb =
                                         (ctx->pipe_framebuffer.nr_cbufs > i) &&
                                         (ctx->pipe_framebuffer.cbufs[i]) &&
                                         util_format_is_srgb(ctx->pipe_framebuffer.cbufs[i]->format);
 
-                                rts[i].flags = blend_count;
-
-                                if (is_srgb)
-                                        rts[i].flags |= MALI_BLEND_SRGB;
-
-                                if (!ctx->blend->base.dither)
-                                        rts[i].flags |= MALI_BLEND_NO_DITHER;
+                                SET_BIT(rts[i].flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
+                                SET_BIT(rts[i].flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
+                                SET_BIT(rts[i].flags, MALI_BLEND_SRGB, is_srgb);
+                                SET_BIT(rts[i].flags, MALI_BLEND_NO_DITHER, !ctx->blend->base.dither);
 
                                 /* TODO: sRGB in blend shaders is currently
                                  * unimplemented. Contact me (Alyssa) if you're
diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h
index fb356e1e6d9..d9a3fe9327e 100644
--- a/src/panfrost/include/panfrost-job.h
+++ b/src/panfrost/include/panfrost-job.h
@@ -417,6 +417,14 @@ union midgard_blend {
         };
 };
 
+/* We need to load the tilebuffer to blend (i.e. the destination factor is not
+ * ZERO) */
+
+#define MALI_BLEND_LOAD_TIB (0x1)
+
+/* A blend shader is used to blend this render target */
+#define MALI_BLEND_MRT_SHADER (0x2)
+
 /* On MRT Midgard systems (using an MFBD), each render target gets its own
  * blend descriptor */
 




More information about the mesa-commit mailing list