diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-02-22 09:30:35 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-02-22 09:30:35 +0000 |
commit | 75620c712f0c4aa5f59ebcf3a88f798af6af6f57 (patch) | |
tree | 6c7d9e250bf1b35ef23809673021b277ea731071 /dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c | |
parent | faa4cb8a1ef3c84f1956c6c777f9e5e4addbe0e7 (diff) |
Backport support for GLX_MESA_query_renderer for non Intel drivers.
This is desirable as the chromium port now uses this extension to
obtain pci vendor/device ids for use in feature/extension blacklists.
Prompted by a mail from byrnet@, tested on r600g by krw@
The newly added os_get_total_physical_memory() was passing the length of
a pointer rather than the type which made the sysctl call fail on
non 64 bit archs. And it was passing the wrong pointer for the result.
Fixes for these problems have been submitted back upstream.
Diffstat (limited to 'dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c')
-rw-r--r-- | dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c index 54db9d549..06b606e8a 100644 --- a/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/dist/Mesa/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -70,44 +70,47 @@ static const char* get_chip_family_name(int chip_family) } } +const char const *radeonVendorString = "Mesa Project"; -/* Return various strings for glGetString(). +/* Return complete renderer string. */ -static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name) +const char *radeonGetRendererString(radeonScreenPtr radeonScreen) { - radeonContextPtr radeon = RADEON_CONTEXT(ctx); static char buffer[128]; + char hardwarename[32]; - switch (name) { - case GL_VENDOR: - return (GLubyte *) "Mesa Project"; - - case GL_RENDERER: - { - unsigned offset; - GLuint agp_mode = (radeon->radeonScreen->card_type==RADEON_CARD_PCI) ? 0 : - radeon->radeonScreen->AGPMode; - char hardwarename[32]; + GLuint agp_mode = (radeonScreen->card_type==RADEON_CARD_PCI) ? 0 : + radeonScreen->AGPMode; - sprintf(hardwarename, "%s (%s %04X)", + snprintf(hardwarename, sizeof(hardwarename), "%s (%s %04X)", #if defined(RADEON_R100) - "R100", + "R100", #elif defined(RADEON_R200) - "R200", + "R200", #endif - get_chip_family_name(radeon->radeonScreen->chip_family), - radeon->radeonScreen->device_id); + get_chip_family_name(radeonScreen->chip_family), + radeonScreen->device_id); - offset = driGetRendererString(buffer, hardwarename, agp_mode); + driGetRendererString(buffer, hardwarename, agp_mode); - sprintf(&buffer[offset], " %sTCL", - !(radeon->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE) - ? "" : "NO-"); + strcat(buffer, " DRI2"); - strcat(buffer, " DRI2"); + return buffer; +} - return (GLubyte *) buffer; - } + +/* Return various strings for glGetString(). + */ +static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name) +{ + radeonContextPtr radeon = RADEON_CONTEXT(ctx); + + switch (name) { + case GL_VENDOR: + return (GLubyte *) radeonVendorString; + + case GL_RENDERER: + return (GLubyte *) radeonGetRendererString(radeon->radeonScreen); default: return NULL; |