diff options
author | Ady Abraham <adyabr@google.com> | 2019-09-18 16:44:02 -0700 |
---|---|---|
committer | Ady Abraham <adyabr@google.com> | 2019-09-18 16:48:11 -0700 |
commit | 0d772e2642ede5ae36542de4eecfe87b6fe21dad (patch) | |
tree | 487bf6ff7f50deb8eb72625d6d1cc1bdee59810e | |
parent | d6536aa908a82d909b99d81012fd3b258faf0d84 (diff) | |
download | native-0d772e2642ede5ae36542de4eecfe87b6fe21dad.tar.gz |
SurfaceFlinger: tune number of buffers for low activity layers
Tune number of buffers indicating whether a layer is low activity
or not to 2 accommodate more cases of low activity layers.
Bug: 140948091
Test: 1) Set the static wallpaper
2) Go to Settings->About Phone -> scroll all the way down
3) Move device to Zone1 and launch settings page
4) Move device to Non Zone1 without touch and wait for 1-2 secs and observe
Change-Id: I6a06fa4945843a8d991463c30cb0e6db68f99365
-rw-r--r-- | services/surfaceflinger/Scheduler/LayerInfo.h | 5 | ||||
-rw-r--r-- | services/surfaceflinger/Scheduler/SchedulerUtils.h | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/services/surfaceflinger/Scheduler/LayerInfo.h b/services/surfaceflinger/Scheduler/LayerInfo.h index a7337817e3..17afddac28 100644 --- a/services/surfaceflinger/Scheduler/LayerInfo.h +++ b/services/surfaceflinger/Scheduler/LayerInfo.h @@ -109,7 +109,7 @@ class LayerInfo { bool isLowActivityLayer() const { // We want to make sure that we received more than two frames from the layer // in order to check low activity. - if (mElements.size() < 2) { + if (mElements.size() < scheduler::LOW_ACTIVITY_BUFFERS + 1) { return false; } @@ -118,7 +118,8 @@ class LayerInfo { // Check the frame before last to determine whether there is low activity. // If that frame is older than LOW_ACTIVITY_EPSILON_NS, the layer is sending // infrequent updates. - if (mElements.at(mElements.size() - 2) < obsoleteEpsilon) { + if (mElements.at(mElements.size() - (scheduler::LOW_ACTIVITY_BUFFERS + 1)) < + obsoleteEpsilon) { return true; } diff --git a/services/surfaceflinger/Scheduler/SchedulerUtils.h b/services/surfaceflinger/Scheduler/SchedulerUtils.h index ced1899109..ac10f83ad9 100644 --- a/services/surfaceflinger/Scheduler/SchedulerUtils.h +++ b/services/surfaceflinger/Scheduler/SchedulerUtils.h @@ -42,9 +42,11 @@ static constexpr uint32_t HWC2_SCREEN_OFF_CONFIG_ID = 0xffffffff; // or waiting idle in messaging app, when cursor is blinking. static constexpr std::chrono::nanoseconds OBSOLETE_TIME_EPSILON_NS = 1200ms; -// Layer is considered low activity if the buffers come more than LOW_ACTIVITY_EPSILON_NS -// apart. This is helping SF to vote for lower refresh rates when there is not activity +// Layer is considered low activity if the LOW_ACTIVITY_BUFFERS buffers come more than +// LOW_ACTIVITY_EPSILON_NS apart. +// This is helping SF to vote for lower refresh rates when there is not activity // in screen. +static constexpr int LOW_ACTIVITY_BUFFERS = 2; static constexpr std::chrono::nanoseconds LOW_ACTIVITY_EPSILON_NS = 250ms; // Calculates the statistical mean (average) in the data structure (array, vector). The |