Loading services/surfaceflinger/Scheduler/LayerInfo.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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}); } Loading services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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; Loading services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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); } Loading services/surfaceflinger/tests/unittests/LayerInfoTest.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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) { Loading Loading
services/surfaceflinger/Scheduler/LayerInfo.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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}); } Loading
services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
services/surfaceflinger/tests/unittests/LayerHistoryTest.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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); } Loading
services/surfaceflinger/tests/unittests/LayerInfoTest.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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) { Loading