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

Commit e9b1e968 authored by Ady Abraham's avatar Ady Abraham Committed by Automerger Merge Worker
Browse files

Merge changes Ia14551e0,Idd32600c,I694e2aa5 am: 69ff6776

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1953900

Change-Id: I8a14f9c6f83cbee689b69bdfac9fdb551c4bf4a9
parents 21ce06ab 69ff6776
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ float RefreshRateConfigs::calculateLayerScoreLocked(const LayerRequirement& laye
    // The layer frame rate is not a divider of the refresh rate,
    // there is a small penalty attached to the score to favor the frame rates
    // the exactly matches the display refresh rate or a multiple.
    constexpr float kNonExactMatchingPenalty = 0.99f;
    constexpr float kNonExactMatchingPenalty = 0.95f;
    return calculateNonExactMatchingLayerScoreLocked(layer, refreshRate) * seamlessness *
            kNonExactMatchingPenalty;
}
+33 −0
Original line number Diff line number Diff line
@@ -2214,6 +2214,39 @@ TEST_F(RefreshRateConfigsTest, getBestRefreshRate_deviceWithCloseRefreshRates) {
    }
}

// b/190578904
TEST_F(RefreshRateConfigsTest, getBestRefreshRate_conflictingVotes) {
    const DisplayModes displayModes = {
            createDisplayMode(DisplayModeId(0), 0, Fps(43.0f).getPeriodNsecs()),
            createDisplayMode(DisplayModeId(1), 0, Fps(53.0f).getPeriodNsecs()),
            createDisplayMode(DisplayModeId(2), 0, Fps(55.0f).getPeriodNsecs()),
            createDisplayMode(DisplayModeId(3), 0, Fps(60.0f).getPeriodNsecs()),
    };

    const RefreshRateConfigs::GlobalSignals globalSignals = {.touch = false, .idle = false};
    auto refreshRateConfigs =
            std::make_unique<RefreshRateConfigs>(displayModes,
                                                 /*currentConfigId=*/displayModes[0]->getId());

    const auto layers = std::vector<LayerRequirement>{
            LayerRequirement{
                    .vote = LayerVoteType::ExplicitDefault,
                    .desiredRefreshRate = Fps(43.0f),
                    .seamlessness = Seamlessness::SeamedAndSeamless,
                    .weight = 0.41f,
            },
            LayerRequirement{
                    .vote = LayerVoteType::ExplicitExactOrMultiple,
                    .desiredRefreshRate = Fps(53.0f),
                    .seamlessness = Seamlessness::SeamedAndSeamless,
                    .weight = 0.41f,
            },
    };

    EXPECT_EQ(53,
              refreshRateConfigs->getBestRefreshRate(layers, globalSignals).getFps().getIntValue());
}

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