diff options
author | Chia-I Wu <[email protected]> | 2010-10-23 11:59:03 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-10-23 15:19:34 +0800 |
commit | dc4f845c37a8446de19036e24fd397a0aa864c02 (patch) | |
tree | 7b1d125da53a1a6f932eae5cdbbdbcf489474601 /src/egl/main/eglsurface.h | |
parent | 662e098b560c6983f5ac320cc5ff7a82ecdc5f8a (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/eglsurface.h')
-rw-r--r-- | src/egl/main/eglsurface.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h index 2812dc36ab0..b833258bf69 100644 --- a/src/egl/main/eglsurface.h +++ b/src/egl/main/eglsurface.h @@ -81,6 +81,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. */ |