Mesa (main): panfrost: Add "hex" type to GenXML
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Dec 6 21:18:32 UTC 2021
Module: Mesa
Branch: main
Commit: 6eb0770be8fb55a8f57b2ec65a56b5aa33bd0211
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6eb0770be8fb55a8f57b2ec65a56b5aa33bd0211
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Thu Nov 18 22:41:22 2021 -0500
panfrost: Add "hex" type to GenXML
Although known fields wouldn't be given the type "hex", it is useful as
the default type for unknown fields while reverse-engineering, and as
such is used in the Valhall XML.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14063>
---
src/panfrost/lib/genxml/gen_pack.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/panfrost/lib/genxml/gen_pack.py b/src/panfrost/lib/genxml/gen_pack.py
index bd57ee462f0..93464525fb3 100644
--- a/src/panfrost/lib/genxml/gen_pack.py
+++ b/src/panfrost/lib/genxml/gen_pack.py
@@ -370,11 +370,11 @@ class Field(object):
type = 'bool'
elif self.type == 'float':
type = 'float'
- elif self.type == 'uint' and self.end - self.start > 32:
+ elif self.type in ['uint', 'hex'] and self.end - self.start > 32:
type = 'uint64_t'
elif self.type == 'int':
type = 'int32_t'
- elif self.type in ['uint', 'uint/float', 'padded', 'Pixel Format']:
+ elif self.type in ['uint', 'hex', 'uint/float', 'padded', 'Pixel Format']:
type = 'uint32_t'
elif self.type in self.parser.structs:
type = 'struct ' + self.parser.gen_prefix(safe_name(self.type.upper()))
@@ -530,7 +530,7 @@ class Group(object):
elif field.modifier[0] == "log2":
value = "util_logbase2({})".format(value)
- if field.type in ["uint", "uint/float", "address", "Pixel Format"]:
+ if field.type in ["uint", "hex", "uint/float", "address", "Pixel Format"]:
s = "__gen_uint(%s, %d, %d)" % \
(value, start, end)
elif field.type == "padded":
@@ -604,7 +604,7 @@ class Group(object):
args.append(str(fieldref.start))
args.append(str(fieldref.end))
- if field.type in set(["uint", "uint/float", "address", "Pixel Format"]):
+ if field.type in set(["uint", "hex", "uint/float", "address", "Pixel Format"]):
convert = "__gen_unpack_uint"
elif field.type in self.parser.enums:
convert = "(enum %s)__gen_unpack_uint" % enum_name(field.type)
@@ -656,8 +656,10 @@ class Group(object):
print(' fprintf(fp, "%*s{}: %s\\n", indent, "", {} ? "true" : "false");'.format(name, val))
elif field.type == "float":
print(' fprintf(fp, "%*s{}: %f\\n", indent, "", {});'.format(name, val))
- elif field.type == "uint" and (field.end - field.start) >= 32:
+ elif field.type in ["uint", "hex"] and (field.end - field.start) >= 32:
print(' fprintf(fp, "%*s{}: 0x%" PRIx64 "\\n", indent, "", {});'.format(name, val))
+ elif field.type == "hex":
+ print(' fprintf(fp, "%*s{}: 0x%x\\n", indent, "", {});'.format(name, val))
elif field.type == "uint/float":
print(' fprintf(fp, "%*s{}: 0x%X (%f)\\n", indent, "", {}, uif({}));'.format(name, val, val))
elif field.type == "Pixel Format":
More information about the mesa-commit
mailing list