summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/egl/main/egldisplay.c32
-rw-r--r--src/egl/main/egldisplay.h4
-rw-r--r--src/egl/main/egldriver.c4
3 files changed, 37 insertions, 3 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 1f1f41ea71f..89de609d0b4 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -121,6 +121,38 @@ _eglFindDisplay(NativeDisplayType nativeDisplay)
/**
+ * Destroy the contexts and surfaces that are linked to the display.
+ */
+void
+_eglReleaseDisplayResources(_EGLDriver *drv, EGLDisplay dpy)
+{
+ _EGLDisplay *display;
+ _EGLContext *contexts;
+ _EGLSurface *surfaces;
+
+ display = _eglLookupDisplay(dpy);
+ if (!display)
+ return;
+ contexts = display->ContextList;
+ surfaces = display->SurfaceList;
+
+ while (contexts) {
+ EGLContext handle = _eglGetContextHandle(contexts);
+ contexts = contexts->Next;
+ drv->API.DestroyContext(drv, dpy, handle);
+ }
+ assert(!display->ContextList);
+
+ while (surfaces) {
+ EGLSurface handle = _eglGetSurfaceHandle(surfaces);
+ surfaces = surfaces->Next;
+ drv->API.DestroySurface(drv, dpy, handle);
+ }
+ assert(!display->SurfaceList);
+}
+
+
+/**
* Free all the data hanging of an _EGLDisplay object, but not
* the object itself.
*/
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 0a6003f39ea..30b466cb4a0 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -57,6 +57,10 @@ _eglFindDisplay(NativeDisplayType nativeDisplay);
extern void
+_eglReleaseDisplayResources(_EGLDriver *drv, EGLDisplay dpy);
+
+
+extern void
_eglCleanupDisplay(_EGLDisplay *disp);
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 43b1f519034..f2a864cd8a7 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -284,9 +284,7 @@ _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
_eglLog(_EGL_DEBUG, "Closing %s", drv->Name);
- /*
- * XXX check for currently bound context/surfaces and delete them?
- */
+ _eglReleaseDisplayResources(drv, dpy);
b = drv->API.Terminate(drv, dpy);