From e05889c8c99dfa489ce050143c84e32b49c53792 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Thu, 7 Jul 2022 12:26:03 +1200 Subject: [PATCH] pan/decode: Use tag bits for resource entry count Fixes crashes when decoding the blob, which sometimes uses fewer than 9 entries. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/lib/genxml/decode.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/panfrost/lib/genxml/decode.c b/src/panfrost/lib/genxml/decode.c index ffa5952323c..69d3f73048f 100644 --- a/src/panfrost/lib/genxml/decode.c +++ b/src/panfrost/lib/genxml/decode.c @@ -1205,11 +1205,10 @@ pandecode_resources(mali_ptr addr, unsigned size) static void pandecode_resource_tables(mali_ptr addr, const char *label) { - fprintf(pandecode_dump_stream, "Tag %x\n", (int) (addr & 0xF)); - addr = addr & ~0xF; + unsigned count = addr & 0x3F; + addr = addr & ~0x3F; struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(addr); - unsigned count = 9; // TODO: what is the actual count? at least 5. const uint8_t *cl = pandecode_fetch_gpu_mem(mem, addr, MALI_RESOURCE_LENGTH * count); for (unsigned i = 0; i < count; ++i) {