struct xdri_egl_surface *xdri_surf = lookup_surface(draw);
/* swapBuffers does not flush commands */
- if (draw == _eglGetCurrentSurface(EGL_DRAW) &&
- xdri_driver->FlushCurrentContext)
+ if (draw->Binding && xdri_driver->FlushCurrentContext)
xdri_driver->FlushCurrentContext();
xdri_dpy->psc->driScreen->swapBuffers(xdri_surf->driDrawable, 0, 0, 0);
EGLDisplay EGLAPIENTRY
eglGetCurrentDisplay(void)
{
- _EGLDisplay *dpy = _eglGetCurrentDisplay();
- return _eglGetDisplayHandle(dpy);
+ _EGLContext *ctx = _eglGetCurrentContext();
+ return (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY;
}
}
-/**
- * Return the display of the currently bound context, or NULL.
- */
-_EGLDisplay *
-_eglGetCurrentDisplay(void)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- _EGLContext *ctx = t->CurrentContexts[t->CurrentAPIIndex];
- if (ctx)
- return ctx->Resource.Display;
- else
- return NULL;
-}
-
-
-/**
- * Return the read or write surface of the currently bound context, or NULL.
- */
-_EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- _EGLContext *ctx = t->CurrentContexts[t->CurrentAPIIndex];
- if (ctx) {
- switch (readdraw) {
- case EGL_DRAW:
- return ctx->DrawSurface;
- case EGL_READ:
- return ctx->ReadSurface;
- default:
- return NULL;
- }
- }
- return NULL;
-}
-
-
/**
* Record EGL error code.
*/
_eglGetCurrentContext(void);
-PUBLIC _EGLDisplay *
-_eglGetCurrentDisplay(void);
-
-
-PUBLIC _EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw);
-
-
PUBLIC EGLBoolean
_eglError(EGLint errCode, const char *msg);
static EGLBoolean
egl_g3d_wait_native(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
{
- _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW);
- struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+ _EGLContext *ctx = _eglGetCurrentContext();
if (engine != EGL_CORE_NATIVE_ENGINE)
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
- if (gsurf)
+ if (ctx && ctx->DrawSurface) {
+ struct egl_g3d_surface *gsurf = egl_g3d_surface(ctx->DrawSurface);
gsurf->native->wait(gsurf->native);
+ }
return EGL_TRUE;
}