From 339f36fc5e841d751e81127da39e5679a88c738f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2013 16:27:01 -0800 Subject: [PATCH] i915: Refactor the renderer string creation out of intelGetString This will soon be used in intel_screen.c from a function that doesn't have a gl_context. Signed-off-by: Ian Romanick Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i915/intel_context.c | 34 ++++++++++++++--------- src/mesa/drivers/dri/i915/intel_context.h | 2 ++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 420ab2a0c47..baa8b6e1085 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -62,29 +62,37 @@ int INTEL_DEBUG = (0); const char *const i915_vendor_string = "Intel Open Source Technology Center"; +const char * +i915_get_renderer_string(unsigned deviceID) +{ + const char *chipset; + static char buffer[128]; + + switch (deviceID) { +#undef CHIPSET +#define CHIPSET(id, symbol, str) case id: chipset = str; break; +#include "pci_ids/i915_pci_ids.h" + default: + chipset = "Unknown Intel Chipset"; + break; + } + + (void) driGetRendererString(buffer, chipset, 0); + return buffer; +} + static const GLubyte * intelGetString(struct gl_context * ctx, GLenum name) { const struct intel_context *const intel = intel_context(ctx); - const char *chipset; - static char buffer[128]; switch (name) { case GL_VENDOR: return (GLubyte *) i915_vendor_string; case GL_RENDERER: - switch (intel->intelScreen->deviceID) { -#undef CHIPSET -#define CHIPSET(id, symbol, str) case id: chipset = str; break; -#include "pci_ids/i915_pci_ids.h" - default: - chipset = "Unknown Intel Chipset"; - break; - } - - (void) driGetRendererString(buffer, chipset, 0); - return (GLubyte *) buffer; + return + (GLubyte *) i915_get_renderer_string(intel->intelScreen->deviceID); default: return NULL; diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index e386e46782e..e488ed1a677 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -395,6 +395,8 @@ extern int INTEL_DEBUG; extern const char *const i915_vendor_string; +extern const char *i915_get_renderer_string(unsigned deviceID); + extern bool intelInitContext(struct intel_context *intel, int api, unsigned major_version, -- 2.30.2