From c947a52df443dbfd06c7efeca837c14939cc09ec Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 9 Jan 2022 15:14:08 -0500 Subject: [PATCH] pan/decode: Add pandecode_dump_mappings Add a helper to dump all mapped GPU memory. This is a blunt, seldom useful instrument ... but when it /is/ useful it's your only option. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/lib/genxml/decode.h | 2 ++ src/panfrost/lib/genxml/decode_common.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/panfrost/lib/genxml/decode.h b/src/panfrost/lib/genxml/decode.h index 49bc2b1b425..bc0061b1f54 100644 --- a/src/panfrost/lib/genxml/decode.h +++ b/src/panfrost/lib/genxml/decode.h @@ -50,6 +50,8 @@ struct pandecode_mapped_memory *pandecode_find_mapped_gpu_mem_containing(uint64_ void pandecode_map_read_write(void); +void pandecode_dump_mappings(void); + static inline void * __pandecode_fetch_gpu_mem(const struct pandecode_mapped_memory *mem, uint64_t gpu_va, size_t size, diff --git a/src/panfrost/lib/genxml/decode_common.c b/src/panfrost/lib/genxml/decode_common.c index ca5384e4e63..40f32b2c935 100644 --- a/src/panfrost/lib/genxml/decode_common.c +++ b/src/panfrost/lib/genxml/decode_common.c @@ -246,6 +246,23 @@ pandecode_close(void) pandecode_dump_file_close(); } +void +pandecode_dump_mappings(void) +{ + pandecode_dump_file_open(); + + rb_tree_foreach(struct pandecode_mapped_memory, it, &mmap_tree, node) { + if (!it->addr || !it->length) + continue; + + fprintf(pandecode_dump_stream, "Buffer: %s gpu %" PRIx64 "\n\n", + it->name, it->gpu_va); + + pan_hexdump(pandecode_dump_stream, it->addr, it->length, false); + fprintf(pandecode_dump_stream, "\n"); + } +} + void pandecode_abort_on_fault_v4(mali_ptr jc_gpu_va); void pandecode_abort_on_fault_v5(mali_ptr jc_gpu_va); void pandecode_abort_on_fault_v6(mali_ptr jc_gpu_va);