i965: Simplify brw_get_renderer_string()
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 17 Dec 2019 09:00:14 +0000 (01:00 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 14 Jan 2020 03:42:22 +0000 (19:42 -0800)
This stops using driGetRendererString() in favor of a simple snprintf().
This should have the same functionality on 64-bit systems, but drops
a "x86/MMX/SSE2" suffix on 32-bit systems.  (People shouldn't be using
the GL_RENDERER string to check for CPU features...)

We also use gen_get_device_name() instead of PCI ID list munging.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3371>

src/mesa/drivers/dri/i965/brw_context.c

index aea2baa64fe98811cf0acf237eb05ef031f5470f..c30f1a04f30f7f8f8406fe1e854ea54394f0ac07 100644 (file)
@@ -103,32 +103,22 @@ get_bsw_model(const struct intel_screen *screen)
 const char *
 brw_get_renderer_string(const struct intel_screen *screen)
 {
-   const char *chipset;
-   static char buffer[128];
-   char *bsw = NULL;
-
-   switch (screen->deviceID) {
-#undef CHIPSET
-#define CHIPSET(id, symbol, str) case id: chipset = str; break;
-#include "pci_ids/i965_pci_ids.h"
-   default:
-      chipset = "Unknown Intel Chipset";
-      break;
-   }
+   static char buf[128];
+   const char *name = gen_get_device_name(screen->deviceID);
+
+   if (!name)
+      name = "Intel Unknown";
+
+   snprintf(buf, sizeof(buf), "Mesa DRI %s", name);
 
    /* Braswell branding is funny, so we have to fix it up here */
    if (screen->deviceID == 0x22B1) {
-      bsw = strdup(chipset);
-      char *needle = strstr(bsw, "XXX");
-      if (needle) {
+      char *needle = strstr(buf, "XXX");
+      if (needle)
          memcpy(needle, get_bsw_model(screen), 3);
-         chipset = bsw;
-      }
    }
 
-   (void) driGetRendererString(buffer, chipset, 0);
-   free(bsw);
-   return buffer;
+   return buf;
 }
 
 static const GLubyte *