From: Icecream95 Date: Thu, 16 Jul 2020 04:12:13 +0000 (+1200) Subject: pan/decode: Open the dump file later X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01d60d3d7545150cd5cbdc25a69c8077562fc578;p=mesa.git 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 Part-of: --- 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;