Module: Mesa Branch: staging/21.2 Commit: 7dfef216bf5d30680b00eb55923f3092efb28f12 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7dfef216bf5d30680b00eb55923f3092efb28f12
Author: Alyssa Rosenzweig <[email protected]> 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 <[email protected]> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11383> (cherry picked from commit e245468eb4c8c5fa0d2be6cec0638fc3068b07fb) Conflicts: src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt src/gallium/drivers/panfrost/pan_cmdstream.c --- .pick_status.json | 2 +- .../drivers/panfrost/ci/deqp-panfrost-t860-fails.txt | 17 ----------------- src/gallium/drivers/panfrost/pan_cmdstream.c | 13 ------------- src/panfrost/lib/pan_blitter.c | 20 +++++++++++--------- src/panfrost/lib/pan_util.h | 13 +++++++++++++ 5 files changed, 25 insertions(+), 40 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 6330cf1ec50..4a8f7048785 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -265,7 +265,7 @@ "description": "panfrost: Port v5 blend shader issue to blitter", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, 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 20ff4c22a83..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,14 +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_blend_func_buffer_separate_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_blend_func_buffer_separate_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 @@ -36,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 @@ -49,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 @@ -64,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 4d3a442eac9..587f994b3a7 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -498,19 +498,6 @@ pan_merge_empty_fs(struct mali_renderer_state_packed *rsd, bool is_bifrost) pan_merge((*rsd), empty_rsd, RENDERER_STATE); } -/* 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; -} - 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 23de9d67135..e305f028b9d 100644 --- a/src/panfrost/lib/pan_blitter.c +++ b/src/panfrost/lib/pan_blitter.c @@ -113,23 +113,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; @@ -334,8 +336,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 7caa0e4cfde..03d4bbeaaf4 100644 --- a/src/panfrost/lib/pan_util.h +++ b/src/panfrost/lib/pan_util.h @@ -63,4 +63,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 */
