diff options
author | Jon Smirl <jonsmirl@gmail.com> | 2005-08-05 03:33:59 +0000 |
---|---|---|
committer | Jon Smirl <jonsmirl@gmail.com> | 2005-08-05 03:33:59 +0000 |
commit | 485528f2acb69940a7c757638127f716c0cb2654 (patch) | |
tree | 4adf1397cd482f50a4bcc92776ef36b53599ff72 /src/egl | |
parent | b507bd41607a8025866d125d99c5abbca1931cd7 (diff) |
More EGL prep. No impact on anything outside of EGL
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/drivers/demo/demo.c | 9 | ||||
-rw-r--r-- | src/egl/main/egldriver.c | 52 | ||||
-rw-r--r-- | src/egl/main/egldriver.h | 5 |
3 files changed, 26 insertions, 40 deletions
diff --git a/src/egl/drivers/demo/demo.c b/src/egl/drivers/demo/demo.c index 9b75195959..4c08ac569f 100644 --- a/src/egl/drivers/demo/demo.c +++ b/src/egl/drivers/demo/demo.c @@ -286,19 +286,12 @@ demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface rea } -/* - * Just to silence warning - */ -extern _EGLDriver * -_eglMain(NativeDisplayType dpy); - - /** * The bootstrap function. Return a new DemoDriver object and * plug in API functions. */ _EGLDriver * -_eglMain(NativeDisplayType dpy) +_eglMain(_EGLDisplay *dpy) { DemoDriver *demo; diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 1aeefbbe48..6e8c9b3b4c 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -45,7 +45,7 @@ _eglChooseDriver(EGLDisplay display) else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) { printf("EGL: Use driver for screen: %s\n", name); /* XXX probe hardware here to determine which driver to open */ - /* driverName = "something"; */ + driverName = "libEGLdri"; } else if (name[0] == '!') { /* use specified driver name */ @@ -71,44 +71,40 @@ _eglChooseDriver(EGLDisplay display) _EGLDriver * _eglOpenDriver(_EGLDisplay *dpy, const char *driverName) { + _EGLDriver *drv; + _EGLMain_t mainFunc; void *lib; char driverFilename[1000]; /* XXX also prepend a directory path??? */ sprintf(driverFilename, "%s.so", driverName); -#if 1 lib = dlopen(driverFilename, RTLD_NOW); - if (lib) { - _EGLDriver *drv; - _EGLMain_t mainFunc; - - mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); - if (!mainFunc) { - fprintf(stderr, "_eglMain not found in %s", (char *) driverFilename); - dlclose(lib); - return NULL; - } - - drv = mainFunc(dpy); - if (!drv) { - dlclose(lib); - return NULL; - } + if (!lib) { + fprintf(stderr, "EGLdebug: Error opening %s: %s\n", driverFilename, dlerror()); + return NULL; + } - drv->LibHandle = lib; - drv->Display = dpy; - return drv; + mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); + if (!mainFunc) { + fprintf(stderr, "_eglMain not found in %s", (char *) driverFilename); + dlclose(lib); + return NULL; } - else { - fprintf(stderr, "EGLdebug: Error opening %s: %s\n", - driverFilename, dlerror()); + + drv = mainFunc(dpy); + if (!drv) { + dlclose(lib); return NULL; } -#else - /* use built-in driver */ - return _eglDefaultMain(d); -#endif + /* with a recurvise open you want the inner most handle */ + if (!drv->LibHandle) + drv->LibHandle = lib; + else + dlclose(lib); + + drv->Display = dpy; + return drv; } diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h index ecf630cb7d..7ab62f1827 100644 --- a/src/egl/main/egldriver.h +++ b/src/egl/main/egldriver.h @@ -125,10 +125,7 @@ struct _egl_driver }; - - -extern _EGLDriver * -_eglDefaultMain(NativeDisplayType d); +extern _EGLDriver *_eglMain(_EGLDisplay *dpy); extern _EGLDriver * |