Mesa (main): panfrost: Don't pass quirks to pan_lower_framebuffer
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jan 28 18:03:03 UTC 2022
Module: Mesa
Branch: main
Commit: 2b638c1eb347c645868b87b192763e4664bbe783
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b638c1eb347c645868b87b192763e4664bbe783
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Tue Jan 25 19:14:17 2022 -0500
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 at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14726>
---
src/panfrost/midgard/midgard_compile.c | 3 +--
src/panfrost/midgard/midgard_quirks.h | 6 +++++-
src/panfrost/util/pan_lower_framebuffer.c | 20 ++++++++------------
src/panfrost/util/pan_lower_framebuffer.h | 2 +-
4 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 78afc09bde7..1caac7e948f 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -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);
diff --git a/src/panfrost/midgard/midgard_quirks.h b/src/panfrost/midgard/midgard_quirks.h
index 70d46f49804..3e7c2a0280e 100644
--- a/src/panfrost/midgard/midgard_quirks.h
+++ b/src/panfrost/midgard/midgard_quirks.h
@@ -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;
diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c
index 6baa9189b58..01d28de666b 100644
--- a/src/panfrost/util/pan_lower_framebuffer.c
+++ b/src/panfrost/util/pan_lower_framebuffer.c
@@ -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);
diff --git a/src/panfrost/util/pan_lower_framebuffer.h b/src/panfrost/util/pan_lower_framebuffer.h
index 23230b648d3..aab8e4bcdef 100644
--- a/src/panfrost/util/pan_lower_framebuffer.h
+++ b/src/panfrost/util/pan_lower_framebuffer.h
@@ -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
More information about the mesa-commit
mailing list