Mesa (master): egl: Make lookup functions static inline.

Brian Paul brianp at kemper.freedesktop.org
Tue Aug 18 14:59:19 UTC 2009


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Fri Aug 14 18:05:19 2009 +0800

egl: Make lookup functions static inline.

progs/egl/demo3.c is also changed since it uses an internal function.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>

---

 progs/egl/demo3.c         |    2 +-
 src/egl/main/egldisplay.c |   66 --------------------------
 src/egl/main/egldisplay.h |  112 +++++++++++++++++++++++++++++++--------------
 3 files changed, 79 insertions(+), 101 deletions(-)

diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c
index a6096a2..daab62d 100644
--- a/progs/egl/demo3.c
+++ b/progs/egl/demo3.c
@@ -551,7 +551,7 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
    }
 }
 
-#include "../src/egl/main/egldisplay.h"
+#include "../../src/egl/main/egldisplay.h"
 
 typedef struct fb_display
 {
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 000db6c..7f1c53a 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -114,28 +114,6 @@ _eglUnlinkDisplay(_EGLDisplay *dpy)
 
 
 /**
- * Return the handle of a linked display, or EGL_NO_DISPLAY.
- */
-EGLDisplay
-_eglGetDisplayHandle(_EGLDisplay *dpy)
-{
-   return (EGLDisplay) ((dpy) ? dpy : EGL_NO_DISPLAY);
-}
-
-
-/**
- * Lookup a handle to find the linked display.
- * Return NULL if the handle has no corresponding linked display.
- */
-_EGLDisplay *
-_eglLookupDisplay(EGLDisplay display)
-{
-   _EGLDisplay *dpy = (_EGLDisplay *) display;
-   return dpy;
-}
-
-
-/**
  * Find the display corresponding to the specified native display id in all
  * linked displays.
  */
@@ -257,28 +235,6 @@ _eglUnlinkContext(_EGLContext *ctx)
 
 
 /**
- * Return the handle of a linked context, or EGL_NO_CONTEXT.
- */
-EGLContext
-_eglGetContextHandle(_EGLContext *ctx)
-{
-   return (EGLContext) ((ctx && ctx->Display) ? ctx : EGL_NO_CONTEXT);
-}
-
-
-/**
- * Lookup a handle to find the linked context.
- * Return NULL if the handle has no corresponding linked context.
- */
-_EGLContext *
-_eglLookupContext(EGLContext ctx, _EGLDisplay *dpy)
-{
-   _EGLContext *context = (_EGLContext *) ctx;
-   return (context && context->Display) ? context : NULL;
-}
-
-
-/**
  * Link a surface to a display and return the handle of the link.
  * The handle can be passed to client directly.
  */
@@ -319,25 +275,3 @@ _eglUnlinkSurface(_EGLSurface *surf)
    surf->Next = NULL;
    surf->Display = NULL;
 }
-
-
-/**
- * Return the handle of a linked surface, or EGL_NO_SURFACE.
- */
-EGLSurface
-_eglGetSurfaceHandle(_EGLSurface *surf)
-{
-   return (EGLSurface) ((surf && surf->Display) ? surf : EGL_NO_SURFACE);
-}
-
-
-/**
- * Lookup a handle to find the linked surface.
- * Return NULL if the handle has no corresponding linked surface.
- */
-_EGLSurface *
-_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy)
-{
-   _EGLSurface *surf = (_EGLSurface *) surface;
-   return (surf && surf->Display) ? surf : NULL;
-}
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 19a4d4e..e8a3d49 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -6,8 +6,9 @@
 #endif
 
 #include "egltypedefs.h"
-#include "eglhash.h"
 #include "egldefines.h"
+#include "eglcontext.h"
+#include "eglsurface.h"
 
 
 /**
@@ -76,24 +77,6 @@ extern void
 _eglUnlinkDisplay(_EGLDisplay *dpy);
 
 
-extern EGLDisplay
-_eglGetDisplayHandle(_EGLDisplay *display);
-
-
-extern _EGLDisplay *
-_eglLookupDisplay(EGLDisplay dpy);
-
-
-/**
- * Return true if the display is linked.
- */
-static INLINE EGLBoolean
-_eglIsDisplayLinked(_EGLDisplay *dpy)
-{
-   return (EGLBoolean) (_eglGetDisplayHandle(dpy) != EGL_NO_DISPLAY);
-}
-
-
 extern _EGLDisplay *
 _eglFindDisplay(NativeDisplayType nativeDisplay);
 
@@ -114,37 +97,98 @@ extern void
 _eglUnlinkContext(_EGLContext *ctx);
 
 
-extern EGLContext
-_eglGetContextHandle(_EGLContext *ctx);
+extern EGLSurface
+_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy);
 
 
-extern _EGLContext *
-_eglLookupContext(EGLContext ctx, _EGLDisplay *dpy);
+extern void
+_eglUnlinkSurface(_EGLSurface *surf);
 
 
 /**
- * Return true if the context is linked to a display.
+ * Lookup a handle to find the linked display.
+ * Return NULL if the handle has no corresponding linked display.
+ */
+static INLINE _EGLDisplay *
+_eglLookupDisplay(EGLDisplay display)
+{
+   _EGLDisplay *dpy = (_EGLDisplay *) display;
+   return dpy;
+}
+
+
+/**
+ * Return the handle of a linked display, or EGL_NO_DISPLAY.
+ */
+static INLINE EGLDisplay
+_eglGetDisplayHandle(_EGLDisplay *dpy)
+{
+   return (EGLDisplay) ((dpy) ? dpy : EGL_NO_DISPLAY);
+}
+
+
+/**
+ * Return true if the display is linked.
  */
 static INLINE EGLBoolean
-_eglIsContextLinked(_EGLContext *ctx)
+_eglIsDisplayLinked(_EGLDisplay *dpy)
 {
-   return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT);
+   return (EGLBoolean) (_eglGetDisplayHandle(dpy) != EGL_NO_DISPLAY);
 }
 
-extern EGLSurface
-_eglLinkSurface(_EGLSurface *surf, _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;
+   return (ctx && ctx->Display) ? ctx : NULL;
+}
 
-extern void
-_eglUnlinkSurface(_EGLSurface *surf);
 
+/**
+ * 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);
+}
 
-extern EGLSurface
-_eglGetSurfaceHandle(_EGLSurface *);
+
+/**
+ * Return true if the context is linked to a display.
+ */
+static INLINE EGLBoolean
+_eglIsContextLinked(_EGLContext *ctx)
+{
+   return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT);
+}
 
 
-extern _EGLSurface *
-_eglLookupSurface(EGLSurface surf, _EGLDisplay *dpy);
+/**
+ * Lookup a handle to find the linked surface.
+ * Return NULL if the handle has no corresponding linked surface.
+ */
+static INLINE _EGLSurface *
+_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy)
+{
+   _EGLSurface *surf = (_EGLSurface *) surface;
+   return (surf && surf->Display) ? surf : NULL;
+}
+
+
+/**
+ * Return the handle of a linked surface, or EGL_NO_SURFACE.
+ */
+static INLINE EGLSurface
+_eglGetSurfaceHandle(_EGLSurface *surf)
+{
+   return (EGLSurface) ((surf && surf->Display) ? surf : EGL_NO_SURFACE);
+}
 
 
 /**




More information about the mesa-commit mailing list