diff options
author | idr <idr> | 2004-03-13 02:11:31 +0000 |
---|---|---|
committer | idr <idr> | 2004-03-13 02:11:31 +0000 |
commit | 1d395fd9a91e38bc95fdd9657605a633a49b9977 (patch) | |
tree | 954663d572182102128ad45dfe67d2e6f81a1bed | |
parent | 3ebfeaf547aac51482594b934f0d2bde1fc56f8e (diff) |
Fixes a bad interaction between the new libGL and drivers built in the
trunk that haven't been converted to the new interface or drivers
built before the driinterface merge (i.e., the ones that ship with
every XFree86 4.x.x release).
Basically, FillInVisuals was excluding modes whose drawableType didn't
match GLX_WINDOW_BIT exactly. This means that a mode would get tossed
if drawableType was (GLX_WINDOW_BIT|GLX_PIXMAP_BIT), which is what
every server-side driver sets! The proper test is to just make sure
that GLX_WINDOW_BIT is set.
Reported by: Numerous folks on dri-devel and dri-users.
-rw-r--r-- | xc/lib/GL/glx/glxext.c | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index 080ecf036..7baeaf820 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -331,6 +331,38 @@ static Bool QueryVersion(Display *dpy, int opcode, int *major, int *minor) } +/** + * Determine if a \c __GLcontextModes structure has the right mojo to be + * converted to a \c __GLXvisualConfig to be sent to an "old" style DRI + * driver. + */ +#define MODE_HAS_MOJO(m) \ + ((m)->visualID != GLX_DONT_CARE) \ + && ((m)->sampleBuffers == 0) \ + && ((m)->samples == 0) \ + && (((m)->drawableType & GLX_WINDOW_BIT) != 0) \ + && (((m)->xRenderable == GL_TRUE) \ + || ((m)->xRenderable == GLX_DONT_CARE)) + + +/** + * Convert the FBConfigs associated with a screen into an array of + * \c __GLXvisualConfig structures. These structures are passed into DRI + * drivers that use the "old" interface. The old-style drivers had a fairly + * strict set of visual types that could be supported. FBConfigs that + * cannot be supported are not converted. + * + * \param psc Screen whose FBConfigs need to be swizzled. + * + * \returns + * If memory could be allocated and at least one FBConfig could be converted + * to a \c __GLXvisualConfig structure, \c GL_TRUE is returned. Otherwise, + * \c GL_FALSE is returned. + * + * \todo + * When the old DRI driver interface is no longer supported, this function + * can be removed. + */ static GLboolean FillInVisuals( __GLXscreenConfigs * psc ) { @@ -340,12 +372,7 @@ FillInVisuals( __GLXscreenConfigs * psc ) glx_visual_count = 0; for ( modes = psc->configs ; modes != NULL ; modes = modes->next ) { - if ( (modes->visualID != GLX_DONT_CARE) - && (modes->sampleBuffers == 0) - && (modes->samples == 0) - && (modes->drawableType == GLX_WINDOW_BIT) - && ((modes->xRenderable == GL_TRUE) - || (modes->xRenderable == GLX_DONT_CARE)) ) { + if ( MODE_HAS_MOJO( modes ) ) { glx_visual_count++; } } @@ -358,12 +385,7 @@ FillInVisuals( __GLXscreenConfigs * psc ) glx_visual_count = 0; for ( modes = psc->configs ; modes != NULL ; modes = modes->next ) { - if ( (modes->visualID != GLX_DONT_CARE) - && (modes->sampleBuffers == 0) - && (modes->samples == 0) - && (modes->drawableType == GLX_WINDOW_BIT) - && ((modes->xRenderable == GL_TRUE) - || (modes->xRenderable == GLX_DONT_CARE)) ) { + if ( MODE_HAS_MOJO( modes ) ) { #define COPY_VALUE(src_tag,dst_tag) \ psc->old_configs[glx_visual_count]. dst_tag = modes-> src_tag @@ -372,7 +394,7 @@ FillInVisuals( __GLXscreenConfigs * psc ) COPY_VALUE( rgbMode, rgba ); COPY_VALUE( stereoMode, stereo ); COPY_VALUE( doubleBufferMode, doubleBuffer ); - + psc->old_configs[glx_visual_count].class = _gl_convert_to_x_visual_type( modes->visualType ); @@ -406,7 +428,12 @@ FillInVisuals( __GLXscreenConfigs * psc ) } psc->numOldConfigs = glx_visual_count; - return GL_TRUE; + if ( glx_visual_count == 0 ) { + Xfree( psc->old_configs ); + psc->old_configs = NULL; + } + + return (glx_visual_count != 0); } |