}
#undef DEFINE_CASE
-#define DEFINE_CASE(name) case MALI_TEX_## name: return "MALI_TEX_" #name
-static char *
-pandecode_texture_type(enum mali_texture_type type)
-{
- switch (type) {
- DEFINE_CASE(1D);
- DEFINE_CASE(2D);
- DEFINE_CASE(3D);
- DEFINE_CASE(CUBE);
-
- default:
- unreachable("Unknown case");
- }
-}
-#undef DEFINE_CASE
-
#define DEFINE_CASE(name) case MALI_MFBD_BLOCK_## name: return "MALI_MFBD_BLOCK_" #name
static char *
pandecode_mfbd_block_format(enum mali_mfbd_block_format fmt)
union mali_attr *attr = pandecode_fetch_gpu_mem(mem, addr, sizeof(union mali_attr) * count);
- char base[128];
- snprintf(base, sizeof(base), "%s_data_%d%s", prefix, job_no, suffix);
+ pandecode_log("union mali_attr %s_%d[] = {\n", prefix, job_no);
+ pandecode_indent++;
for (int i = 0; i < count; ++i) {
+ pandecode_log("{\n");
+ pandecode_indent++;
+
enum mali_attr_mode mode = attr[i].elements & 7;
if (mode == MALI_ATTR_UNUSED)
- continue;
+ pandecode_msg("XXX: unused attribute record\n");
mali_ptr raw_elements = attr[i].elements & ~7;
-
- /* TODO: Do we maybe want to dump the attribute values
- * themselves given the specified format? Or is that too hard?
- * */
-
char *a = pointer_as_memory_reference(raw_elements);
- pandecode_log("mali_ptr %s_%d_p = %s;\n", base, i, a);
+ pandecode_prop("elements = (%s) | %s", a, pandecode_attr_mode(mode));
free(a);
- }
-
- pandecode_log("union mali_attr %s_%d[] = {\n", prefix, job_no);
- pandecode_indent++;
-
- for (int i = 0; i < count; ++i) {
- pandecode_log("{\n");
- pandecode_indent++;
- unsigned mode = attr[i].elements & 7;
- pandecode_prop("elements = (%s_%d_p) | %s", base, i, pandecode_attr_mode(mode));
pandecode_prop("shift = %d", attr[i].shift);
pandecode_prop("extra_flags = %d", attr[i].extra_flags);
pandecode_prop("stride = 0x%" PRIx32, attr[i].stride);
/* See the definiton of enum mali_texture_type */
- unsigned dimension =
- (f.type == MALI_TEX_CUBE) ? 2 : f.type;
+ bool is_cube = f.type == MALI_TEX_CUBE;
+ unsigned dimension = is_cube ? 2 : f.type;
+
+ pandecode_make_indent();
+
+ /* TODO: Are there others? */
+ bool is_zs = f.format == MALI_Z32_UNORM;
+
+ /* Recall Z/S switched the meaning of linear/tiled .. */
+ if (is_zs && f.layout == MALI_TEXTURE_LINEAR)
+ pandecode_msg("XXX: depth/stencil cannot be tiled\n");
+
+ /* Print the layout. Default is linear; a modifier can denote AFBC or
+ * u-interleaved/tiled modes */
+
+ if (f.layout == MALI_TEXTURE_AFBC)
+ pandecode_log_cont("afbc");
+ else if (f.layout == MALI_TEXTURE_TILED)
+ pandecode_log_cont(is_zs ? "linear" : "tiled");
+ else if (f.layout == MALI_TEXTURE_LINEAR)
+ pandecode_log_cont("linear");
+ else
+ pandecode_msg("XXX: invalid texture layout 0x%X\n", f.layout);
+
+ pandecode_swizzle(t->swizzle, f.format);
+ pandecode_log_cont(" ");
+
+ /* Distinguish cube/2D with modifier */
+
+ if (is_cube)
+ pandecode_log_cont("cube ");
+
+ pandecode_format_short(f.format, f.srgb);
+ pandecode_swizzle(f.swizzle, f.format);
/* All four width/height/depth/array_size dimensions are present
* regardless of the type of texture, but it is an error to have
/* Print only the dimensions that are actually there */
- pandecode_log("dim: %d", t->width + 1);
+ pandecode_log_cont(": %d", t->width + 1);
if (dimension >= 2)
pandecode_log_cont("x%u", t->height + 1);
pandecode_log_cont("\n");
- pandecode_log(".format = {\n");
- pandecode_indent++;
-
- pandecode_log(".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("layout = %" PRId32, f.layout);
-
if (f.unknown1 | f.zero) {
pandecode_msg("XXX: texture format zero tripped\n");
pandecode_prop("unknown1 = %" PRId32, f.unknown1);
pandecode_prop("unknown2 = %" PRId32, f.unknown1);
}
- pandecode_indent--;
- pandecode_log("},\n");
-
if (t->swizzle_zero) {
pandecode_msg("XXX: swizzle zero tripped\n");
pandecode_prop("swizzle_zero = %d", t->swizzle_zero);