Loading services/surfaceflinger/DisplayDevice.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ inline void eglSetSwapRectangleANDROID (EGLDisplay, EGLSurface, EGLint, EGLint, * */ uint32_t DisplayDevice::sPrimaryDisplayOrientation = 0; DisplayDevice::DisplayDevice( const sp<SurfaceFlinger>& flinger, DisplayType type, Loading Loading @@ -550,10 +552,32 @@ void DisplayDevice::setProjection(int orientation, } mOrientation = orientation; if (mType == DisplayType::DISPLAY_PRIMARY) { uint32_t transform = 0; switch (mOrientation) { case DisplayState::eOrientationDefault: transform = Transform::ROT_0; break; case DisplayState::eOrientation90: transform = Transform::ROT_90; break; case DisplayState::eOrientation180: transform = Transform::ROT_180; break; case DisplayState::eOrientation270: transform = Transform::ROT_270; break; } sPrimaryDisplayOrientation = transform; } mViewport = viewport; mFrame = frame; } uint32_t DisplayDevice::getPrimaryDisplayOrientationTransform() { return sPrimaryDisplayOrientation; } void DisplayDevice::dump(String8& result) const { const Transform& tr(mGlobalTransform); result.appendFormat( Loading services/surfaceflinger/DisplayDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ public: int getOrientation() const { return mOrientation; } uint32_t getOrientationTransform() const; static uint32_t getPrimaryDisplayOrientationTransform(); const Transform& getTransform() const { return mGlobalTransform; } const Rect getViewport() const { return mViewport; } const Rect getFrame() const { return mFrame; } Loading Loading @@ -238,6 +239,7 @@ private: uint32_t mLayerStack; int mOrientation; static uint32_t sPrimaryDisplayOrientation; // user-provided visible area of the layer stack Rect mViewport; // user-provided rectangle where mViewport gets mapped to Loading services/surfaceflinger/Layer.cpp +13 −10 Original line number Diff line number Diff line Loading @@ -434,9 +434,11 @@ FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const { uint32_t invTransform = mCurrentTransform; if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the buffer * the code below applies the primary display's inverse transform to the * buffer */ uint32_t invTransformOrient = hw->getOrientationTransform(); uint32_t invTransformOrient = DisplayDevice::getPrimaryDisplayOrientationTransform(); // calculate the inverse transform if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) { invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | Loading Loading @@ -633,13 +635,12 @@ void Layer::setGeometry( if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the buffer * the code below applies the primary display's inverse transform to the * buffer */ #ifdef USE_HWC2 uint32_t invTransform = displayDevice->getOrientationTransform(); #else uint32_t invTransform = hw->getOrientationTransform(); #endif uint32_t invTransform = DisplayDevice::getPrimaryDisplayOrientationTransform(); uint32_t t_orientation = transform.getOrientation(); // calculate the inverse transform if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { Loading Loading @@ -940,7 +941,8 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip, if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the texture transform * the code below applies the primary display's inverse transform to * the texture transform */ // create a 4x4 transform matrix from the display transform flags Loading @@ -949,7 +951,8 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip, const mat4 rot90( 0,1,0,0, -1,0,0,0, 0,0,1,0, 1,0,0,1); mat4 tr; uint32_t transform = hw->getOrientationTransform(); uint32_t transform = DisplayDevice::getPrimaryDisplayOrientationTransform(); if (transform & NATIVE_WINDOW_TRANSFORM_ROT_90) tr = tr * rot90; if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_H) Loading Loading
services/surfaceflinger/DisplayDevice.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ inline void eglSetSwapRectangleANDROID (EGLDisplay, EGLSurface, EGLint, EGLint, * */ uint32_t DisplayDevice::sPrimaryDisplayOrientation = 0; DisplayDevice::DisplayDevice( const sp<SurfaceFlinger>& flinger, DisplayType type, Loading Loading @@ -550,10 +552,32 @@ void DisplayDevice::setProjection(int orientation, } mOrientation = orientation; if (mType == DisplayType::DISPLAY_PRIMARY) { uint32_t transform = 0; switch (mOrientation) { case DisplayState::eOrientationDefault: transform = Transform::ROT_0; break; case DisplayState::eOrientation90: transform = Transform::ROT_90; break; case DisplayState::eOrientation180: transform = Transform::ROT_180; break; case DisplayState::eOrientation270: transform = Transform::ROT_270; break; } sPrimaryDisplayOrientation = transform; } mViewport = viewport; mFrame = frame; } uint32_t DisplayDevice::getPrimaryDisplayOrientationTransform() { return sPrimaryDisplayOrientation; } void DisplayDevice::dump(String8& result) const { const Transform& tr(mGlobalTransform); result.appendFormat( Loading
services/surfaceflinger/DisplayDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ public: int getOrientation() const { return mOrientation; } uint32_t getOrientationTransform() const; static uint32_t getPrimaryDisplayOrientationTransform(); const Transform& getTransform() const { return mGlobalTransform; } const Rect getViewport() const { return mViewport; } const Rect getFrame() const { return mFrame; } Loading Loading @@ -238,6 +239,7 @@ private: uint32_t mLayerStack; int mOrientation; static uint32_t sPrimaryDisplayOrientation; // user-provided visible area of the layer stack Rect mViewport; // user-provided rectangle where mViewport gets mapped to Loading
services/surfaceflinger/Layer.cpp +13 −10 Original line number Diff line number Diff line Loading @@ -434,9 +434,11 @@ FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const { uint32_t invTransform = mCurrentTransform; if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the buffer * the code below applies the primary display's inverse transform to the * buffer */ uint32_t invTransformOrient = hw->getOrientationTransform(); uint32_t invTransformOrient = DisplayDevice::getPrimaryDisplayOrientationTransform(); // calculate the inverse transform if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) { invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | Loading Loading @@ -633,13 +635,12 @@ void Layer::setGeometry( if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the buffer * the code below applies the primary display's inverse transform to the * buffer */ #ifdef USE_HWC2 uint32_t invTransform = displayDevice->getOrientationTransform(); #else uint32_t invTransform = hw->getOrientationTransform(); #endif uint32_t invTransform = DisplayDevice::getPrimaryDisplayOrientationTransform(); uint32_t t_orientation = transform.getOrientation(); // calculate the inverse transform if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { Loading Loading @@ -940,7 +941,8 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip, if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { /* * the code below applies the display's inverse transform to the texture transform * the code below applies the primary display's inverse transform to * the texture transform */ // create a 4x4 transform matrix from the display transform flags Loading @@ -949,7 +951,8 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip, const mat4 rot90( 0,1,0,0, -1,0,0,0, 0,0,1,0, 1,0,0,1); mat4 tr; uint32_t transform = hw->getOrientationTransform(); uint32_t transform = DisplayDevice::getPrimaryDisplayOrientationTransform(); if (transform & NATIVE_WINDOW_TRANSFORM_ROT_90) tr = tr * rot90; if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_H) Loading