X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fegl%2Fmain%2Feglapi.c;h=9df938e188729d2b8f06c62c0f450aa02a5b7c01;hb=b01d0077af9d93c582e5f53ebd358ac8148b22df;hp=fe63d36b803a3ff4d99a789e417f46e42b1f8e11;hpb=938d9d596324e411fde5312f2bb65b444c502c37;p=mesa.git diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index fe63d36b803..9df938e1887 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -63,18 +63,37 @@ eglGetDisplay(NativeDisplayType nativeDisplay) EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { + EGLint major_int, minor_int; + if (dpy) { + EGLBoolean retVal; _EGLDisplay *dpyPriv = _eglLookupDisplay(dpy); if (!dpyPriv) { return EGL_FALSE; } - dpyPriv->Driver = _eglOpenDriver(dpyPriv, dpyPriv->DriverName); + dpyPriv->Driver = _eglOpenDriver(dpyPriv, + dpyPriv->DriverName, + dpyPriv->DriverArgs); if (!dpyPriv->Driver) { return EGL_FALSE; } /* Initialize the particular driver now */ - return dpyPriv->Driver->API.Initialize(dpyPriv->Driver, dpy, - major, minor); + retVal = dpyPriv->Driver->API.Initialize(dpyPriv->Driver, dpy, + &major_int, &minor_int); + + dpyPriv->Driver->APImajor = major_int; + dpyPriv->Driver->APIminor = minor_int; + snprintf(dpyPriv->Driver->Version, sizeof(dpyPriv->Driver->Version), + "%d.%d (%s)", major_int, minor_int, dpyPriv->Driver->Name); + + /* Update applications version of major and minor if not NULL */ + if((major != NULL) && (minor != NULL)) + { + *major = major_int; + *minor = minor_int; + } + + return retVal; } return EGL_FALSE; } @@ -375,12 +394,15 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() return (genericFunc) egl_functions[i].function; } } -#if 0 - /* XXX enable this code someday */ - return (genericFunc) _glapi_get_proc_address(procname); -#else + + /* now loop over drivers to query their procs */ + for (i = 0; i < _eglGlobal.NumDrivers; i++) { + _EGLProc p = _eglGlobal.Drivers[i]->API.GetProcAddress(procname); + if (p) + return p; + } + return NULL; -#endif } @@ -507,6 +529,18 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) #ifdef EGL_VERSION_1_2 + +/** + * Specify the client API to use for subsequent calls including: + * eglCreateContext() + * eglGetCurrentContext() + * eglGetCurrentDisplay() + * eglGetCurrentSurface() + * eglMakeCurrent(when the ctx parameter is EGL NO CONTEXT) + * eglWaitClient() + * eglWaitNative() + * See section 3.7 "Rendering Context" in the EGL specification for details. + */ EGLBoolean eglBindAPI(EGLenum api) { @@ -515,7 +549,7 @@ eglBindAPI(EGLenum api) switch (api) { #ifdef EGL_VERSION_1_4 case EGL_OPENGL_API: - if (_eglGlobal.OpenGLAPISupported) { + if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_BIT) { t->CurrentAPI = api; return EGL_TRUE; } @@ -523,14 +557,14 @@ eglBindAPI(EGLenum api) return EGL_FALSE; #endif case EGL_OPENGL_ES_API: - if (_eglGlobal.OpenGLESAPISupported) { + if (_eglGlobal.ClientAPIsMask & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT)) { t->CurrentAPI = api; return EGL_TRUE; } _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); return EGL_FALSE; case EGL_OPENVG_API: - if (_eglGlobal.OpenVGAPISupported) { + if (_eglGlobal.ClientAPIsMask & EGL_OPENVG_BIT) { t->CurrentAPI = api; return EGL_TRUE; } @@ -543,6 +577,18 @@ eglBindAPI(EGLenum api) } +/** + * Return the last value set with eglBindAPI(). + */ +EGLenum +eglQueryAPI(void) +{ + /* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */ + _EGLThreadInfo *t = _eglGetCurrentThread(); + return t->CurrentAPI; +} + + EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, @@ -554,15 +600,6 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, } -EGLenum -eglQueryAPI(void) -{ - /* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */ - _EGLThreadInfo *t = _eglGetCurrentThread(); - return t->CurrentAPI; -} - - EGLBoolean eglReleaseThread(void) {