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

Commit 1818975c authored by Prabhanjan Kandula's avatar Prabhanjan Kandula Committed by Linux Build Service Account
Browse files

SF : Add support for rotated panel mounts

This is a combination of 2 commits.

SF: Add support for inverse mounted panels

Add 180 rotation in SF to account for inverse mounted panels.
The framework will be unaffected and use policies for a 0 mounted
panel. SF changes the global transform and silently induces the H,V
flips. Similar flips are added to screenshots as well.

Change-Id: I6e9576ee734ee85097491eaa1e8e94cfb3731e0f

SF: Add support for all flips of panel mount

Add support for all flips of panel mount, H, V, HV (180). Property
persist.panel.mountflip can be set to 1 for H-Flip, 2 for V-Flip,
3 for HV-Flip (180 / inverse mount).

Change-Id: Ide7b8378ad6a423e5d7335fedc27d480a25b53ae
CRs-fixed: 990622

Change-Id: Ide7b8378ad6a423e5d7335fedc27d480a25b53af
parent bac313c9
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ DisplayDevice::DisplayDevice(
    Surface* surface;
    mNativeWindow = surface = new Surface(producer, false);
    ANativeWindow* const window = mNativeWindow.get();
    char property[PROPERTY_VALUE_MAX];

    /*
     * Create our display's surface
@@ -162,6 +163,11 @@ DisplayDevice::DisplayDevice(
            break;
    }

    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);

@@ -462,6 +468,11 @@ status_t DisplayDevice::orientationToTransfrom(
    default:
        return BAD_VALUE;
    }

    if (DISPLAY_PRIMARY == mHwcDisplayId) {
        flags = flags ^ getPanelMountFlip();
    }

    tr->set(flags, w, h);
    return NO_ERROR;
}
+7 −1
Original line number Diff line number Diff line
@@ -141,6 +141,10 @@ public:
    int32_t                 getHwcDisplayId() const { return mHwcDisplayId; }
    const wp<IBinder>&      getDisplayToken() const { return mDisplayToken; }

    uint32_t getPanelMountFlip() const {
        return mPanelMountFlip;
    }

    // We pass in mustRecompose so we can keep VirtualDisplaySurface's state
    // machine happy without actually queueing a buffer if nothing has changed
    status_t beginFrame(bool mustRecompose) const;
@@ -234,7 +238,7 @@ private:
    /*
     * Transaction state
     */
    static status_t orientationToTransfrom(int orientation,
    status_t orientationToTransfrom(int orientation,
            int w, int h, Transform* tr);

    uint32_t mLayerStack;
@@ -252,6 +256,8 @@ private:
    int mPowerMode;
    // Current active config
    int mActiveConfig;
    // Panel's mount flip, H, V or 180 (HV)
    uint32_t mPanelMountFlip;
};

}; // namespace android
+5 −0
Original line number Diff line number Diff line
@@ -3362,6 +3362,11 @@ void SurfaceFlinger::renderScreenImplLocked(
    // make sure to clear all GL error flags
    engine.checkErrors();

    if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType()) {
        rotation = (Transform::orientation_flags)
                (rotation ^ hw->getPanelMountFlip());
    }

    // set-up our viewport
    engine.setViewportAndProjection(
        reqWidth, reqHeight, sourceCrop, hw_h, yswap, rotation);