diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index a18f47331..3a8690eb5 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -466,6 +466,18 @@ bool Layer::setBypass(bool enable) return true; } +void Layer::updateBuffersOrientation() +{ + sp buffer(getBypassBuffer()); + if (buffer != NULL && mOrientation != buffer->transform) { + ClientRef::Access sharedClient(mUserClientRef); + SharedBufferServer* lcblk(sharedClient.get()); + if (lcblk) { // all buffers need reallocation + lcblk->reallocateAll(); + } + } +} + uint32_t Layer::doTransaction(uint32_t flags) { const Layer::State& front(drawingState()); diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 9ff57164a..cb62558f0 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -83,6 +83,8 @@ public: virtual void onRemoved(); virtual bool setBypass(bool enable); + void updateBuffersOrientation(); + inline sp getBypassBuffer() const { return mBufferManager.getActiveBuffer(); } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 5e9e06cd0..af0f95a25 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -725,8 +725,12 @@ void SurfaceFlinger::setBypassLayer(const sp& layer) { // if this layer is already the bypass layer, do nothing sp cur(mBypassLayer.promote()); - if (mBypassLayer == layer) + if (mBypassLayer == layer) { + if (cur != NULL) { + cur->updateBuffersOrientation(); + } return; + } // clear the current bypass layer mBypassLayer.clear();