From dc4f845c37a8446de19036e24fd397a0aa864c02 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 23 Oct 2010 11:59:03 +0800 Subject: 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. --- src/egl/main/eglsync.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/egl/main/eglsync.h') 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 @@ -33,6 +33,28 @@ _eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint attribute, EGLint *value); +/** + * 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. -- cgit v1.2.3