freedreno/cffdump: add arg to filter by process name
[mesa.git] / src / freedreno / decode / cffdump.c
index a9ceacdee4e865d081c0137a1c0cc5c536283546..cd787fb43a3ee2e232853e75f9887018cae2e1e8 100644 (file)
@@ -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);