Loading services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -843,9 +843,13 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi const auto touchRefreshRates = rankFrameRates(anchorGroup, RefreshRateOrder::Descending); using fps_approx_ops::operator<; // A method for UI Toolkit to send the touch signal via "HighHint" category vote, // which will touch boost when there are no ExplicitDefault layer votes. This is an // incomplete solution but accounts for cases such as games that use `setFrameRate` with default // compatibility to limit the frame rate, which should not have touch boost. const bool hasInteraction = signals.touch || interactiveLayers > 0; if (hasInteraction && explicitDefaultVoteLayers == 0 && explicitCategoryVoteLayers == 0 && touchBoostForExplicitExact && if (hasInteraction && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact && scores.front().frameRateMode.fps < touchRefreshRates.front().frameRateMode.fps) { ALOGV("Touch Boost"); ATRACE_FORMAT_INSTANT("%s (Touch Boost [late])", Loading services/surfaceflinger/tests/unittests/RefreshRateSelectorTest.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -1624,6 +1624,7 @@ TEST_P(RefreshRateSelectorTest, getBestFrameRateMode_withFrameRateCategory_HighH EXPECT_EQ(120_Hz, actualFrameRateMode.fps); EXPECT_EQ(kModeId120, actualFrameRateMode.modePtr->getId()); // No touch boost, for example a game that uses setFrameRate(30, default compatibility). lr1.vote = LayerVoteType::ExplicitCategory; lr1.frameRateCategory = FrameRateCategory::HighHint; lr1.name = "ExplicitCategory HighHint"; Loading Loading @@ -1652,8 +1653,9 @@ TEST_P(RefreshRateSelectorTest, getBestFrameRateMode_withFrameRateCategory_HighH lr2.frameRateCategory = FrameRateCategory::Low; lr2.name = "ExplicitCategory Low"; actualFrameRateMode = selector.getBestFrameRateMode(layers); EXPECT_EQ(30_Hz, actualFrameRateMode.fps); EXPECT_EQ(kModeId30, actualFrameRateMode.modePtr->getId()); // Gets touch boost EXPECT_EQ(120_Hz, actualFrameRateMode.fps); EXPECT_EQ(kModeId120, actualFrameRateMode.modePtr->getId()); lr1.vote = LayerVoteType::ExplicitCategory; lr1.frameRateCategory = FrameRateCategory::HighHint; Loading Loading
services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -843,9 +843,13 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi const auto touchRefreshRates = rankFrameRates(anchorGroup, RefreshRateOrder::Descending); using fps_approx_ops::operator<; // A method for UI Toolkit to send the touch signal via "HighHint" category vote, // which will touch boost when there are no ExplicitDefault layer votes. This is an // incomplete solution but accounts for cases such as games that use `setFrameRate` with default // compatibility to limit the frame rate, which should not have touch boost. const bool hasInteraction = signals.touch || interactiveLayers > 0; if (hasInteraction && explicitDefaultVoteLayers == 0 && explicitCategoryVoteLayers == 0 && touchBoostForExplicitExact && if (hasInteraction && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact && scores.front().frameRateMode.fps < touchRefreshRates.front().frameRateMode.fps) { ALOGV("Touch Boost"); ATRACE_FORMAT_INSTANT("%s (Touch Boost [late])", Loading
services/surfaceflinger/tests/unittests/RefreshRateSelectorTest.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -1624,6 +1624,7 @@ TEST_P(RefreshRateSelectorTest, getBestFrameRateMode_withFrameRateCategory_HighH EXPECT_EQ(120_Hz, actualFrameRateMode.fps); EXPECT_EQ(kModeId120, actualFrameRateMode.modePtr->getId()); // No touch boost, for example a game that uses setFrameRate(30, default compatibility). lr1.vote = LayerVoteType::ExplicitCategory; lr1.frameRateCategory = FrameRateCategory::HighHint; lr1.name = "ExplicitCategory HighHint"; Loading Loading @@ -1652,8 +1653,9 @@ TEST_P(RefreshRateSelectorTest, getBestFrameRateMode_withFrameRateCategory_HighH lr2.frameRateCategory = FrameRateCategory::Low; lr2.name = "ExplicitCategory Low"; actualFrameRateMode = selector.getBestFrameRateMode(layers); EXPECT_EQ(30_Hz, actualFrameRateMode.fps); EXPECT_EQ(kModeId30, actualFrameRateMode.modePtr->getId()); // Gets touch boost EXPECT_EQ(120_Hz, actualFrameRateMode.fps); EXPECT_EQ(kModeId120, actualFrameRateMode.modePtr->getId()); lr1.vote = LayerVoteType::ExplicitCategory; lr1.frameRateCategory = FrameRateCategory::HighHint; Loading