Mesa (master): pan/decode: Open the dump file later

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 16 21:55:12 UTC 2020


Module: Mesa
Branch: master
Commit: 01d60d3d7545150cd5cbdc25a69c8077562fc578
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=01d60d3d7545150cd5cbdc25a69c8077562fc578

Author: Icecream95 <ixn at keemail.me>
Date:   Thu Jul 16 16:12:13 2020 +1200

pan/decode: Open the dump file later

Opening the dump file in pandecode_jc instead of doing it in
pandecode_next_frame avoids creating zero sized files when
applications exit.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5931>

---

 src/panfrost/pandecode/common.c | 9 +++++----
 src/panfrost/pandecode/decode.c | 2 ++
 src/panfrost/pandecode/decode.h | 2 ++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/pandecode/common.c b/src/panfrost/pandecode/common.c
index ba825cf10b6..14cb2f092c1 100644
--- a/src/panfrost/pandecode/common.c
+++ b/src/panfrost/pandecode/common.c
@@ -141,8 +141,10 @@ pointer_as_memory_reference(uint64_t ptr)
 
 static int pandecode_dump_frame_count = 0;
 
-static void
-pandecode_dump_file_open(bool force_stderr)
+static bool force_stderr = false;
+
+void
+pandecode_dump_file_open(void)
 {
         if (pandecode_dump_stream)
                 return;
@@ -177,9 +179,9 @@ pandecode_dump_file_close(void)
 void
 pandecode_initialize(bool to_stderr)
 {
+        force_stderr = to_stderr;
         mmap_table = _mesa_hash_table_u64_create(NULL);
         util_dynarray_init(&ro_mappings, NULL);
-        pandecode_dump_file_open(to_stderr);
 }
 
 void
@@ -187,7 +189,6 @@ pandecode_next_frame(void)
 {
         pandecode_dump_file_close();
         pandecode_dump_frame_count++;
-        pandecode_dump_file_open(false);
 }
 
 void
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c
index d3a0a01c882..119fcc0287f 100644
--- a/src/panfrost/pandecode/decode.c
+++ b/src/panfrost/pandecode/decode.c
@@ -3173,6 +3173,8 @@ pandecode_fragment_job(const struct pandecode_mapped_memory *mem,
 void
 pandecode_jc(mali_ptr jc_gpu_va, bool bifrost, unsigned gpu_id, bool minimal)
 {
+        pandecode_dump_file_open();
+
         struct mali_job_descriptor_header *h;
         unsigned job_descriptor_number = 0;
 
diff --git a/src/panfrost/pandecode/decode.h b/src/panfrost/pandecode/decode.h
index 0c0ea10404a..61345a2f6db 100644
--- a/src/panfrost/pandecode/decode.h
+++ b/src/panfrost/pandecode/decode.h
@@ -31,6 +31,8 @@
 
 extern FILE *pandecode_dump_stream;
 
+void pandecode_dump_file_open(void);
+
 struct pandecode_mapped_memory {
         size_t length;
         void *addr;



More information about the mesa-commit mailing list