From d2ddd4d56562d0c43e662882eca0964377dfba20 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 5 Aug 2020 19:43:58 -0400 Subject: [PATCH] pan/decode: Add helper to dump GPU structures Based on generating unpack/print. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/lib/decode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c index d3b68f2..059a74d 100644 --- a/src/panfrost/lib/decode.c +++ b/src/panfrost/lib/decode.c @@ -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. -- 2.7.4