summaryrefslogtreecommitdiff
path: root/src/egl/main/eglapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r--src/egl/main/eglapi.c124
1 files changed, 66 insertions, 58 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index bfa580e6c3..fe63d36b80 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -43,36 +43,44 @@
/**
- * 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 APIENTRY
-eglGetDisplay(NativeDisplayType displayName)
+EGLDisplay EGLAPIENTRY
+eglGetDisplay(NativeDisplayType nativeDisplay)
{
_EGLDisplay *dpy;
_eglInitGlobals();
- dpy = _eglNewDisplay(displayName);
- if (dpy)
- return dpy->Handle;
- else
- return EGL_NO_DISPLAY;
+ dpy = _eglNewDisplay(nativeDisplay);
+ return _eglGetDisplayHandle(dpy);
}
-EGLBoolean APIENTRY
+/**
+ * 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;
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglTerminate(EGLDisplay dpy)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -83,7 +91,7 @@ eglTerminate(EGLDisplay dpy)
}
-const char * APIENTRY
+const char * EGLAPIENTRY
eglQueryString(EGLDisplay dpy, EGLint name)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -94,7 +102,7 @@ eglQueryString(EGLDisplay dpy, EGLint name)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -103,7 +111,7 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *nu
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -111,7 +119,7 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, E
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -119,7 +127,7 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *v
}
-EGLContext APIENTRY
+EGLContext EGLAPIENTRY
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -127,7 +135,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -135,7 +143,7 @@ eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -143,7 +151,7 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -151,7 +159,7 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
}
-EGLSurface APIENTRY
+EGLSurface EGLAPIENTRY
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -159,7 +167,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window
}
-EGLSurface APIENTRY
+EGLSurface EGLAPIENTRY
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -167,7 +175,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap
}
-EGLSurface APIENTRY
+EGLSurface EGLAPIENTRY
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -175,7 +183,7 @@ eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_l
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -183,7 +191,7 @@ eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -191,7 +199,7 @@ eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *va
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -199,7 +207,7 @@ eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint va
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -207,7 +215,7 @@ eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -215,7 +223,7 @@ eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglSwapInterval(EGLDisplay dpy, EGLint interval)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -223,7 +231,7 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -231,7 +239,7 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -239,7 +247,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglWaitGL(void)
{
EGLDisplay dpy = eglGetCurrentDisplay();
@@ -252,7 +260,7 @@ eglWaitGL(void)
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglWaitNative(EGLint engine)
{
EGLDisplay dpy = eglGetCurrentDisplay();
@@ -265,40 +273,31 @@ eglWaitNative(EGLint engine)
}
-EGLDisplay APIENTRY
+EGLDisplay EGLAPIENTRY
eglGetCurrentDisplay(void)
{
_EGLDisplay *dpy = _eglGetCurrentDisplay();
- if (dpy)
- return dpy->Handle;
- else
- return EGL_NO_DISPLAY;
+ return _eglGetDisplayHandle(dpy);
}
-EGLContext APIENTRY
+EGLContext EGLAPIENTRY
eglGetCurrentContext(void)
{
_EGLContext *ctx = _eglGetCurrentContext();
- if (ctx)
- return ctx->Handle;
- else
- return EGL_NO_CONTEXT;
+ return _eglGetContextHandle(ctx);
}
-EGLSurface APIENTRY
+EGLSurface EGLAPIENTRY
eglGetCurrentSurface(EGLint readdraw)
{
_EGLSurface *s = _eglGetCurrentSurface(readdraw);
- if (s)
- return s->Handle;
- else
- return EGL_NO_SURFACE;
+ return _eglGetSurfaceHandle(s);
}
-EGLint APIENTRY
+EGLint EGLAPIENTRY
eglGetError(void)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
@@ -308,7 +307,7 @@ eglGetError(void)
}
-void (* APIENTRY eglGetProcAddress(const char *procname))()
+void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
{
typedef void (*genericFunc)();
struct name_function {
@@ -389,7 +388,7 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
* EGL_MESA_screen extension
*/
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
const EGLint *attrib_list, EGLModeMESA *modes,
EGLint modes_size, EGLint *num_modes)
@@ -402,7 +401,7 @@ eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -413,7 +412,7 @@ eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -424,7 +423,7 @@ eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint
}
-EGLBoolean APIENTRY
+EGLBoolean EGLAPIENTRY
eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask)
{
_EGLDriver *drv = _eglLookupDriver(dpy);
@@ -514,6 +513,15 @@ eglBindAPI(EGLenum api)
_EGLThreadInfo *t = _eglGetCurrentThread();
switch (api) {
+#ifdef EGL_VERSION_1_4
+ case EGL_OPENGL_API:
+ if (_eglGlobal.OpenGLAPISupported) {
+ t->CurrentAPI = api;
+ return EGL_TRUE;
+ }
+ _eglError(EGL_BAD_PARAMETER, "eglBindAPI");
+ return EGL_FALSE;
+#endif
case EGL_OPENGL_ES_API:
if (_eglGlobal.OpenGLESAPISupported) {
t->CurrentAPI = api;
@@ -549,7 +557,7 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
EGLenum
eglQueryAPI(void)
{
- /* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
+ /* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */
_EGLThreadInfo *t = _eglGetCurrentThread();
return t->CurrentAPI;
}