diff options
| author | 2009-04-22 15:23:34 -0700 | |
|---|---|---|
| committer | 2009-04-24 16:30:38 -0700 | |
| commit | a3aa6c9aa96873a70e2ff3170218a275f503520e (patch) | |
| tree | 67ce04dbb5e73d9ce96f93bef729d44754ead365 /libs/surfaceflinger/Layer.cpp | |
| parent | 6ead5d9f140529edfb744584fa5427b84b4dc13a (diff) | |
Surfaces are now destroyed properly in SurfaceFlinger.
First, the window manager tells us when a surface is no longer needed. At this point, several things happen:
- the surface is removed from the active/visible list
- it is added to a purgatory list, where it waits for all clients to release their reference
- it destroys all data/state that can be spared
Later, when all clients are done, the remains of the Surface are disposed off: it is removed from the purgatory and destroyed.
In particular its gralloc buffers are destroyed at that point (when we're sure nobody is using them anymore).
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
| -rw-r--r-- | libs/surfaceflinger/Layer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 5fdec3f64e3a..4e3f3a9b8435 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -61,15 +61,23 @@ Layer::Layer(SurfaceFlinger* flinger, DisplayID display, Client* c, int32_t i) Layer::~Layer() { + destroy(); + // the actual buffers will be destroyed here +} + +void Layer::destroy() +{ for (int i=0 ; i<NUM_BUFFERS ; i++) { if (mTextures[i].name != -1U) { // FIXME: this was originally to work-around a bug in the // adreno driver. this should be fixed now. deletedTextures.add(mTextures[i].name); + mTextures[i].name = -1U; } if (mTextures[i].image != EGL_NO_IMAGE_KHR) { EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay()); eglDestroyImageKHR(dpy, mTextures[i].image); + mTextures[i].image = EGL_NO_IMAGE_KHR; } } } @@ -89,7 +97,9 @@ sp<LayerBaseClient::Surface> Layer::createSurface() const status_t Layer::ditch() { + // the layer is not on screen anymore. free as much resources as possible mSurface.clear(); + destroy(); return NO_ERROR; } |