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 Diff line number Diff line
@@ -865,7 +865,7 @@ void SurfaceFlinger::init() FTL_FAKE_GUARD(kMainThreadContext) {
    // initialize our drawing state
    mDrawingState = mCurrentState;

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

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

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

        static bool sPrimaryDisplay = true;
        if (sPrimaryDisplay || activeDisplayChanged) {
        if (isInternalDisplay && (!activeDisplay || !activeDisplay->isPoweredOn())) {
            onActiveDisplayChangedLocked(activeDisplay.get(), *display);
            sPrimaryDisplay = false;
        }

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

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

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

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

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

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