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

Commit 6484426f authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Steve Kondik
Browse files

surfaceflinger: Reimplement hwrotation

Change-Id: Ia26bb36b5b6de132af49c272c4472ad2703afbda

Fix boot animation rotation problem when ro.sf.hwrotation is set to 90 or 270

Change-Id: I7ad3c83e23ce38280818ec5283d173d50c889531

sf: Only apply hwrotation to primary displays

Change-Id: Ib51030cec5ce7609f12be9a5e46310f75442b680
parent 4f3d1126
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -452,6 +452,20 @@ status_t DisplayDevice::orientationToTransfrom(
        int orientation, int w, int h, Transform* tr)
{
    uint32_t flags = 0;
    char value[PROPERTY_VALUE_MAX];
    property_get("ro.sf.hwrotation", value, "0");
    int additionalRot = atoi(value);

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

    switch (orientation) {
    case DisplayState::eOrientationDefault:
        flags = Transform::ROT_0;
@@ -512,8 +526,16 @@ 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.
        char value[PROPERTY_VALUE_MAX];
        property_get("ro.sf.hwrotation", value, "0");
        int additionalRot = atoi(value);

        if (additionalRot == 90 || additionalRot == 270) {
            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