Mesa (main): asahi/decode: Only dump mapped allocations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jul 11 18:58:29 UTC 2021


Module: Mesa
Branch: main
Commit: 9b6ca87672be842a21dfe33863c93a57b981f4e3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b6ca87672be842a21dfe33863c93a57b981f4e3

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Sat Jul 10 11:04:45 2021 -0400

asahi/decode: Only dump mapped allocations

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 at rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11815>

---

 src/asahi/lib/decode.c | 8 ++++++--
 src/asahi/lib/decode.h | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c
index 4813ba990e1..4abad19470c 100644
--- a/src/asahi/lib/decode.c
+++ b/src/asahi/lib/decode.c
@@ -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);
diff --git a/src/asahi/lib/decode.h b/src/asahi/lib/decode.h
index 836bbfc3a0f..72197fb2d41 100644
--- a/src/asahi/lib/decode.h
+++ b/src/asahi/lib/decode.h
@@ -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);
 



More information about the mesa-commit mailing list