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

Commit a39e32fd authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Activate boot display earlier

Remove setPowerModeInternal's special case for the boot display, whose
global state broke tests unless they happened to run in the convenient
order.

Bug: 255635821
Bug: 262417075
Test: SetPowerModeInternalTest
Change-Id: Id6800c30ef58e78615bf9abaaad116d8b1195ca2
parent 39dfc94b
Loading
Loading
Loading
Loading
+7 −13
Original line number Original line Diff line number Diff line
@@ -865,7 +865,7 @@ void SurfaceFlinger::init() FTL_FAKE_GUARD(kMainThreadContext) {
    // initialize our drawing state
    // initialize our drawing state
    mDrawingState = mCurrentState;
    mDrawingState = mCurrentState;


    // set initial conditions (e.g. unblank default device)
    onActiveDisplayChangedLocked(nullptr, *display);
    initializeDisplays();
    initializeDisplays();


    mPowerAdvisor->init();
    mPowerAdvisor->init();
@@ -4972,21 +4972,15 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
    if (!currentModeOpt || *currentModeOpt == hal::PowerMode::OFF) {
    if (!currentModeOpt || *currentModeOpt == hal::PowerMode::OFF) {
        // Turn on the display
        // Turn on the display


        // Activate the display (which involves a modeset to the active mode):
        // Activate the display (which involves a modeset to the active mode) when the inner or
        //     1) When the first (a.k.a. primary) display is powered on during boot.
        // outer display of a foldable is powered on. This condition relies on the above
        //     2) When the inner or outer display of a foldable is powered on. This condition relies
        // DisplayDevice::setPowerMode. If `display` and `activeDisplay` are the same display,
        //        on the above DisplayDevice::setPowerMode. If `display` and `activeDisplay` are the
        // then the `activeDisplay->isPoweredOn()` below is true, such that the display is not
        //        same display, then the `activeDisplay->isPoweredOn()` below is true, such that the
        // activated every time it is powered on.
        //        display is not activated every time it is powered on.
        //
        //
        // TODO(b/255635821): Remove the concept of active display.
        // TODO(b/255635821): Remove the concept of active display.
        const bool activeDisplayChanged =
        if (isInternalDisplay && (!activeDisplay || !activeDisplay->isPoweredOn())) {
                isInternalDisplay && (!activeDisplay || !activeDisplay->isPoweredOn());

        static bool sPrimaryDisplay = true;
        if (sPrimaryDisplay || activeDisplayChanged) {
            onActiveDisplayChangedLocked(activeDisplay.get(), *display);
            onActiveDisplayChangedLocked(activeDisplay.get(), *display);
            sPrimaryDisplay = false;
        }
        }


        // Keep uclamp in a separate syscall and set it before changing to RT due to b/190237315.
        // Keep uclamp in a separate syscall and set it before changing to RT due to b/190237315.
+4 −8
Original line number Original line Diff line number Diff line
@@ -404,13 +404,11 @@ TEST_F(SetPowerModeInternalTest, setPowerModeInternalDoesNothingIfVirtualDisplay
    EXPECT_EQ(PowerMode::ON, display.mutableDisplayDevice()->getPowerMode());
    EXPECT_EQ(PowerMode::ON, display.mutableDisplayDevice()->getPowerMode());
}
}


// TODO(b/262417075)
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToOnPrimaryDisplay) {
TEST_F(SetPowerModeInternalTest, DISABLED_transitionsDisplayFromOffToOnPrimaryDisplay) {
    transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOffToOnVariant>>();
    transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOffToOnVariant>>();
}
}


// TODO(b/262417075)
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToDozeSuspendPrimaryDisplay) {
TEST_F(SetPowerModeInternalTest, DISABLED_transitionsDisplayFromOffToDozeSuspendPrimaryDisplay) {
    transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOffToDozeSuspendVariant>>();
    transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOffToDozeSuspendVariant>>();
}
}


@@ -446,13 +444,11 @@ TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOnToUnknownPrimaryDisplay
    transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOnToUnknownVariant>>();
    transitionDisplayCommon<PrimaryDisplayPowerCase<TransitionOnToUnknownVariant>>();
}
}


// TODO(b/262417075)
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToOnExternalDisplay) {
TEST_F(SetPowerModeInternalTest, DISABLED_transitionsDisplayFromOffToOnExternalDisplay) {
    transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToOnVariant>>();
    transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToOnVariant>>();
}
}


// TODO(b/262417075)
TEST_F(SetPowerModeInternalTest, transitionsDisplayFromOffToDozeSuspendExternalDisplay) {
TEST_F(SetPowerModeInternalTest, DISABLED_transitionsDisplayFromOffToDozeSuspendExternalDisplay) {
    transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToDozeSuspendVariant>>();
    transitionDisplayCommon<ExternalDisplayPowerCase<TransitionOffToDozeSuspendVariant>>();
}
}