__eglMustCastToProperFunctionPointerType _eglGetDriverProc(const char *procname) { EGLint i; _EGLProc proc = NULL; if (!_eglModules) { /* load the driver for the default display */ EGLDisplay egldpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); _EGLDisplay *dpy = _eglLookupDisplay(egldpy); if (!dpy || !_eglMatchDriver(dpy, EGL_TRUE)) return NULL; } for (i = 0; i < _eglModules->Size; i++) { _EGLModule *mod = (_EGLModule *) _eglModules->Elements[i]; if (!mod->Driver) break; proc = mod->Driver->API.GetProcAddress(mod->Driver, procname); if (proc) break; } return proc; }
/** * 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) { _EGLDisplay *disp = _eglLockDisplay(dpy); if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); if (!disp->Initialized) { if (!_eglMatchDriver(disp, EGL_FALSE)) RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); /* limit to APIs supported by core */ disp->ClientAPIs &= _EGL_API_ALL_BITS; } /* Update applications version of major and minor if not NULL */ if ((major != NULL) && (minor != NULL)) { *major = disp->VersionMajor; *minor = disp->VersionMinor; } RETURN_EGL_SUCCESS(disp, EGL_TRUE); }
/** * Open a preloaded driver. */ _EGLDriver * _eglOpenDriver(_EGLDisplay *dpy) { _EGLDriver *drv = _eglMatchDriver(dpy); return drv; }