Loading services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Flattener.h +2 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ class Predictor; class Flattener { public: Flattener(bool enableHolePunch = false) : mEnableHolePunch(enableHolePunch) {} Flattener(bool enableHolePunch = false); void setDisplaySize(ui::Size size) { mDisplaySize = size; } Loading Loading @@ -162,6 +162,7 @@ private: size_t mCachedSetCreationCount = 0; size_t mCachedSetCreationCost = 0; std::unordered_map<size_t, size_t> mInvalidatedCachedSetAges; std::chrono::nanoseconds mActiveLayerTimeout = kActiveLayerTimeout; static constexpr auto kActiveLayerTimeout = std::chrono::nanoseconds(150ms); }; Loading services/surfaceflinger/CompositionEngine/src/planner/Flattener.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ // #define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <android-base/properties.h> #include <compositionengine/impl/planner/Flattener.h> #include <compositionengine/impl/planner/LayerState.h> Loading Loading @@ -59,6 +60,14 @@ bool isSameStack(const std::vector<const LayerState*>& incomingLayers, } // namespace Flattener::Flattener(bool enableHolePunch) : mEnableHolePunch(enableHolePunch) { const int timeoutInMs = base::GetIntProperty(std::string("debug.sf.layer_caching_active_layer_timeout_ms"), 0); if (timeoutInMs != 0) { mActiveLayerTimeout = std::chrono::milliseconds(timeoutInMs); } } NonBufferHash Flattener::flattenLayers(const std::vector<const LayerState*>& layers, NonBufferHash hash, time_point now) { ATRACE_CALL(); Loading Loading @@ -370,7 +379,7 @@ std::vector<Flattener::Run> Flattener::findCandidateRuns(time_point now) const { bool runHasFirstLayer = false; for (auto currentSet = mLayers.cbegin(); currentSet != mLayers.cend(); ++currentSet) { const bool layerIsInactive = now - currentSet->getLastUpdate() > kActiveLayerTimeout; const bool layerIsInactive = now - currentSet->getLastUpdate() > mActiveLayerTimeout; const bool layerHasBlur = currentSet->hasBlurBehind(); if (layerIsInactive && (firstLayer || runHasFirstLayer || !layerHasBlur) && !currentSet->hasHdrLayers() && !currentSet->hasProtectedLayers()) { Loading Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Flattener.h +2 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ class Predictor; class Flattener { public: Flattener(bool enableHolePunch = false) : mEnableHolePunch(enableHolePunch) {} Flattener(bool enableHolePunch = false); void setDisplaySize(ui::Size size) { mDisplaySize = size; } Loading Loading @@ -162,6 +162,7 @@ private: size_t mCachedSetCreationCount = 0; size_t mCachedSetCreationCost = 0; std::unordered_map<size_t, size_t> mInvalidatedCachedSetAges; std::chrono::nanoseconds mActiveLayerTimeout = kActiveLayerTimeout; static constexpr auto kActiveLayerTimeout = std::chrono::nanoseconds(150ms); }; Loading
services/surfaceflinger/CompositionEngine/src/planner/Flattener.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ // #define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <android-base/properties.h> #include <compositionengine/impl/planner/Flattener.h> #include <compositionengine/impl/planner/LayerState.h> Loading Loading @@ -59,6 +60,14 @@ bool isSameStack(const std::vector<const LayerState*>& incomingLayers, } // namespace Flattener::Flattener(bool enableHolePunch) : mEnableHolePunch(enableHolePunch) { const int timeoutInMs = base::GetIntProperty(std::string("debug.sf.layer_caching_active_layer_timeout_ms"), 0); if (timeoutInMs != 0) { mActiveLayerTimeout = std::chrono::milliseconds(timeoutInMs); } } NonBufferHash Flattener::flattenLayers(const std::vector<const LayerState*>& layers, NonBufferHash hash, time_point now) { ATRACE_CALL(); Loading Loading @@ -370,7 +379,7 @@ std::vector<Flattener::Run> Flattener::findCandidateRuns(time_point now) const { bool runHasFirstLayer = false; for (auto currentSet = mLayers.cbegin(); currentSet != mLayers.cend(); ++currentSet) { const bool layerIsInactive = now - currentSet->getLastUpdate() > kActiveLayerTimeout; const bool layerIsInactive = now - currentSet->getLastUpdate() > mActiveLayerTimeout; const bool layerHasBlur = currentSet->hasBlurBehind(); if (layerIsInactive && (firstLayer || runHasFirstLayer || !layerHasBlur) && !currentSet->hasHdrLayers() && !currentSet->hasProtectedLayers()) { Loading