The functions will be reused by GLX_MESA_query_renderer.

Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com>
---
 src/mesa/drivers/dri/nouveau/nouveau_driver.c | 24 ++++++++++++++++--------
 src/mesa/drivers/dri/nouveau/nouveau_driver.h |  5 +++++
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 809b5ff..4b952af 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -34,21 +34,29 @@
 
 #include "drivers/common/meta.h"
 
-static const GLubyte *
-nouveau_get_string(struct gl_context *ctx, GLenum name)
+const char const *nouveau_vendor_string = "Nouveau";
+
+const char *
+nouveau_get_renderer_string(unsigned chipset)
 {
-       static char buffer[128];
        char hardware_name[32];
+       static char buffer[128];
+
+       snprintf(hardware_name, sizeof(hardware_name), "nv%02X", chipset);
+       driGetRendererString(buffer, hardware_name, 0);
 
+       return buffer;
+}
+
+static const GLubyte *
+nouveau_get_string(struct gl_context *ctx, GLenum name)
+{
        switch (name) {
                case GL_VENDOR:
-                       return (GLubyte *)"Nouveau";
+                       return (GLubyte *)nouveau_vendor_string;
 
                case GL_RENDERER:
-                       sprintf(hardware_name, "nv%02X", context_chipset(ctx));
-                       driGetRendererString(buffer, hardware_name, 0);
-
-                       return (GLubyte *)buffer;
+                       return (GLubyte 
*)nouveau_get_renderer_string(context_chipset(ctx));
                default:
                        return NULL;
        }
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.h
index b6a8276..75d4cc7 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h
@@ -69,6 +69,11 @@ struct nouveau_driver {
 #define nouveau_error(format, ...) \
        fprintf(stderr, "%s: " format, __func__, ## __VA_ARGS__)
 
+extern const char const *nouveau_vendor_string;
+
+const char *
+nouveau_get_renderer_string(unsigned chipset);
+
 void
 nouveau_clear(struct gl_context *ctx, GLbitfield buffers);
 
-- 
1.9.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to