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

Commit 086507b2 authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Skip choosing mode for powered-off followers

While the inactive display of a foldable is powered off, the Scheduler's
chosen mode for it is ignored by shouldApplyRefreshRateSelectorPolicy in
SF::requestDisplayModes, as it will be applied when the display becomes
active.

As an optimization, skip RefreshRateSelector::getRankedFrameRates for
follower displays, since SF::requestDisplayModes throws the result away.

This also restricts the mode of powered-off external displays to only be
set in response to DM policy changes, e.g. 60+60 constraint. Previously,
the Scheduler could initiate a mode request with an unconstrained policy
before powering on the display, which HWC would apply after powering on.

Flag: NONE (blocks P1 bug fix, and risk is limited to multi-display)
Bug: 329111930
Bug: 318534874
Test: SchedulerTest.chooseDisplayModesMultipleDisplays
Change-Id: I4dd954bf9a943f181bd64950ff9edee863f53e99
parent a6306843
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1152,8 +1152,10 @@ auto Scheduler::chooseDisplayModes() const -> DisplayModeChoiceMap {
        return pacesetterFps;
    }();

    // Choose a mode for powered-on follower displays.
    for (const auto& [id, display] : mDisplays) {
        if (id == *mPacesetterDisplayId) continue;
        if (display.powerMode != hal::PowerMode::ON) continue;

        auto rankedFrameRates =
                display.selectorPtr->getRankedFrameRates(mPolicy.contentRequirements, globalSignals,
+4 −0
Original line number Diff line number Diff line
@@ -350,6 +350,9 @@ TEST_F(SchedulerTest, chooseDisplayModesMultipleDisplays) {
                                std::make_shared<RefreshRateSelector>(kDisplay2Modes,
                                                                      kDisplay2Mode60->getId()));

    mScheduler->setDisplayPowerMode(kDisplayId1, hal::PowerMode::ON);
    mScheduler->setDisplayPowerMode(kDisplayId2, hal::PowerMode::ON);

    using DisplayModeChoice = TestableScheduler::DisplayModeChoice;
    TestableScheduler::DisplayModeChoiceMap expectedChoices;

@@ -412,6 +415,7 @@ TEST_F(SchedulerTest, chooseDisplayModesMultipleDisplays) {
                ->registerDisplay(kDisplayId3,
                                  std::make_shared<RefreshRateSelector>(kDisplay3Modes,
                                                                        kDisplay3Mode60->getId()));
        mScheduler->setDisplayPowerMode(kDisplayId3, hal::PowerMode::ON);

        const GlobalSignals globalSignals = {.touch = true};
        mScheduler->replaceTouchTimer(10);
+5 −0
Original line number Diff line number Diff line
@@ -111,6 +111,11 @@ public:
        Scheduler::unregisterDisplay(displayId);
    }

    void setDisplayPowerMode(PhysicalDisplayId displayId, hal::PowerMode powerMode) {
        ftl::FakeGuard guard(kMainThreadContext);
        Scheduler::setDisplayPowerMode(displayId, powerMode);
    }

    std::optional<PhysicalDisplayId> pacesetterDisplayId() const NO_THREAD_SAFETY_ANALYSIS {
        return mPacesetterDisplayId;
    }