summaryrefslogtreecommitdiffstats
path: root/src/egl/main/egldisplay.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-01-24 20:32:34 +0800
committerChia-I Wu <[email protected]>2010-01-24 20:38:16 +0800
commitecb3b3102a3022e31cf9d75ae099eddbe298517f (patch)
tree70d5476f2d46c8444b74625bedcd588e2e765ae6 /src/egl/main/egldisplay.c
parent7abf42626fe8552cf898652134f3767e591614ab (diff)
egl: Make surfaces and contexts resources.
Turn _EGLSurface and _EGLContext into _EGLResource so that they can be managed uniformly.
Diffstat (limited to 'src/egl/main/egldisplay.c')
-rw-r--r--src/egl/main/egldisplay.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index ef144f7f07a..c978adb47f5 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -26,12 +26,18 @@ _eglFiniDisplay(void)
/* atexit function is called with global mutex locked */
dpyList = _eglGlobal.DisplayList;
while (dpyList) {
+ EGLint i;
+
/* pop list head */
dpy = dpyList;
dpyList = dpyList->Next;
- if (dpy->ContextList || dpy->SurfaceList)
- _eglLog(_EGL_DEBUG, "Display %p is destroyed with resources", dpy);
+ for (i = 0; i < _EGL_NUM_RESOURCES; i++) {
+ if (dpy->ResourceLists[i]) {
+ _eglLog(_EGL_DEBUG, "Display %p is destroyed with resources", dpy);
+ break;
+ }
+ }
free(dpy);
}
@@ -135,29 +141,27 @@ _eglFindDisplay(NativeDisplayType nativeDisplay)
void
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display)
{
- _EGLContext *contexts;
- _EGLSurface *surfaces;
-
- contexts = display->ContextList;
- surfaces = display->SurfaceList;
+ _EGLResource *list;
- while (contexts) {
- _EGLContext *ctx = contexts;
- contexts = contexts->Next;
+ list = display->ResourceLists[_EGL_RESOURCE_CONTEXT];
+ while (list) {
+ _EGLContext *ctx = (_EGLContext *) list;
+ list = list->Next;
_eglUnlinkContext(ctx);
drv->API.DestroyContext(drv, display, ctx);
}
- assert(!display->ContextList);
+ assert(!display->ResourceLists[_EGL_RESOURCE_CONTEXT]);
- while (surfaces) {
- _EGLSurface *surf = surfaces;
- surfaces = surfaces->Next;
+ list = display->ResourceLists[_EGL_RESOURCE_SURFACE];
+ while (list) {
+ _EGLSurface *surf = (_EGLSurface *) list;
+ list = list->Next;
_eglUnlinkSurface(surf);
drv->API.DestroySurface(drv, display, surf);
}
- assert(!display->SurfaceList);
+ assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]);
}