Mesa (master): pan/decode: Rotate trace files
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 21:14:08 UTC 2020
Module: Mesa
Branch: master
Commit: cf2c5a56a1bc9f14e4c84db7a08739a195156844
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf2c5a56a1bc9f14e4c84db7a08739a195156844
Author: Icecream95 <ixn at keemail.me>
Date: Thu Jan 23 10:32:18 2020 +1300
pan/decode: Rotate trace files
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3525>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3525>
---
src/gallium/drivers/panfrost/pan_context.c | 4 ++++
src/panfrost/pandecode/common.c | 24 ++++++++++++++++++++----
src/panfrost/pandecode/public.h | 2 ++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 6c4a510f955..aa28e341a20 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -52,6 +52,7 @@
#include "pan_blending.h"
#include "pan_blend_shaders.h"
#include "pan_util.h"
+#include "pandecode/decode.h"
struct midgard_tiler_descriptor
panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
@@ -1327,6 +1328,9 @@ panfrost_flush(
util_dynarray_fini(&fences);
}
+
+ if (pan_debug & PAN_DBG_TRACE)
+ pandecode_next_frame();
}
#define DEFINE_CASE(c) case PIPE_PRIM_##c: return MALI_##c;
diff --git a/src/panfrost/pandecode/common.c b/src/panfrost/pandecode/common.c
index 1c293a4f22b..f4db65126b4 100644
--- a/src/panfrost/pandecode/common.c
+++ b/src/panfrost/pandecode/common.c
@@ -116,20 +116,28 @@ pointer_as_memory_reference(uint64_t ptr)
}
+static int pandecode_dump_frame_count = 0;
+
static void
pandecode_dump_file_open(void)
{
if (pandecode_dump_stream)
return;
- const char *dump_file = debug_get_option("PANDECODE_DUMP_FILE", "pandecode.dump");
+ char buffer[1024];
+
+ /* This does a getenv every frame, so it is possible to use
+ * setenv to change the base at runtime.
+ */
+ const char *dump_file_base = debug_get_option("PANDECODE_DUMP_FILE", "pandecode.dump");
+ snprintf(buffer, sizeof(buffer), "%s.%04d", dump_file_base, pandecode_dump_frame_count);
- printf("pandecode: dump command stream to file %s\n", dump_file);
- pandecode_dump_stream = fopen(dump_file, "w");
+ printf("pandecode: dump command stream to file %s\n", buffer);
+ pandecode_dump_stream = fopen(buffer, "w");
if (!pandecode_dump_stream)
fprintf(stderr,"pandecode: failed to open command stream log file %s\n",
- dump_file);
+ buffer);
}
static void
@@ -148,6 +156,14 @@ pandecode_initialize(void)
pandecode_dump_file_open();
}
+void
+pandecode_next_frame(void)
+{
+ pandecode_dump_file_close();
+ pandecode_dump_frame_count++;
+ pandecode_dump_file_open();
+}
+
void
pandecode_close(void)
{
diff --git a/src/panfrost/pandecode/public.h b/src/panfrost/pandecode/public.h
index 4dcefcca1fa..7d684347c46 100644
--- a/src/panfrost/pandecode/public.h
+++ b/src/panfrost/pandecode/public.h
@@ -44,6 +44,8 @@
void pandecode_initialize(void);
+void pandecode_next_frame(void);
+
void pandecode_close(void);
void
More information about the mesa-commit
mailing list