From d19afc57fe49816f3f3290410e0124d326577be2 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 23 Oct 2010 12:52:26 +0800 Subject: egl: Use reference counting to replace IsLinked or IsBound. Remove all _eglIsLinked and _eglIsBound. Update _eglBindContext and drivers to do reference counting. --- src/egl/main/eglapi.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/egl/main/eglapi.c') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 913ddd288b..efa9e97346 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -648,11 +648,12 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval) _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); - if (!ctx || !_eglIsContextLinked(ctx) || ctx->Resource.Display != disp) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + ctx->Resource.Display != disp) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); surf = ctx->DrawSurface; - if (!_eglIsSurfaceLinked(surf)) + if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); ret = drv->API.SwapInterval(drv, disp, surf, interval); @@ -673,7 +674,8 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); /* surface must be bound to current context in EGL 1.4 */ - if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + surf != ctx->DrawSurface) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); ret = drv->API.SwapBuffers(drv, disp, surf); @@ -714,7 +716,8 @@ eglWaitClient(void) _eglLockMutex(&disp->Mutex); /* let bad current context imply bad current surface */ - if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface)) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + _eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); /* a valid current context implies an initialized current display */ @@ -763,7 +766,8 @@ eglWaitNative(EGLint engine) _eglLockMutex(&disp->Mutex); /* let bad current context imply bad current surface */ - if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface)) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + _eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); /* a valid current context implies an initialized current display */ @@ -1437,7 +1441,8 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, RETURN_EGL_EVAL(disp, EGL_FALSE); /* surface must be bound to current context in EGL 1.4 */ - if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + surf != ctx->DrawSurface) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); -- cgit v1.2.3