pan/decode: Open the dump file later
authorIcecream95 <ixn@keemail.me>
Thu, 16 Jul 2020 04:12:13 +0000 (16:12 +1200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 16 Jul 2020 21:33:13 +0000 (21:33 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5931>

src/panfrost/pandecode/common.c
src/panfrost/pandecode/decode.c
src/panfrost/pandecode/decode.h

index ba825cf10b63a797256e3929f73d154dff8b9be4..14cb2f092c1c689d5a607a34ad030661baf99982 100644 (file)
@@ -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
index d3a0a01c882234f69a7d10c91da3906c79a437ee..119fcc0287ff64f093c8fdc57b33e44c8d276914 100644 (file)
@@ -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;
 
index 0c0ea10404a0de3f8b23149186e9fc5269c168d9..61345a2f6db494c515b053a221bcbca2a3c15340 100644 (file)
@@ -31,6 +31,8 @@
 
 extern FILE *pandecode_dump_stream;
 
+void pandecode_dump_file_open(void);
+
 struct pandecode_mapped_memory {
         size_t length;
         void *addr;