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

Commit 0dd4bd48 authored by Ady Abraham's avatar Ady Abraham Committed by Rachel Lee
Browse files

SF: use CategoryDefault for layers w/ setFrameRate

Uses Default category for layers with that also specified something in
setFrameRate. this makes it easier downstream to not double count or
choose frame rate incorrectly.

Bug: 325130604
Test: atest libsurfaceflinger_unittest
Change-Id: I6481c6fd95474310e11046839f8b05e136bf3f19
parent 7b203676
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -327,7 +327,8 @@ LayerInfo::RefreshRateVotes LayerInfo::getRefreshRateVote(const RefreshRateSelec
            mLayerVote.type != LayerHistory::LayerVoteType::ExplicitDefault) {
            ATRACE_FORMAT_INSTANT("Vote %s", ftl::enum_string(mLayerVote.type).c_str());
            ALOGV("%s voted %d", mName.c_str(), static_cast<int>(mLayerVote.type));
            votes.push_back(mLayerVote);
            votes.push_back({mLayerVote.type, mLayerVote.fps, mLayerVote.seamlessness,
                             FrameRateCategory::Default, mLayerVote.categorySmoothSwitchOnly});
        }

        return votes;
+1 −1
Original line number Diff line number Diff line
@@ -646,7 +646,7 @@ TEST_F(LayerHistoryTest, oneLayerExplicitVoteWithCategory) {
    // Second LayerRequirement is the frame rate specification
    EXPECT_EQ(LayerHistory::LayerVoteType::ExplicitDefault, summarizeLayerHistory(time)[1].vote);
    EXPECT_EQ(73.4_Hz, summarizeLayerHistory(time)[1].desiredRefreshRate);
    EXPECT_EQ(FrameRateCategory::High, summarizeLayerHistory(time)[1].frameRateCategory);
    EXPECT_EQ(FrameRateCategory::Default, summarizeLayerHistory(time)[1].frameRateCategory);

    // layer became inactive, but the vote stays
    setDefaultLayerVote(layer.get(), LayerHistory::LayerVoteType::Heuristic);
+5 −2
Original line number Diff line number Diff line
@@ -213,7 +213,8 @@ TEST_F(LayerInfoTest, getRefreshRateVote_explicitVote) {
TEST_F(LayerInfoTest, getRefreshRateVote_explicitVoteWithCategory) {
    LayerInfo::LayerVote vote = {.type = LayerHistory::LayerVoteType::ExplicitDefault,
                                 .fps = 20_Hz,
                                 .category = FrameRateCategory::High};
                                 .category = FrameRateCategory::High,
                                 .categorySmoothSwitchOnly = true};
    layerInfo.setLayerVote(vote);

    auto actualVotes =
@@ -221,10 +222,12 @@ TEST_F(LayerInfoTest, getRefreshRateVote_explicitVoteWithCategory) {
    ASSERT_EQ(actualVotes.size(), 2u);
    ASSERT_EQ(actualVotes[0].type, LayerHistory::LayerVoteType::ExplicitCategory);
    ASSERT_EQ(actualVotes[0].category, vote.category);
    ASSERT_TRUE(actualVotes[0].categorySmoothSwitchOnly);
    ASSERT_EQ(actualVotes[1].type, vote.type);
    ASSERT_EQ(actualVotes[1].fps, vote.fps);
    ASSERT_EQ(actualVotes[1].seamlessness, vote.seamlessness);
    ASSERT_EQ(actualVotes[1].category, vote.category);
    ASSERT_EQ(actualVotes[1].category, FrameRateCategory::Default);
    ASSERT_TRUE(actualVotes[1].categorySmoothSwitchOnly);
}

TEST_F(LayerInfoTest, getRefreshRateVote_explicitCategory) {