Skip to content

Commit 74da537

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
Merge "[317580] fix issue where the screen wouldn't be rotated properly in bypass mode" into gingerbread
2 parents 36af794 + ee5a3ac commit 74da537

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

services/surfaceflinger/Layer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,18 @@ bool Layer::setBypass(bool enable)
466466
return true;
467467
}
468468

469+
void Layer::updateBuffersOrientation()
470+
{
471+
sp<GraphicBuffer> buffer(getBypassBuffer());
472+
if (buffer != NULL && mOrientation != buffer->transform) {
473+
ClientRef::Access sharedClient(mUserClientRef);
474+
SharedBufferServer* lcblk(sharedClient.get());
475+
if (lcblk) { // all buffers need reallocation
476+
lcblk->reallocateAll();
477+
}
478+
}
479+
}
480+
469481
uint32_t Layer::doTransaction(uint32_t flags)
470482
{
471483
const Layer::State& front(drawingState());

services/surfaceflinger/Layer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class Layer : public LayerBaseClient
8383
virtual void onRemoved();
8484
virtual bool setBypass(bool enable);
8585

86+
void updateBuffersOrientation();
87+
8688
inline sp<GraphicBuffer> getBypassBuffer() const {
8789
return mBufferManager.getActiveBuffer(); }
8890

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,12 @@ void SurfaceFlinger::setBypassLayer(const sp<LayerBase>& layer)
725725
{
726726
// if this layer is already the bypass layer, do nothing
727727
sp<Layer> cur(mBypassLayer.promote());
728-
if (mBypassLayer == layer)
728+
if (mBypassLayer == layer) {
729+
if (cur != NULL) {
730+
cur->updateBuffersOrientation();
731+
}
729732
return;
733+
}
730734

731735
// clear the current bypass layer
732736
mBypassLayer.clear();

0 commit comments

Comments
 (0)