diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 92ccf2fd2..b83149bb9 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -142,10 +142,10 @@ DisplayDevice::DisplayDevice( break; } - mPanelInverseMounted = false; - // Check if panel is inverse mounted (contents show up HV flipped) - property_get("persist.panel.inversemounted", property, "0"); - mPanelInverseMounted = !!atoi(property); + mPanelMountFlip = 0; + // 1: H-Flip, 2: V-Flip, 3: 180 (HV Flip) + property_get("persist.panel.mountflip", property, "0"); + mPanelMountFlip = atoi(property); // initialize the display orientation transform. setProjection(DisplayState::eOrientationDefault, mViewport, mFrame); @@ -428,8 +428,8 @@ status_t DisplayDevice::orientationToTransfrom( return BAD_VALUE; } - if (DISPLAY_PRIMARY == mHwcDisplayId && isPanelInverseMounted()) { - flags = flags ^ Transform::ROT_180; + if (DISPLAY_PRIMARY == mHwcDisplayId) { + flags = flags ^ getPanelMountFlip(); } tr->set(flags, w, h); diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h index f492a427a..9023ce93f 100644 --- a/services/surfaceflinger/DisplayDevice.h +++ b/services/surfaceflinger/DisplayDevice.h @@ -126,8 +126,8 @@ public: int32_t getHwcDisplayId() const { return mHwcDisplayId; } const wp& getDisplayToken() const { return mDisplayToken; } - bool isPanelInverseMounted() const { - return mPanelInverseMounted; + uint32_t getPanelMountFlip() const { + return mPanelMountFlip; } // We pass in mustRecompose so we can keep VirtualDisplaySurface's state @@ -230,8 +230,8 @@ private: int mPowerMode; // Current active config int mActiveConfig; - // Panel is inverse mounted - int mPanelInverseMounted; + // Panel's mount flip, H, V or 180 (HV) + uint32_t mPanelMountFlip; }; }; // namespace android diff --git a/services/surfaceflinger/LayerBlur.cpp b/services/surfaceflinger/LayerBlur.cpp index 021978d1c..4f5a72dc6 100644 --- a/services/surfaceflinger/LayerBlur.cpp +++ b/services/surfaceflinger/LayerBlur.cpp @@ -238,8 +238,7 @@ bool LayerBlur::captureScreen(const sp& hw, FBO& fbo, Textu texture.getTextureName(), 0); mFlinger->getRenderEngine().clearWithColor(0.0f, 0.0f, 0.0f, 1.0f); - if (hw->isPanelInverseMounted()) - rotation = Transform::ROT_180; + rotation = (Transform::orientation_flags)(rotation ^ hw->getPanelMountFlip()); mFlinger->renderScreenImplLocked( hw, Rect(0,0,width,height), diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 40e5da161..97d3163eb 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3463,10 +3463,9 @@ void SurfaceFlinger::renderScreenImplLocked( // make sure to clear all GL error flags engine.checkErrors(); - if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType() && - hw->isPanelInverseMounted()) { + if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType()) { rotation = (Transform::orientation_flags) - (rotation ^ Transform::ROT_180); + (rotation ^ hw->getPanelMountFlip()); } // set-up our viewport