diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2019-12-17 01:00:14 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2020-01-13 19:42:22 -0800 |
commit | 44bad9c31a11ca7bf67cba7eaa094963b5f5a2f7 (patch) | |
tree | 9740855b09c2d0d792c379d6a1cccc9b3d37d708 /src/mesa | |
parent | 50c47ba49edc525bb8bca7a95cf75d7275a21a76 (diff) |
i965: Simplify brw_get_renderer_string()
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>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index aea2baa64fe..c30f1a04f30 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -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 * |