Mesa (main): pan/va: Allow forcing enums for 1-bit modifiers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 22:14:24 UTC 2022
Module: Mesa
Branch: main
Commit: 142ba9fea6f559fc6a218b8d0d5b712c52fa58bf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=142ba9fea6f559fc6a218b8d0d5b712c52fa58bf
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Fri Feb 25 11:51:56 2022 -0500
pan/va: Allow forcing enums for 1-bit modifiers
Ocassionally the 0 value has a meaningful value that's not meaningfully default,
so we want an enum to encode both possible states.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15182>
---
src/panfrost/bifrost/valhall/disasm.py | 8 ++++----
src/panfrost/bifrost/valhall/valhall.py | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/panfrost/bifrost/valhall/disasm.py b/src/panfrost/bifrost/valhall/disasm.py
index 99e8c9b5dee..6d0cda9cc5f 100644
--- a/src/panfrost/bifrost/valhall/disasm.py
+++ b/src/panfrost/bifrost/valhall/disasm.py
@@ -134,11 +134,11 @@ va_disasm_instr(FILE *fp, uint64_t instr)
% endif
fputs("${op.name}", fp);
% for mod in op.modifiers:
-% if mod.name not in ["left", "staging_register_count"]:
-% if mod.size == 1:
- if (instr & BIT(${mod.start})) fputs(".${mod.name}", fp);
-% else:
+% 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);
+% else:
+ if (instr & BIT(${mod.start})) fputs(".${mod.name}", fp);
% endif
% endif
% endfor
diff --git a/src/panfrost/bifrost/valhall/valhall.py b/src/panfrost/bifrost/valhall/valhall.py
index 2e740dc8cd8..8c792404270 100644
--- a/src/panfrost/bifrost/valhall/valhall.py
+++ b/src/panfrost/bifrost/valhall/valhall.py
@@ -73,17 +73,18 @@ def build_enum(el):
return Enum(el.attrib['name'], values)
class Modifier:
- def __init__(self, name, start, size, implied = False):
+ def __init__(self, name, start, size, implied = False, force_enum = None):
self.name = name
self.start = start
self.size = size
self.implied = implied
+ self.is_enum = (force_enum is not None) or size > 1
- if size == 1:
+ if not self.is_enum:
self.bare_values = ['', name]
self.default = 0
else:
- enum = enums[name]
+ 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]
assert(len(defaults) <= 1)
More information about the mesa-commit
mailing list