egl: Destroy display's resources upon termination.
eglTerminate should destroy the contexts and surfaces of the display. Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
@@ -120,6 +120,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
|
* Free all the data hanging of an _EGLDisplay object, but not
|
||||||
* the object itself.
|
* the object itself.
|
||||||
|
@@ -56,6 +56,10 @@ extern _EGLDisplay *
|
|||||||
_eglFindDisplay(NativeDisplayType nativeDisplay);
|
_eglFindDisplay(NativeDisplayType nativeDisplay);
|
||||||
|
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_eglReleaseDisplayResources(_EGLDriver *drv, EGLDisplay dpy);
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_eglCleanupDisplay(_EGLDisplay *disp);
|
_eglCleanupDisplay(_EGLDisplay *disp);
|
||||||
|
|
||||||
|
@@ -284,9 +284,7 @@ _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
|
|||||||
|
|
||||||
_eglLog(_EGL_DEBUG, "Closing %s", drv->Name);
|
_eglLog(_EGL_DEBUG, "Closing %s", drv->Name);
|
||||||
|
|
||||||
/*
|
_eglReleaseDisplayResources(drv, dpy);
|
||||||
* XXX check for currently bound context/surfaces and delete them?
|
|
||||||
*/
|
|
||||||
|
|
||||||
b = drv->API.Terminate(drv, dpy);
|
b = drv->API.Terminate(drv, dpy);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user