diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-15 10:06:22 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-15 10:06:22 +0000 |
commit | 1f5125be037d697985b407487b7be83949c7140f (patch) | |
tree | 38d3babeddd635a58c65632d0d8cad5e1d7c63e7 | |
parent | 4c4fa3528bfa4834dc4389a6c61c287171a364a1 (diff) | |
parent | 8f2727dfc631eda85e153478b8d5d6a5b15aa4f7 (diff) |
Snap for 8459452 from 8f2727dfc631eda85e153478b8d5d6a5b15aa4f7 to s-keystone-qcom-release
Change-Id: If4e236589b8430a2c91e3f7298c02a45b5abe1f8
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 5 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 49 |
3 files changed, 40 insertions, 22 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 316144c0d1..008cd80559 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1106,6 +1106,14 @@ uint32_t Layer::getLayerStack() const { return p->getLayerStack(); } +void Layer::setSmomoLayerStackId() { + smomoLayerStackId = getLayerStack(); +} + +uint32_t Layer::getSmomoLayerStackId() { + return smomoLayerStackId; +} + bool Layer::setShadowRadius(float shadowRadius) { if (mDrawingState.shadowRadius == shadowRadius) { return false; diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index a95f9085d7..bfa97a07c8 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -906,6 +906,9 @@ public: virtual std::string getPendingBufferCounterName() { return ""; } virtual bool updateGeometry() { return false; } + void setSmomoLayerStackId(); + uint32_t getSmomoLayerStackId(); + protected: friend class impl::SurfaceInterceptor; @@ -1135,6 +1138,8 @@ private: const std::vector<BlurRegion> getBlurRegions() const; bool mIsAtRoot = false; + + uint32_t smomoLayerStackId = UINT32_MAX; public: nsecs_t getPreviousGfxInfo(); }; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1aeb21778c..0be7df1488 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3291,6 +3291,10 @@ void SurfaceFlinger::UpdateSmomoState() { return; } + mDrawingState.traverse([&](Layer* layer) { + layer->setSmomoLayerStackId(); + }); + // Disable smomo if external or virtual is connected. bool enableSmomo = mSmomoInstances.size() == mDisplays.size(); uint32_t fps = 0; @@ -4895,11 +4899,15 @@ status_t SurfaceFlinger::setTransactionState( } state.traverseStatesWithBuffers([&](const layer_state_t& state) { - sp<Layer> layer = fromHandle(state.surface).promote(); - if (layer != nullptr) { - SmomoIntf *smoMo = nullptr; - if (mSmomoInstances.size() > 1) { - const uint32_t layerStackId = layer->getLayerStack(); + SmomoIntf *smoMo = nullptr; + int32_t sequence; + sp<Layer> layer = nullptr; + { + Mutex::Autolock _l(mStateLock); + layer = fromHandle(state.surface).promote(); + if (layer != nullptr) { + const uint32_t layerStackId = layer->getSmomoLayerStackId(); + sequence = layer->getSequence(); for (auto &instance: mSmomoInstances) { if (instance.layerStackId == layerStackId) { smoMo = instance.smoMo; @@ -4907,24 +4915,21 @@ status_t SurfaceFlinger::setTransactionState( } } } - else if (mSmomoInstances.size() == 1) { - smoMo = mSmomoInstances[0].smoMo; - } + } - if (smoMo) { - smomo::SmomoBufferStats bufferStats; - const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - bufferStats.id = layer->getSequence(); - bufferStats.auto_timestamp = isAutoTimestamp; - bufferStats.timestamp = now; - bufferStats.dequeue_latency = 0; - bufferStats.key = desiredPresentTime; - smoMo->CollectLayerStats(bufferStats); - - const DisplayStatInfo stats = mScheduler->getDisplayStatInfo(now); - if (smoMo->FrameIsLate(bufferStats.id, stats.vsyncTime)) { - signalImmedLayerUpdate(); - } + if (smoMo) { + smomo::SmomoBufferStats bufferStats; + const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + bufferStats.id = sequence; + bufferStats.auto_timestamp = isAutoTimestamp; + bufferStats.timestamp = now; + bufferStats.dequeue_latency = 0; + bufferStats.key = desiredPresentTime; + smoMo->CollectLayerStats(bufferStats); + + const DisplayStatInfo stats = mScheduler->getDisplayStatInfo(now); + if (smoMo->FrameIsLate(bufferStats.id, stats.vsyncTime)) { + signalImmedLayerUpdate(); } } }); |