asahi/decode: Only dump mapped allocations
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 10 Jul 2021 15:04:45 +0000 (11:04 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 10 Jul 2021 15:04:45 +0000 (11:04 -0400)
This matches the hardware's view of memory and helps catch spurious reads. (One
symptom of messing this up -- besides broken rendering -- is a kernel warning
about a "bogus texture handle 0".)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11815>

src/asahi/lib/decode.c
src/asahi/lib/decode.h

index 4813ba9..4abad19 100644 (file)
@@ -426,12 +426,16 @@ agxdecode_cmdstream(unsigned cmdbuf_handle, unsigned map_handle, bool verbose)
 }
 
 void
-agxdecode_dump_mappings(void)
+agxdecode_dump_mappings(unsigned map_handle)
 {
    agxdecode_dump_file_open();
 
+   struct agx_bo *map = agxdecode_find_handle(map_handle, AGX_ALLOC_MEMMAP);
+   assert(map != NULL && "nonexistant mapping");
+   agxdecode_validate_map(map->ptr.cpu);
+
    for (unsigned i = 0; i < mmap_count; ++i) {
-      if (!mmap_array[i].ptr.cpu || !mmap_array[i].size)
+      if (!mmap_array[i].ptr.cpu || !mmap_array[i].size || !mmap_array[i].mapped)
          continue;
 
       assert(mmap_array[i].type < AGX_NUM_ALLOC);
index 836bbfc..72197fb 100644 (file)
@@ -38,7 +38,7 @@ void agxdecode_dump_file_open(void);
 
 void agxdecode_track_alloc(struct agx_bo *alloc);
 
-void agxdecode_dump_mappings(void);
+void agxdecode_dump_mappings(unsigned map_index);
 
 void agxdecode_track_free(struct agx_bo *bo);