Mesa (master): egl: Move context functions in egldisplay.[ch] to eglcontext .[ch].

Chia-I Wu olv at kemper.freedesktop.org
Sun Jan 24 12:36:24 UTC 2010


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Jan 23 22:53:59 2010 +0800

egl: Move context functions in egldisplay.[ch] to eglcontext.[ch].

Move functions to where they should be.  There should be no real change
here.

---

 src/egl/main/eglcontext.c |   69 +++++++++++++++++++++++++++++++++++++++++++++
 src/egl/main/eglcontext.h |   63 +++++++++++++++++++++++++++++++++++++++++
 src/egl/main/egldisplay.c |   63 -----------------------------------------
 src/egl/main/egldisplay.h |   55 -----------------------------------
 4 files changed, 132 insertions(+), 118 deletions(-)

diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index ee4b1b5..41960f5 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -251,3 +251,72 @@ _eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source,
     */
    return EGL_FALSE;
 }
+
+
+/**
+ * Link a context to a display and return the handle of the link.
+ * The handle can be passed to client directly.
+ */
+EGLContext
+_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
+{
+   ctx->Display = dpy;
+   ctx->Next = dpy->ContextList;
+   dpy->ContextList = ctx;
+   return (EGLContext) ctx;
+}
+
+
+/**
+ * Unlink a linked context from its display.
+ * Accessing an unlinked context should generate EGL_BAD_CONTEXT error.
+ */
+void
+_eglUnlinkContext(_EGLContext *ctx)
+{
+   _EGLContext *prev;
+
+   prev = ctx->Display->ContextList;
+   if (prev != ctx) {
+      while (prev) {
+         if (prev->Next == ctx)
+            break;
+         prev = prev->Next;
+      }
+      assert(prev);
+      prev->Next = ctx->Next;
+   }
+   else {
+      ctx->Display->ContextList = ctx->Next;
+   }
+
+   ctx->Next = NULL;
+   ctx->Display = NULL;
+}
+
+
+#ifndef _EGL_SKIP_HANDLE_CHECK
+
+
+/**
+ * Return EGL_TRUE if the given handle is a valid handle to a context.
+ */
+EGLBoolean
+_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
+{
+   _EGLContext *cur = NULL;
+
+   if (dpy)
+      cur = dpy->ContextList;
+   while (cur) {
+      if (cur == (_EGLContext *) ctx) {
+         assert(cur->Display == dpy);
+         break;
+      }
+      cur = cur->Next;
+   }
+   return (cur != NULL);
+}
+
+
+#endif /* !_EGL_SKIP_HANDLE_CHECK */
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index cb9e3f4..0dcec92 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -65,4 +65,67 @@ _eglIsContextBound(_EGLContext *ctx)
 }
 
 
+extern EGLContext
+_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy);
+
+
+extern void
+_eglUnlinkContext(_EGLContext *ctx);
+
+
+#ifndef _EGL_SKIP_HANDLE_CHECK
+
+
+extern EGLBoolean
+_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy);
+
+
+#else /* !_EGL_SKIP_HANDLE_CHECK */
+
+
+static INLINE EGLBoolean
+_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
+{
+   _EGLContext *c = (_EGLContext *) ctx;
+   return (dpy && c && c->Display == dpy);
+}
+
+
+#endif /* _EGL_SKIP_HANDLE_CHECK */
+
+
+/**
+ * Lookup a handle to find the linked context.
+ * Return NULL if the handle has no corresponding linked context.
+ */
+static INLINE _EGLContext *
+_eglLookupContext(EGLContext context, _EGLDisplay *dpy)
+{
+   _EGLContext *ctx = (_EGLContext *) context;
+   if (!_eglCheckContextHandle(context, dpy))
+      ctx = NULL;
+   return ctx;
+}
+
+
+/**
+ * Return the handle of a linked context, or EGL_NO_CONTEXT.
+ */
+static INLINE EGLContext
+_eglGetContextHandle(_EGLContext *ctx)
+{
+   return (EGLContext) ((ctx && ctx->Display) ? ctx : EGL_NO_CONTEXT);
+}
+
+
+/**
+ * Return true if the context is linked to a display.
+ */
+static INLINE EGLBoolean
+_eglIsContextLinked(_EGLContext *ctx)
+{
+   return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT);
+}
+
+
 #endif /* EGLCONTEXT_INCLUDED */
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index eb82af4..e14d0c1 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -183,48 +183,6 @@ _eglCleanupDisplay(_EGLDisplay *disp)
 
 
 /**
- * Link a context to a display and return the handle of the link.
- * The handle can be passed to client directly.
- */
-EGLContext
-_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
-{
-   ctx->Display = dpy;
-   ctx->Next = dpy->ContextList;
-   dpy->ContextList = ctx;
-   return (EGLContext) ctx;
-}
-
-
-/**
- * Unlink a linked context from its display.
- * Accessing an unlinked context should generate EGL_BAD_CONTEXT error.
- */
-void
-_eglUnlinkContext(_EGLContext *ctx)
-{
-   _EGLContext *prev;
-
-   prev = ctx->Display->ContextList;
-   if (prev != ctx) {
-      while (prev) {
-         if (prev->Next == ctx)
-            break;
-         prev = prev->Next;
-      }
-      assert(prev);
-      prev->Next = ctx->Next;
-   }
-   else {
-      ctx->Display->ContextList = ctx->Next;
-   }
-
-   ctx->Next = NULL;
-   ctx->Display = NULL;
-}
-
-
-/**
  * Link a surface to a display and return the handle of the link.
  * The handle can be passed to client directly.
  */
@@ -291,27 +249,6 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
 
 
 /**
- * Return EGL_TRUE if the given handle is a valid handle to a context.
- */
-EGLBoolean
-_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
-{
-   _EGLContext *cur = NULL;
-
-   if (dpy)
-      cur = dpy->ContextList;
-   while (cur) {
-      if (cur == (_EGLContext *) ctx) {
-         assert(cur->Display == dpy);
-         break;
-      }
-      cur = cur->Next;
-   }
-   return (cur != NULL);
-}
-
-
-/**
  * Return EGL_TRUE if the given handle is a valid handle to a surface.
  */
 EGLBoolean
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index a698131..4b9010e 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -3,7 +3,6 @@
 
 #include "egltypedefs.h"
 #include "egldefines.h"
-#include "eglcontext.h"
 #include "eglsurface.h"
 
 
@@ -81,14 +80,6 @@ PUBLIC void
 _eglCleanupDisplay(_EGLDisplay *disp);
 
 
-extern EGLContext
-_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy);
-
-
-extern void
-_eglUnlinkContext(_EGLContext *ctx);
-
-
 extern EGLSurface
 _eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy);
 
@@ -105,10 +96,6 @@ _eglCheckDisplayHandle(EGLDisplay dpy);
 
 
 extern EGLBoolean
-_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy);
-
-
-extern EGLBoolean
 _eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy);
 
 
@@ -124,14 +111,6 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
 
 
 static INLINE EGLBoolean
-_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
-{
-   _EGLContext *c = (_EGLContext *) ctx;
-   return (dpy && c && c->Display == dpy);
-}
-
-
-static INLINE EGLBoolean
 _eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
 {
    _EGLSurface *s = (_EGLSurface *) surf;
@@ -177,40 +156,6 @@ _eglIsDisplayLinked(_EGLDisplay *dpy)
 
 
 /**
- * Lookup a handle to find the linked context.
- * Return NULL if the handle has no corresponding linked context.
- */
-static INLINE _EGLContext *
-_eglLookupContext(EGLContext context, _EGLDisplay *dpy)
-{
-   _EGLContext *ctx = (_EGLContext *) context;
-   if (!_eglCheckContextHandle(context, dpy))
-      ctx = NULL;
-   return ctx;
-}
-
-
-/**
- * Return the handle of a linked context, or EGL_NO_CONTEXT.
- */
-static INLINE EGLContext
-_eglGetContextHandle(_EGLContext *ctx)
-{
-   return (EGLContext) ((ctx && ctx->Display) ? ctx : EGL_NO_CONTEXT);
-}
-
-
-/**
- * Return true if the context is linked to a display.
- */
-static INLINE EGLBoolean
-_eglIsContextLinked(_EGLContext *ctx)
-{
-   return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT);
-}
-
-
-/**
  * Lookup a handle to find the linked surface.
  * Return NULL if the handle has no corresponding linked surface.
  */




More information about the mesa-commit mailing list