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/eglcontext.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/egl/main/eglcontext.h') diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h index c2b8280b67..9c1e2184c6 100644 --- a/src/egl/main/eglcontext.h +++ b/src/egl/main/eglcontext.h @@ -42,6 +42,28 @@ PUBLIC EGLBoolean _eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read); +/** + * Increment reference count for the context. + */ +static INLINE _EGLContext * +_eglGetContext(_EGLContext *ctx) +{ + if (ctx) + _eglGetResource(&ctx->Resource); + return ctx; +} + + +/** + * Decrement reference count for the context. + */ +static INLINE EGLBoolean +_eglPutContext(_EGLContext *ctx) +{ + return (ctx) ? _eglPutResource(&ctx->Resource) : EGL_FALSE; +} + + /** * Return true if the context is bound to a thread. * -- cgit v1.2.3