diff --git a/src/panfrost/lib/genxml/gen_pack.py b/src/panfrost/lib/genxml/gen_pack.py index 4d48284fa82..e14f3035a72 100644 --- a/src/panfrost/lib/genxml/gen_pack.py +++ b/src/panfrost/lib/genxml/gen_pack.py @@ -173,6 +173,17 @@ static inline void pan_merge_helper(uint32_t *dst, const uint32_t *src, size_t b #define pan_merge(packed1, packed2, type) \ pan_merge_helper((packed1).opaque, (packed2).opaque, pan_size(type)) +static inline const char *mali_component_swizzle(unsigned val) { + static const char swiz_name[] = "RGBA01??"; + static char out_str[5], *outp; + outp = out_str; + for (int i = 0; i < 12; i += 3) { + *outp++ = swiz_name[(val >> i) & 7]; + } + *outp = 0; + return out_str; +} + /* From presentations, 16x16 tiles externally. Use shift for fast computation * of tile numbers. */ @@ -354,7 +365,7 @@ class Field(object): type = 'uint64_t' elif self.type == 'int': type = 'int32_t' - elif self.type in ['uint', 'hex', 'uint/float', 'padded', 'Pixel Format']: + elif self.type in ['uint', 'hex', 'uint/float', 'padded', 'Pixel Format', 'Component Swizzle']: type = 'uint32_t' elif self.type in self.parser.structs: type = 'struct ' + self.parser.gen_prefix(safe_name(self.type.upper())) @@ -505,7 +516,7 @@ class Group(object): elif field.modifier[0] == "log2": value = "util_logbase2({})".format(value) - if field.type in ["uint", "hex", "uint/float", "address", "Pixel Format"]: + if field.type in ["uint", "hex", "uint/float", "address", "Pixel Format", "Component Swizzle"]: s = "util_bitpack_uint(%s, %d, %d)" % \ (value, start, end) elif field.type == "padded": @@ -587,7 +598,7 @@ class Group(object): args.append(str(fieldref.start)) args.append(str(fieldref.end)) - if field.type in set(["uint", "hex", "uint/float", "address", "Pixel Format"]): + if field.type in set(["uint", "hex", "uint/float", "address", "Pixel Format", "Component Swizzle"]): convert = "__gen_unpack_uint" elif field.type in self.parser.enums: convert = "(enum %s)__gen_unpack_uint" % enum_name(field.type) @@ -651,6 +662,8 @@ class Group(object): print(' fprintf(fp, "%*s{}: 0x%X (%f)\\n", indent, "", {}, uif({}));'.format(name, val, val)) elif field.type == "Pixel Format": print(' mali_pixel_format_print(fp, {});'.format(val)) + elif field.type == "Component Swizzle": + print(' fprintf(fp, "%*s{}: %u (%s)\\n", indent, "", {}, mali_component_swizzle({}));'.format(name, val, val)) else: print(' fprintf(fp, "%*s{}: %u\\n", indent, "", {});'.format(name, val)) diff --git a/src/panfrost/lib/genxml/v10.xml b/src/panfrost/lib/genxml/v10.xml index 2530d8668ed..52206d1a470 100644 --- a/src/panfrost/lib/genxml/v10.xml +++ b/src/panfrost/lib/genxml/v10.xml @@ -1282,7 +1282,7 @@ - + @@ -1628,7 +1628,7 @@ - + diff --git a/src/panfrost/lib/genxml/v6.xml b/src/panfrost/lib/genxml/v6.xml index 86622677991..75f37eec17c 100644 --- a/src/panfrost/lib/genxml/v6.xml +++ b/src/panfrost/lib/genxml/v6.xml @@ -664,7 +664,7 @@ - + @@ -1080,7 +1080,7 @@ - + diff --git a/src/panfrost/lib/genxml/v7.xml b/src/panfrost/lib/genxml/v7.xml index da560d2733a..66af047d4a4 100644 --- a/src/panfrost/lib/genxml/v7.xml +++ b/src/panfrost/lib/genxml/v7.xml @@ -728,7 +728,7 @@ - + @@ -1168,7 +1168,7 @@ - + diff --git a/src/panfrost/lib/genxml/v9.xml b/src/panfrost/lib/genxml/v9.xml index 33bf05b3a7e..ca43a43e720 100644 --- a/src/panfrost/lib/genxml/v9.xml +++ b/src/panfrost/lib/genxml/v9.xml @@ -819,7 +819,7 @@ - + @@ -1157,7 +1157,7 @@ - +