summaryrefslogtreecommitdiff
path: root/src/egl/main/eglsync.h
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-10-23 11:59:03 +0800
committerChia-I Wu <olv@lunarg.com>2010-10-23 15:19:34 +0800
commitdc4f845c37a8446de19036e24fd397a0aa864c02 (patch)
tree7b1d125da53a1a6f932eae5cdbbdbcf489474601 /src/egl/main/eglsync.h
parent662e098b560c6983f5ac320cc5ff7a82ecdc5f8a (diff)
egl: Add reference count for resources.
This is a really simple mechanism. There is no atomicity and the caller is expected to hold the display lock.
Diffstat (limited to 'src/egl/main/eglsync.h')
-rw-r--r--src/egl/main/eglsync.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/egl/main/eglsync.h b/src/egl/main/eglsync.h
index 09d799ba5f..97ae67cf86 100644
--- a/src/egl/main/eglsync.h
+++ b/src/egl/main/eglsync.h
@@ -34,6 +34,28 @@ _eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
/**
+ * Increment reference count for the sync.
+ */
+static INLINE _EGLSync *
+_eglGetSync(_EGLSync *sync)
+{
+ if (sync)
+ _eglGetResource(&sync->Resource);
+ return sync;
+}
+
+
+/**
+ * Decrement reference count for the sync.
+ */
+static INLINE EGLBoolean
+_eglPutSync(_EGLSync *sync)
+{
+ return (sync) ? _eglPutResource(&sync->Resource) : EGL_FALSE;
+}
+
+
+/**
* Link a sync to its display and return the handle of the link.
* The handle can be passed to client directly.
*/