diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py index bb17bd53ffd..31de09c1fa2 100644 --- a/src/panfrost/lib/gen_pack.py +++ b/src/panfrost/lib/gen_pack.py @@ -166,6 +166,24 @@ __gen_unpack_padded(const uint8_t *restrict cl, uint32_t start, uint32_t end) #define pan_section_print(fp, A, S, var, indent) \\ MALI_ ## A ## _SECTION_ ## S ## _print(fp, &(var), indent) +#define mali_pixel_format_print_v6(fp, format) \\ + fprintf(fp, "%*sFormat (v6): %s%s%s %s%s%s%s\\n", indent, "", \\ + mali_format_as_str((format >> 12) & 0xFF), \\ + (format & (1 << 20)) ? " sRGB" : "", \\ + (format & (1 << 21)) ? " big-endian" : "", \\ + mali_channel_as_str(((format >> 0) & 0x7)), \\ + mali_channel_as_str(((format >> 3) & 0x7)), \\ + mali_channel_as_str(((format >> 6) & 0x7)), \\ + mali_channel_as_str(((format >> 9) & 0x7))); + +#define mali_pixel_format_print_v7(fp, format) \\ + fprintf(fp, "%*sFormat (v7): %s%s %s%s\\n", indent, "", \\ + mali_format_as_str((format >> 12) & 0xFF), \\ + (format & (1 << 20)) ? " sRGB" : "", \\ + mali_rgb_component_order_as_str((format & ((1 << 12) - 1))), \\ + (format & (1 << 21)) ? " XXX BAD BIT" : ""); + + /* From presentations, 16x16 tiles externally. Use shift for fast computation * of tile numbers. */ @@ -332,7 +350,7 @@ class Field(object): type = 'uint64_t' elif self.type == 'int': type = 'int32_t' - elif self.type in ['uint', 'padded']: + elif self.type in ['uint', 'padded', 'Pixel Format']: type = 'uint32_t' elif self.type in self.parser.structs: type = 'struct ' + self.parser.gen_prefix(safe_name(self.type.upper())) @@ -487,7 +505,7 @@ class Group(object): elif field.modifier[0] == "log2": value = "util_logbase2({})".format(value) - if field.type == "uint" or field.type == "address": + if field.type in ["uint", "address", "Pixel Format"]: s = "__gen_uint(%s, %d, %d)" % \ (value, start, end) elif field.type == "padded": @@ -561,7 +579,7 @@ class Group(object): args.append(str(fieldref.start)) args.append(str(fieldref.end)) - if field.type in set(["uint", "address"]) | self.parser.enums: + if field.type in set(["uint", "address", "Pixel Format"]) | self.parser.enums: convert = "__gen_unpack_uint" elif field.type == "int": convert = "__gen_unpack_sint" @@ -613,6 +631,9 @@ class Group(object): print(' fprintf(fp, "%*s{}: %f\\n", indent, "", {});'.format(name, val)) elif field.type == "uint" and (field.end - field.start) >= 32: print(' fprintf(fp, "%*s{}: 0x%" PRIx64 "\\n", indent, "", {});'.format(name, val)) + elif field.type == "Pixel Format": + print(' mali_pixel_format_print_v6(fp, {});'.format(val)) + print(' mali_pixel_format_print_v7(fp, {});'.format(val)) else: print(' fprintf(fp, "%*s{}: %u\\n", indent, "", {});'.format(name, val)) diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml index e7e0f6ad016..703c828fb64 100644 --- a/src/panfrost/lib/midgard.xml +++ b/src/panfrost/lib/midgard.xml @@ -462,7 +462,7 @@ - + @@ -563,7 +563,7 @@ - + @@ -708,7 +708,7 @@ - + @@ -751,7 +751,7 @@ - +