[PATCH] intel_aubdump: Add device override names (from Mesa INTEL_DEVID_OVERRIDE)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Jordan Justen <jordan.l.justen@xxxxxxxxx>
---
 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 4392e589..788bed13 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -59,6 +59,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 {
@@ -563,10 +581,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 8bc6b19d..09dcf35f 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux