pan/decode: Add helper to dump GPU structures
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 5 Aug 2020 23:43:58 +0000 (19:43 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 13 Aug 2020 06:55:15 +0000 (08:55 +0200)
Based on generating unpack/print.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6195>

src/panfrost/lib/decode.c

index d3b68f29fa900a7895fc091bb690505d6b99bf17..059a74d24aa9372337e837a6570b874da53c5ce1 100644 (file)
@@ -57,6 +57,19 @@ static void pandecode_swizzle(unsigned swizzle, enum mali_format format);
         } \
 }
 
+#define DUMP_CL(title, T, cl, indent) {\
+        fprintf(pandecode_dump_stream, "%s\n", title); \
+        struct MALI_ ## T temp; \
+        MALI_ ## T ## _unpack((const uint8_t *) cl, &temp); \
+        MALI_ ## T ## _print(pandecode_dump_stream, &temp, 0); \
+}
+
+#define DUMP_ADDR(title, T, addr, indent) {\
+        struct pandecode_mapped_memory *mapped_mem = pandecode_find_mapped_gpu_mem_containing(addr); \
+        const uint8_t *cl = pandecode_fetch_gpu_mem(mapped_mem, addr, MALI_ ## T ## _LENGTH); \
+        DUMP_CL(title, T, cl, indent); \
+}
+
 FILE *pandecode_dump_stream;
 
 /* Semantic logging type.