Loading services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -422,7 +422,15 @@ RefreshRate RefreshRateConfigs::getBestRefreshRateLocked( // actually increase the refresh rate over the normal selection. const RefreshRate& touchRefreshRate = getMaxRefreshRateByPolicyLocked(); bool touchBoostForExplicitExact = explicitExact == 0 || mSupportsFrameRateOverride; const bool touchBoostForExplicitExact = [&] { if (mSupportsFrameRateOverride) { // Enable touch boost if there are other layers besides exact return explicitExact + noVoteLayers != layers.size(); } else { // Enable touch boost if there are no exact layers return explicitExact == 0; } }(); if (globalSignals.touch && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact && bestRefreshRate->fps.lessThanWithMargin(touchRefreshRate.fps)) { setTouchConsidered(); Loading services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp +33 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ protected: mConfig30DifferentGroup, mConfig25DifferentGroup, mConfig50}; DisplayModes m60_120Device = {mConfig60, mConfig120}; // Expected RefreshRate objects RefreshRate mExpected60Config = {HWC_CONFIG_ID_60, mConfig60, Fps(60), Loading Loading @@ -1844,6 +1845,38 @@ TEST_F(RefreshRateConfigsTest, getBestRefreshRate_WritesCache) { ASSERT_FALSE(detaultSignals == lastInvocation->outSignalsConsidered); } TEST_F(RefreshRateConfigsTest, getBestRefreshRate_ExplicitExactTouchBoost) { auto refreshRateConfigs = std::make_unique<RefreshRateConfigs>(m60_120Device, /*currentConfigId=*/HWC_CONFIG_ID_60, /*enableFrameRateOverride=*/true); auto layers = std::vector<LayerRequirement>{LayerRequirement{.weight = 1.0f}, LayerRequirement{.weight = 0.5f}}; auto& explicitExactLayer = layers[0]; auto& explicitExactOrMultipleLayer = layers[1]; explicitExactOrMultipleLayer.vote = LayerVoteType::ExplicitExactOrMultiple; explicitExactOrMultipleLayer.name = "ExplicitExactOrMultiple"; explicitExactOrMultipleLayer.desiredRefreshRate = Fps(60); explicitExactLayer.vote = LayerVoteType::ExplicitExact; explicitExactLayer.name = "ExplicitExact"; explicitExactLayer.desiredRefreshRate = Fps(30); EXPECT_EQ(mExpected60Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = false, .idle = false})); EXPECT_EQ(mExpected120Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = true, .idle = false})); explicitExactOrMultipleLayer.vote = LayerVoteType::NoVote; EXPECT_EQ(mExpected60Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = false, .idle = false})); EXPECT_EQ(mExpected60Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = true, .idle = false})); } TEST_F(RefreshRateConfigsTest, testComparisonOperator) { EXPECT_TRUE(mExpected60Config < mExpected90Config); EXPECT_FALSE(mExpected60Config < mExpected60Config); Loading Loading
services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -422,7 +422,15 @@ RefreshRate RefreshRateConfigs::getBestRefreshRateLocked( // actually increase the refresh rate over the normal selection. const RefreshRate& touchRefreshRate = getMaxRefreshRateByPolicyLocked(); bool touchBoostForExplicitExact = explicitExact == 0 || mSupportsFrameRateOverride; const bool touchBoostForExplicitExact = [&] { if (mSupportsFrameRateOverride) { // Enable touch boost if there are other layers besides exact return explicitExact + noVoteLayers != layers.size(); } else { // Enable touch boost if there are no exact layers return explicitExact == 0; } }(); if (globalSignals.touch && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact && bestRefreshRate->fps.lessThanWithMargin(touchRefreshRate.fps)) { setTouchConsidered(); Loading
services/surfaceflinger/tests/unittests/RefreshRateConfigsTest.cpp +33 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ protected: mConfig30DifferentGroup, mConfig25DifferentGroup, mConfig50}; DisplayModes m60_120Device = {mConfig60, mConfig120}; // Expected RefreshRate objects RefreshRate mExpected60Config = {HWC_CONFIG_ID_60, mConfig60, Fps(60), Loading Loading @@ -1844,6 +1845,38 @@ TEST_F(RefreshRateConfigsTest, getBestRefreshRate_WritesCache) { ASSERT_FALSE(detaultSignals == lastInvocation->outSignalsConsidered); } TEST_F(RefreshRateConfigsTest, getBestRefreshRate_ExplicitExactTouchBoost) { auto refreshRateConfigs = std::make_unique<RefreshRateConfigs>(m60_120Device, /*currentConfigId=*/HWC_CONFIG_ID_60, /*enableFrameRateOverride=*/true); auto layers = std::vector<LayerRequirement>{LayerRequirement{.weight = 1.0f}, LayerRequirement{.weight = 0.5f}}; auto& explicitExactLayer = layers[0]; auto& explicitExactOrMultipleLayer = layers[1]; explicitExactOrMultipleLayer.vote = LayerVoteType::ExplicitExactOrMultiple; explicitExactOrMultipleLayer.name = "ExplicitExactOrMultiple"; explicitExactOrMultipleLayer.desiredRefreshRate = Fps(60); explicitExactLayer.vote = LayerVoteType::ExplicitExact; explicitExactLayer.name = "ExplicitExact"; explicitExactLayer.desiredRefreshRate = Fps(30); EXPECT_EQ(mExpected60Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = false, .idle = false})); EXPECT_EQ(mExpected120Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = true, .idle = false})); explicitExactOrMultipleLayer.vote = LayerVoteType::NoVote; EXPECT_EQ(mExpected60Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = false, .idle = false})); EXPECT_EQ(mExpected60Config, refreshRateConfigs->getBestRefreshRate(layers, {.touch = true, .idle = false})); } TEST_F(RefreshRateConfigsTest, testComparisonOperator) { EXPECT_TRUE(mExpected60Config < mExpected90Config); EXPECT_FALSE(mExpected60Config < mExpected60Config); Loading