Loading services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +18 −16 Original line number Original line Diff line number Diff line Loading @@ -861,7 +861,7 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi // interactive (as opposed to ExplicitExactOrMultiple) and therefore if those posted an explicit // interactive (as opposed to ExplicitExactOrMultiple) and therefore if those posted an explicit // vote we should not change it if we get a touch event. Only apply touch boost if it will // vote we should not change it if we get a touch event. Only apply touch boost if it will // actually increase the refresh rate over the normal selection. // actually increase the refresh rate over the normal selection. const bool touchBoostForExplicitExact = [&] { const auto isTouchBoostForExplicitExact = [&]() -> bool { if (supportsAppFrameRateOverrideByContent()) { if (supportsAppFrameRateOverrideByContent()) { // Enable touch boost if there are other layers besides exact // Enable touch boost if there are other layers besides exact return explicitExact + noVoteLayers + explicitGteLayers != layers.size(); return explicitExact + noVoteLayers + explicitGteLayers != layers.size(); Loading @@ -869,13 +869,11 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi // Enable touch boost if there are no exact layers // Enable touch boost if there are no exact layers return explicitExact == 0; return explicitExact == 0; } } }(); }; const bool touchBoostForCategory = explicitCategoryVoteLayers + noVoteLayers + explicitGteLayers != layers.size(); const auto touchRefreshRates = rankFrameRates(anchorGroup, RefreshRateOrder::Descending); const auto isTouchBoostForCategory = [&]() -> bool { using fps_approx_ops::operator<; return explicitCategoryVoteLayers + noVoteLayers + explicitGteLayers != layers.size(); }; // A method for UI Toolkit to send the touch signal via "HighHint" category vote, // 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 // which will touch boost when there are no ExplicitDefault layer votes. This is an Loading @@ -883,14 +881,18 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi // compatibility to limit the frame rate, which should not have touch boost. // compatibility to limit the frame rate, which should not have touch boost. const bool hasInteraction = signals.touch || interactiveLayers > 0; const bool hasInteraction = signals.touch || interactiveLayers > 0; if (hasInteraction && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact && if (hasInteraction && explicitDefaultVoteLayers == 0 && isTouchBoostForExplicitExact() && touchBoostForCategory && isTouchBoostForCategory()) { scores.front().frameRateMode.fps < touchRefreshRates.front().frameRateMode.fps) { const auto touchRefreshRates = rankFrameRates(anchorGroup, RefreshRateOrder::Descending); using fps_approx_ops::operator<; if (scores.front().frameRateMode.fps < touchRefreshRates.front().frameRateMode.fps) { ALOGV("Touch Boost"); ALOGV("Touch Boost"); ATRACE_FORMAT_INSTANT("%s (Touch Boost [late])", ATRACE_FORMAT_INSTANT("%s (Touch Boost [late])", to_string(touchRefreshRates.front().frameRateMode.fps).c_str()); to_string(touchRefreshRates.front().frameRateMode.fps).c_str()); return {touchRefreshRates, GlobalSignals{.touch = true}}; return {touchRefreshRates, GlobalSignals{.touch = true}}; } } } // If we never scored any layers, and we don't favor high refresh rates, prefer to stay with the // If we never scored any layers, and we don't favor high refresh rates, prefer to stay with the // current config // current config Loading @@ -903,8 +905,8 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi return {ascendingWithPreferred, kNoSignals}; return {ascendingWithPreferred, kNoSignals}; } } ALOGV("%s (scored))", to_string(ranking.front().frameRateMode.fps).c_str()); ALOGV("%s (scored)", to_string(ranking.front().frameRateMode.fps).c_str()); ATRACE_FORMAT_INSTANT("%s (scored))", to_string(ranking.front().frameRateMode.fps).c_str()); ATRACE_FORMAT_INSTANT("%s (scored)", to_string(ranking.front().frameRateMode.fps).c_str()); return {ranking, kNoSignals}; return {ranking, kNoSignals}; } } Loading Loading
services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +18 −16 Original line number Original line Diff line number Diff line Loading @@ -861,7 +861,7 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi // interactive (as opposed to ExplicitExactOrMultiple) and therefore if those posted an explicit // interactive (as opposed to ExplicitExactOrMultiple) and therefore if those posted an explicit // vote we should not change it if we get a touch event. Only apply touch boost if it will // vote we should not change it if we get a touch event. Only apply touch boost if it will // actually increase the refresh rate over the normal selection. // actually increase the refresh rate over the normal selection. const bool touchBoostForExplicitExact = [&] { const auto isTouchBoostForExplicitExact = [&]() -> bool { if (supportsAppFrameRateOverrideByContent()) { if (supportsAppFrameRateOverrideByContent()) { // Enable touch boost if there are other layers besides exact // Enable touch boost if there are other layers besides exact return explicitExact + noVoteLayers + explicitGteLayers != layers.size(); return explicitExact + noVoteLayers + explicitGteLayers != layers.size(); Loading @@ -869,13 +869,11 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi // Enable touch boost if there are no exact layers // Enable touch boost if there are no exact layers return explicitExact == 0; return explicitExact == 0; } } }(); }; const bool touchBoostForCategory = explicitCategoryVoteLayers + noVoteLayers + explicitGteLayers != layers.size(); const auto touchRefreshRates = rankFrameRates(anchorGroup, RefreshRateOrder::Descending); const auto isTouchBoostForCategory = [&]() -> bool { using fps_approx_ops::operator<; return explicitCategoryVoteLayers + noVoteLayers + explicitGteLayers != layers.size(); }; // A method for UI Toolkit to send the touch signal via "HighHint" category vote, // 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 // which will touch boost when there are no ExplicitDefault layer votes. This is an Loading @@ -883,14 +881,18 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi // compatibility to limit the frame rate, which should not have touch boost. // compatibility to limit the frame rate, which should not have touch boost. const bool hasInteraction = signals.touch || interactiveLayers > 0; const bool hasInteraction = signals.touch || interactiveLayers > 0; if (hasInteraction && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact && if (hasInteraction && explicitDefaultVoteLayers == 0 && isTouchBoostForExplicitExact() && touchBoostForCategory && isTouchBoostForCategory()) { scores.front().frameRateMode.fps < touchRefreshRates.front().frameRateMode.fps) { const auto touchRefreshRates = rankFrameRates(anchorGroup, RefreshRateOrder::Descending); using fps_approx_ops::operator<; if (scores.front().frameRateMode.fps < touchRefreshRates.front().frameRateMode.fps) { ALOGV("Touch Boost"); ALOGV("Touch Boost"); ATRACE_FORMAT_INSTANT("%s (Touch Boost [late])", ATRACE_FORMAT_INSTANT("%s (Touch Boost [late])", to_string(touchRefreshRates.front().frameRateMode.fps).c_str()); to_string(touchRefreshRates.front().frameRateMode.fps).c_str()); return {touchRefreshRates, GlobalSignals{.touch = true}}; return {touchRefreshRates, GlobalSignals{.touch = true}}; } } } // If we never scored any layers, and we don't favor high refresh rates, prefer to stay with the // If we never scored any layers, and we don't favor high refresh rates, prefer to stay with the // current config // current config Loading @@ -903,8 +905,8 @@ auto RefreshRateSelector::getRankedFrameRatesLocked(const std::vector<LayerRequi return {ascendingWithPreferred, kNoSignals}; return {ascendingWithPreferred, kNoSignals}; } } ALOGV("%s (scored))", to_string(ranking.front().frameRateMode.fps).c_str()); ALOGV("%s (scored)", to_string(ranking.front().frameRateMode.fps).c_str()); ATRACE_FORMAT_INSTANT("%s (scored))", to_string(ranking.front().frameRateMode.fps).c_str()); ATRACE_FORMAT_INSTANT("%s (scored)", to_string(ranking.front().frameRateMode.fps).c_str()); return {ranking, kNoSignals}; return {ranking, kNoSignals}; } } Loading