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/eglimage.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/egl/main/eglimage.h') diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h index 161230f9009..bdc325a7f33 100644 --- a/src/egl/main/eglimage.h +++ b/src/egl/main/eglimage.h @@ -42,6 +42,28 @@ PUBLIC EGLBoolean _eglInitImage(_EGLImage *img, _EGLDisplay *dpy); +/** + * Increment reference count for the image. + */ +static INLINE _EGLImage * +_eglGetImage(_EGLImage *img) +{ + if (img) + _eglGetResource(&img->Resource); + return img; +} + + +/** + * Decrement reference count for the image. + */ +static INLINE EGLBoolean +_eglPutImage(_EGLImage *img) +{ + return (img) ? _eglPutResource(&img->Resource) : EGL_FALSE; +} + + /** * Link an image to its display and return the handle of the link. * The handle can be passed to client directly. -- cgit v1.2.3