Mesa (main): pan/va: Handle force_enum differing from name

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 3 00:58:11 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Mar  2 10:42:47 2022 -0500

pan/va: Handle force_enum differing from name

Needed for secondary register width, for dual texturing.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15216>

---

 src/panfrost/bifrost/valhall/disasm.py  | 2 +-
 src/panfrost/bifrost/valhall/valhall.py | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/panfrost/bifrost/valhall/disasm.py b/src/panfrost/bifrost/valhall/disasm.py
index 0b3d81f968a..b557c349fea 100644
--- a/src/panfrost/bifrost/valhall/disasm.py
+++ b/src/panfrost/bifrost/valhall/disasm.py
@@ -159,7 +159,7 @@ va_disasm_instr(FILE *fp, uint64_t instr)
 % for mod in op.modifiers:
 % if mod.name not in ["left", "staging_register_count", "staging_register_write_count"]:
 % if mod.is_enum:
-            fputs(valhall_${safe_name(mod.name)}[(instr >> ${mod.start}) & ${hex((1 << mod.size) - 1)}], fp);
+            fputs(valhall_${safe_name(mod.enum)}[(instr >> ${mod.start}) & ${hex((1 << mod.size) - 1)}], fp);
 % else:
             if (instr & BIT(${mod.start})) fputs(".${mod.name}", fp);
 % endif
diff --git a/src/panfrost/bifrost/valhall/valhall.py b/src/panfrost/bifrost/valhall/valhall.py
index 343c9de82bd..020b2c00f35 100644
--- a/src/panfrost/bifrost/valhall/valhall.py
+++ b/src/panfrost/bifrost/valhall/valhall.py
@@ -79,16 +79,16 @@ class Modifier:
         self.size = size
         self.implied = implied
         self.is_enum = (force_enum is not None) or size > 1
+        self.enum = force_enum or name
 
         if not self.is_enum:
             self.bare_values = ['', name]
             self.default = 0
         else:
-            enum = enums[force_enum or name]
-            self.bare_values = [x.value for x in enum.values]
-            defaults = [x for x in enum.values if x.default]
+            self.bare_values = [x.value for x in enums[self.enum].values]
+            defaults = [x for x in enums[self.enum].values if x.default]
             assert(len(defaults) <= 1)
-            
+
             if len(defaults) > 0:
                 self.default = self.bare_values.index(defaults[0].value)
             else:



More information about the mesa-commit mailing list