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/eglsurface.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/egl/main/eglsurface.h') diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h index 2812dc36ab..b833258bf6 100644 --- a/src/egl/main/eglsurface.h +++ b/src/egl/main/eglsurface.h @@ -80,6 +80,28 @@ _eglIsSurfaceBound(_EGLSurface *surf) } +/** + * Increment reference count for the surface. + */ +static INLINE _EGLSurface * +_eglGetSurface(_EGLSurface *surf) +{ + if (surf) + _eglGetResource(&surf->Resource); + return surf; +} + + +/** + * Decrement reference count for the surface. + */ +static INLINE EGLBoolean +_eglPutSurface(_EGLSurface *surf) +{ + return (surf) ? _eglPutResource(&surf->Resource) : EGL_FALSE; +} + + /** * Link a surface to its display and return the handle of the link. * The handle can be passed to client directly. -- cgit v1.2.3