Mesa (master): intel/tools: Use gen_device_name_to_pci_device_id in aubinator

Jordan Justen jljusten at kemper.freedesktop.org
Tue Feb 27 19:17:38 UTC 2018


Module: Mesa
Branch: master
Commit: 9f223d860b6fed0ae296bcd1b8ae14dca66a7986
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f223d860b6fed0ae296bcd1b8ae14dca66a7986

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Fri Feb  9 19:06:43 2018 -0800

intel/tools: Use gen_device_name_to_pci_device_id in aubinator

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Scott D Phillips <scott.d.phillips at intel.com>

---

 src/intel/tools/aubinator.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 92aa208a61..77bad29051 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -549,22 +549,6 @@ int main(int argc, char *argv[])
    struct aub_file *file;
    int c, i;
    bool help = false, pager = true;
-   const struct {
-      const char *name;
-      int pci_id;
-   } gens[] = {
-      { "ilk", 0x0046 }, /* Intel(R) Ironlake Mobile */
-      { "snb", 0x0126 }, /* Intel(R) Sandybridge Mobile GT2 */
-      { "ivb", 0x0166 }, /* Intel(R) Ivybridge Mobile GT2 */
-      { "hsw", 0x0416 }, /* Intel(R) Haswell Mobile GT2 */
-      { "byt", 0x0155 }, /* Intel(R) Bay Trail */
-      { "bdw", 0x1616 }, /* Intel(R) HD Graphics 5500 (Broadwell GT2) */
-      { "chv", 0x22B3 }, /* Intel(R) HD Graphics (Cherryview) */
-      { "skl", 0x1912 }, /* Intel(R) HD Graphics 530 (Skylake GT2) */
-      { "kbl", 0x591D }, /* Intel(R) Kabylake GT2 */
-      { "bxt", 0x0A84 },  /* Intel(R) HD Graphics (Broxton) */
-      { "cnl", 0x5A52 },  /* Intel(R) HD Graphics (Cannonlake) */
-   };
    const struct option aubinator_opts[] = {
       { "help",       no_argument,       (int *) &help,                 true },
       { "no-pager",   no_argument,       (int *) &pager,                false },
@@ -581,19 +565,17 @@ int main(int argc, char *argv[])
    i = 0;
    while ((c = getopt_long(argc, argv, "", aubinator_opts, &i)) != -1) {
       switch (c) {
-      case 'g':
-         for (i = 0; i < ARRAY_SIZE(gens); i++) {
-            if (!strcmp(optarg, gens[i].name)) {
-               pci_id = gens[i].pci_id;
-               break;
-            }
-         }
-         if (i == ARRAY_SIZE(gens)) {
+      case 'g': {
+         const int id = gen_device_name_to_pci_device_id(optarg);
+         if (id < 0) {
             fprintf(stderr, "can't parse gen: '%s', expected ivb, byt, hsw, "
                                    "bdw, chv, skl, kbl or bxt\n", optarg);
             exit(EXIT_FAILURE);
+         } else {
+            pci_id = id;
          }
          break;
+      }
       case 'c':
          if (optarg == NULL || strcmp(optarg, "always") == 0)
             option_color = COLOR_ALWAYS;




More information about the mesa-commit mailing list