pan/decode: Pretty-print sRGB format
We can just stick an "s" in if it's sRGB.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index 4ebab6d4..f14cc80 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -807,7 +807,7 @@
/* Maps MALI_RGBA32F to rgba32f, etc */
static void
-pandecode_format_short(enum mali_format fmt)
+pandecode_format_short(enum mali_format fmt, bool srgb)
{
/* We want a type-like format, so cut off the initial MALI_ */
char *format = pandecode_format(fmt);
@@ -819,6 +819,14 @@
for (unsigned i = 0; i < len; ++i)
lower_format[i] = tolower(format[i]);
+ /* Sanity check sRGB flag is applied to RGB, per the name */
+ if (srgb && lower_format[0] != 'r')
+ pandecode_msg("XXX: sRGB applied to non-colour format\n");
+
+ /* Just prefix with an s, so you get formats like srgba8_unorm */
+ if (srgb)
+ pandecode_log_cont("s");
+
pandecode_log_cont("%s", lower_format);
free(lower_format);
}
@@ -1525,7 +1533,7 @@
}
pandecode_make_indent();
- pandecode_format_short(attr_meta->format);
+ pandecode_format_short(attr_meta->format, false);
pandecode_log_cont(" %s_%u", prefix, attr_meta->index);
if (attr_meta->src_offset)
@@ -1799,12 +1807,11 @@
pandecode_indent++;
pandecode_log(".format = ");
- pandecode_format_short(f.format);
+ pandecode_format_short(f.format, f.srgb);
pandecode_swizzle(f.swizzle, f.format);
pandecode_log_cont(",\n");
pandecode_prop("type = %s", pandecode_texture_type(f.type));
- pandecode_prop("srgb = %" PRId32, f.srgb);
pandecode_prop("usage2 = 0x%" PRIx32, f.usage2);
if (f.unknown1) {