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

Commit 7e19eaca authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: don't touch boost if we only have Exact layers" into sc-dev

parents ea214ad4 5e4e983e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -422,7 +422,15 @@ RefreshRate RefreshRateConfigs::getBestRefreshRateLocked(
    // actually increase the refresh rate over the normal selection.
    const RefreshRate& touchRefreshRate = getMaxRefreshRateByPolicyLocked();

    bool touchBoostForExplicitExact = explicitExact == 0 || mSupportsFrameRateOverride;
    const bool touchBoostForExplicitExact = [&] {
        if (mSupportsFrameRateOverride) {
            // Enable touch boost if there are other layers besides exact
            return explicitExact + noVoteLayers != layers.size();
        } else {
            // Enable touch boost if there are no exact layers
            return explicitExact == 0;
        }
    }();
    if (globalSignals.touch && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact &&
        bestRefreshRate->fps.lessThanWithMargin(touchRefreshRate.fps)) {
        setTouchConsidered();
+33 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ protected:
                                       mConfig30DifferentGroup,
                                       mConfig25DifferentGroup,
                                       mConfig50};
    DisplayModes m60_120Device = {mConfig60, mConfig120};

    // Expected RefreshRate objects
    RefreshRate mExpected60Config = {HWC_CONFIG_ID_60, mConfig60, Fps(60),
@@ -1844,6 +1845,38 @@ TEST_F(RefreshRateConfigsTest, getBestRefreshRate_WritesCache) {
    ASSERT_FALSE(detaultSignals == lastInvocation->outSignalsConsidered);
}

TEST_F(RefreshRateConfigsTest, getBestRefreshRate_ExplicitExactTouchBoost) {
    auto refreshRateConfigs =
            std::make_unique<RefreshRateConfigs>(m60_120Device,
                                                 /*currentConfigId=*/HWC_CONFIG_ID_60,
                                                 /*enableFrameRateOverride=*/true);

    auto layers = std::vector<LayerRequirement>{LayerRequirement{.weight = 1.0f},
                                                LayerRequirement{.weight = 0.5f}};
    auto& explicitExactLayer = layers[0];
    auto& explicitExactOrMultipleLayer = layers[1];

    explicitExactOrMultipleLayer.vote = LayerVoteType::ExplicitExactOrMultiple;
    explicitExactOrMultipleLayer.name = "ExplicitExactOrMultiple";
    explicitExactOrMultipleLayer.desiredRefreshRate = Fps(60);

    explicitExactLayer.vote = LayerVoteType::ExplicitExact;
    explicitExactLayer.name = "ExplicitExact";
    explicitExactLayer.desiredRefreshRate = Fps(30);

    EXPECT_EQ(mExpected60Config,
              refreshRateConfigs->getBestRefreshRate(layers, {.touch = false, .idle = false}));
    EXPECT_EQ(mExpected120Config,
              refreshRateConfigs->getBestRefreshRate(layers, {.touch = true, .idle = false}));

    explicitExactOrMultipleLayer.vote = LayerVoteType::NoVote;

    EXPECT_EQ(mExpected60Config,
              refreshRateConfigs->getBestRefreshRate(layers, {.touch = false, .idle = false}));
    EXPECT_EQ(mExpected60Config,
              refreshRateConfigs->getBestRefreshRate(layers, {.touch = true, .idle = false}));
}

TEST_F(RefreshRateConfigsTest, testComparisonOperator) {
    EXPECT_TRUE(mExpected60Config < mExpected90Config);
    EXPECT_FALSE(mExpected60Config < mExpected60Config);