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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5931>
This commit is contained in:
Icecream95 2020-07-16 16:12:13 +12:00 committed by Marge Bot
parent 4dcbad476e
commit 01d60d3d75
3 changed files with 9 additions and 4 deletions

View 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

View 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;

View 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;