2005-04-22 22:09:39 +01:00
|
|
|
/**
|
|
|
|
* Public EGL API entrypoints
|
|
|
|
*
|
|
|
|
* Generally, we use the EGLDisplay parameter as a key to lookup the
|
|
|
|
* appropriate device driver handle, then jump though the driver's
|
|
|
|
* dispatch table to handle the function.
|
|
|
|
*
|
|
|
|
* That allows us the option of supporting multiple, simultaneous,
|
|
|
|
* heterogeneous hardware devices in the future.
|
|
|
|
*
|
|
|
|
* The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are
|
|
|
|
* opaque handles implemented with 32-bit unsigned integers.
|
|
|
|
* It's up to the driver function or fallback function to look up the
|
|
|
|
* handle and get an object.
|
|
|
|
* By using opaque handles, we leave open the possibility of having
|
|
|
|
* indirect rendering in the future, like GLX.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Notes on naming conventions:
|
|
|
|
*
|
|
|
|
* eglFooBar - public EGL function
|
|
|
|
* EGL_FOO_BAR - public EGL token
|
|
|
|
* EGLDatatype - public EGL datatype
|
|
|
|
*
|
|
|
|
* _eglFooBar - private EGL function
|
|
|
|
* _EGLDatatype - private EGL datatype, typedef'd struct
|
|
|
|
* _egl_struct - private EGL struct, non-typedef'd
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2006-01-30 00:10:55 +00:00
|
|
|
#include <stdlib.h>
|
2005-04-22 22:09:39 +01:00
|
|
|
#include <string.h>
|
|
|
|
#include "eglcontext.h"
|
|
|
|
#include "egldisplay.h"
|
|
|
|
#include "egltypedefs.h"
|
|
|
|
#include "eglglobals.h"
|
|
|
|
#include "egldriver.h"
|
|
|
|
#include "eglsurface.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-05-27 23:48:23 +01:00
|
|
|
* This is typically the first EGL function that an application calls.
|
|
|
|
* We initialize our global vars and create a private _EGLDisplay object.
|
2005-04-22 22:09:39 +01:00
|
|
|
*/
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLDisplay EGLAPIENTRY
|
2008-05-27 23:48:23 +01:00
|
|
|
eglGetDisplay(NativeDisplayType nativeDisplay)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
|
|
|
_EGLDisplay *dpy;
|
|
|
|
_eglInitGlobals();
|
2008-05-27 23:48:23 +01:00
|
|
|
dpy = _eglNewDisplay(nativeDisplay);
|
2008-05-27 21:33:54 +01:00
|
|
|
return _eglGetDisplayHandle(dpy);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 23:48:23 +01:00
|
|
|
/**
|
|
|
|
* This is typically the second EGL function that an application calls.
|
|
|
|
* Here we load/initialize the actual hardware driver.
|
|
|
|
*/
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
|
|
|
{
|
|
|
|
if (dpy) {
|
2008-05-28 22:43:41 +01:00
|
|
|
EGLBoolean retVal;
|
2008-05-27 23:48:23 +01:00
|
|
|
_EGLDisplay *dpyPriv = _eglLookupDisplay(dpy);
|
|
|
|
if (!dpyPriv) {
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
2008-05-28 19:56:36 +01:00
|
|
|
dpyPriv->Driver = _eglOpenDriver(dpyPriv,
|
|
|
|
dpyPriv->DriverName,
|
|
|
|
dpyPriv->DriverArgs);
|
2008-05-27 23:48:23 +01:00
|
|
|
if (!dpyPriv->Driver) {
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
/* Initialize the particular driver now */
|
2008-05-28 22:43:41 +01:00
|
|
|
retVal = dpyPriv->Driver->API.Initialize(dpyPriv->Driver, dpy,
|
|
|
|
major, minor);
|
|
|
|
|
|
|
|
dpyPriv->Driver->APImajor = *major;
|
|
|
|
dpyPriv->Driver->APIminor = *minor;
|
2008-05-30 00:02:31 +01:00
|
|
|
snprintf(dpyPriv->Driver->Version, sizeof(dpyPriv->Driver->Version),
|
|
|
|
"%d.%d (%s)", *major, *minor, dpyPriv->Driver->Name);
|
2008-05-28 22:43:41 +01:00
|
|
|
|
|
|
|
return retVal;
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglTerminate(EGLDisplay dpy)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
|
|
|
return _eglCloseDriver(drv, dpy);
|
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
const char * EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglQueryString(EGLDisplay dpy, EGLint name)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QueryString(drv, dpy, name);
|
2005-04-22 22:09:39 +01:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
/* XXX check drv for null in remaining functions */
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.GetConfigs(drv, dpy, configs, config_size, num_config);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.GetConfigAttrib(drv, dpy, config, attribute, value);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLContext EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CreateContext(drv, dpy, config, share_list, attrib_list);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.DestroyContext(drv, dpy, ctx);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.MakeCurrent(drv, dpy, draw, read, ctx);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QueryContext(drv, dpy, ctx, attribute, value);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CreateWindowSurface(drv, dpy, config, window, attrib_list);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CreatePbufferSurface(drv, dpy, config, attrib_list);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.DestroySurface(drv, dpy, surface);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QuerySurface(drv, dpy, surface, attribute, value);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.SurfaceAttrib(drv, dpy, surface, attribute, value);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.BindTexImage(drv, dpy, surface, buffer);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.ReleaseTexImage(drv, dpy, surface, buffer);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglSwapInterval(EGLDisplay dpy, EGLint interval)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.SwapInterval(drv, dpy, interval);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.SwapBuffers(drv, dpy, draw);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CopyBuffers(drv, dpy, surface, target);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglWaitGL(void)
|
|
|
|
{
|
|
|
|
EGLDisplay dpy = eglGetCurrentDisplay();
|
|
|
|
if (dpy != EGL_NO_DISPLAY) {
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.WaitGL(drv, dpy);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglWaitNative(EGLint engine)
|
|
|
|
{
|
|
|
|
EGLDisplay dpy = eglGetCurrentDisplay();
|
|
|
|
if (dpy != EGL_NO_DISPLAY) {
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.WaitNative(drv, dpy, engine);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLDisplay EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetCurrentDisplay(void)
|
|
|
|
{
|
|
|
|
_EGLDisplay *dpy = _eglGetCurrentDisplay();
|
2008-05-27 21:33:54 +01:00
|
|
|
return _eglGetDisplayHandle(dpy);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLContext EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetCurrentContext(void)
|
|
|
|
{
|
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
2008-05-27 21:21:25 +01:00
|
|
|
return _eglGetContextHandle(ctx);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetCurrentSurface(EGLint readdraw)
|
|
|
|
{
|
|
|
|
_EGLSurface *s = _eglGetCurrentSurface(readdraw);
|
2008-05-27 21:33:54 +01:00
|
|
|
return _eglGetSurfaceHandle(s);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLint EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetError(void)
|
|
|
|
{
|
2005-12-10 17:54:00 +00:00
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
|
|
EGLint e = t->LastError;
|
|
|
|
t->LastError = EGL_SUCCESS;
|
2005-04-22 22:09:39 +01:00
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
|
|
|
typedef void (*genericFunc)();
|
|
|
|
struct name_function {
|
|
|
|
const char *name;
|
|
|
|
_EGLProc function;
|
|
|
|
};
|
|
|
|
static struct name_function egl_functions[] = {
|
|
|
|
/* alphabetical order */
|
|
|
|
{ "eglBindTexImage", (_EGLProc) eglBindTexImage },
|
|
|
|
{ "eglChooseConfig", (_EGLProc) eglChooseConfig },
|
|
|
|
{ "eglCopyBuffers", (_EGLProc) eglCopyBuffers },
|
|
|
|
{ "eglCreateContext", (_EGLProc) eglCreateContext },
|
|
|
|
{ "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface },
|
|
|
|
{ "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface },
|
|
|
|
{ "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface },
|
|
|
|
{ "eglDestroyContext", (_EGLProc) eglDestroyContext },
|
|
|
|
{ "eglDestroySurface", (_EGLProc) eglDestroySurface },
|
|
|
|
{ "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib },
|
|
|
|
{ "eglGetConfigs", (_EGLProc) eglGetConfigs },
|
|
|
|
{ "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext },
|
|
|
|
{ "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay },
|
|
|
|
{ "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface },
|
|
|
|
{ "eglGetDisplay", (_EGLProc) eglGetDisplay },
|
|
|
|
{ "eglGetError", (_EGLProc) eglGetError },
|
|
|
|
{ "eglGetProcAddress", (_EGLProc) eglGetProcAddress },
|
|
|
|
{ "eglInitialize", (_EGLProc) eglInitialize },
|
|
|
|
{ "eglMakeCurrent", (_EGLProc) eglMakeCurrent },
|
|
|
|
{ "eglQueryContext", (_EGLProc) eglQueryContext },
|
|
|
|
{ "eglQueryString", (_EGLProc) eglQueryString },
|
|
|
|
{ "eglQuerySurface", (_EGLProc) eglQuerySurface },
|
|
|
|
{ "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage },
|
|
|
|
{ "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib },
|
|
|
|
{ "eglSwapBuffers", (_EGLProc) eglSwapBuffers },
|
|
|
|
{ "eglSwapInterval", (_EGLProc) eglSwapInterval },
|
|
|
|
{ "eglTerminate", (_EGLProc) eglTerminate },
|
|
|
|
{ "eglWaitGL", (_EGLProc) eglWaitGL },
|
|
|
|
{ "eglWaitNative", (_EGLProc) eglWaitNative },
|
|
|
|
/* Extensions */
|
2006-01-30 00:10:55 +00:00
|
|
|
#ifdef EGL_MESA_screen_surface
|
2005-05-13 19:31:35 +01:00
|
|
|
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
|
|
|
|
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
|
|
|
|
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
|
2005-05-14 15:54:38 +01:00
|
|
|
{ "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA },
|
2005-05-13 19:31:35 +01:00
|
|
|
{ "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA },
|
|
|
|
{ "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA },
|
2005-12-10 17:54:00 +00:00
|
|
|
{ "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA },
|
2005-05-13 19:31:35 +01:00
|
|
|
{ "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA },
|
|
|
|
{ "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA },
|
|
|
|
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
|
|
|
|
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
|
|
|
|
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
|
2006-01-30 00:10:55 +00:00
|
|
|
#endif /* EGL_MESA_screen_surface */
|
|
|
|
#ifdef EGL_VERSION_1_2
|
|
|
|
{ "eglBindAPI", (_EGLProc) eglBindAPI },
|
|
|
|
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
|
|
|
|
{ "eglQueryAPI", (_EGLProc) eglQueryAPI },
|
|
|
|
{ "eglReleaseThread", (_EGLProc) eglReleaseThread },
|
|
|
|
{ "eglWaitClient", (_EGLProc) eglWaitClient },
|
|
|
|
#endif /* EGL_VERSION_1_2 */
|
2005-04-22 22:09:39 +01:00
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
EGLint i;
|
|
|
|
for (i = 0; egl_functions[i].name; i++) {
|
|
|
|
if (strcmp(egl_functions[i].name, procname) == 0) {
|
|
|
|
return (genericFunc) egl_functions[i].function;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
/* XXX enable this code someday */
|
|
|
|
return (genericFunc) _glapi_get_proc_address(procname);
|
|
|
|
#else
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* EGL_MESA_screen extension
|
|
|
|
*/
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-05-04 04:33:21 +01:00
|
|
|
eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
|
2005-04-22 22:09:39 +01:00
|
|
|
const EGLint *attrib_list, EGLModeMESA *modes,
|
|
|
|
EGLint modes_size, EGLint *num_modes)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes);
|
2005-04-22 22:09:39 +01:00
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-05-04 04:33:21 +01:00
|
|
|
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode);
|
2005-04-22 22:09:39 +01:00
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.GetModeAttribMESA(drv, dpy, mode, attribute, value);
|
2005-04-22 22:09:39 +01:00
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-05-16 03:21:08 +01:00
|
|
|
eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask)
|
2005-05-14 15:54:38 +01:00
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CopyContextMESA(drv, dpy, source, dest, mask);
|
2005-05-14 15:54:38 +01:00
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-22 22:09:39 +01:00
|
|
|
EGLBoolean
|
2005-05-04 04:33:21 +01:00
|
|
|
eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2005-05-04 04:33:21 +01:00
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
if (drv)
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.GetScreensMESA(drv, dpy, screens, max_screens, num_screens);
|
2005-05-04 04:33:21 +01:00
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-04 04:33:21 +01:00
|
|
|
EGLSurface
|
|
|
|
eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2005-05-13 19:31:35 +01:00
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.CreateScreenSurfaceMESA(drv, dpy, config, attrib_list);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean
|
2005-12-10 17:54:00 +00:00
|
|
|
eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2005-05-13 19:31:35 +01:00
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-12-10 17:54:00 +00:00
|
|
|
return drv->API.ShowScreenSurfaceMESA(drv, dpy, screen, surface, mode);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean
|
2005-05-13 19:31:35 +01:00
|
|
|
eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2005-05-13 19:31:35 +01:00
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.ScreenPositionMESA(drv, dpy, screen, x, y);
|
2005-05-13 19:31:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean
|
|
|
|
eglQueryScreenMESA( EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QueryScreenMESA(drv, dpy, screen, attribute, value);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean
|
2005-05-04 04:33:21 +01:00
|
|
|
eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2005-05-13 19:31:35 +01:00
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QueryScreenSurfaceMESA(drv, dpy, screen, surface);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean
|
2005-05-13 19:31:35 +01:00
|
|
|
eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2005-05-13 19:31:35 +01:00
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QueryScreenModeMESA(drv, dpy, screen, mode);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-13 19:31:35 +01:00
|
|
|
const char *
|
|
|
|
eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
2005-11-24 04:02:16 +00:00
|
|
|
return drv->API.QueryModeStringMESA(drv, dpy, mode);
|
2005-05-13 19:31:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-30 00:10:55 +00:00
|
|
|
/**
|
|
|
|
** EGL 1.2
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifdef EGL_VERSION_1_2
|
|
|
|
|
|
|
|
EGLBoolean
|
|
|
|
eglBindAPI(EGLenum api)
|
|
|
|
{
|
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
|
|
|
|
|
|
switch (api) {
|
2008-05-27 21:23:56 +01:00
|
|
|
#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
|
2006-01-30 00:10:55 +00:00
|
|
|
case EGL_OPENGL_ES_API:
|
|
|
|
if (_eglGlobal.OpenGLESAPISupported) {
|
|
|
|
t->CurrentAPI = api;
|
|
|
|
return EGL_TRUE;
|
|
|
|
}
|
|
|
|
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
|
|
|
return EGL_FALSE;
|
|
|
|
case EGL_OPENVG_API:
|
|
|
|
if (_eglGlobal.OpenVGAPISupported) {
|
|
|
|
t->CurrentAPI = api;
|
|
|
|
return EGL_TRUE;
|
|
|
|
}
|
|
|
|
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
|
|
|
return EGL_FALSE;
|
|
|
|
default:
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
|
|
|
return EGL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLSurface
|
|
|
|
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
|
|
|
EGLClientBuffer buffer, EGLConfig config,
|
|
|
|
const EGLint *attrib_list)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer,
|
|
|
|
config, attrib_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLenum
|
|
|
|
eglQueryAPI(void)
|
|
|
|
{
|
2008-05-27 21:23:56 +01:00
|
|
|
/* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
2006-01-30 00:10:55 +00:00
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
|
|
return t->CurrentAPI;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean
|
|
|
|
eglReleaseThread(void)
|
|
|
|
{
|
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
|
|
EGLDisplay dpy = eglGetCurrentDisplay();
|
|
|
|
if (dpy) {
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
/* unbind context */
|
|
|
|
(void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE,
|
|
|
|
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
|
|
}
|
|
|
|
_eglDeleteThreadData(t);
|
|
|
|
return EGL_TRUE;
|
|
|
|
}
|
2005-05-13 19:31:35 +01:00
|
|
|
|
|
|
|
|
2006-01-30 00:10:55 +00:00
|
|
|
EGLBoolean
|
|
|
|
eglWaitClient(void)
|
|
|
|
{
|
|
|
|
EGLDisplay dpy = eglGetCurrentDisplay();
|
|
|
|
if (dpy != EGL_NO_DISPLAY) {
|
|
|
|
_EGLDriver *drv = _eglLookupDriver(dpy);
|
|
|
|
return drv->API.WaitClient(drv, dpy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return EGL_FALSE;
|
|
|
|
}
|
2005-05-13 19:31:35 +01:00
|
|
|
|
2006-01-30 00:10:55 +00:00
|
|
|
#endif /* EGL_VERSION_1_2 */
|