Mesa (main): panfrost: Port v5 blend shader issue to blitter

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 23 21:08:50 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Aug 23 14:06:41 2021 -0400

panfrost: Port v5 blend shader issue to blitter

This is a presumed erratum workaround. Fixes INSTR_INVALID_PC faults on
some draw_buffers_indexed.* cases on Midgard, where a blend shader is
required to pack RT n > 0.

Backport the workaround from the GL driver. The helper is now in common
code for panvk to use as well; it has the same bug.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11383>

---

 .../drivers/panfrost/ci/deqp-panfrost-t860-fails.txt | 15 ---------------
 src/gallium/drivers/panfrost/pan_cmdstream.c         | 15 ---------------
 src/panfrost/lib/pan_blitter.c                       | 20 +++++++++++---------
 src/panfrost/lib/pan_util.h                          | 13 +++++++++++++
 4 files changed, 24 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt b/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt
index ed977926670..73b25f1ef85 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt
+++ b/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt
@@ -12,12 +12,6 @@ dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_x,Fa
 dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_y,Fail
 dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_x,Fail
 dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_y,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_blend_func_buffer_blend_func,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_separate_blend_func_buffer_blend_func,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_separate_blend_func_buffer_separate_blend_func,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_blend_func_buffer_blend_func,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_separate_blend_func_buffer_blend_func,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_separate_blend_func_buffer_separate_blend_func,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.0,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.1,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.10,Fail
@@ -34,7 +28,6 @@ dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffe
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.3,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.4,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.5,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.6,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.7,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.8,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.9,Fail
@@ -47,8 +40,6 @@ dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.16,
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.17,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.18,Fail
 dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.2,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.3,Fail
-dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.8,Fail
 dEQP-GLES31.functional.separate_shader.random.23,Fail
 dEQP-GLES31.functional.separate_shader.random.35,Fail
 dEQP-GLES31.functional.separate_shader.random.68,Fail
@@ -62,12 +53,6 @@ dEQP-GLES31.functional.shaders.builtin_functions.integer.findmsb.uvec2_lowp_comp
 dEQP-GLES31.functional.shaders.builtin_functions.integer.findmsb.uvec3_lowp_compute,Fail
 dEQP-GLES31.functional.shaders.builtin_functions.integer.imulextended.ivec3_highp_fragment,Fail
 dEQP-GLES31.functional.shaders.builtin_functions.integer.umulextended.uvec3_highp_fragment,Fail
-dEQP-GLES31.functional.shaders.opaque_type_indexing.ssbo.const_expression_vertex,Fail
-dEQP-GLES31.functional.shaders.opaque_type_indexing.ssbo.const_literal_vertex,Fail
-dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.const_expression_fragment,Fail
-dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.const_expression_vertex,Fail
-dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.const_literal_fragment,Fail
-dEQP-GLES31.functional.shaders.opaque_type_indexing.ubo.const_literal_vertex,Fail
 dEQP-GLES31.functional.synchronization.in_invocation.image_alias_overwrite,Crash
 dEQP-GLES31.functional.synchronization.in_invocation.image_atomic_alias_overwrite,Crash
 dEQP-GLES31.functional.synchronization.in_invocation.image_atomic_alias_write,Crash
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 9a5d8162577..4b5bcf93447 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -361,21 +361,6 @@ pan_merge_empty_fs(struct mali_renderer_state_packed *rsd)
         pan_merge((*rsd), empty_rsd, RENDERER_STATE);
 }
 
-#if PAN_ARCH == 5
-/* Get the last blend shader, for an erratum workaround */
-
-static mali_ptr
-panfrost_last_nonnull(mali_ptr *ptrs, unsigned count)
-{
-        for (signed i = ((signed) count - 1); i >= 0; --i) {
-                if (ptrs[i])
-                        return ptrs[i];
-        }
-
-        return 0;
-}
-#endif
-
 static void
 panfrost_prepare_fs_state(struct panfrost_context *ctx,
                           mali_ptr *blend_shaders,
diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index 4208a9cb17b..4ecdf760492 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -114,23 +114,25 @@ struct pan_blit_rsd_data {
 static void
 pan_blitter_prepare_midgard_rsd(const struct panfrost_device *dev,
                                 const struct pan_image_view **rts,
-                                mali_ptr *blend_shaders, bool zs,
-                                struct MALI_RENDERER_STATE *rsd)
+                                mali_ptr *blend_shaders, unsigned rt_count,
+                                bool zs, struct MALI_RENDERER_STATE *rsd)
 {
-        mali_ptr blend_shader = blend_shaders ? blend_shaders[0] : 0;
+        mali_ptr blend_shader = blend_shaders ?
+                panfrost_last_nonnull(blend_shaders, rt_count) : 0;
 
         rsd->properties.midgard.work_register_count = 4;
         rsd->properties.midgard.force_early_z = !zs;
         rsd->stencil_mask_misc.alpha_test_compare_function = MALI_FUNC_ALWAYS;
-        if (!(dev->quirks & MIDGARD_SFBD)) {
-                rsd->sfbd_blend_shader = blend_shader;
+
+        /* Set even on v5 for erratum workaround */
+        rsd->sfbd_blend_shader = blend_shader;
+
+        if (!(dev->quirks & MIDGARD_SFBD))
                 return;
-        }
 
         rsd->stencil_mask_misc.sfbd_write_enable = true;
         rsd->stencil_mask_misc.sfbd_dither_disable = true;
         rsd->multisample_misc.sfbd_blend_shader = !!blend_shader;
-        rsd->sfbd_blend_shader = blend_shader;
         if (rsd->multisample_misc.sfbd_blend_shader)
                 return;
 
@@ -335,8 +337,8 @@ pan_blitter_emit_rsd(const struct panfrost_device *dev,
                         pan_blitter_prepare_bifrost_rsd(dev, zs, ms, &cfg);
                 } else {
                         pan_blitter_prepare_midgard_rsd(dev, rts,
-                                                        blend_shaders, zs,
-                                                        &cfg);
+                                                        blend_shaders,
+                                                        rt_count, zs, &cfg);
                 }
         }
 
diff --git a/src/panfrost/lib/pan_util.h b/src/panfrost/lib/pan_util.h
index 3fd9503a663..229c1e1bae8 100644
--- a/src/panfrost/lib/pan_util.h
+++ b/src/panfrost/lib/pan_util.h
@@ -64,4 +64,17 @@ void
 pan_pack_color(uint32_t *packed, const union pipe_color_union *color,
                enum pipe_format format, bool dithered);
 
+/* Get the last blend shader, for an erratum workaround on v5 */
+
+static inline uint64_t
+panfrost_last_nonnull(uint64_t *ptrs, unsigned count)
+{
+        for (signed i = ((signed) count - 1); i >= 0; --i) {
+                if (ptrs[i])
+                        return ptrs[i];
+        }
+
+        return 0;
+}
+
 #endif /* PAN_UTIL_H */



More information about the mesa-commit mailing list