Mesa (main): pan/bi: Fix clper_xor on Mali-G31

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 3 01:04:52 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jun  2 20:27:41 2022 -0400

pan/bi: Fix clper_xor on Mali-G31

Mali-G31 has the old CLPER instruction, not the new one, which means we don't
get to specify a custom lane op. But the clper_xor helper incorrectly checked
the arch, not the implementation quirk.

Fixes: c00e7b729fe ("pan/bi: Optimize abs(derivative)")
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reported-by: Icecream95 <ixn at disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16846>

---

 src/panfrost/bifrost/bifrost_compile.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 6386e2675d0..cb5e368cd11 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -2157,13 +2157,15 @@ bi_lower_fsincos_32(bi_builder *b, bi_index dst, bi_index s0, bool cos)
         bi_fadd_f32_to(b, dst, I->dest[0], cos ? cosx : sinx);
 }
 
-/* The XOR lane op is useful for derivative calculation, but was added in v7.
- * Add a safe helper that will do the appropriate lowering on v6 */
-
+/*
+ * The XOR lane op is useful for derivative calculations, but not all Bifrost
+ * implementations have it. Add a safe helper that uses the hardware
+ * functionality when available and lowers where unavailable.
+ */
 static bi_index
 bi_clper_xor(bi_builder *b, bi_index s0, bi_index s1)
 {
-        if (b->shader->arch >= 7) {
+        if (!(b->shader->quirks & BIFROST_LIMITED_CLPER)) {
                 return bi_clper_i32(b, s0, s1,
                                 BI_INACTIVE_RESULT_ZERO, BI_LANE_OP_XOR,
                                 BI_SUBGROUP_SUBGROUP4);



More information about the mesa-commit mailing list