summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglapi.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-27 16:48:23 -0600
committerBrian Paul <[email protected]>2008-05-27 16:48:23 -0600
commit6052af172f0241e6678cd16efac0a0f14f40146c (patch)
treedefc05f9ffee989aac7faf6d7ba690f5f11e4e93 /src/egl/main/eglapi.c
parent721ba15bf4596b2e9589e7656005b387724875c3 (diff)
minor overhaul/re-org of driver selection/loading code
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r--src/egl/main/eglapi.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e4eec26de0a..fe63d36b803 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -43,27 +43,38 @@
/**
- * NOTE: displayName is treated as a string in _eglChooseDriver()!!!
- * This will probably change!
- * See _eglChooseDriver() for details!
+ * This is typically the first EGL function that an application calls.
+ * We initialize our global vars and create a private _EGLDisplay object.
*/
EGLDisplay EGLAPIENTRY
-eglGetDisplay(NativeDisplayType displayName)
+eglGetDisplay(NativeDisplayType nativeDisplay)
{
_EGLDisplay *dpy;
_eglInitGlobals();
- dpy = _eglNewDisplay(displayName);
+ dpy = _eglNewDisplay(nativeDisplay);
return _eglGetDisplayHandle(dpy);
}
+/**
+ * This is typically the second EGL function that an application calls.
+ * Here we load/initialize the actual hardware driver.
+ */
EGLBoolean EGLAPIENTRY
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
if (dpy) {
- _EGLDriver *drv = _eglChooseDriver(dpy);
- if (drv)
- return drv->API.Initialize(drv, dpy, major, minor);
+ _EGLDisplay *dpyPriv = _eglLookupDisplay(dpy);
+ if (!dpyPriv) {
+ return EGL_FALSE;
+ }
+ dpyPriv->Driver = _eglOpenDriver(dpyPriv, dpyPriv->DriverName);
+ if (!dpyPriv->Driver) {
+ return EGL_FALSE;
+ }
+ /* Initialize the particular driver now */
+ return dpyPriv->Driver->API.Initialize(dpyPriv->Driver, dpy,
+ major, minor);
}
return EGL_FALSE;
}