panfrost: Don't pass quirks to pan_lower_framebuffer

There is a single quirk it cares about. Pass just that, so the relevant quirk
can be made a Midgard compiler quirk and not a global Panfrost quirk.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14726>
This commit is contained in:
Alyssa Rosenzweig 2022-01-25 19:14:17 -05:00 committed by Marge Bot
parent 2b699d0650
commit 2b638c1eb3
4 changed files with 15 additions and 16 deletions

View file

@ -3091,10 +3091,9 @@ midgard_compile_shader_nir(nir_shader *nir,
NIR_PASS_V(nir, nir_lower_var_copies);
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
unsigned pan_quirks = panfrost_get_quirks(inputs->gpu_id, 0);
NIR_PASS_V(nir, pan_lower_framebuffer,
inputs->rt_formats, inputs->raw_fmt_mask,
inputs->is_blend, pan_quirks);
inputs->is_blend, ctx->quirks & MIDGARD_BROKEN_BLEND_LOADS);
NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
glsl_type_size, 0);

View file

@ -28,7 +28,10 @@
* may be errata requiring a workaround, or features. We're trying to be
* quirk-positive here; quirky is the best! */
/* bit 0 unused */
/* Typed loads are broken on this Midgard GPU due to issue #10607 and #10632 and
* should use software unpacks instead.
*/
#define MIDGARD_BROKEN_BLEND_LOADS (1 << 0)
/* Whether output texture registers (normally r28/r29) overlap with work
* registers r0/r1 and input texture registers (also normally r28/r29) overlap
@ -70,6 +73,7 @@ midgard_get_quirks(unsigned gpu_id)
case 0x600:
case 0x620:
return MIDGARD_OLD_BLEND |
MIDGARD_BROKEN_BLEND_LOADS |
MIDGARD_BROKEN_LOD |
MIDGARD_NO_UPPER_ALU |
MIDGARD_NO_OOO;

View file

@ -88,17 +88,14 @@ pan_unpacked_type_for_format(const struct util_format_description *desc)
}
static bool
pan_is_format_native(const struct util_format_description *desc, unsigned quirks, bool is_store)
pan_is_format_native(const struct util_format_description *desc, bool broken_ld_special, bool is_store)
{
if (is_store)
if (is_store || broken_ld_special)
return false;
if (util_format_is_pure_integer(desc->format) || util_format_is_float(desc->format))
return false;
if (quirks & MIDGARD_NO_TYPED_BLEND_LOADS)
return false;
/* Some formats are missing as typed but have unpacks */
if (desc->format == PIPE_FORMAT_R11G11B10_FLOAT)
return false;
@ -490,8 +487,7 @@ pan_lower_fb_store(nir_shader *shader,
nir_builder *b,
nir_intrinsic_instr *intr,
const struct util_format_description *desc,
bool reorder_comps,
unsigned quirks)
bool reorder_comps)
{
/* For stores, add conversion before */
nir_ssa_def *unpacked = nir_ssa_for_src(b, intr->src[1], 4);
@ -517,7 +513,7 @@ pan_lower_fb_load(nir_shader *shader,
nir_intrinsic_instr *intr,
const struct util_format_description *desc,
bool reorder_comps,
unsigned base, int sample, unsigned quirks)
unsigned base, int sample)
{
nir_ssa_def *packed =
nir_load_raw_output_pan(b, 4, 32, pan_sample_id(b, sample),
@ -555,7 +551,7 @@ pan_lower_fb_load(nir_shader *shader,
bool
pan_lower_framebuffer(nir_shader *shader, const enum pipe_format *rt_fmts,
uint8_t raw_fmt_mask, bool is_blend, unsigned quirks)
uint8_t raw_fmt_mask, bool is_blend, bool broken_ld_special)
{
if (shader->info.stage != MESA_SHADER_FRAGMENT)
return false;
@ -594,7 +590,7 @@ pan_lower_framebuffer(nir_shader *shader, const enum pipe_format *rt_fmts,
util_format_description(rt_fmts[rt]);
/* Don't lower */
if (pan_is_format_native(desc, quirks, is_store))
if (pan_is_format_native(desc, broken_ld_special, is_store))
continue;
/* EXT_shader_framebuffer_fetch requires
@ -609,10 +605,10 @@ pan_lower_framebuffer(nir_shader *shader, const enum pipe_format *rt_fmts,
if (is_store) {
b.cursor = nir_before_instr(instr);
pan_lower_fb_store(shader, &b, intr, desc, reorder_comps, quirks);
pan_lower_fb_store(shader, &b, intr, desc, reorder_comps);
} else {
b.cursor = nir_after_instr(instr);
pan_lower_fb_load(shader, &b, intr, desc, reorder_comps, base, sample, quirks);
pan_lower_fb_load(shader, &b, intr, desc, reorder_comps, base, sample);
}
nir_instr_remove(instr);

View file

@ -35,6 +35,6 @@ nir_alu_type pan_unpacked_type_for_format(const struct util_format_description *
bool pan_lower_framebuffer(nir_shader *shader,
const enum pipe_format *rt_fmts,
uint8_t raw_fmt_mask,
bool is_blend, unsigned quirks);
bool is_blend, bool broken_ld_special);
#endif