Loading libs/surfaceflinger/LayerBuffer.cpp +17 −11 Original line number Diff line number Diff line Loading @@ -444,10 +444,6 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const NativeBuffer src(ourBuffer->getBuffer()); const Rect transformedBounds(mLayer.getTransformedBounds()); if (UNLIKELY(mTexture.name == -1LU)) { mTexture.name = mLayer.createTexture(); } #if defined(EGL_ANDROID_image_native_buffer) if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { copybit_device_t* copybit = mLayer.mBlitEngine; Loading @@ -463,7 +459,9 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); err = copybit->stretch(copybit, &dst.img, &src.img, &dst.crop, &src.crop, &clip); if (err != NO_ERROR) { clearTempBufferImage(); } } } else { err = INVALID_OPERATION; Loading @@ -485,6 +483,9 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const t.format = src.img.format; t.data = (GGLubyte*)src.img.base; const Region dirty(Rect(t.width, t.height)); if (UNLIKELY(mTexture.name == -1LU)) { mTexture.name = mLayer.createTexture(); } mLayer.loadTexture(&mTexture, dirty, t); } Loading @@ -506,12 +507,7 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const // we have an EGLImage, make sure the needed size didn't change if (w!=mTexture.width || h!= mTexture.height) { // delete the EGLImage and texture EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); glDeleteTextures(1, &mTexture.name); eglDestroyImageKHR(dpy, mTexture.image); Texture defaultTexture; mTexture = defaultTexture; mTempGraphicBuffer.clear(); clearTempBufferImage(); } else { // we're good, we have an EGLImageKHR and it's (still) the // right size Loading Loading @@ -558,6 +554,16 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const return err; } void LayerBuffer::BufferSource::clearTempBufferImage() const { EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); glDeleteTextures(1, &mTexture.name); eglDestroyImageKHR(dpy, mTexture.image); Texture defaultTexture; mTexture = defaultTexture; mTempGraphicBuffer.clear(); } // --------------------------------------------------------------------------- LayerBuffer::OverlaySource::OverlaySource(LayerBuffer& layer, Loading libs/surfaceflinger/LayerBuffer.h +1 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ private: virtual void destroy() { } private: status_t initTempBuffer() const; void clearTempBufferImage() const; mutable Mutex mBufferSourceLock; sp<Buffer> mBuffer; status_t mStatus; Loading Loading
libs/surfaceflinger/LayerBuffer.cpp +17 −11 Original line number Diff line number Diff line Loading @@ -444,10 +444,6 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const NativeBuffer src(ourBuffer->getBuffer()); const Rect transformedBounds(mLayer.getTransformedBounds()); if (UNLIKELY(mTexture.name == -1LU)) { mTexture.name = mLayer.createTexture(); } #if defined(EGL_ANDROID_image_native_buffer) if (mLayer.mFlags & DisplayHardware::DIRECT_TEXTURE) { copybit_device_t* copybit = mLayer.mBlitEngine; Loading @@ -463,7 +459,9 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_ENABLE); err = copybit->stretch(copybit, &dst.img, &src.img, &dst.crop, &src.crop, &clip); if (err != NO_ERROR) { clearTempBufferImage(); } } } else { err = INVALID_OPERATION; Loading @@ -485,6 +483,9 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const t.format = src.img.format; t.data = (GGLubyte*)src.img.base; const Region dirty(Rect(t.width, t.height)); if (UNLIKELY(mTexture.name == -1LU)) { mTexture.name = mLayer.createTexture(); } mLayer.loadTexture(&mTexture, dirty, t); } Loading @@ -506,12 +507,7 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const // we have an EGLImage, make sure the needed size didn't change if (w!=mTexture.width || h!= mTexture.height) { // delete the EGLImage and texture EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); glDeleteTextures(1, &mTexture.name); eglDestroyImageKHR(dpy, mTexture.image); Texture defaultTexture; mTexture = defaultTexture; mTempGraphicBuffer.clear(); clearTempBufferImage(); } else { // we're good, we have an EGLImageKHR and it's (still) the // right size Loading Loading @@ -558,6 +554,16 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const return err; } void LayerBuffer::BufferSource::clearTempBufferImage() const { EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay()); glDeleteTextures(1, &mTexture.name); eglDestroyImageKHR(dpy, mTexture.image); Texture defaultTexture; mTexture = defaultTexture; mTempGraphicBuffer.clear(); } // --------------------------------------------------------------------------- LayerBuffer::OverlaySource::OverlaySource(LayerBuffer& layer, Loading
libs/surfaceflinger/LayerBuffer.h +1 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ private: virtual void destroy() { } private: status_t initTempBuffer() const; void clearTempBufferImage() const; mutable Mutex mBufferSourceLock; sp<Buffer> mBuffer; status_t mStatus; Loading