panfrost: Decode blend shaders for SFBD
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 5 Nov 2019 14:31:42 +0000 (15:31 +0100)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Wed, 6 Nov 2019 15:18:46 +0000 (16:18 +0100)
Also set MALI_HAS_BLEND_SHADER as needed.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_context.c
src/panfrost/pandecode/decode.c

index e8cedb961871c7f4da8103853a89f393773b1444..b7b77715fc80c36c81c77e2407f7c71b96df4896 100644 (file)
@@ -1047,7 +1047,9 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
                          * additionally need to signal CAN_DISCARD for nontrivial blend
                          * modes (so we're able to read back the destination buffer) */
 
-                        if (!blend[0].is_shader) {
+                        if (blend[0].is_shader) {
+                                ctx->fragment_shader_core.unknown2_3 |= MALI_HAS_BLEND_SHADER;
+                        } else {
                                 ctx->fragment_shader_core.blend.equation =
                                         *blend[0].equation.equation;
                                 ctx->fragment_shader_core.blend.constant =
index 7c1d681d0189016ec8358fa9c9ffc40348bb349a..94b640c54d6c0e38a503960eac2bf685754ef082 100644 (file)
@@ -2068,6 +2068,30 @@ pandecode_shader_prop(const char *name, unsigned claim, signed truth, bool fuzzy
         pandecode_log_cont(",\n");
 }
 
+static void
+pandecode_blend_shader_disassemble(mali_ptr shader, int job_no, int job_type,
+                                   bool is_bifrost)
+{
+        struct midgard_disasm_stats stats =
+                pandecode_shader_disassemble(shader, job_no, job_type, is_bifrost);
+
+        bool has_texture = (stats.texture_count > 0);
+        bool has_sampler = (stats.sampler_count > 0);
+        bool has_attribute = (stats.attribute_count > 0);
+        bool has_varying = (stats.varying_count > 0);
+        bool has_uniform = (stats.uniform_count > 0);
+        bool has_ubo = (stats.uniform_buffer_count > 0);
+
+        if (has_texture || has_sampler)
+                pandecode_msg("XXX: blend shader accessing textures\n");
+
+        if (has_attribute || has_varying)
+                pandecode_msg("XXX: blend shader accessing interstage\n");
+
+        if (has_uniform || has_ubo)
+                pandecode_msg("XXX: blend shader accessing uniforms\n");
+}
+
 static void
 pandecode_vertex_tiler_postfix_pre(
                 const struct mali_vertex_tiler_postfix *p,
@@ -2245,9 +2269,10 @@ pandecode_vertex_tiler_postfix_pre(
 
                 if (!is_bifrost) {
                         /* TODO: Blend shaders routing/disasm */
-
                         union midgard_blend blend = s->blend;
-                        pandecode_midgard_blend(&blend, false);
+                        mali_ptr shader = pandecode_midgard_blend(&blend, s->unknown2_3 & MALI_HAS_BLEND_SHADER);
+                        if (shader & ~0xF)
+                                pandecode_blend_shader_disassemble(shader, job_no, job_type, false);
                 }
 
                 pandecode_indent--;
@@ -2267,26 +2292,8 @@ pandecode_vertex_tiler_postfix_pre(
                                 else
                                         shader = pandecode_midgard_blend_mrt(blend_base, job_no, i);
 
-                                if (shader & ~0xF) {
-                                        struct midgard_disasm_stats stats =
-                                                pandecode_shader_disassemble(shader, job_no, job_type, false);
-
-                                        bool has_texture = (stats.texture_count > 0);
-                                        bool has_sampler = (stats.sampler_count > 0);
-                                        bool has_attribute = (stats.attribute_count > 0);
-                                        bool has_varying = (stats.varying_count > 0);
-                                        bool has_uniform = (stats.uniform_count > 0);
-                                        bool has_ubo = (stats.uniform_buffer_count > 0);
-
-                                        if (has_texture || has_sampler)
-                                                pandecode_msg("XXX: blend shader accessing textures\n");
-
-                                        if (has_attribute || has_varying)
-                                                pandecode_msg("XXX: blend shader accessing interstage\n");
-
-                                        if (has_uniform || has_ubo)
-                                                pandecode_msg("XXX: blend shader accessing uniforms\n");
-                                }
+                                if (shader & ~0xF)
+                                        pandecode_blend_shader_disassemble(shader, job_no, job_type, false);
 
                         }
                 }