pan/genxml: use process name to distinguish CS dumps

Android has to enable dumping globally. There's no per app based env
var at runtime since most apps just fork from Zygote process. So we have
to add process name to the dump file name. Now with pandecode.dump as
the base name, it'll be like below on Android:
- pandecode.dump.com.example.VkCube.ctx-*
- pandecode.dump.com.google.android.apps.nexuslauncher.ctx-*

This can be generally useful on Linux as well when debugging different
things to avoid accidentally touching existing dumps.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37729>
This commit is contained in:
Yiwei Zhang 2025-10-06 14:11:57 -07:00 committed by Marge Bot
parent 55bc8319fd
commit 55c355c572

View file

@ -35,6 +35,7 @@
#include "util/macros.h"
#include "util/u_debug.h"
#include "util/u_hexdump.h"
#include "util/u_process.h"
#include "decode.h"
#include "compiler/bifrost/disassemble.h"
@ -260,8 +261,8 @@ pandecode_dump_file_open(struct pandecode_context *ctx)
ctx->dump_stream = stderr;
else if (!ctx->dump_stream) {
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%s.ctx-%d.%04d", dump_file_base,
ctx->id, ctx->dump_frame_count);
snprintf(buffer, sizeof(buffer), "%s.%s.ctx-%d.%04d", dump_file_base,
util_get_process_name(), ctx->id, ctx->dump_frame_count);
mesa_logd("pandecode: dump command stream to file %s", buffer);
ctx->dump_stream = fopen(buffer, "w");
if (!ctx->dump_stream) {