summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/main/egldisplay.c64
-rw-r--r--src/egl/main/egldisplay.h55
-rw-r--r--src/egl/main/eglsurface.c70
-rw-r--r--src/egl/main/eglsurface.h63
4 files changed, 133 insertions, 119 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index e14d0c1b63..79efa8477e 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -182,49 +182,6 @@ _eglCleanupDisplay(_EGLDisplay *disp)
}
-/**
- * Link a surface to a display and return the handle of the link.
- * The handle can be passed to client directly.
- */
-EGLSurface
-_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy)
-{
- surf->Display = dpy;
- surf->Next = dpy->SurfaceList;
- dpy->SurfaceList = surf;
- return (EGLSurface) surf;
-}
-
-
-/**
- * Unlink a linked surface from its display.
- * Accessing an unlinked surface should generate EGL_BAD_SURFACE error.
- */
-void
-_eglUnlinkSurface(_EGLSurface *surf)
-{
- _EGLSurface *prev;
-
- prev = surf->Display->SurfaceList;
- if (prev != surf) {
- while (prev) {
- if (prev->Next == surf)
- break;
- prev = prev->Next;
- }
- assert(prev);
- prev->Next = surf->Next;
- }
- else {
- prev = NULL;
- surf->Display->SurfaceList = surf->Next;
- }
-
- surf->Next = NULL;
- surf->Display = NULL;
-}
-
-
#ifndef _EGL_SKIP_HANDLE_CHECK
@@ -248,25 +205,4 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
}
-/**
- * Return EGL_TRUE if the given handle is a valid handle to a surface.
- */
-EGLBoolean
-_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
-{
- _EGLSurface *cur = NULL;
-
- if (dpy)
- cur = dpy->SurfaceList;
- while (cur) {
- if (cur == (_EGLSurface *) surf) {
- assert(cur->Display == dpy);
- break;
- }
- cur = cur->Next;
- }
- return (cur != NULL);
-}
-
-
#endif /* !_EGL_SKIP_HANDLE_CHECK */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 4b9010e76d..77458cb38d 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -3,7 +3,6 @@
#include "egltypedefs.h"
#include "egldefines.h"
-#include "eglsurface.h"
/**
@@ -80,14 +79,6 @@ PUBLIC void
_eglCleanupDisplay(_EGLDisplay *disp);
-extern EGLSurface
-_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy);
-
-
-extern void
-_eglUnlinkSurface(_EGLSurface *surf);
-
-
#ifndef _EGL_SKIP_HANDLE_CHECK
@@ -95,10 +86,6 @@ extern EGLBoolean
_eglCheckDisplayHandle(EGLDisplay dpy);
-extern EGLBoolean
-_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy);
-
-
#else /* !_EGL_SKIP_HANDLE_CHECK */
/* Only do a quick check. This is NOT standard compliant. */
@@ -110,14 +97,6 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
}
-static INLINE EGLBoolean
-_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
-{
- _EGLSurface *s = (_EGLSurface *) surf;
- return (dpy && s && s->Display == dpy);
-}
-
-
#endif /* _EGL_SKIP_HANDLE_CHECK */
@@ -156,40 +135,6 @@ _eglIsDisplayLinked(_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;
- if (!_eglCheckSurfaceHandle(surf, dpy))
- surf = NULL;
- return surf;
-}
-
-
-/**
- * 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);
-}
-
-
-/**
- * Return true if the surface is linked to a display.
- */
-static INLINE EGLBoolean
-_eglIsSurfaceLinked(_EGLSurface *surf)
-{
- return (EGLBoolean) (_eglGetSurfaceHandle(surf) != EGL_NO_SURFACE);
-}
-
-
-/**
* Cast an unsigned int to a pointer.
*/
static INLINE void *
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 940a1b760c..5e9a3417a6 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -511,3 +511,73 @@ _eglCreatePbufferFromClientBuffer(_EGLDriver *drv, _EGLDisplay *dpy,
}
#endif /* EGL_VERSION_1_2 */
+
+
+/**
+ * Link a surface to a display and return the handle of the link.
+ * The handle can be passed to client directly.
+ */
+EGLSurface
+_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy)
+{
+ surf->Display = dpy;
+ surf->Next = dpy->SurfaceList;
+ dpy->SurfaceList = surf;
+ return (EGLSurface) surf;
+}
+
+
+/**
+ * Unlink a linked surface from its display.
+ * Accessing an unlinked surface should generate EGL_BAD_SURFACE error.
+ */
+void
+_eglUnlinkSurface(_EGLSurface *surf)
+{
+ _EGLSurface *prev;
+
+ prev = surf->Display->SurfaceList;
+ if (prev != surf) {
+ while (prev) {
+ if (prev->Next == surf)
+ break;
+ prev = prev->Next;
+ }
+ assert(prev);
+ prev->Next = surf->Next;
+ }
+ else {
+ prev = NULL;
+ surf->Display->SurfaceList = surf->Next;
+ }
+
+ surf->Next = NULL;
+ surf->Display = NULL;
+}
+
+
+#ifndef _EGL_SKIP_HANDLE_CHECK
+
+
+/**
+ * Return EGL_TRUE if the given handle is a valid handle to a surface.
+ */
+EGLBoolean
+_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
+{
+ _EGLSurface *cur = NULL;
+
+ if (dpy)
+ cur = dpy->SurfaceList;
+ while (cur) {
+ if (cur == (_EGLSurface *) surf) {
+ assert(cur->Display == dpy);
+ break;
+ }
+ cur = cur->Next;
+ }
+ return (cur != NULL);
+}
+
+
+#endif /* !_EGL_SKIP_HANDLE_CHECK */
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index dacdf7e63c..b1163293fe 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -111,4 +111,67 @@ _eglIsSurfaceBound(_EGLSurface *surf)
}
+extern EGLSurface
+_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy);
+
+
+extern void
+_eglUnlinkSurface(_EGLSurface *surf);
+
+
+#ifndef _EGL_SKIP_HANDLE_CHECK
+
+
+extern EGLBoolean
+_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy);
+
+
+#else /* !_EGL_SKIP_HANDLE_CHECK */
+
+
+static INLINE EGLBoolean
+_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
+{
+ _EGLSurface *s = (_EGLSurface *) surf;
+ return (dpy && s && s->Display == dpy);
+}
+
+
+#endif /* _EGL_SKIP_HANDLE_CHECK */
+
+
+/**
+ * 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;
+ if (!_eglCheckSurfaceHandle(surf, dpy))
+ surf = NULL;
+ return surf;
+}
+
+
+/**
+ * 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);
+}
+
+
+/**
+ * Return true if the surface is linked to a display.
+ */
+static INLINE EGLBoolean
+_eglIsSurfaceLinked(_EGLSurface *surf)
+{
+ return (EGLBoolean) (_eglGetSurfaceHandle(surf) != EGL_NO_SURFACE);
+}
+
+
#endif /* EGLSURFACE_INCLUDED */