diff options
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index e3cf27e0ff..c9dcef370a 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -120,8 +120,7 @@ void Layer::onRemoved() sp<LayerBaseClient::Surface> Layer::createSurface() const { - sp<Surface> sur(new SurfaceLayer(mFlinger, const_cast<Layer *>(this))); - return sur; + return mSurface; } status_t Layer::ditch() @@ -131,6 +130,10 @@ status_t Layer::ditch() // the layer is not on screen anymore. free as much resources as possible mFreezeLock.clear(); + EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay()); + mBufferManager.destroy(dpy); + mSurface.clear(); + Mutex::Autolock _l(mLock); mWidth = mHeight = 0; return NO_ERROR; @@ -175,6 +178,7 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); mNeedsDithering = layerRedsize > displayRedSize; + mSurface = new SurfaceLayer(mFlinger, this); return NO_ERROR; } |