Loading services/surfaceflinger/Layer.cpp +14 −11 Original line number Diff line number Diff line Loading @@ -1267,7 +1267,8 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool overr return parentFrameRate; }(); *transactionNeeded |= setFrameRateForLayerTreeLegacy(frameRate); auto now = systemTime(); *transactionNeeded |= setFrameRateForLayerTreeLegacy(frameRate, now); // The frame rate is propagated to the children bool childrenHaveFrameRate = false; Loading @@ -1283,7 +1284,8 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool overr // layer as NoVote to allow the children to control the refresh rate if (!frameRate.isValid() && childrenHaveFrameRate) { *transactionNeeded |= setFrameRateForLayerTreeLegacy(FrameRate(Fps(), FrameRateCompatibility::NoVote)); setFrameRateForLayerTreeLegacy(FrameRate(Fps(), FrameRateCompatibility::NoVote), now); } // We return whether this layer or its children has a vote. We ignore ExactOrMultiple votes for Loading Loading @@ -1492,7 +1494,7 @@ void Layer::setFrameTimelineVsyncForSkippedFrames(const FrameTimelineInfo& info, addSurfaceFrameDroppedForBuffer(surfaceFrame, postTime); } bool Layer::setFrameRateForLayerTreeLegacy(FrameRate frameRate) { bool Layer::setFrameRateForLayerTreeLegacy(FrameRate frameRate, nsecs_t now) { if (mDrawingState.frameRateForLayerTree == frameRate) { return false; } Loading @@ -1506,19 +1508,20 @@ bool Layer::setFrameRateForLayerTreeLegacy(FrameRate frameRate) { setTransactionFlags(eTransactionNeeded); mFlinger->mScheduler ->recordLayerHistory(sequence, getLayerProps(), systemTime(), ->recordLayerHistory(sequence, getLayerProps(), now, now, scheduler::LayerHistory::LayerUpdateType::SetFrameRate); return true; } bool Layer::setFrameRateForLayerTree(FrameRate frameRate, const scheduler::LayerProps& layerProps) { bool Layer::setFrameRateForLayerTree(FrameRate frameRate, const scheduler::LayerProps& layerProps, nsecs_t now) { if (mDrawingState.frameRateForLayerTree == frameRate) { return false; } mDrawingState.frameRateForLayerTree = frameRate; mFlinger->mScheduler ->recordLayerHistory(sequence, layerProps, systemTime(), ->recordLayerHistory(sequence, layerProps, now, now, scheduler::LayerHistory::LayerUpdateType::SetFrameRate); return true; } Loading Loading @@ -3225,7 +3228,7 @@ bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer, mOwnerUid, postTime, getGameMode()); if (mFlinger->mLegacyFrontEndEnabled) { recordLayerHistoryBufferUpdate(getLayerProps()); recordLayerHistoryBufferUpdate(getLayerProps(), systemTime()); } setFrameTimelineVsyncForBufferTransaction(info, postTime); Loading Loading @@ -3256,7 +3259,7 @@ void Layer::setDesiredPresentTime(nsecs_t desiredPresentTime, bool isAutoTimesta mDrawingState.isAutoTimestamp = isAutoTimestamp; } void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerProps) { void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerProps, nsecs_t now) { ATRACE_CALL(); const nsecs_t presentTime = [&] { if (!mDrawingState.isAutoTimestamp) { Loading Loading @@ -3310,14 +3313,14 @@ void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerPro ATRACE_FORMAT_INSTANT("presentIn %s", to_string(presentIn).c_str()); } mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, now, scheduler::LayerHistory::LayerUpdateType::Buffer); } void Layer::recordLayerHistoryAnimationTx(const scheduler::LayerProps& layerProps) { void Layer::recordLayerHistoryAnimationTx(const scheduler::LayerProps& layerProps, nsecs_t now) { const nsecs_t presentTime = mDrawingState.isAutoTimestamp ? 0 : mDrawingState.desiredPresentTime; mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, now, scheduler::LayerHistory::LayerUpdateType::AnimationTX); } Loading services/surfaceflinger/Layer.h +4 −4 Original line number Diff line number Diff line Loading @@ -908,10 +908,10 @@ public: void callReleaseBufferCallback(const sp<ITransactionCompletedListener>& listener, const sp<GraphicBuffer>& buffer, uint64_t framenumber, const sp<Fence>& releaseFence); bool setFrameRateForLayerTreeLegacy(FrameRate); bool setFrameRateForLayerTree(FrameRate, const scheduler::LayerProps&); void recordLayerHistoryBufferUpdate(const scheduler::LayerProps&); void recordLayerHistoryAnimationTx(const scheduler::LayerProps&); bool setFrameRateForLayerTreeLegacy(FrameRate, nsecs_t now); bool setFrameRateForLayerTree(FrameRate, const scheduler::LayerProps&, nsecs_t now); void recordLayerHistoryBufferUpdate(const scheduler::LayerProps&, nsecs_t now); void recordLayerHistoryAnimationTx(const scheduler::LayerProps&, nsecs_t now); auto getLayerProps() const { return scheduler::LayerProps{ .visible = isVisible(), Loading services/surfaceflinger/Scheduler/LayerHistory.h +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public: private: friend class LayerHistoryTest; friend class LayerHistoryIntegrationTest; friend class TestableScheduler; using LayerPair = std::pair<Layer*, std::unique_ptr<LayerInfo>>; Loading services/surfaceflinger/Scheduler/LayerInfo.h +2 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ class LayerInfo { static constexpr size_t kNumSmallDirtyThreshold = 2; friend class LayerHistoryTest; friend class LayerHistoryIntegrationTest; friend class LayerInfoTest; public: Loading Loading @@ -264,6 +265,7 @@ private: private: friend class LayerHistoryTest; friend class LayerHistoryIntegrationTest; // Holds the refresh rate when it was calculated struct RefreshRateData { Loading services/surfaceflinger/Scheduler/Scheduler.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -625,9 +625,9 @@ void Scheduler::onLayerDestroyed(Layer* layer) { } void Scheduler::recordLayerHistory(int32_t id, const LayerProps& layerProps, nsecs_t presentTime, LayerHistory::LayerUpdateType updateType) { nsecs_t now, LayerHistory::LayerUpdateType updateType) { if (pacesetterSelectorPtr()->canSwitch()) { mLayerHistory.record(id, layerProps, presentTime, systemTime(), updateType); mLayerHistory.record(id, layerProps, presentTime, now, updateType); } } Loading Loading
services/surfaceflinger/Layer.cpp +14 −11 Original line number Diff line number Diff line Loading @@ -1267,7 +1267,8 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool overr return parentFrameRate; }(); *transactionNeeded |= setFrameRateForLayerTreeLegacy(frameRate); auto now = systemTime(); *transactionNeeded |= setFrameRateForLayerTreeLegacy(frameRate, now); // The frame rate is propagated to the children bool childrenHaveFrameRate = false; Loading @@ -1283,7 +1284,8 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool overr // layer as NoVote to allow the children to control the refresh rate if (!frameRate.isValid() && childrenHaveFrameRate) { *transactionNeeded |= setFrameRateForLayerTreeLegacy(FrameRate(Fps(), FrameRateCompatibility::NoVote)); setFrameRateForLayerTreeLegacy(FrameRate(Fps(), FrameRateCompatibility::NoVote), now); } // We return whether this layer or its children has a vote. We ignore ExactOrMultiple votes for Loading Loading @@ -1492,7 +1494,7 @@ void Layer::setFrameTimelineVsyncForSkippedFrames(const FrameTimelineInfo& info, addSurfaceFrameDroppedForBuffer(surfaceFrame, postTime); } bool Layer::setFrameRateForLayerTreeLegacy(FrameRate frameRate) { bool Layer::setFrameRateForLayerTreeLegacy(FrameRate frameRate, nsecs_t now) { if (mDrawingState.frameRateForLayerTree == frameRate) { return false; } Loading @@ -1506,19 +1508,20 @@ bool Layer::setFrameRateForLayerTreeLegacy(FrameRate frameRate) { setTransactionFlags(eTransactionNeeded); mFlinger->mScheduler ->recordLayerHistory(sequence, getLayerProps(), systemTime(), ->recordLayerHistory(sequence, getLayerProps(), now, now, scheduler::LayerHistory::LayerUpdateType::SetFrameRate); return true; } bool Layer::setFrameRateForLayerTree(FrameRate frameRate, const scheduler::LayerProps& layerProps) { bool Layer::setFrameRateForLayerTree(FrameRate frameRate, const scheduler::LayerProps& layerProps, nsecs_t now) { if (mDrawingState.frameRateForLayerTree == frameRate) { return false; } mDrawingState.frameRateForLayerTree = frameRate; mFlinger->mScheduler ->recordLayerHistory(sequence, layerProps, systemTime(), ->recordLayerHistory(sequence, layerProps, now, now, scheduler::LayerHistory::LayerUpdateType::SetFrameRate); return true; } Loading Loading @@ -3225,7 +3228,7 @@ bool Layer::setBuffer(std::shared_ptr<renderengine::ExternalTexture>& buffer, mOwnerUid, postTime, getGameMode()); if (mFlinger->mLegacyFrontEndEnabled) { recordLayerHistoryBufferUpdate(getLayerProps()); recordLayerHistoryBufferUpdate(getLayerProps(), systemTime()); } setFrameTimelineVsyncForBufferTransaction(info, postTime); Loading Loading @@ -3256,7 +3259,7 @@ void Layer::setDesiredPresentTime(nsecs_t desiredPresentTime, bool isAutoTimesta mDrawingState.isAutoTimestamp = isAutoTimestamp; } void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerProps) { void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerProps, nsecs_t now) { ATRACE_CALL(); const nsecs_t presentTime = [&] { if (!mDrawingState.isAutoTimestamp) { Loading Loading @@ -3310,14 +3313,14 @@ void Layer::recordLayerHistoryBufferUpdate(const scheduler::LayerProps& layerPro ATRACE_FORMAT_INSTANT("presentIn %s", to_string(presentIn).c_str()); } mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, now, scheduler::LayerHistory::LayerUpdateType::Buffer); } void Layer::recordLayerHistoryAnimationTx(const scheduler::LayerProps& layerProps) { void Layer::recordLayerHistoryAnimationTx(const scheduler::LayerProps& layerProps, nsecs_t now) { const nsecs_t presentTime = mDrawingState.isAutoTimestamp ? 0 : mDrawingState.desiredPresentTime; mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, mFlinger->mScheduler->recordLayerHistory(sequence, layerProps, presentTime, now, scheduler::LayerHistory::LayerUpdateType::AnimationTX); } Loading
services/surfaceflinger/Layer.h +4 −4 Original line number Diff line number Diff line Loading @@ -908,10 +908,10 @@ public: void callReleaseBufferCallback(const sp<ITransactionCompletedListener>& listener, const sp<GraphicBuffer>& buffer, uint64_t framenumber, const sp<Fence>& releaseFence); bool setFrameRateForLayerTreeLegacy(FrameRate); bool setFrameRateForLayerTree(FrameRate, const scheduler::LayerProps&); void recordLayerHistoryBufferUpdate(const scheduler::LayerProps&); void recordLayerHistoryAnimationTx(const scheduler::LayerProps&); bool setFrameRateForLayerTreeLegacy(FrameRate, nsecs_t now); bool setFrameRateForLayerTree(FrameRate, const scheduler::LayerProps&, nsecs_t now); void recordLayerHistoryBufferUpdate(const scheduler::LayerProps&, nsecs_t now); void recordLayerHistoryAnimationTx(const scheduler::LayerProps&, nsecs_t now); auto getLayerProps() const { return scheduler::LayerProps{ .visible = isVisible(), Loading
services/surfaceflinger/Scheduler/LayerHistory.h +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public: private: friend class LayerHistoryTest; friend class LayerHistoryIntegrationTest; friend class TestableScheduler; using LayerPair = std::pair<Layer*, std::unique_ptr<LayerInfo>>; Loading
services/surfaceflinger/Scheduler/LayerInfo.h +2 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ class LayerInfo { static constexpr size_t kNumSmallDirtyThreshold = 2; friend class LayerHistoryTest; friend class LayerHistoryIntegrationTest; friend class LayerInfoTest; public: Loading Loading @@ -264,6 +265,7 @@ private: private: friend class LayerHistoryTest; friend class LayerHistoryIntegrationTest; // Holds the refresh rate when it was calculated struct RefreshRateData { Loading
services/surfaceflinger/Scheduler/Scheduler.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -625,9 +625,9 @@ void Scheduler::onLayerDestroyed(Layer* layer) { } void Scheduler::recordLayerHistory(int32_t id, const LayerProps& layerProps, nsecs_t presentTime, LayerHistory::LayerUpdateType updateType) { nsecs_t now, LayerHistory::LayerUpdateType updateType) { if (pacesetterSelectorPtr()->canSwitch()) { mLayerHistory.record(id, layerProps, presentTime, systemTime(), updateType); mLayerHistory.record(id, layerProps, presentTime, now, updateType); } } Loading