Mesa (master): pan/decode: Dump to a file
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 21:14:08 UTC 2020
Module: Mesa
Branch: master
Commit: c1952779d68fdaea153d762fe2d83810b346085b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1952779d68fdaea153d762fe2d83810b346085b
Author: Icecream95 <ixn at keemail.me>
Date: Thu Jan 23 10:23:17 2020 +1300
pan/decode: Dump to a file
The file name is taken from the environment variable
PANDECODE_DUMP_FILE, defaulting to pandecode.dump if it is not set.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3525>
---
src/panfrost/pandecode/common.c | 34 +++++++++++++++++++++++++++++++++-
src/panfrost/pandecode/public.h | 2 ++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/panfrost/pandecode/common.c b/src/panfrost/pandecode/common.c
index fa3ba578ab1..1c293a4f22b 100644
--- a/src/panfrost/pandecode/common.c
+++ b/src/panfrost/pandecode/common.c
@@ -31,6 +31,7 @@
#include "decode.h"
#include "util/macros.h"
+#include "util/u_debug.h"
/* Memory handling */
@@ -115,9 +116,40 @@ pointer_as_memory_reference(uint64_t ptr)
}
+static void
+pandecode_dump_file_open(void)
+{
+ if (pandecode_dump_stream)
+ return;
+
+ const char *dump_file = debug_get_option("PANDECODE_DUMP_FILE", "pandecode.dump");
+
+ printf("pandecode: dump command stream to file %s\n", dump_file);
+ pandecode_dump_stream = fopen(dump_file, "w");
+
+ if (!pandecode_dump_stream)
+ fprintf(stderr,"pandecode: failed to open command stream log file %s\n",
+ dump_file);
+}
+
+static void
+pandecode_dump_file_close(void)
+{
+ if (pandecode_dump_stream) {
+ fclose(pandecode_dump_stream);
+ pandecode_dump_stream = NULL;
+ }
+}
+
void
pandecode_initialize(void)
{
list_inithead(&mmaps.node);
- pandecode_dump_stream = stdout;
+ pandecode_dump_file_open();
+}
+
+void
+pandecode_close(void)
+{
+ pandecode_dump_file_close();
}
diff --git a/src/panfrost/pandecode/public.h b/src/panfrost/pandecode/public.h
index 89e6c3e02d4..4dcefcca1fa 100644
--- a/src/panfrost/pandecode/public.h
+++ b/src/panfrost/pandecode/public.h
@@ -44,6 +44,8 @@
void pandecode_initialize(void);
+void pandecode_close(void);
+
void
pandecode_inject_mmap(uint64_t gpu_va, void *cpu, unsigned sz, const char *name);
More information about the mesa-commit
mailing list