diff options
author | Ian Romanick <[email protected]> | 2005-07-24 06:29:14 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-07-24 06:29:14 +0000 |
commit | c39bf5e273a4995a279ae2af59fc29e06ab47e29 (patch) | |
tree | 7b2edd0c9b039d75da7b95c8c97142c31494a03e /src/glx/x11/glxext.c | |
parent | 7d40d230fa26abeb9f92bdcf8012eddbc585b118 (diff) |
All elements of pre-DRI_NEW_INTERFACE_ONLY are removed. This allows
1,402 lines of code to be removed from Mesa (drivers and libGL). The
big winner is dri_util.c.
Primary changes are:
1. Remove all "deprecated" entry-points from the various structures in
dri_interface.h.
2. Rename the remaining fields to removed "version numbers." So,
bindContext3 becomes bindContext. Functions with "New" in the name
(e.g., CreateNewContext) were *not* changed, but that is an option.
Having "New" in the name is less annoying to me than having "3" in the name.
3. Remove all compatibility code that handles cases where the driver or
the loader is too old to support the latest interfaces.
4. Append the API version to the __driCreateNewScreen function name.
This is currently done by hand. In the future (i.e., the next time we
make an incompatible change to the interface) we'll want to come up with
a better way to do this. This prevents old loaders from being able to load
new (incompatible) drivers.
5. Bump the API version to 20050722. All drivers (by way of dri_util.c)
require this version.
6. All drivers are *required* to expose GLX_SGIX_fbconfig and
GLX_OML_swap_method (or the moral equivalents). Support for these
functions in implicit in the use of the "new" interface.
7. Some cases still exist that need to be compiled differently in a loader
or core Mesa versus in a driver. These are identified by the define
IN_DRI_DRIVER.
Diffstat (limited to 'src/glx/x11/glxext.c')
-rw-r--r-- | src/glx/x11/glxext.c | 188 |
1 files changed, 19 insertions, 169 deletions
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 1d82af295fd..be6b84b262d 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -272,7 +272,6 @@ int __glXDebug = 0; */ int __glXCloseDisplay(Display *dpy, XExtCodes *codes); -static GLboolean FillInVisuals( __GLXscreenConfigs * psc ); /************************************************************************/ @@ -352,12 +351,6 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) if(psc->effectiveGLXexts) Xfree(psc->effectiveGLXexts); - if ( psc->old_configs != NULL ) { - Xfree( psc->old_configs ); - psc->old_configs = NULL; - psc->numOldConfigs = 0; - } - psc->configs = NULL; /* NOTE: just for paranoia */ } @@ -399,10 +392,6 @@ static int __glXFreeDisplayPrivate(XExtData *extension) priv->driDisplay.private = NULL; #endif -#ifdef GLX_DIRECT_RENDERING - XFree(priv->driDisplay.createScreen); -#endif - Xfree((char*) priv); return 0; } @@ -442,112 +431,6 @@ 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 ) -{ - __GLcontextModes *modes; - int glx_visual_count; - - - glx_visual_count = 0; - for ( modes = psc->configs ; modes != NULL ; modes = modes->next ) { - if ( MODE_HAS_MOJO( modes ) ) { - glx_visual_count++; - } - } - - psc->old_configs = (__GLXvisualConfig *) - Xmalloc( sizeof( __GLXvisualConfig ) * glx_visual_count ); - if ( psc->old_configs == NULL ) { - return GL_FALSE; - } - - glx_visual_count = 0; - for ( modes = psc->configs ; modes != NULL ; modes = modes->next ) { - if ( MODE_HAS_MOJO( modes ) ) { - -#define COPY_VALUE(src_tag,dst_tag) \ - psc->old_configs[glx_visual_count]. dst_tag = modes-> src_tag - - COPY_VALUE( visualID, vid ); - 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 ); - - COPY_VALUE( level, level ); - COPY_VALUE( numAuxBuffers, auxBuffers ); - - COPY_VALUE( redBits, redSize ); - COPY_VALUE( greenBits, greenSize ); - COPY_VALUE( blueBits, blueSize ); - COPY_VALUE( alphaBits, alphaSize ); - COPY_VALUE( rgbBits, bufferSize ); - COPY_VALUE( accumRedBits, accumRedSize ); - COPY_VALUE( accumGreenBits, accumGreenSize ); - COPY_VALUE( accumBlueBits, accumBlueSize ); - COPY_VALUE( accumAlphaBits, accumAlphaSize ); - COPY_VALUE( depthBits, depthSize ); - COPY_VALUE( stencilBits, stencilSize ); - - COPY_VALUE( visualRating, visualRating ); - COPY_VALUE( transparentPixel, transparentPixel ); - COPY_VALUE( transparentRed, transparentRed ); - COPY_VALUE( transparentGreen, transparentGreen ); - COPY_VALUE( transparentBlue, transparentBlue ); - COPY_VALUE( transparentAlpha, transparentAlpha ); - COPY_VALUE( transparentIndex, transparentIndex ); - -#undef COPY_VALUE - - glx_visual_count++; - } - } - - psc->numOldConfigs = glx_visual_count; - if ( glx_visual_count == 0 ) { - Xfree( psc->old_configs ); - psc->old_configs = NULL; - } - - return (glx_visual_count != 0); -} - - void __glXInitializeVisualConfigFromTags( __GLcontextModes *config, int count, const INT32 *bp, Bool tagged_only, @@ -865,9 +748,9 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc, char *driverName; /* - * Get device name (like "tdfx") and the ddx version numbers. - * We'll check the version in each DRI driver's "createScreen" - * function. + * Get device name (like "tdfx") and the ddx version + * numbers. We'll check the version in each DRI driver's + * "createNewScreen" function. */ err_msg = "XF86DRIGetClientDriverName"; if (XF86DRIGetClientDriverName(dpy, scrn, @@ -910,8 +793,9 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc, if ( status == 0 ) { /* - * Map the SAREA region. Further mmap regions may be setup in - * each DRI driver's "createScreen" function. + * Map the SAREA region. Further mmap regions + * may be setup in each DRI driver's + * "createNewScreen" function. */ status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA); @@ -1156,6 +1040,9 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) psc->ext_list_first_time = GL_TRUE; /* Initialize the direct rendering per screen data and functions */ if (priv->driDisplay.private != NULL) { + /* FIXME: Should it be some sort of an error if createNewScreen[i] + * FIXME: is NULL? + */ if (priv->driDisplay.createNewScreen && priv->driDisplay.createNewScreen[i]) { @@ -1165,21 +1052,6 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) & priv->driDisplay, priv->driDisplay.createNewScreen[i] ); } - else if (priv->driDisplay.createScreen && - priv->driDisplay.createScreen[i]) { - /* screen initialization (bootstrap the driver) */ - if ( (psc->old_configs == NULL) - && !FillInVisuals(psc) ) { - FreeScreenConfigs(priv); - return GL_FALSE; - } - - psc->driScreen.screenConfigs = (void *)psc; - psc->driScreen.private = - (*(priv->driDisplay.createScreen[i]))(dpy, i, &psc->driScreen, - psc->numOldConfigs, - psc->old_configs); - } } #endif } @@ -1273,7 +1145,6 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) /* Assinging zero here assures we'll never go direct */ dpyPriv->driDisplay.private = 0; dpyPriv->driDisplay.destroyDisplay = 0; - dpyPriv->driDisplay.createScreen = 0; } else { dpyPriv->driDisplay.private = @@ -1607,44 +1478,23 @@ static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode, } +#ifdef GLX_DIRECT_RENDERING static Bool BindContextWrapper( Display *dpy, GLXContext gc, GLXDrawable draw, GLXDrawable read ) { -#ifdef GLX_DIRECT_RENDERING - if ( gc->driContext.bindContext3 != NULL ) { - return (*gc->driContext.bindContext3)(dpy, gc->screen, draw, read, - & gc->driContext); - } -#ifndef DRI_NEW_INTERFACE_ONLY - else { - return (*gc->driContext.bindContext2)(dpy, gc->screen, draw, read, - gc); - } -#endif -#endif - return GL_FALSE; + return (*gc->driContext.bindContext)(dpy, gc->screen, draw, read, + & gc->driContext); } -static Bool UnbindContextWrapper( Display *dpy, GLXContext gc ) +static Bool UnbindContextWrapper( GLXContext gc ) { -#ifdef GLX_DIRECT_RENDERING - if ( gc->driContext.unbindContext3 != NULL ) { - return (*gc->driContext.unbindContext3)(dpy, gc->screen, - gc->currentDrawable, - gc->currentReadable, - & gc->driContext ); - } -#ifndef DRI_NEW_INTERFACE_ONLY - else { - return (*gc->driContext.unbindContext2)(dpy, gc->screen, - gc->currentDrawable, - gc->currentReadable, gc); - } -#endif -#endif - return GL_FALSE; + return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen, + gc->currentDrawable, + gc->currentReadable, + & gc->driContext ); } +#endif /* GLX_DIRECT_RENDERING */ /* @@ -1707,7 +1557,7 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, /* Unbind the old direct rendering context */ if (oldGC->isDirect) { if (oldGC->driContext.private) { - if (! UnbindContextWrapper( oldGC->currentDpy, oldGC )) { + if (! UnbindContextWrapper( oldGC )) { /* The make current failed. Just return GL_FALSE. */ return GL_FALSE; } |