Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3263117 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Abhisek Devkota
Browse files

Squashed fixes for additional hwrotation

Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date: 25.11.2012 12:11 AM
    surfaceflinger: Reimplement hwrotation

Author: Hashcode <hashcode0f@gmail.com>
Date: 11.12.2012 1:33 AM
    surfaceflinger: odd hw rotation (90/270) patch for swapping width/height

    This patch works in addition to the following commit
    re-implementing ro.sf.hwrotation:
    https://github.com/CyanogenMod/android_frameworks_native/commit/7d283431efffc4402cb1a6cacf5da64729c883bb

    When using values of 90 and 270 for ro.sf.hwrotation the
    LCD width and height also need to be swapped to display properly.

    NOTE: This patch does not fix the initial startup of bootanimation

Author: Clyde Tan <bokbokan@yahoo.com>
Date: 30.12.2013 1:49 AM
    Fix boot animation rotation problem when ro.sf.hwrotation is set to 90 or 270

Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date: 04.01.2014 5:44 AM
    surfaceflinger: Consolidate display orientation compensation hooks

    Dedupe rotation calculation code and make rotation a statically
    available property in the DisplayDevice

Conflicts:
	services/surfaceflinger/DisplayDevice.cpp
	services/surfaceflinger/SurfaceFlinger.cpp

Change-Id: Ic517ab0d2c05026cd6fa46d664aab7926be17b62
parent 46b7e320
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ DisplayDevice::DisplayDevice(
      mIsSecure(isSecure),
      mSecureLayerVisible(false),
      mLayerStack(NO_LAYER_STACK),
      mHardwareOrientation(0),
      mOrientation(),
      mPowerMode(HWC_POWER_MODE_OFF),
      mActiveConfig(0)
@@ -119,7 +120,12 @@ DisplayDevice::DisplayDevice(
    // was created with createDisplay().
    switch (mType) {
        case DISPLAY_PRIMARY:
            char value[PROPERTY_VALUE_MAX];
            mDisplayName = "Built-in Screen";

            /* hwrotation applies only to the primary display */
            property_get("ro.sf.hwrotation", value, "0");
            mHardwareOrientation = atoi(value);
            break;
        case DISPLAY_EXTERNAL:
            mDisplayName = "HDMI Screen";
@@ -397,6 +403,18 @@ status_t DisplayDevice::orientationToTransfrom(
        int orientation, int w, int h, Transform* tr)
{
    uint32_t flags = 0;
    int additionalRot = this->getHardwareOrientation();

    if (additionalRot) {
        additionalRot /= 90;
        if (orientation == DisplayState::eOrientationUnchanged) {
            orientation = additionalRot;
        } else {
            orientation += additionalRot;
            orientation %= 4;
        }
    }

    switch (orientation) {
    case DisplayState::eOrientationDefault:
        flags = Transform::ROT_0;
@@ -457,8 +475,12 @@ void DisplayDevice::setProjection(int orientation,
    if (!frame.isValid()) {
        // the destination frame can be invalid if it has never been set,
        // in that case we assume the whole display frame.
        if ((mHardwareOrientation/90) & DisplayState::eOrientationSwapMask) {
            frame = Rect(h, w);
        } else {
            frame = Rect(w, h);
        }
    }

    if (viewport.isEmpty()) {
        // viewport can be invalid if it has never been set, in that case
@@ -512,6 +534,10 @@ void DisplayDevice::setProjection(int orientation,
    mFrame = frame;
}

int DisplayDevice::getHardwareOrientation() {
    return mHardwareOrientation;
}

void DisplayDevice::dump(String8& result) const {
    const Transform& tr(mGlobalTransform);
    result.appendFormat(
+2 −0
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ public:
     */
    uint32_t getPageFlipCount() const;
    void dump(String8& result) const;
    int getHardwareOrientation();

#ifdef QCOM_BSP
    /* To set egl atribute, EGL_SWAP_BEHAVIOR value
@@ -223,6 +224,7 @@ private:
            int w, int h, Transform* tr);

    uint32_t mLayerStack;
    int mHardwareOrientation;
    int mOrientation;
    // user-provided visible area of the layer stack
    Rect mViewport;
+13 −4
Original line number Diff line number Diff line
@@ -612,10 +612,19 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
            info.orientation = 0;
        }

        int additionalRot = mDisplays[0]->getHardwareOrientation() / 90;
        if ((type == DisplayDevice::DISPLAY_PRIMARY) && (additionalRot & DisplayState::eOrientationSwapMask)) {
            info.h = hwConfig.width;
            info.w = hwConfig.height;
            info.xdpi = ydpi;
            info.ydpi = xdpi;
        }
        else {
            info.w = hwConfig.width;
            info.h = hwConfig.height;
            info.xdpi = xdpi;
            info.ydpi = ydpi;
        }
        info.fps = float(1e9 / hwConfig.refresh);
        info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;