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

Commit 902599b8 authored by Rachel Lee's avatar Rachel Lee Committed by Android (Google) Code Review
Browse files

Merge "FrameRateCategory::NoPreference votes Min" into main

parents 32295332 f377b367
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ LayerInfo::RefreshRateVotes LayerInfo::getRefreshRateVote(const RefreshRateSelec
        if (mLayerVote.category != FrameRateCategory::Default) {
            ALOGV("%s uses frame rate category: %d", mName.c_str(),
                  static_cast<int>(mLayerVote.category));
            votes.push_back({LayerHistory::LayerVoteType::ExplicitCategory, mLayerVote.fps,
            votes.push_back({LayerHistory::LayerVoteType::ExplicitCategory, Fps(),
                             Seamlessness::Default, mLayerVote.category});
        }

+6 −0
Original line number Diff line number Diff line
@@ -501,6 +501,12 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi
                break;
            case LayerVoteType::ExplicitCategory:
                explicitCategoryVoteLayers++;
                if (layer.frameRateCategory == FrameRateCategory::NoPreference) {
                    // Count this layer for Min vote as well. The explicit vote avoids
                    // touch boost and idle for choosing a category, while Min vote is for correct
                    // behavior when all layers are Min or no vote.
                    minVoteLayers++;
                }
                break;
            case LayerVoteType::Heuristic:
                break;
+2 −2
Original line number Diff line number Diff line
@@ -529,7 +529,7 @@ TEST_F(LayerHistoryTest, oneLayerExplicitVoteWithCategory) {
    EXPECT_EQ(1, frequentLayerCount(time));
    // First LayerRequirement is the layer's category specification
    EXPECT_EQ(LayerHistory::LayerVoteType::ExplicitCategory, summarizeLayerHistory(time)[0].vote);
    EXPECT_EQ(73.4_Hz, summarizeLayerHistory(time)[0].desiredRefreshRate);
    EXPECT_EQ(0_Hz, summarizeLayerHistory(time)[0].desiredRefreshRate);
    EXPECT_EQ(FrameRateCategory::High, summarizeLayerHistory(time)[0].frameRateCategory);

    // Second LayerRequirement is the frame rate specification
@@ -544,7 +544,7 @@ TEST_F(LayerHistoryTest, oneLayerExplicitVoteWithCategory) {
    EXPECT_EQ(1, activeLayerCount());
    EXPECT_EQ(0, frequentLayerCount(time));
    EXPECT_EQ(LayerHistory::LayerVoteType::ExplicitCategory, summarizeLayerHistory(time)[0].vote);
    EXPECT_EQ(73.4_Hz, summarizeLayerHistory(time)[0].desiredRefreshRate);
    EXPECT_EQ(0_Hz, summarizeLayerHistory(time)[0].desiredRefreshRate);
    EXPECT_EQ(FrameRateCategory::High, summarizeLayerHistory(time)[0].frameRateCategory);
}

+14 −2
Original line number Diff line number Diff line
@@ -223,8 +223,6 @@ TEST_F(LayerInfoTest, getRefreshRateVote_explicitVoteWithCategory) {
}

TEST_F(LayerInfoTest, getRefreshRateVote_explicitCategory) {
    // When a layer only has a category set, the LayerVoteType should be the LayerInfo's default.
    // The most common case should be Heuristic.
    LayerInfo::LayerVote vote = {.type = LayerHistory::LayerVoteType::ExplicitDefault,
                                 .category = FrameRateCategory::High};
    layerInfo.setLayerVote(vote);
@@ -234,6 +232,20 @@ TEST_F(LayerInfoTest, getRefreshRateVote_explicitCategory) {
    ASSERT_EQ(actualVotes.size(), 1u);
    ASSERT_EQ(actualVotes[0].type, LayerHistory::LayerVoteType::ExplicitCategory);
    ASSERT_EQ(actualVotes[0].category, vote.category);
    ASSERT_EQ(actualVotes[0].fps, 0_Hz);
}

TEST_F(LayerInfoTest, getRefreshRateVote_categoryNoPreference) {
    LayerInfo::LayerVote vote = {.type = LayerHistory::LayerVoteType::ExplicitDefault,
                                 .category = FrameRateCategory::NoPreference};
    layerInfo.setLayerVote(vote);

    auto actualVotes =
            layerInfo.getRefreshRateVote(*mScheduler->refreshRateSelector(), systemTime());
    ASSERT_EQ(actualVotes.size(), 1u);
    ASSERT_EQ(actualVotes[0].type, LayerHistory::LayerVoteType::ExplicitCategory);
    ASSERT_EQ(actualVotes[0].category, vote.category);
    ASSERT_EQ(actualVotes[0].fps, 0_Hz);
}

TEST_F(LayerInfoTest, getRefreshRateVote_noData) {