egl: Remove _eglGetCurrentSurface and _eglGetCurrentDisplay.
authorChia-I Wu <olvaffe@gmail.com>
Tue, 26 Jan 2010 09:13:51 +0000 (17:13 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 26 Jan 2010 10:46:05 +0000 (18:46 +0800)
They have little use in drivers since drivers need to work for multiple
current contexts.

src/egl/drivers/xdri/egl_xdri.c
src/egl/main/eglapi.c
src/egl/main/eglcurrent.c
src/egl/main/eglcurrent.h
src/gallium/state_trackers/egl/common/egl_g3d.c

index df251d908b9c3dac420201d60b6f67b984ffe4e9..e13d884e71573e6141e9062d82567050c8ba9ae8 100644 (file)
@@ -574,8 +574,7 @@ xdri_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
    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);
index 2e5027a32e61814edd672f2ea9f6ce25580b47bc..492a14180aac148807a5cc52a24e9b89473682d5 100644 (file)
@@ -629,8 +629,8 @@ eglWaitNative(EGLint engine)
 EGLDisplay EGLAPIENTRY
 eglGetCurrentDisplay(void)
 {
-   _EGLDisplay *dpy = _eglGetCurrentDisplay();
-   return _eglGetDisplayHandle(dpy);
+   _EGLContext *ctx = _eglGetCurrentContext();
+   return (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY;
 }
 
 
index b3be2305fd65c1b2c131957b86b59df2a115d9aa..696d04e8ba9fc1a3f1624df71f0c78892ba1ff64 100644 (file)
@@ -248,43 +248,6 @@ _eglGetCurrentContext(void)
 }
 
 
-/**
- * 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.
  */
index b8c2bda48552c2cb5663250e4ac8dc159911bb0b..c169c93e9454b15ccbbf8524387181dfb946a4a6 100644 (file)
@@ -80,14 +80,6 @@ PUBLIC _EGLContext *
 _eglGetCurrentContext(void);
 
 
-PUBLIC _EGLDisplay *
-_eglGetCurrentDisplay(void);
-
-
-PUBLIC _EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw);
-
-
 PUBLIC EGLBoolean
 _eglError(EGLint errCode, const char *msg);
 
index d073f226f2ed9b7973033d3a26dcfd41809a6e00..aa4f01221694fc6247b5a51435a8b82189e6ad13 100644 (file)
@@ -1037,14 +1037,15 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
 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;
 }