aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/main/egldisplay.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2009-08-11 17:09:39 +0800
committerBrian Paul <[email protected]>2009-08-18 08:44:34 -0600
commit2f2cf461c57974abd89e4917945cc8ae6a67a72e (patch)
tree0548e5d4fc90f8603bfe019783cd041f5f8adb94 /src/egl/main/egldisplay.c
parent521dea21d46b4012653a4998d92ac0f6c0d1a8d4 (diff)
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 <[email protected]>
Diffstat (limited to 'src/egl/main/egldisplay.c')
-rw-r--r--src/egl/main/egldisplay.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index feae1d60409..c684e4291ee 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);
}