panfrost: Share MRT blend flag calculation with Bifrost
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 26 May 2020 22:48:04 +0000 (18:48 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 20:49:43 +0000 (16:49 -0400)
As far as I know the field is the same.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5232>

src/gallium/drivers/panfrost/pan_cmdstream.c

index af7ee5b8d6e782302b90cc4620635c7d5606b2aa..d640cc7d327e19547923613e004f0bfeb90444a2 100644 (file)
@@ -730,9 +730,26 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
         /* Additional blend descriptor tacked on for jobs using MFBD */
 
         for (unsigned i = 0; i < rt_count; ++i) {
+                unsigned flags = 0;
+
+                if (ctx->pipe_framebuffer.nr_cbufs > i && !blend[i].no_colour) {
+                        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);
+
+                        SET_BIT(flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
+                        SET_BIT(flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
+                        SET_BIT(flags, MALI_BLEND_SRGB, is_srgb);
+                        SET_BIT(flags, MALI_BLEND_NO_DITHER, !ctx->blend->base.dither);
+                }
+
                 if (dev->quirks & IS_BIFROST) {
                         struct bifrost_blend_rt *brts = rts;
 
+                        brts[i].flags = flags;
+
                         if (blend[i].is_shader) {
                                 /* The blend shader's address needs to be at
                                  * the same top 32 bit as the fragment shader.
@@ -742,7 +759,6 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                                        (fs->bo->gpu & (0xffffffffull << 32)));
                                 brts[i].shader = blend[i].shader.gpu;
                                 brts[i].unk2 = 0x0;
-                                brts[i].flags = 0x200;
                         } else if (ctx->pipe_framebuffer.nr_cbufs > i) {
                                 enum pipe_format format = ctx->pipe_framebuffer.cbufs[i]->format;
                                 const struct util_format_description *format_desc;
@@ -757,7 +773,6 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                                 brts[i].unk2 = 0x19;
 
                                 brts[i].shader_type = fs->blend_types[i];
-                                brts[i].flags = 0x200;
                         } else {
                                 /* Dummy attachment for depth-only */
                                 brts[i].unk2 = 0x3;
@@ -765,19 +780,7 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx,
                         }
                 } else {
                         struct midgard_blend_rt *mrts = rts;
-
-                        if (!blend[i].no_colour) {
-                                mrts[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);
-
-                                SET_BIT(mrts[i].flags, MALI_BLEND_MRT_SHADER, blend[i].is_shader);
-                                SET_BIT(mrts[i].flags, MALI_BLEND_LOAD_TIB, !blend[i].no_blending);
-                                SET_BIT(mrts[i].flags, MALI_BLEND_SRGB, is_srgb);
-                                SET_BIT(mrts[i].flags, MALI_BLEND_NO_DITHER, !ctx->blend->base.dither);
-                        }
+                        mrts[i].flags = flags;
 
                         if (blend[i].is_shader) {
                                 mrts[i].blend.shader = blend[i].shader.gpu | blend[i].shader.first_tag;