From 4de027d6bf018912747d37316fe7521bd36c1ac8 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 20 Aug 2020 11:13:32 -0700 Subject: [PATCH] freedreno/cffdump: add arg to filter by process name Usueful when you have a cmdstream trace which consists of multiple different processes. Signed-off-by: Rob Clark Part-of: --- src/freedreno/decode/cffdump.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/freedreno/decode/cffdump.c b/src/freedreno/decode/cffdump.c index a9ceacdee4e..cd787fb43a3 100644 --- a/src/freedreno/decode/cffdump.c +++ b/src/freedreno/decode/cffdump.c @@ -58,6 +58,7 @@ static bool is_blob = false; static int show_comp = false; static int interactive; static int vertices; +static const char *exename; static int handle_file(const char *filename, int start, int end, int draw); @@ -81,6 +82,7 @@ static void print_usage(const char *name) "\t-E, --end=N - stop decoding after frame N\n" "\t-F, --frame=N - decode only frame N\n" "\t-D, --draw=N - decode only draw N\n" + "\t-e, --exe=NAME - only decode cmdstream from named process\n" "\t--textures - dump texture contents (if possible)\n" "\t-L, --script=LUA - run specified lua script to analyze state\n" "\t-q, --query=REG - query mode, dump only specified query registers on\n" @@ -132,6 +134,7 @@ static const struct option opts[] = { { "end", required_argument, 0, 'E' }, { "frame", required_argument, 0, 'F' }, { "draw", required_argument, 0, 'D' }, + { "exe", required_argument, 0, 'e' }, { "script", required_argument, 0, 'L' }, { "query", required_argument, 0, 'q' }, { "help", no_argument, 0, 'h' }, @@ -148,7 +151,7 @@ int main(int argc, char **argv) options.color = interactive; - while ((c = getopt_long(argc, argv, "vsaS:E:F:D:L:q:h", opts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "vsaS:E:F:D:e:L:q:h", opts, NULL)) != -1) { switch (c) { case 0: /* option that set a flag, nothing to do */ @@ -174,6 +177,9 @@ int main(int argc, char **argv) case 'D': draw = atoi(optarg); break; + case 'e': + exename = optarg; + break; case 'L': options.script = optarg; if (script_load(options.script)) { @@ -306,7 +312,9 @@ static int handle_file(const char *filename, int start, int end, int draw) is_blob = true; printl(2, "cmd: %s\n", (char *)buf); skip = false; - if (!show_comp) { + if (exename) { + skip |= (strstr(buf, exename) != buf); + } else if (!show_comp) { skip |= (strstr(buf, "fdperf") == buf); skip |= (strstr(buf, "chrome") == buf); skip |= (strstr(buf, "surfaceflinger") == buf); -- 2.30.2