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@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11383>
This commit is contained in:
Alyssa Rosenzweig 2021-08-23 14:06:41 -04:00 committed by Marge Bot
parent 3113dbd837
commit e245468eb4
4 changed files with 24 additions and 39 deletions

View File

@ -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

View File

@ -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,

View File

@ -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);
}
}

View File

@ -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 */