mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-24 11:20:44 +01:00
fd: make RD dump output path configurable through FD_RD_DUMP_PATH
Allow adjusting the location of RD dumps and trigger file through the FD_RD_DUMP_PATH environment variable. When not present, the existing defaults will be used. Signed-off-by: Zan Dobersek <zdobersek@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40532>
This commit is contained in:
parent
8c4e6aa4c0
commit
e7f6c8ab7e
3 changed files with 22 additions and 14 deletions
|
|
@ -407,9 +407,10 @@ capture from inside Mesa. Different ``FD_RD_DUMP`` options are available:
|
|||
of that many subsequent submits. Writing -1 will enable dumping of submits
|
||||
until disabled. Writing 0 (or any other value) will disable dumps.
|
||||
|
||||
Output dump files and trigger file (when enabled) are hard-coded to be placed
|
||||
under ``/tmp``, or ``/data/local/tmp`` under Android. `FD_RD_DUMP_TESTNAME` can
|
||||
be used to specify a more descriptive prefix for the output or trigger files.
|
||||
Output dump files and trigger file (when enabled) are placed under ``/tmp`` or
|
||||
``/data/local/tmp`` under Android by default, but that location can be adjusted
|
||||
through ``FD_RD_DUMP_PATH``. ``FD_RD_DUMP_TESTNAME`` can be used to specify a
|
||||
more descriptive prefix for the output or trigger files.
|
||||
|
||||
Dumping can be limited to specific ranges of frames or submits. For example,
|
||||
``FD_RD_DUMP_SUBMITS=120-140,160,165`` will dump command streams only for the
|
||||
|
|
|
|||
|
|
@ -20,12 +20,6 @@
|
|||
#include "util/u_atomic.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
static const char *fd_rd_output_base_path = "/data/local/tmp";
|
||||
#else
|
||||
static const char *fd_rd_output_base_path = "/tmp";
|
||||
#endif
|
||||
|
||||
static const struct debug_control fd_rd_dump_options[] = {
|
||||
{ "enable", FD_RD_DUMP_ENABLE },
|
||||
{ "combine", FD_RD_DUMP_COMBINE },
|
||||
|
|
@ -52,6 +46,18 @@ fd_rd_dump_env_init_once(void)
|
|||
*/
|
||||
if (fd_rd_dump_env.flags & ~FD_RD_DUMP_ENABLE)
|
||||
fd_rd_dump_env.flags |= FD_RD_DUMP_ENABLE;
|
||||
|
||||
const char *output_path_value = os_get_option("FD_RD_DUMP_PATH");
|
||||
if (!output_path_value) {
|
||||
output_path_value =
|
||||
#if DETECT_OS_ANDROID
|
||||
"/data/local/tmp";
|
||||
#else
|
||||
"/tmp";
|
||||
#endif
|
||||
}
|
||||
snprintf(fd_rd_dump_env.output_path, sizeof(fd_rd_dump_env.output_path),
|
||||
"%s", output_path_value);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -172,14 +178,14 @@ fd_rd_output_init(struct fd_rd_output *output, const char* output_name)
|
|||
|
||||
char file_path[PATH_MAX];
|
||||
snprintf(file_path, sizeof(file_path), "%s/%s_combined.rd.gz",
|
||||
fd_rd_output_base_path, output->name);
|
||||
fd_rd_dump_env.output_path, output->name);
|
||||
output->file = gzopen(file_path, "w");
|
||||
}
|
||||
|
||||
if (FD_RD_DUMP(TRIGGER)) {
|
||||
char file_path[PATH_MAX];
|
||||
snprintf(file_path, sizeof(file_path), "%s/%s_trigger",
|
||||
fd_rd_output_base_path, output->name);
|
||||
fd_rd_dump_env.output_path, output->name);
|
||||
output->trigger_fd = open(file_path, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +211,7 @@ fd_rd_output_fini(struct fd_rd_output *output)
|
|||
*/
|
||||
char file_path[PATH_MAX];
|
||||
snprintf(file_path, sizeof(file_path), "%s/%s_trigger",
|
||||
fd_rd_output_base_path, output->name);
|
||||
fd_rd_dump_env.output_path, output->name);
|
||||
unlink(file_path);
|
||||
}
|
||||
|
||||
|
|
@ -302,10 +308,10 @@ fd_rd_output_begin(struct fd_rd_output *output, uint32_t frame, uint32_t submit)
|
|||
char file_path[PATH_MAX];
|
||||
if (frame != UINT_MAX) {
|
||||
snprintf(file_path, sizeof(file_path), "%s/%s_frame%.5d_submit%.5d.rd",
|
||||
fd_rd_output_base_path, output->name, frame, submit);
|
||||
fd_rd_dump_env.output_path, output->name, frame, submit);
|
||||
} else {
|
||||
snprintf(file_path, sizeof(file_path), "%s/%s_submit%.5d.rd",
|
||||
fd_rd_output_base_path, output->name, submit);
|
||||
fd_rd_dump_env.output_path, output->name, submit);
|
||||
}
|
||||
output->file = gzopen(file_path, "w");
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ enum fd_rd_dump_flags {
|
|||
|
||||
struct fd_rd_dump_env {
|
||||
uint32_t flags;
|
||||
char output_path[PATH_MAX];
|
||||
};
|
||||
|
||||
extern struct fd_rd_dump_env fd_rd_dump_env;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue