diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2022-04-29 20:10:07 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2022-04-29 20:10:07 -0700 |
commit | 338982efec029ea047b8749d549e0aeeba8ff048 (patch) | |
tree | b5f6bb05110da32f3bcf78d805912ce1b124a003 | |
parent | 41072e7c8c5c3f03c051b2689bc88e51c03d25e4 (diff) | |
parent | 1f5125be037d697985b407487b7be83949c7140f (diff) |
Merge 1f5125be037d697985b407487b7be83949c7140f on remote branch
Change-Id: Ic94a7892a8a9421b7d9738de30a4c37a1d78c07a
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 5 | ||||
-rwxr-xr-x | 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 100755 --- 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(); } } }); |