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/dri_glx.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/dri_glx.c')
-rw-r--r-- | src/glx/x11/dri_glx.c | 77 |
1 files changed, 19 insertions, 58 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 7ac80eb74d7..a4a389ce5d8 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -55,14 +55,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RTLD_GLOBAL 0 #endif -#ifdef BUILT_IN_DRI_DRIVER - -extern void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config); - - -#else /* BUILT_IN_DRI_DRIVER */ - #ifndef DEFAULT_DRIVER_DIR /* this is normally defined in the Imakefile */ @@ -102,23 +94,6 @@ static void ErrorMessageF(const char *f, ...) } -/* - * We'll save a pointer to this function when we couldn't find a - * direct rendering driver for a given screen. - */ -static void *DummyCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, - int numConfigs, __GLXvisualConfig *config) -{ - (void) dpy; - (void) scrn; - (void) psc; - (void) numConfigs; - (void) config; - return NULL; -} - - - /** * Extract the ith directory path out of a colon-separated list of paths. No * more than \c dirLen characters, including the terminating \c NUL, will be @@ -182,6 +157,19 @@ ExtractDir(int index, const char *paths, int dirLen, char *dir) /** + * Versioned name of the expected \c __driCreateNewScreen function. + * + * The version of the last incompatible loader/driver inteface change is + * appended to the name of the \c __driCreateNewScreen function. This + * prevents loaders from trying to load drivers that are too old. + * + * \todo + * Create a macro or something so that this is automatically updated. + */ +static const char createNewScreenName[] = "__driCreateNewScreen_20050722"; + + +/** * Try to \c dlopen the named driver. * * This function adds the "_dri.so" suffix to the driver name and searches the @@ -249,18 +237,16 @@ static __DRIdriver *OpenDriver(const char *driverName) return NULL; /* out of memory! */ } - driver->createScreenFunc = (CreateScreenFunc) - dlsym(handle, "__driCreateScreen"); driver->createNewScreenFunc = (CreateNewScreenFunc) - dlsym(handle, "__driCreateNewScreen"); + dlsym(handle, createNewScreenName); - if ( (driver->createScreenFunc == NULL) - && (driver->createNewScreenFunc == NULL) ) { + if ( driver->createNewScreenFunc == NULL ) { /* If the driver doesn't have this symbol then something's * really, really wrong. */ - ErrorMessageF("Neither __driCreateScreen or __driCreateNewScreen " - "are defined in %s_dri.so!\n", driverName); + ErrorMessageF("%s not defined in %s_dri.so!\n" + "Your driver may be too old for this libGL.\n", + createNewScreenName, driverName); Xfree(driver); dlclose(handle); continue; @@ -379,9 +365,6 @@ const char *glXGetDriverConfig (const char *driverName) { } -#endif /* BUILT_IN_DRI_DRIVER */ - - /* This function isn't currently used. */ static void driDestroyDisplay(Display *dpy, void *private) @@ -420,7 +403,6 @@ void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) */ pdisp->private = NULL; pdisp->destroyDisplay = NULL; - pdisp->createScreen = NULL; if (!XF86DRIQueryExtension(dpy, &eventBase, &errorBase)) { return NULL; @@ -441,17 +423,9 @@ void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) pdisp->destroyDisplay = driDestroyDisplay; - /* allocate array of pointers to createScreen funcs */ - pdisp->createScreen = (CreateScreenFunc *) Xmalloc(numScreens * sizeof(void *)); - if (!pdisp->createScreen) { - Xfree(pdpyp); - return NULL; - } - - /* allocate array of pointers to createScreen funcs */ + /* allocate array of pointers to createNewScreen funcs */ pdisp->createNewScreen = (CreateNewScreenFunc *) Xmalloc(numScreens * sizeof(void *)); if (!pdisp->createNewScreen) { - Xfree(pdisp->createScreen); Xfree(pdpyp); return NULL; } @@ -460,20 +434,10 @@ void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) pdpyp->libraryHandles = (void **) Xmalloc(numScreens * sizeof(void*)); if (!pdpyp->libraryHandles) { Xfree(pdisp->createNewScreen); - Xfree(pdisp->createScreen); Xfree(pdpyp); return NULL; } -#ifdef BUILT_IN_DRI_DRIVER - /* we'll statically bind to the built-in __driCreateScreen function */ - for (scrn = 0; scrn < numScreens; scrn++) { - pdisp->createScreen[scrn] = __driCreateScreen; - pdisp->createNewScreen[scrn] = NULL; - pdpyp->libraryHandles[scrn] = NULL; - } - -#else /* dynamically discover DRI drivers for all screens, saving each * driver's "__driCreateScreen" function pointer. That's the bootstrap * entrypoint for all DRI drivers. @@ -481,17 +445,14 @@ void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) for (scrn = 0; scrn < numScreens; scrn++) { __DRIdriver *driver = driGetDriver(dpy, scrn); if (driver) { - pdisp->createScreen[scrn] = driver->createScreenFunc; pdisp->createNewScreen[scrn] = driver->createNewScreenFunc; pdpyp->libraryHandles[scrn] = driver->handle; } else { - pdisp->createScreen[scrn] = DummyCreateScreen; pdisp->createNewScreen[scrn] = NULL; pdpyp->libraryHandles[scrn] = NULL; } } -#endif return (void *)pdpyp; } |