From: Kenneth Graunke Date: Tue, 17 Dec 2019 09:00:14 +0000 (-0800) Subject: i965: Simplify brw_get_renderer_string() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44bad9c31a11ca7bf67cba7eaa094963b5f5a2f7;p=mesa.git 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 Reviewed-by: Caio Marcelo de Oliveira Filho Reviewed-by: Jordan Justen Part-of: --- 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 *