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
|
2009-09-30 08:08:34 +01:00
|
|
|
* opaque handles. Internal objects are linked to a display to
|
|
|
|
* create the handles.
|
2005-04-22 22:09:39 +01:00
|
|
|
*
|
2009-09-30 08:08:34 +01:00
|
|
|
* For each public API entry point, the opaque handles are looked up
|
|
|
|
* before being dispatched to the drivers. When it fails to look up
|
|
|
|
* a handle, one of
|
|
|
|
*
|
|
|
|
* EGL_BAD_DISPLAY
|
|
|
|
* EGL_BAD_CONFIG
|
|
|
|
* EGL_BAD_CONTEXT
|
|
|
|
* EGL_BAD_SURFACE
|
|
|
|
* EGL_BAD_SCREEN_MESA
|
|
|
|
* EGL_BAD_MODE_MESA
|
|
|
|
*
|
|
|
|
* is generated and the driver function is not called. An
|
|
|
|
* uninitialized EGLDisplay has no driver associated with it. When
|
|
|
|
* such display is detected,
|
|
|
|
*
|
|
|
|
* EGL_NOT_INITIALIZED
|
|
|
|
*
|
|
|
|
* is generated.
|
2005-04-22 22:09:39 +01:00
|
|
|
*
|
2009-10-15 04:08:33 +01:00
|
|
|
* Some of the entry points use current display, context, or surface
|
|
|
|
* implicitly. For such entry points, the implicit objects are also
|
|
|
|
* checked before calling the driver function. Other than the
|
|
|
|
* errors listed above,
|
|
|
|
*
|
|
|
|
* EGL_BAD_CURRENT_SURFACE
|
|
|
|
*
|
|
|
|
* may also be generated.
|
|
|
|
*
|
2005-04-22 22:09:39 +01:00
|
|
|
* 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>
|
2010-05-31 04:47:58 +01:00
|
|
|
|
2005-04-22 22:09:39 +01:00
|
|
|
#include "eglcontext.h"
|
|
|
|
#include "egldisplay.h"
|
|
|
|
#include "egltypedefs.h"
|
2010-01-29 01:00:30 +00:00
|
|
|
#include "eglcurrent.h"
|
2005-04-22 22:09:39 +01:00
|
|
|
#include "egldriver.h"
|
|
|
|
#include "eglsurface.h"
|
2009-08-11 10:09:39 +01:00
|
|
|
#include "eglconfig.h"
|
|
|
|
#include "eglscreen.h"
|
|
|
|
#include "eglmode.h"
|
2009-08-15 15:58:13 +01:00
|
|
|
#include "eglimage.h"
|
2010-08-14 16:09:12 +01:00
|
|
|
#include "eglsync.h"
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
2010-02-17 07:22:03 +00:00
|
|
|
/**
|
|
|
|
* Macros to help return an API entrypoint.
|
2010-02-17 09:30:44 +00:00
|
|
|
*
|
|
|
|
* These macros will unlock the display and record the error code.
|
2010-02-17 07:22:03 +00:00
|
|
|
*/
|
2010-02-19 04:08:50 +00:00
|
|
|
#define RETURN_EGL_ERROR(disp, err, ret) \
|
|
|
|
do { \
|
2010-02-17 09:30:44 +00:00
|
|
|
if (disp) \
|
|
|
|
_eglUnlockDisplay(disp); \
|
2010-02-17 07:22:03 +00:00
|
|
|
/* EGL error codes are non-zero */ \
|
|
|
|
if (err) \
|
|
|
|
_eglError(err, __FUNCTION__); \
|
2010-02-19 04:08:50 +00:00
|
|
|
return ret; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define RETURN_EGL_SUCCESS(disp, ret) \
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_SUCCESS, ret)
|
|
|
|
|
2010-02-17 08:05:27 +00:00
|
|
|
/* record EGL_SUCCESS only when ret evaluates to true */
|
2010-02-19 04:08:50 +00:00
|
|
|
#define RETURN_EGL_EVAL(disp, ret) \
|
|
|
|
RETURN_EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret)
|
2010-02-17 07:22:03 +00:00
|
|
|
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
/*
|
2010-02-17 07:22:03 +00:00
|
|
|
* A bunch of macros and checks to simplify error checking.
|
|
|
|
*/
|
2010-02-19 04:08:50 +00:00
|
|
|
|
|
|
|
#define _EGL_CHECK_DISPLAY(disp, ret, drv) \
|
|
|
|
do { \
|
|
|
|
drv = _eglCheckDisplay(disp, __FUNCTION__); \
|
|
|
|
if (!drv) \
|
|
|
|
RETURN_EGL_ERROR(disp, 0, ret); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define _EGL_CHECK_OBJECT(disp, type, obj, ret, drv) \
|
|
|
|
do { \
|
|
|
|
drv = _eglCheck ## type(disp, obj, __FUNCTION__); \
|
|
|
|
if (!drv) \
|
|
|
|
RETURN_EGL_ERROR(disp, 0, ret); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define _EGL_CHECK_SURFACE(disp, surf, ret, drv) \
|
|
|
|
_EGL_CHECK_OBJECT(disp, Surface, surf, ret, drv)
|
|
|
|
|
|
|
|
#define _EGL_CHECK_CONTEXT(disp, context, ret, drv) \
|
|
|
|
_EGL_CHECK_OBJECT(disp, Context, context, ret, drv)
|
|
|
|
|
|
|
|
#define _EGL_CHECK_CONFIG(disp, conf, ret, drv) \
|
|
|
|
_EGL_CHECK_OBJECT(disp, Config, conf, ret, drv)
|
|
|
|
|
|
|
|
#define _EGL_CHECK_SCREEN(disp, scrn, ret, drv) \
|
|
|
|
_EGL_CHECK_OBJECT(disp, Screen, scrn, ret, drv)
|
|
|
|
|
|
|
|
#define _EGL_CHECK_MODE(disp, m, ret, drv) \
|
|
|
|
_EGL_CHECK_OBJECT(disp, Mode, m, ret, drv)
|
|
|
|
|
2010-08-14 16:09:12 +01:00
|
|
|
#define _EGL_CHECK_SYNC(disp, s, ret, drv) \
|
|
|
|
_EGL_CHECK_OBJECT(disp, Sync, s, ret, drv)
|
2010-02-17 07:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckDisplay(_EGLDisplay *disp, const char *msg)
|
|
|
|
{
|
|
|
|
if (!disp) {
|
|
|
|
_eglError(EGL_BAD_DISPLAY, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!disp->Initialized) {
|
|
|
|
_eglError(EGL_NOT_INITIALIZED, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return disp->Driver;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckSurface(_EGLDisplay *disp, _EGLSurface *surf, const char *msg)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglCheckDisplay(disp, msg);
|
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
if (!surf) {
|
|
|
|
_eglError(EGL_BAD_SURFACE, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckContext(_EGLDisplay *disp, _EGLContext *context, const char *msg)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglCheckDisplay(disp, msg);
|
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
if (!context) {
|
|
|
|
_eglError(EGL_BAD_CONTEXT, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckConfig(_EGLDisplay *disp, _EGLConfig *conf, const char *msg)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglCheckDisplay(disp, msg);
|
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
if (!conf) {
|
|
|
|
_eglError(EGL_BAD_CONFIG, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-14 16:09:12 +01:00
|
|
|
#ifdef EGL_KHR_reusable_sync
|
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckSync(_EGLDisplay *disp, _EGLSync *s, const char *msg)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglCheckDisplay(disp, msg);
|
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
if (!s) {
|
|
|
|
_eglError(EGL_BAD_PARAMETER, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* EGL_KHR_reusable_sync */
|
|
|
|
|
|
|
|
|
2010-02-17 07:22:03 +00:00
|
|
|
#ifdef EGL_MESA_screen_surface
|
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckScreen(_EGLDisplay *disp, _EGLScreen *scrn, const char *msg)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglCheckDisplay(disp, msg);
|
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
if (!scrn) {
|
|
|
|
_eglError(EGL_BAD_SCREEN_MESA, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static INLINE _EGLDriver *
|
|
|
|
_eglCheckMode(_EGLDisplay *disp, _EGLMode *m, const char *msg)
|
|
|
|
{
|
|
|
|
_EGLDriver *drv = _eglCheckDisplay(disp, msg);
|
|
|
|
if (!drv)
|
|
|
|
return NULL;
|
|
|
|
if (!m) {
|
|
|
|
_eglError(EGL_BAD_MODE_MESA, msg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return drv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* EGL_MESA_screen_surface */
|
|
|
|
|
|
|
|
|
2010-02-17 09:30:44 +00:00
|
|
|
/**
|
|
|
|
* Lookup and lock a display.
|
|
|
|
*/
|
|
|
|
static INLINE _EGLDisplay *
|
|
|
|
_eglLockDisplay(EGLDisplay display)
|
|
|
|
{
|
|
|
|
_EGLDisplay *dpy = _eglLookupDisplay(display);
|
|
|
|
if (dpy)
|
|
|
|
_eglLockMutex(&dpy->Mutex);
|
|
|
|
return dpy;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unlock a display.
|
|
|
|
*/
|
|
|
|
static INLINE void
|
|
|
|
_eglUnlockDisplay(_EGLDisplay *dpy)
|
|
|
|
{
|
|
|
|
_eglUnlockMutex(&dpy->Mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-22 22:09:39 +01:00
|
|
|
/**
|
2008-05-27 23:48:23 +01:00
|
|
|
* This is typically the first EGL function that an application calls.
|
2010-02-17 10:39:27 +00:00
|
|
|
* It associates a private _EGLDisplay object to the native display.
|
2005-04-22 22:09:39 +01:00
|
|
|
*/
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLDisplay EGLAPIENTRY
|
2010-01-25 03:55:48 +00:00
|
|
|
eglGetDisplay(EGLNativeDisplayType nativeDisplay)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-06-17 10:14:03 +01:00
|
|
|
_EGLPlatformType plat = _eglGetNativePlatform();
|
|
|
|
_EGLDisplay *dpy = _eglFindDisplay(plat, (void *) 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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2008-08-06 20:40:03 +01:00
|
|
|
|
2009-08-11 10:09:39 +01:00
|
|
|
if (!disp)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-01-27 15:55:58 +00:00
|
|
|
if (!disp->Initialized) {
|
2010-07-04 08:55:12 +01:00
|
|
|
if (!_eglMatchDriver(disp, EGL_FALSE))
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2009-08-17 08:53:54 +01:00
|
|
|
/* limit to APIs supported by core */
|
2011-01-13 08:53:13 +00:00
|
|
|
disp->ClientAPIs &= _EGL_API_ALL_BITS;
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
/* Update applications version of major and minor if not NULL */
|
|
|
|
if ((major != NULL) && (minor != NULL)) {
|
2011-01-13 08:53:13 +00:00
|
|
|
*major = disp->VersionMajor;
|
|
|
|
*minor = disp->VersionMinor;
|
2009-08-11 10:09:39 +01:00
|
|
|
}
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(disp, EGL_TRUE);
|
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
|
|
|
eglTerminate(EGLDisplay dpy)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
if (!disp)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-01-27 15:55:58 +00:00
|
|
|
if (disp->Initialized) {
|
|
|
|
_EGLDriver *drv = disp->Driver;
|
|
|
|
|
2009-08-13 06:39:51 +01:00
|
|
|
drv->API.Terminate(drv, disp);
|
2010-01-27 15:55:58 +00:00
|
|
|
/* do not reset disp->Driver */
|
|
|
|
disp->Initialized = EGL_FALSE;
|
2009-08-11 10:09:39 +01:00
|
|
|
}
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(disp, EGL_TRUE);
|
2009-08-11 10:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
const char * EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglQueryString(EGLDisplay dpy, EGLint name)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
const char *ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, NULL, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QueryString(drv, disp, name);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
|
|
|
|
EGLint config_size, EGLint *num_config)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs,
|
|
|
|
EGLint config_size, EGLint *num_config)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs,
|
2009-08-11 10:09:39 +01:00
|
|
|
config_size, num_config);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
|
|
|
|
EGLint attribute, EGLint *value)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLContext EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
|
|
|
|
const EGLint *attrib_list)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLContext *share = _eglLookupContext(share_list, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLContext *context;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLContext ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-09-23 19:42:15 +01:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
|
|
|
|
|
|
|
|
if (!config) {
|
|
|
|
/* config may be NULL if surfaceless */
|
|
|
|
if (!disp->Extensions.KHR_surfaceless_gles1 &&
|
|
|
|
!disp->Extensions.KHR_surfaceless_gles2 &&
|
|
|
|
!disp->Extensions.KHR_surfaceless_opengl)
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
|
|
|
|
}
|
2010-06-03 03:48:06 +01:00
|
|
|
|
2010-02-17 08:05:27 +00:00
|
|
|
if (!share && share_list != EGL_NO_CONTEXT)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
context = drv->API.CreateContext(drv, disp, conf, share, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (context) ? _eglLinkContext(context) : EGL_NO_CONTEXT;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLContext *context = _eglLookupContext(ctx, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv);
|
2009-08-11 10:09:39 +01:00
|
|
|
_eglUnlinkContext(context);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.DestroyContext(drv, disp, context);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
|
|
|
|
EGLContext ctx)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLContext *context = _eglLookupContext(ctx, disp);
|
|
|
|
_EGLSurface *draw_surf = _eglLookupSurface(draw, disp);
|
|
|
|
_EGLSurface *read_surf = _eglLookupSurface(read, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-01-27 15:51:54 +00:00
|
|
|
if (!disp)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE);
|
2010-01-27 15:51:54 +00:00
|
|
|
drv = disp->Driver;
|
|
|
|
|
|
|
|
/* display is allowed to be uninitialized under certain condition */
|
|
|
|
if (!disp->Initialized) {
|
|
|
|
if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE ||
|
|
|
|
ctx != EGL_NO_CONTEXT)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE);
|
2010-01-27 15:51:54 +00:00
|
|
|
}
|
2009-08-11 10:09:39 +01:00
|
|
|
if (!drv)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(disp, EGL_TRUE);
|
2010-01-27 15:51:54 +00:00
|
|
|
|
2009-08-11 10:09:39 +01:00
|
|
|
if (!context && ctx != EGL_NO_CONTEXT)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
|
2010-09-23 19:42:15 +01:00
|
|
|
if (!draw_surf || !read_surf) {
|
|
|
|
/* surfaces may be NULL if surfaceless */
|
|
|
|
if (!disp->Extensions.KHR_surfaceless_gles1 &&
|
|
|
|
!disp->Extensions.KHR_surfaceless_gles2 &&
|
|
|
|
!disp->Extensions.KHR_surfaceless_opengl)
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
|
|
|
|
|
|
|
if ((!draw_surf && draw != EGL_NO_SURFACE) ||
|
|
|
|
(!read_surf && read != EGL_NO_SURFACE))
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
|
|
|
if (draw_surf || read_surf)
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
|
|
|
|
}
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglQueryContext(EGLDisplay dpy, EGLContext ctx,
|
|
|
|
EGLint attribute, EGLint *value)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLContext *context = _eglLookupContext(ctx, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QueryContext(drv, disp, context, attribute, value);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
|
2010-01-25 03:55:48 +00:00
|
|
|
EGLNativeWindowType window, const EGLint *attrib_list)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLSurface ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
|
2010-06-17 10:14:03 +01:00
|
|
|
if (disp->Platform != _eglGetNativePlatform())
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
|
2010-01-25 03:55:48 +00:00
|
|
|
EGLNativePixmapType pixmap, const EGLint *attrib_list)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLSurface ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
|
2010-06-17 10:14:03 +01:00
|
|
|
if (disp->Platform != _eglGetNativePlatform())
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
|
|
|
|
const EGLint *attrib_list)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLSurface ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2009-08-11 10:09:39 +01:00
|
|
|
_eglUnlinkSurface(surf);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.DestroySurface(drv, disp, surf);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
|
|
|
|
EGLint attribute, EGLint *value)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QuerySurface(drv, disp, surf, attribute, value);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
|
|
|
|
EGLint attribute, EGLint value)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.SurfaceAttrib(drv, disp, surf, attribute, value);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.BindTexImage(drv, disp, surf, buffer);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.ReleaseTexImage(drv, disp, surf, buffer);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-10-15 04:08:48 +01:00
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
2009-10-15 04:08:48 +01:00
|
|
|
|
2010-10-23 05:52:26 +01:00
|
|
|
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
|
|
|
ctx->Resource.Display != disp)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
|
2009-10-15 04:08:48 +01:00
|
|
|
|
|
|
|
surf = ctx->DrawSurface;
|
2010-10-23 05:52:26 +01:00
|
|
|
if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
2009-10-15 04:08:48 +01:00
|
|
|
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.SwapInterval(drv, disp, surf, interval);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2009-10-15 04:08:33 +01:00
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2009-10-15 04:08:33 +01:00
|
|
|
|
|
|
|
/* surface must be bound to current context in EGL 1.4 */
|
2010-10-23 05:52:26 +01:00
|
|
|
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
|
|
|
surf != ctx->DrawSurface)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
|
|
|
ret = drv->API.SwapBuffers(drv, disp, surf);
|
2009-10-15 04:08:33 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2010-01-25 03:55:48 +00:00
|
|
|
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
2010-06-17 10:14:03 +01:00
|
|
|
if (disp->Platform != _eglGetNativePlatform())
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.CopyBuffers(drv, disp, surf, target);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-09-28 07:12:39 +01:00
|
|
|
eglWaitClient(void)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2009-09-28 07:12:39 +01:00
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
|
|
|
_EGLDisplay *disp;
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2009-09-28 07:12:39 +01:00
|
|
|
if (!ctx)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-01-24 12:32:34 +00:00
|
|
|
disp = ctx->Resource.Display;
|
2010-02-17 09:30:44 +00:00
|
|
|
_eglLockMutex(&disp->Mutex);
|
|
|
|
|
|
|
|
/* let bad current context imply bad current surface */
|
2010-10-23 05:52:26 +01:00
|
|
|
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
|
|
|
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
|
|
|
/* a valid current context implies an initialized current display */
|
2010-01-27 15:55:58 +00:00
|
|
|
assert(disp->Initialized);
|
2009-08-11 10:09:39 +01:00
|
|
|
drv = disp->Driver;
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.WaitClient(drv, disp, ctx);
|
2009-09-28 07:12:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2009-09-28 07:12:39 +01:00
|
|
|
}
|
|
|
|
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2009-09-28 07:12:39 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglWaitGL(void)
|
|
|
|
{
|
|
|
|
#ifdef EGL_VERSION_1_2
|
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
|
|
EGLint api_index = t->CurrentAPIIndex;
|
|
|
|
EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API);
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
if (api_index != es_index && _eglIsCurrentThreadDummy())
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE);
|
2009-09-28 07:12:39 +01:00
|
|
|
|
|
|
|
t->CurrentAPIIndex = es_index;
|
|
|
|
ret = eglWaitClient();
|
|
|
|
t->CurrentAPIIndex = api_index;
|
|
|
|
return ret;
|
|
|
|
#else
|
|
|
|
return eglWaitClient();
|
|
|
|
#endif
|
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
|
|
|
eglWaitNative(EGLint engine)
|
|
|
|
{
|
2009-09-28 07:12:39 +01:00
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
|
|
|
_EGLDisplay *disp;
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2009-09-28 07:12:39 +01:00
|
|
|
if (!ctx)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-17 09:30:44 +00:00
|
|
|
disp = ctx->Resource.Display;
|
|
|
|
_eglLockMutex(&disp->Mutex);
|
|
|
|
|
2009-09-28 07:12:39 +01:00
|
|
|
/* let bad current context imply bad current surface */
|
2010-10-23 05:52:26 +01:00
|
|
|
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
|
|
|
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
|
|
|
/* a valid current context implies an initialized current display */
|
2010-01-27 15:55:58 +00:00
|
|
|
assert(disp->Initialized);
|
2009-08-11 10:09:39 +01:00
|
|
|
drv = disp->Driver;
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.WaitNative(drv, disp, engine);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLDisplay EGLAPIENTRY
|
2005-04-22 22:09:39 +01:00
|
|
|
eglGetCurrentDisplay(void)
|
|
|
|
{
|
2010-01-26 09:13:51 +00:00
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLDisplay ret;
|
|
|
|
|
|
|
|
ret = (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY;
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, ret);
|
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();
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLContext ret;
|
|
|
|
|
|
|
|
ret = _eglGetContextHandle(ctx);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, ret);
|
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)
|
|
|
|
{
|
2009-09-30 08:34:45 +01:00
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLint err = EGL_SUCCESS;
|
2009-09-30 08:34:45 +01:00
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLSurface ret;
|
2009-09-30 08:34:45 +01:00
|
|
|
|
|
|
|
if (!ctx)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, EGL_NO_SURFACE);
|
2009-09-30 08:34:45 +01:00
|
|
|
|
|
|
|
switch (readdraw) {
|
|
|
|
case EGL_DRAW:
|
|
|
|
surf = ctx->DrawSurface;
|
|
|
|
break;
|
|
|
|
case EGL_READ:
|
|
|
|
surf = ctx->ReadSurface;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
surf = NULL;
|
2010-02-17 08:05:27 +00:00
|
|
|
err = EGL_BAD_PARAMETER;
|
2009-09-30 08:34:45 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = _eglGetSurfaceHandle(surf);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(NULL, err, ret);
|
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;
|
2009-07-17 18:41:02 +01:00
|
|
|
if (!_eglIsCurrentThreadDummy())
|
|
|
|
t->LastError = EGL_SUCCESS;
|
2005-04-22 22:09:39 +01:00
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-15 15:57:47 +01:00
|
|
|
__eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
|
|
|
eglGetProcAddress(const char *procname)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2009-08-15 15:44:46 +01:00
|
|
|
static const struct {
|
2005-04-22 22:09:39 +01:00
|
|
|
const char *name;
|
|
|
|
_EGLProc function;
|
2009-08-15 15:44:46 +01:00
|
|
|
} egl_functions[] = {
|
2010-08-20 05:35:02 +01:00
|
|
|
/* core functions should not be queryable, but, well... */
|
|
|
|
#ifdef _EGL_GET_CORE_ADDRESSES
|
|
|
|
/* alphabetical order */
|
|
|
|
{ "eglBindAPI", (_EGLProc) eglBindAPI },
|
|
|
|
{ "eglBindTexImage", (_EGLProc) eglBindTexImage },
|
|
|
|
{ "eglChooseConfig", (_EGLProc) eglChooseConfig },
|
|
|
|
{ "eglCopyBuffers", (_EGLProc) eglCopyBuffers },
|
|
|
|
{ "eglCreateContext", (_EGLProc) eglCreateContext },
|
|
|
|
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
|
|
|
|
{ "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 },
|
|
|
|
{ "eglQueryAPI", (_EGLProc) eglQueryAPI },
|
|
|
|
{ "eglQueryContext", (_EGLProc) eglQueryContext },
|
|
|
|
{ "eglQueryString", (_EGLProc) eglQueryString },
|
|
|
|
{ "eglQuerySurface", (_EGLProc) eglQuerySurface },
|
|
|
|
{ "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage },
|
|
|
|
{ "eglReleaseThread", (_EGLProc) eglReleaseThread },
|
|
|
|
{ "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib },
|
|
|
|
{ "eglSwapBuffers", (_EGLProc) eglSwapBuffers },
|
|
|
|
{ "eglSwapInterval", (_EGLProc) eglSwapInterval },
|
|
|
|
{ "eglTerminate", (_EGLProc) eglTerminate },
|
|
|
|
{ "eglWaitClient", (_EGLProc) eglWaitClient },
|
|
|
|
{ "eglWaitGL", (_EGLProc) eglWaitGL },
|
|
|
|
{ "eglWaitNative", (_EGLProc) eglWaitNative },
|
|
|
|
#endif /* _EGL_GET_CORE_ADDRESSES */
|
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 */
|
2010-06-17 10:09:01 +01:00
|
|
|
#ifdef EGL_MESA_drm_display
|
|
|
|
{ "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
|
|
|
|
#endif
|
2009-08-15 15:58:13 +01:00
|
|
|
#ifdef EGL_KHR_image_base
|
|
|
|
{ "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
|
|
|
|
{ "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
|
|
|
|
#endif /* EGL_KHR_image_base */
|
2010-05-07 03:01:35 +01:00
|
|
|
#ifdef EGL_NOK_swap_region
|
|
|
|
{ "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK },
|
2010-06-04 19:28:59 +01:00
|
|
|
#endif
|
|
|
|
#ifdef EGL_MESA_drm_image
|
|
|
|
{ "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA },
|
|
|
|
{ "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA },
|
2011-02-21 15:22:34 +00:00
|
|
|
#endif
|
2011-04-25 20:34:04 +01:00
|
|
|
#ifdef EGL_WL_bind_wayland_display
|
2011-02-21 15:22:34 +00:00
|
|
|
{ "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL },
|
|
|
|
{ "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL },
|
2010-05-07 03:01:35 +01:00
|
|
|
#endif
|
2005-04-22 22:09:39 +01:00
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
EGLint i;
|
2010-02-17 08:05:27 +00:00
|
|
|
_EGLProc ret;
|
2009-08-15 15:44:46 +01:00
|
|
|
|
|
|
|
if (!procname)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, NULL);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
|
|
|
ret = NULL;
|
2009-08-15 15:44:46 +01:00
|
|
|
if (strncmp(procname, "egl", 3) == 0) {
|
|
|
|
for (i = 0; egl_functions[i].name; i++) {
|
2010-02-17 08:05:27 +00:00
|
|
|
if (strcmp(egl_functions[i].name, procname) == 0) {
|
|
|
|
ret = egl_functions[i].function;
|
|
|
|
break;
|
|
|
|
}
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
}
|
2010-07-04 08:55:12 +01:00
|
|
|
if (!ret)
|
|
|
|
ret = _eglGetDriverProc(procname);
|
2008-05-30 21:50:33 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-15 15:44:46 +01:00
|
|
|
#ifdef EGL_MESA_screen_surface
|
|
|
|
|
|
|
|
|
2005-04-22 22:09:39 +01:00
|
|
|
/*
|
|
|
|
* 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)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen(screen, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.ChooseModeMESA(drv, disp, scrn, attrib_list,
|
|
|
|
modes, modes_size, num_modes);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes,
|
|
|
|
EGLint mode_size, EGLint *num_mode)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen(screen, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.GetModesMESA(drv, disp, scrn, modes, mode_size, num_mode);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,
|
|
|
|
EGLint attribute, EGLint *value)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLMode *m = _eglLookupMode(mode, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_MODE(disp, m, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.GetModeAttribMESA(drv, disp, m, attribute, value);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-27 20:45:41 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest,
|
|
|
|
EGLint mask)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLContext *source_context = _eglLookupContext(source, disp);
|
|
|
|
_EGLContext *dest_context = _eglLookupContext(dest, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
if (!dest_context)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.CopyContextMESA(drv, disp,
|
|
|
|
source_context, dest_context, mask);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-05-14 15:54:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,
|
|
|
|
EGLint max_screens, EGLint *num_screens)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.GetScreensMESA(drv, disp, screens, max_screens, num_screens);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,
|
|
|
|
const EGLint *attrib_list)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLSurface ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen,
|
|
|
|
EGLSurface surface, EGLModeMESA mode)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp);
|
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLMode *m = _eglLookupMode(mode, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2009-08-11 10:09:39 +01:00
|
|
|
if (!surf && surface != EGL_NO_SURFACE)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
2009-08-11 10:09:39 +01:00
|
|
|
if (!m && mode != EGL_NO_MODE_MESA)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_MODE_MESA, EGL_FALSE);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
|
|
|
ret = drv->API.ShowScreenSurfaceMESA(drv, disp, scrn, surf, m);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
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
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen(screen, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.ScreenPositionMESA(drv, disp, scrn, x, y);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-05-13 19:31:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,
|
|
|
|
EGLint attribute, EGLint *value)
|
2005-05-13 19:31:35 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen(screen, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QueryScreenMESA(drv, disp, scrn, attribute, value);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2009-08-11 10:09:39 +01:00
|
|
|
eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,
|
|
|
|
EGLSurface *surface)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QueryScreenSurfaceMESA(drv, disp, scrn, &surf);
|
|
|
|
if (ret && surface)
|
2009-08-11 10:09:39 +01:00
|
|
|
*surface = _eglGetSurfaceHandle(surf);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2005-05-13 19:31:35 +01:00
|
|
|
eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode)
|
2005-04-22 22:09:39 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLMode *m;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QueryScreenModeMESA(drv, disp, scrn, &m);
|
|
|
|
if (ret && mode)
|
2009-08-11 10:09:39 +01:00
|
|
|
*mode = m->Handle;
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-04-22 22:09:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
const char * EGLAPIENTRY
|
2005-05-13 19:31:35 +01:00
|
|
|
eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2010-02-17 07:43:47 +00:00
|
|
|
_EGLMode *m = _eglLookupMode(mode, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
const char *ret;
|
2010-02-17 07:43:47 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_MODE(disp, m, NULL, drv);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.QueryModeStringMESA(drv, disp, m);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2005-05-13 19:31:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-15 15:44:46 +01:00
|
|
|
#endif /* EGL_MESA_screen_surface */
|
|
|
|
|
|
|
|
|
2010-06-17 10:09:01 +01:00
|
|
|
#ifdef EGL_MESA_drm_display
|
|
|
|
|
|
|
|
EGLDisplay EGLAPIENTRY
|
|
|
|
eglGetDRMDisplayMESA(int fd)
|
|
|
|
{
|
|
|
|
_EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
|
|
|
|
return _eglGetDisplayHandle(dpy);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* EGL_MESA_drm_display */
|
|
|
|
|
2006-01-30 00:10:55 +00:00
|
|
|
/**
|
|
|
|
** EGL 1.2
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifdef EGL_VERSION_1_2
|
|
|
|
|
2008-05-30 20:45:40 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2006-01-30 00:10:55 +00:00
|
|
|
eglBindAPI(EGLenum api)
|
|
|
|
{
|
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
|
|
|
|
2009-07-17 18:41:02 +01:00
|
|
|
if (_eglIsCurrentThreadDummy())
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE);
|
2009-07-17 18:41:02 +01:00
|
|
|
|
2009-07-17 18:42:04 +01:00
|
|
|
if (!_eglIsApiValid(api))
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE);
|
2009-07-17 18:42:04 +01:00
|
|
|
|
2009-08-17 08:53:54 +01:00
|
|
|
t->CurrentAPIIndex = _eglConvertApiToIndex(api);
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
|
2006-01-30 00:10:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-30 20:45:40 +01:00
|
|
|
/**
|
|
|
|
* Return the last value set with eglBindAPI().
|
|
|
|
*/
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLenum EGLAPIENTRY
|
2008-05-30 20:45:40 +01:00
|
|
|
eglQueryAPI(void)
|
|
|
|
{
|
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLenum ret;
|
|
|
|
|
|
|
|
/* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
|
|
|
ret = _eglConvertApiFromIndex(t->CurrentAPIIndex);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, ret);
|
2008-05-30 20:45:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLSurface EGLAPIENTRY
|
2006-01-30 00:10:55 +00:00
|
|
|
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
|
|
|
EGLClientBuffer buffer, EGLConfig config,
|
|
|
|
const EGLint *attrib_list)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-11 10:09:39 +01:00
|
|
|
_EGLConfig *conf = _eglLookupConfig(config, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSurface *surf;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLSurface ret;
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
|
2009-08-11 10:09:39 +01:00
|
|
|
|
|
|
|
surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer,
|
|
|
|
conf, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2006-01-30 00:10:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2006-01-30 00:10:55 +00:00
|
|
|
eglReleaseThread(void)
|
|
|
|
{
|
2010-01-26 09:22:21 +00:00
|
|
|
/* unbind current contexts */
|
2009-08-11 10:09:39 +01:00
|
|
|
if (!_eglIsCurrentThreadDummy()) {
|
2010-01-26 09:22:21 +00:00
|
|
|
_EGLThreadInfo *t = _eglGetCurrentThread();
|
2010-01-28 08:49:40 +00:00
|
|
|
EGLint api_index = t->CurrentAPIIndex;
|
2010-01-26 09:22:21 +00:00
|
|
|
EGLint i;
|
|
|
|
|
|
|
|
for (i = 0; i < _EGL_API_NUM_APIS; i++) {
|
|
|
|
_EGLContext *ctx = t->CurrentContexts[i];
|
|
|
|
if (ctx) {
|
|
|
|
_EGLDisplay *disp = ctx->Resource.Display;
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDriver *drv;
|
|
|
|
|
2010-01-28 08:49:40 +00:00
|
|
|
t->CurrentAPIIndex = i;
|
2010-02-17 09:30:44 +00:00
|
|
|
|
|
|
|
_eglLockMutex(&disp->Mutex);
|
|
|
|
drv = disp->Driver;
|
2010-01-27 15:51:54 +00:00
|
|
|
(void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL);
|
2010-02-17 09:30:44 +00:00
|
|
|
_eglUnlockMutex(&disp->Mutex);
|
2010-01-26 09:22:21 +00:00
|
|
|
}
|
2009-08-11 10:09:39 +01:00
|
|
|
}
|
2010-01-28 08:49:40 +00:00
|
|
|
|
|
|
|
t->CurrentAPIIndex = api_index;
|
2006-01-30 00:10:55 +00:00
|
|
|
}
|
2009-08-11 10:09:39 +01:00
|
|
|
|
2009-07-17 18:41:02 +01:00
|
|
|
_eglDestroyCurrentThread();
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
|
2006-01-30 00:10:55 +00:00
|
|
|
}
|
2005-05-13 19:31:35 +01:00
|
|
|
|
|
|
|
|
2006-01-30 00:10:55 +00:00
|
|
|
#endif /* EGL_VERSION_1_2 */
|
2009-08-15 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef EGL_KHR_image_base
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLImageKHR EGLAPIENTRY
|
2009-08-15 15:58:13 +01:00
|
|
|
eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
|
|
|
|
EGLClientBuffer buffer, const EGLint *attr_list)
|
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-15 15:58:13 +01:00
|
|
|
_EGLContext *context = _eglLookupContext(ctx, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLImage *img;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLImageKHR ret;
|
2009-08-15 15:58:13 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
if (!disp->Extensions.KHR_image_base)
|
|
|
|
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
|
2010-02-17 08:05:27 +00:00
|
|
|
if (!context && ctx != EGL_NO_CONTEXT)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
|
2009-08-15 15:58:13 +01:00
|
|
|
|
|
|
|
img = drv->API.CreateImageKHR(drv,
|
|
|
|
disp, context, target, buffer, attr_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR;
|
2010-02-17 08:05:27 +00:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2009-08-15 15:58:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2010-02-17 08:05:27 +00:00
|
|
|
eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
|
2009-08-15 15:58:13 +01:00
|
|
|
{
|
2010-02-17 09:30:44 +00:00
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
2009-08-15 15:58:13 +01:00
|
|
|
_EGLImage *img = _eglLookupImage(image, disp);
|
|
|
|
_EGLDriver *drv;
|
2010-02-17 08:05:27 +00:00
|
|
|
EGLBoolean ret;
|
2009-08-15 15:58:13 +01:00
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
if (!disp->Extensions.KHR_image_base)
|
|
|
|
RETURN_EGL_EVAL(disp, EGL_FALSE);
|
2009-08-15 15:58:13 +01:00
|
|
|
if (!img)
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
|
2009-08-15 15:58:13 +01:00
|
|
|
|
|
|
|
_eglUnlinkImage(img);
|
2010-02-17 08:05:27 +00:00
|
|
|
ret = drv->API.DestroyImageKHR(drv, disp, img);
|
|
|
|
|
2010-02-19 04:08:50 +00:00
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
2009-08-15 15:58:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* EGL_KHR_image_base */
|
2010-05-07 03:01:35 +01:00
|
|
|
|
|
|
|
|
2010-08-14 16:09:12 +01:00
|
|
|
#ifdef EGL_KHR_reusable_sync
|
|
|
|
|
|
|
|
|
|
|
|
EGLSyncKHR EGLAPIENTRY
|
|
|
|
eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLSync *sync;
|
|
|
|
EGLSyncKHR ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
if (!disp->Extensions.KHR_reusable_sync)
|
|
|
|
RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
|
2010-08-14 16:09:12 +01:00
|
|
|
|
|
|
|
sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR;
|
2010-08-14 16:09:12 +01:00
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLSync *s = _eglLookupSync(sync, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
assert(disp->Extensions.KHR_reusable_sync);
|
|
|
|
|
2010-08-14 16:09:12 +01:00
|
|
|
_eglUnlinkSync(s);
|
|
|
|
ret = drv->API.DestroySyncKHR(drv, disp, s);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLint EGLAPIENTRY
|
|
|
|
eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLSync *s = _eglLookupSync(sync, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLint ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
assert(disp->Extensions.KHR_reusable_sync);
|
2010-08-14 16:09:12 +01:00
|
|
|
ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLSync *s = _eglLookupSync(sync, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
assert(disp->Extensions.KHR_reusable_sync);
|
2010-08-14 16:09:12 +01:00
|
|
|
ret = drv->API.SignalSyncKHR(drv, disp, s, mode);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLSync *s = _eglLookupSync(sync, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
assert(disp->Extensions.KHR_reusable_sync);
|
2010-08-14 16:09:12 +01:00
|
|
|
ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* EGL_KHR_reusable_sync */
|
|
|
|
|
|
|
|
|
2010-05-07 03:01:35 +01:00
|
|
|
#ifdef EGL_NOK_swap_region
|
|
|
|
|
2010-07-03 00:38:07 +01:00
|
|
|
EGLBoolean EGLAPIENTRY
|
2010-05-07 03:01:35 +01:00
|
|
|
eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface,
|
|
|
|
EGLint numRects, const EGLint *rects)
|
|
|
|
{
|
|
|
|
_EGLContext *ctx = _eglGetCurrentContext();
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
|
|
|
|
2010-09-23 19:42:15 +01:00
|
|
|
if (!disp->Extensions.NOK_swap_region)
|
|
|
|
RETURN_EGL_EVAL(disp, EGL_FALSE);
|
|
|
|
|
2010-05-07 03:01:35 +01:00
|
|
|
/* surface must be bound to current context in EGL 1.4 */
|
2010-10-23 05:52:26 +01:00
|
|
|
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
|
|
|
|
surf != ctx->DrawSurface)
|
2010-05-07 03:01:35 +01:00
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
|
|
|
|
2010-09-23 19:42:15 +01:00
|
|
|
ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects);
|
2010-05-07 03:01:35 +01:00
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* EGL_NOK_swap_region */
|
2010-06-04 19:28:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef EGL_MESA_drm_image
|
|
|
|
|
|
|
|
EGLImageKHR EGLAPIENTRY
|
|
|
|
eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
_EGLImage *img;
|
|
|
|
EGLImageKHR ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
if (!disp->Extensions.MESA_drm_image)
|
|
|
|
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
|
2010-06-04 19:28:59 +01:00
|
|
|
|
|
|
|
img = drv->API.CreateDRMImageMESA(drv, disp, attr_list);
|
2010-10-22 17:37:19 +01:00
|
|
|
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR;
|
2010-06-04 19:28:59 +01:00
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image,
|
|
|
|
EGLint *name, EGLint *handle, EGLint *stride)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLImage *img = _eglLookupImage(image, disp);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
2010-09-23 19:42:15 +01:00
|
|
|
assert(disp->Extensions.MESA_drm_image);
|
|
|
|
|
2010-06-04 19:28:59 +01:00
|
|
|
if (!img)
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
|
|
|
|
|
|
|
|
ret = drv->API.ExportDRMImageMESA(drv, disp, img, name, handle, stride);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2011-02-21 15:22:34 +00:00
|
|
|
|
|
|
|
#ifdef EGL_WL_bind_wayland_display
|
|
|
|
struct wl_display;
|
|
|
|
|
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
|
|
|
assert(disp->Extensions.WL_bind_wayland_display);
|
|
|
|
|
|
|
|
if (!display)
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
|
|
|
|
|
|
|
|
ret = drv->API.BindWaylandDisplayWL(drv, disp, display);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
EGLBoolean EGLAPIENTRY
|
|
|
|
eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
|
|
|
|
{
|
|
|
|
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
|
|
|
_EGLDriver *drv;
|
|
|
|
EGLBoolean ret;
|
|
|
|
|
|
|
|
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
|
|
|
assert(disp->Extensions.WL_bind_wayland_display);
|
|
|
|
|
|
|
|
if (!display)
|
|
|
|
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
|
|
|
|
|
|
|
|
ret = drv->API.UnbindWaylandDisplayWL(drv, disp, display);
|
|
|
|
|
|
|
|
RETURN_EGL_EVAL(disp, ret);
|
|
|
|
}
|
|
|
|
#endif
|