diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-09-02 21:04:26 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-09-05 23:48:50 +0100 |
commit | c1f562e1e5cdcf9be44a8aeb92f00a161b264787 (patch) | |
tree | 2547909e80231c2eed908e45ab19a497ac258b6f /glx | |
parent | 4686a030cc5b8d595f98fdde7eca7ae02f7927b0 (diff) |
Generate the GLX extension list for swrast in the same way as dri and dri2 do.
Rather than using a fixed list of GLX extensions for swrast, generate the
extension list in the same way as dri and dri2 do.
This still looks a bit wonky: swrast and DRI1 will still always report certain
GLX extensions, as __glXInitExtensionEnableBits() has enabled them, even though
they then subsequently check if the underlying driver supports them (e.g.
GLX_SGI_make_current_read)
This has a couple of side-effects on the reported GLX extensions for swrast:
- GLX_SGIS_multisample is now reported on APPLE (I can't work out why this
conditional was added, it dates back to the XFree86 4.4RC3 import)
- GLX_SGIX_visual_select_group is now reported (this is probably pointless but
benign)
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Diffstat (limited to 'glx')
-rw-r--r-- | glx/glxdriswrast.c | 36 | ||||
-rw-r--r-- | glx/glxscreens.c | 14 |
2 files changed, 36 insertions, 14 deletions
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c index b47839868..7eb537df4 100644 --- a/glx/glxdriswrast.c +++ b/glx/glxdriswrast.c @@ -75,6 +75,8 @@ struct __GLXDRIscreen { const __DRIcopySubBufferExtension *copySubBuffer; const __DRItexBufferExtension *texBuffer; const __DRIconfig **driConfigs; + + unsigned char glx_enable_bits[__GLX_EXT_BYTES]; }; struct __GLXDRIcontext { @@ -410,12 +412,27 @@ initializeExtensions(__GLXDRIscreen * screen) extensions = screen->core->getExtensions(screen->driScreen); + /* GLX_MESA_copy_sub_buffer is always enabled. */ + __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer"); + for (i = 0; extensions[i]; i++) { +#ifdef __DRI_READ_DRAWABLE + if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { + __glXEnableExtension(screen->glx_enable_bits, + "GLX_SGI_make_current_read"); + + LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n"); + } +#endif + #ifdef __DRI_COPY_SUB_BUFFER if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { screen->copySubBuffer = (const __DRIcopySubBufferExtension *) extensions[i]; - /* GLX_MESA_copy_sub_buffer is always enabled. */ + __glXEnableExtension(screen->glx_enable_bits, + "GLX_MESA_copy_sub_buffer"); + + LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n"); } #endif @@ -423,6 +440,7 @@ initializeExtensions(__GLXDRIscreen * screen) if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { screen->texBuffer = (const __DRItexBufferExtension *) extensions[i]; /* GLX_EXT_texture_from_pixmap is always enabled. */ + LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_texture_from_pixmap\n"); } #endif /* Ignore unknown extensions */ @@ -434,6 +452,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) { const char *driverName = "swrast"; __GLXDRIscreen *screen; + size_t buffer_size; screen = calloc(1, sizeof *screen); if (screen == NULL) @@ -445,6 +464,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->base.swapInterval = NULL; screen->base.pScreen = pScreen; + __glXInitExtensionEnableBits(screen->glx_enable_bits); + screen->driver = glxProbeDriver(driverName, (void **) &screen->core, __DRI_CORE, __DRI_CORE_VERSION, @@ -473,6 +494,19 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXScreenInit(&screen->base, pScreen); + /* The first call simply determines the length of the extension string. + * This allows us to allocate some memory to hold the extension string, + * but it requires that we call __glXGetExtensionString a second time. + */ + buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); + if (buffer_size > 0) { + free(screen->base.GLXextensions); + + screen->base.GLXextensions = xnfalloc(buffer_size); + (void) __glXGetExtensionString(screen->glx_enable_bits, + screen->base.GLXextensions); + } + screen->base.GLXmajor = 1; screen->base.GLXminor = 4; diff --git a/glx/glxscreens.c b/glx/glxscreens.c index 61d590cc8..6a2382ad4 100644 --- a/glx/glxscreens.c +++ b/glx/glxscreens.c @@ -163,18 +163,6 @@ static const char GLServerExtensions[] = static char GLXServerVendorName[] = "SGI"; unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION; unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION; -static char GLXServerExtensions[] = - "GLX_ARB_multisample " - "GLX_EXT_visual_info " - "GLX_EXT_visual_rating " - "GLX_EXT_import_context " - "GLX_EXT_texture_from_pixmap " - "GLX_OML_swap_method " "GLX_SGI_make_current_read " -#ifndef __APPLE__ - "GLX_SGIS_multisample " -#endif - "GLX_SGIX_fbconfig " - "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer "; static Bool glxCloseScreen(ScreenPtr pScreen) @@ -331,7 +319,7 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen) pGlxScreen->pScreen = pScreen; pGlxScreen->GLextensions = strdup(GLServerExtensions); pGlxScreen->GLXvendor = strdup(GLXServerVendorName); - pGlxScreen->GLXextensions = strdup(GLXServerExtensions); + pGlxScreen->GLXextensions = strdup(""); /* All GLX providers must support all of the functionality required for at * least GLX 1.2. If the provider supports a higher version, the GLXminor |