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 <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2013-02-14 16:27:01 -08:00
parent 18291251ec
commit 339f36fc5e
2 changed files with 23 additions and 13 deletions

View File

@@ -62,19 +62,13 @@ int INTEL_DEBUG = (0);
const char *const i915_vendor_string = "Intel Open Source Technology Center"; const char *const i915_vendor_string = "Intel Open Source Technology Center";
static const GLubyte * const char *
intelGetString(struct gl_context * ctx, GLenum name) i915_get_renderer_string(unsigned deviceID)
{ {
const struct intel_context *const intel = intel_context(ctx);
const char *chipset; const char *chipset;
static char buffer[128]; static char buffer[128];
switch (name) { switch (deviceID) {
case GL_VENDOR:
return (GLubyte *) i915_vendor_string;
case GL_RENDERER:
switch (intel->intelScreen->deviceID) {
#undef CHIPSET #undef CHIPSET
#define CHIPSET(id, symbol, str) case id: chipset = str; break; #define CHIPSET(id, symbol, str) case id: chipset = str; break;
#include "pci_ids/i915_pci_ids.h" #include "pci_ids/i915_pci_ids.h"
@@ -84,7 +78,21 @@ intelGetString(struct gl_context * ctx, GLenum name)
} }
(void) driGetRendererString(buffer, chipset, 0); (void) driGetRendererString(buffer, chipset, 0);
return (GLubyte *) buffer; return buffer;
}
static const GLubyte *
intelGetString(struct gl_context * ctx, GLenum name)
{
const struct intel_context *const intel = intel_context(ctx);
switch (name) {
case GL_VENDOR:
return (GLubyte *) i915_vendor_string;
case GL_RENDERER:
return
(GLubyte *) i915_get_renderer_string(intel->intelScreen->deviceID);
default: default:
return NULL; return NULL;

View File

@@ -395,6 +395,8 @@ extern int INTEL_DEBUG;
extern const char *const i915_vendor_string; extern const char *const i915_vendor_string;
extern const char *i915_get_renderer_string(unsigned deviceID);
extern bool intelInitContext(struct intel_context *intel, extern bool intelInitContext(struct intel_context *intel,
int api, int api,
unsigned major_version, unsigned major_version,