Mesa (master): egl: Remove _eglGetCurrentSurface and _eglGetCurrentDisplay.

Chia-I Wu olv at kemper.freedesktop.org
Tue Jan 26 10:47:33 UTC 2010


Module: Mesa
Branch: master
Commit: a1717970e78d897f527273278bf1346cc86a5741
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1717970e78d897f527273278bf1346cc86a5741

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Tue Jan 26 17:13:51 2010 +0800

egl: Remove _eglGetCurrentSurface and _eglGetCurrentDisplay.

They have little use in drivers since drivers need to work for multiple
current contexts.

---

 src/egl/drivers/xdri/egl_xdri.c                 |    3 +-
 src/egl/main/eglapi.c                           |    4 +-
 src/egl/main/eglcurrent.c                       |   37 -----------------------
 src/egl/main/eglcurrent.h                       |    8 -----
 src/gallium/state_trackers/egl/common/egl_g3d.c |    7 ++--
 5 files changed, 7 insertions(+), 52 deletions(-)

diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c
index df251d9..e13d884 100644
--- a/src/egl/drivers/xdri/egl_xdri.c
+++ b/src/egl/drivers/xdri/egl_xdri.c
@@ -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);
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 2e5027a..492a141 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -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;
 }
 
 
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index b3be230..696d04e 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -249,43 +249,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.
  */
 EGLBoolean
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index b8c2bda..c169c93 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -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);
 
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index d073f22..aa4f012 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -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;
 }




More information about the mesa-commit mailing list