*
* These macros will unlock the display and record the error code.
*/
-#define _EGL_ERROR(disp, err, ret) \
- ({ \
+#define RETURN_EGL_ERROR(disp, err, ret) \
+ do { \
if (disp) \
_eglUnlockDisplay(disp); \
/* EGL error codes are non-zero */ \
if (err) \
_eglError(err, __FUNCTION__); \
- ret; \
- })
-#define _EGL_SUCCESS(disp, ret) _EGL_ERROR(disp, EGL_SUCCESS, ret)
+ return ret; \
+ } while (0)
+
+#define RETURN_EGL_SUCCESS(disp, ret) \
+ RETURN_EGL_ERROR(disp, EGL_SUCCESS, ret)
+
/* record EGL_SUCCESS only when ret evaluates to true */
-#define _EGL_EVAL(disp, ret) _EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret)
+#define RETURN_EGL_EVAL(disp, ret) \
+ RETURN_EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret)
-/**
+/*
* A bunch of macros and checks to simplify error checking.
*/
-#define _EGL_CHECK_DISPLAY(disp, ret) \
- ({ \
- _EGLDriver *__drv = _eglCheckDisplay(disp, __FUNCTION__); \
- if (!__drv) \
- return _EGL_ERROR(disp, 0, ret); \
- __drv; \
- })
-
-
-#define _EGL_CHECK_OBJECT(disp, type, obj, ret) \
- ({ \
- _EGLDriver *__drv = _eglCheck ## type(disp, obj, __FUNCTION__); \
- if (!__drv) \
- return _EGL_ERROR(disp, 0, ret); \
- __drv; \
- })
-#define _EGL_CHECK_SURFACE(disp, surf, ret) \
- _EGL_CHECK_OBJECT(disp, Surface, surf, ret)
-#define _EGL_CHECK_CONTEXT(disp, context, ret) \
- _EGL_CHECK_OBJECT(disp, Context, context, ret)
-#define _EGL_CHECK_CONFIG(disp, conf, ret) \
- _EGL_CHECK_OBJECT(disp, Config, conf, ret)
-#define _EGL_CHECK_SCREEN(disp, scrn, ret) \
- _EGL_CHECK_OBJECT(disp, Screen, scrn, ret)
-#define _EGL_CHECK_MODE(disp, m, ret) \
- _EGL_CHECK_OBJECT(disp, Mode, m, ret)
+
+#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)
+
static INLINE _EGLDriver *
EGLint major_int, minor_int;
if (!disp)
- return _EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
+ RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
if (!disp->Initialized) {
_EGLDriver *drv = disp->Driver;
_eglPreloadDrivers();
drv = _eglMatchDriver(disp);
if (!drv)
- return _EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
}
/* Initialize the particular display now */
if (!drv->API.Initialize(drv, disp, &major_int, &minor_int))
- return _EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
disp->APImajor = major_int;
disp->APIminor = minor_int;
*minor = minor_int;
}
- return _EGL_SUCCESS(disp, EGL_TRUE);
+ RETURN_EGL_SUCCESS(disp, EGL_TRUE);
}
_EGLDisplay *disp = _eglLockDisplay(dpy);
if (!disp)
- return _EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
+ RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
if (disp->Initialized) {
_EGLDriver *drv = disp->Driver;
disp->Initialized = EGL_FALSE;
}
- return _EGL_SUCCESS(disp, EGL_TRUE);
+ RETURN_EGL_SUCCESS(disp, EGL_TRUE);
}
_EGLDriver *drv;
const char *ret;
- drv = _EGL_CHECK_DISPLAY(disp, NULL);
+ _EGL_CHECK_DISPLAY(disp, NULL, drv);
ret = drv->API.QueryString(drv, disp, name);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs,
config_size, num_config);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv);
ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLContext *context;
EGLContext ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
if (!share && share_list != EGL_NO_CONTEXT)
- return _EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
context = drv->API.CreateContext(drv, disp, conf, share, attrib_list);
ret = (context) ? _eglLinkContext(context, disp) : EGL_NO_CONTEXT;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE);
+ _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv);
_eglUnlinkContext(context);
ret = drv->API.DestroyContext(drv, disp, context);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
EGLBoolean ret;
if (!disp)
- return _EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE);
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)
- return _EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE);
}
if (!drv)
- return _EGL_SUCCESS(disp, EGL_TRUE);
+ RETURN_EGL_SUCCESS(disp, EGL_TRUE);
if (!context && ctx != EGL_NO_CONTEXT)
- return _EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
if ((!draw_surf && draw != EGL_NO_SURFACE) ||
(!read_surf && read != EGL_NO_SURFACE))
- return _EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE);
+ _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv);
ret = drv->API.QueryContext(drv, disp, context, attribute, value);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLSurface *surf;
EGLSurface ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLSurface *surf;
EGLSurface ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLSurface *surf;
EGLSurface ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
_eglUnlinkSurface(surf);
ret = drv->API.DestroySurface(drv, disp, surf);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
EGLBoolean EGLAPIENTRY
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
ret = drv->API.QuerySurface(drv, disp, surf, attribute, value);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
EGLBoolean EGLAPIENTRY
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
ret = drv->API.SurfaceAttrib(drv, disp, surf, attribute, value);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
ret = drv->API.BindTexImage(drv, disp, surf, buffer);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
ret = drv->API.ReleaseTexImage(drv, disp, surf, buffer);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
if (!ctx || !_eglIsContextLinked(ctx) || ctx->Resource.Display != disp)
- return _EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
surf = ctx->DrawSurface;
if (!_eglIsSurfaceLinked(surf))
- return _EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.SwapInterval(drv, disp, surf, interval);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
/* surface must be bound to current context in EGL 1.4 */
if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
- return _EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
ret = drv->API.SwapBuffers(drv, disp, surf);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE);
+ _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
ret = drv->API.CopyBuffers(drv, disp, surf, target);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
EGLBoolean ret;
if (!ctx)
- return _EGL_SUCCESS(NULL, EGL_TRUE);
+ RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
disp = ctx->Resource.Display;
_eglLockMutex(&disp->Mutex);
/* let bad current context imply bad current surface */
if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
- return _EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
/* a valid current context implies an initialized current display */
assert(disp->Initialized);
drv = disp->Driver;
ret = drv->API.WaitClient(drv, disp, ctx);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
EGLBoolean ret;
if (api_index != es_index && _eglIsCurrentThreadDummy())
- return _EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE);
+ RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE);
t->CurrentAPIIndex = es_index;
ret = eglWaitClient();
EGLBoolean ret;
if (!ctx)
- return _EGL_SUCCESS(NULL, EGL_TRUE);
+ RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
disp = ctx->Resource.Display;
_eglLockMutex(&disp->Mutex);
/* let bad current context imply bad current surface */
if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface))
- return _EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
/* a valid current context implies an initialized current display */
assert(disp->Initialized);
drv = disp->Driver;
ret = drv->API.WaitNative(drv, disp, engine);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
ret = (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY;
- return _EGL_SUCCESS(NULL, ret);
+ RETURN_EGL_SUCCESS(NULL, ret);
}
ret = _eglGetContextHandle(ctx);
- return _EGL_SUCCESS(NULL, ret);
+ RETURN_EGL_SUCCESS(NULL, ret);
}
EGLSurface ret;
if (!ctx)
- return _EGL_SUCCESS(NULL, EGL_NO_SURFACE);
+ RETURN_EGL_SUCCESS(NULL, EGL_NO_SURFACE);
switch (readdraw) {
case EGL_DRAW:
ret = _eglGetSurfaceHandle(surf);
- return _EGL_ERROR(NULL, err, ret);
+ RETURN_EGL_ERROR(NULL, err, ret);
}
_EGLProc ret;
if (!procname)
- return _EGL_SUCCESS(NULL, NULL);
+ RETURN_EGL_SUCCESS(NULL, NULL);
ret = NULL;
if (strncmp(procname, "egl", 3) == 0) {
}
}
if (ret)
- return _EGL_SUCCESS(NULL, ret);
+ RETURN_EGL_SUCCESS(NULL, ret);
_eglPreloadDrivers();
break;
}
- return _EGL_SUCCESS(NULL, ret);
+ RETURN_EGL_SUCCESS(NULL, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
ret = drv->API.ChooseModeMESA(drv, disp, scrn, attrib_list,
modes, modes_size, num_modes);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
ret = drv->API.GetModesMESA(drv, disp, scrn, modes, mode_size, num_mode);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_MODE(disp, m, EGL_FALSE);
+ _EGL_CHECK_MODE(disp, m, EGL_FALSE, drv);
ret = drv->API.GetModeAttribMESA(drv, disp, m, attribute, value);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE);
+ _EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE, drv);
if (!dest_context)
- return _EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
ret = drv->API.CopyContextMESA(drv, disp,
source_context, dest_context, mask);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
ret = drv->API.GetScreensMESA(drv, disp, screens, max_screens, num_screens);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLSurface *surf;
EGLSurface ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
if (!surf && surface != EGL_NO_SURFACE)
- return _EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if (!m && mode != EGL_NO_MODE_MESA)
- return _EGL_ERROR(disp, EGL_BAD_MODE_MESA, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_MODE_MESA, EGL_FALSE);
ret = drv->API.ShowScreenSurfaceMESA(drv, disp, scrn, surf, m);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
ret = drv->API.ScreenPositionMESA(drv, disp, scrn, x, y);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
ret = drv->API.QueryScreenMESA(drv, disp, scrn, attribute, value);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLSurface *surf;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
ret = drv->API.QueryScreenSurfaceMESA(drv, disp, scrn, &surf);
if (ret && surface)
*surface = _eglGetSurfaceHandle(surf);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLMode *m;
EGLBoolean ret;
- drv = _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE);
+ _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
ret = drv->API.QueryScreenModeMESA(drv, disp, scrn, &m);
if (ret && mode)
*mode = m->Handle;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
const char *ret;
- drv = _EGL_CHECK_MODE(disp, m, NULL);
+ _EGL_CHECK_MODE(disp, m, NULL, drv);
ret = drv->API.QueryModeStringMESA(drv, disp, m);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLThreadInfo *t = _eglGetCurrentThread();
if (_eglIsCurrentThreadDummy())
- return _EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE);
+ RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE);
if (!_eglIsApiValid(api))
- return _EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE);
+ RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE);
t->CurrentAPIIndex = _eglConvertApiToIndex(api);
- return _EGL_SUCCESS(NULL, EGL_TRUE);
+ RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
}
/* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */
ret = _eglConvertApiFromIndex(t->CurrentAPIIndex);
- return _EGL_SUCCESS(NULL, ret);
+ RETURN_EGL_SUCCESS(NULL, ret);
}
_EGLSurface *surf;
EGLSurface ret;
- drv = _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE);
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer,
conf, attrib_list);
ret = (surf) ? _eglLinkSurface(surf, disp) : EGL_NO_SURFACE;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_eglDestroyCurrentThread();
- return _EGL_SUCCESS(NULL, EGL_TRUE);
+ RETURN_EGL_SUCCESS(NULL, EGL_TRUE);
}
_EGLImage *img;
EGLImageKHR ret;
- drv = _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR);
+ _EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
if (!context && ctx != EGL_NO_CONTEXT)
- return _EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
img = drv->API.CreateImageKHR(drv,
disp, context, target, buffer, attr_list);
ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}
_EGLDriver *drv;
EGLBoolean ret;
- drv = _EGL_CHECK_DISPLAY(disp, EGL_FALSE);
+ _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
if (!img)
- return _EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
+ RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
_eglUnlinkImage(img);
ret = drv->API.DestroyImageKHR(drv, disp, img);
- return _EGL_EVAL(disp, ret);
+ RETURN_EGL_EVAL(disp, ret);
}