From 2f2cf461c57974abd89e4917945cc8ae6a67a72e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 11 Aug 2009 17:09:39 +0800 Subject: egl: Overhaul driver API. The motivation is so that drivers do not need to look up and check for bad display, context, and etc. It also becomes unnecessary for drivers to call the link functions. This commit makes eglapi.[ch] do the lookup and check. As a result, the driver API is overhauled, and almost all sources and drivers need update. The updates are mainly find and replace with human brains. Signed-off-by: Chia-I Wu --- src/egl/main/egldisplay.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/egl/main/egldisplay.c') diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index feae1d6040..c684e4291e 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -200,29 +200,29 @@ _eglFindDisplay(NativeDisplayType nativeDisplay) * Destroy the contexts and surfaces that are linked to the display. */ void -_eglReleaseDisplayResources(_EGLDriver *drv, EGLDisplay dpy) +_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) { - _EGLDisplay *display; _EGLContext *contexts; _EGLSurface *surfaces; - display = _eglLookupDisplay(dpy); - if (!display) - return; contexts = display->ContextList; surfaces = display->SurfaceList; while (contexts) { - EGLContext handle = _eglGetContextHandle(contexts); + _EGLContext *ctx = contexts; contexts = contexts->Next; - drv->API.DestroyContext(drv, dpy, handle); + + _eglUnlinkContext(ctx); + drv->API.DestroyContext(drv, display, ctx); } assert(!display->ContextList); while (surfaces) { - EGLSurface handle = _eglGetSurfaceHandle(surfaces); + _EGLSurface *surf = surfaces; surfaces = surfaces->Next; - drv->API.DestroySurface(drv, dpy, handle); + + _eglUnlinkSurface(surf); + drv->API.DestroySurface(drv, display, surf); } assert(!display->SurfaceList); } @@ -309,7 +309,7 @@ _eglGetContextHandle(_EGLContext *ctx) * Return NULL if the handle has no corresponding linked context. */ _EGLContext * -_eglLookupContext(EGLContext ctx) +_eglLookupContext(EGLContext ctx, _EGLDisplay *dpy) { _EGLContext *context = (_EGLContext *) ctx; return (context && context->Display) ? context : NULL; @@ -389,8 +389,8 @@ _eglGetSurfaceHandle(_EGLSurface *surface) * Return NULL if the handle has no corresponding linked surface. */ _EGLSurface * -_eglLookupSurface(EGLSurface surf) +_eglLookupSurface(EGLSurface surf, _EGLDisplay *dpy) { EGLuint key = _eglPointerToUInt((void *) surf); - return (_EGLSurface *) _eglHashLookup(_eglSurfaceHash, key); + return (_EGLSurface *) _eglHashLookup(dpy->SurfaceHash, key); } -- cgit v1.2.3