This just lets you specify an override like --device=bdw for
broadwell.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
Resend with 'i-g-t' in subject line.

 tools/aubdump.c        | 36 ++++++++++++++++++++++++++++++++----
 tools/intel_aubdump.in |  4 +++-
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/tools/aubdump.c b/tools/aubdump.c
index ee4d99b0..f3efb451 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -60,6 +60,24 @@ static int verbose = 0;
 static bool device_override;
 static uint32_t device;
 
+static const struct {
+       const char *name;
+       int pci_id;
+} name_map[] = {
+       { "brw", 0x2a02 },
+       { "g4x", 0x2a42 },
+       { "ilk", 0x0042 },
+       { "snb", 0x0126 },
+       { "ivb", 0x016a },
+       { "hsw", 0x0d2e },
+       { "byt", 0x0f33 },
+       { "bdw", 0x162e },
+       { "skl", 0x1912 },
+       { "kbl", 0x5912 },
+       { "cnl", 0x5a52 },
+       /* Note: also update list in intel_aubdump.in */
+};
+
 #define MAX_BO_COUNT 64 * 1024
 
 struct bo {
@@ -570,10 +588,20 @@ maybe_init(void)
                if (!strcmp(key, "verbose")) {
                        verbose = 1;
                } else if (!strcmp(key, "device")) {
-                       fail_if(sscanf(value, "%i", &device) != 1,
-                               "intel_aubdump: failed to parse device id '%s'",
-                               value);
-                       device_override = true;
+                       unsigned i;
+                       for (i = 0; i < ARRAY_SIZE(name_map); i++) {
+                               if (!strcmp(name_map[i].name, value)) {
+                                       device = name_map[i].pci_id;
+                                       device_override = true;
+                                       break;
+                               }
+                       }
+                       if (i >= ARRAY_SIZE(name_map)) {
+                               fail_if(sscanf(value, "%i", &device) != 1,
+                                       "intel_aubdump: failed to parse device 
id '%s'",
+                                       value);
+                               device_override = true;
+                       }
                } else if (!strcmp(key, "file")) {
                        filename = strdup(value);
                        files[0] = fopen(filename, "w+");
diff --git a/tools/intel_aubdump.in b/tools/intel_aubdump.in
index 977fe951..f9a92d86 100755
--- a/tools/intel_aubdump.in
+++ b/tools/intel_aubdump.in
@@ -13,7 +13,9 @@ contents and execution of the GEM application.
   -c, --command=CMD  Execute CMD and write the AUB file's content to its
                      standard input
 
-      --device=ID    Override PCI ID of the reported device
+      --device=ID    Override PCI ID of the reported device. ID may be an
+                     integer, or one of: brw, g4x, ilk, snb, ivb, hsw, byt,
+                     bdw, skl, kbl or cnl
 
   -v                 Enable verbose output
 
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to