Loading services/surfaceflinger/SurfaceFlinger.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -2094,6 +2094,8 @@ void SurfaceFlinger::handleMessageRefresh() { postFrame(); postComposition(); const bool prevFrameHadDeviceComposition = mHadDeviceComposition; mHadClientComposition = std::any_of(mDisplays.cbegin(), mDisplays.cend(), [](const auto& tokenDisplayPair) { auto& displayDevice = tokenDisplayPair.second; Loading @@ -2111,6 +2113,11 @@ void SurfaceFlinger::handleMessageRefresh() { return displayDevice->getCompositionDisplay()->getState().reusedClientComposition; }); // Only report a strategy change if we move in and out of composition with hw overlays if (prevFrameHadDeviceComposition != mHadDeviceComposition) { mTimeStats->incrementCompositionStrategyChanges(); } mVSyncModulator->onRefreshed(mHadClientComposition); mLayersWithQueuedFrames.clear(); Loading services/surfaceflinger/TimeStats/TimeStats.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,15 @@ void TimeStats::incrementRefreshRateSwitches() { mTimeStats.refreshRateSwitches++; } void TimeStats::incrementCompositionStrategyChanges() { if (!mEnabled.load()) return; ATRACE_CALL(); std::lock_guard<std::mutex> lock(mMutex); mTimeStats.compositionStrategyChanges++; } void TimeStats::recordDisplayEventConnectionCount(int32_t count) { if (!mEnabled.load()) return; Loading Loading @@ -844,6 +853,7 @@ void TimeStats::clearGlobalLocked() { mTimeStats.clientCompositionFrames = 0; mTimeStats.clientCompositionReusedFrames = 0; mTimeStats.refreshRateSwitches = 0; mTimeStats.compositionStrategyChanges = 0; mTimeStats.displayEventConnectionsCount = 0; mTimeStats.displayOnTime = 0; mTimeStats.presentToPresent.hist.clear(); Loading services/surfaceflinger/TimeStats/TimeStats.h +5 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ public: virtual void incrementClientCompositionReusedFrames() = 0; // Increments the number of times the display refresh rate changed. virtual void incrementRefreshRateSwitches() = 0; // Increments the number of changes in composition strategy // The intention is to reflect the number of changes between hwc and gpu // composition, where "gpu composition" may also include mixed composition. virtual void incrementCompositionStrategyChanges() = 0; // Records the most up-to-date count of display event connections. // The stored count will be the maximum ever recoded. virtual void recordDisplayEventConnectionCount(int32_t count) = 0; Loading Loading @@ -218,6 +222,7 @@ public: void incrementClientCompositionFrames() override; void incrementClientCompositionReusedFrames() override; void incrementRefreshRateSwitches() override; void incrementCompositionStrategyChanges() override; void recordDisplayEventConnectionCount(int32_t count) override; void recordFrameDuration(nsecs_t startTime, nsecs_t endTime) override; Loading services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ std::string TimeStatsHelper::TimeStatsGlobal::toString(std::optional<uint32_t> m StringAppendF(&result, "clientCompositionFrames = %d\n", clientCompositionFrames); StringAppendF(&result, "clientCompositionReusedFrames = %d\n", clientCompositionReusedFrames); StringAppendF(&result, "refreshRateSwitches = %d\n", refreshRateSwitches); StringAppendF(&result, "compositionStrategyChanges = %d\n", compositionStrategyChanges); StringAppendF(&result, "displayOnTime = %" PRId64 " ms\n", displayOnTime); StringAppendF(&result, "displayConfigStats is as below:\n"); for (const auto& [fps, duration] : refreshRateStats) { Loading services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ public: int32_t clientCompositionFrames = 0; int32_t clientCompositionReusedFrames = 0; int32_t refreshRateSwitches = 0; int32_t compositionStrategyChanges = 0; int32_t displayEventConnectionsCount = 0; int64_t displayOnTime = 0; Histogram presentToPresent; Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -2094,6 +2094,8 @@ void SurfaceFlinger::handleMessageRefresh() { postFrame(); postComposition(); const bool prevFrameHadDeviceComposition = mHadDeviceComposition; mHadClientComposition = std::any_of(mDisplays.cbegin(), mDisplays.cend(), [](const auto& tokenDisplayPair) { auto& displayDevice = tokenDisplayPair.second; Loading @@ -2111,6 +2113,11 @@ void SurfaceFlinger::handleMessageRefresh() { return displayDevice->getCompositionDisplay()->getState().reusedClientComposition; }); // Only report a strategy change if we move in and out of composition with hw overlays if (prevFrameHadDeviceComposition != mHadDeviceComposition) { mTimeStats->incrementCompositionStrategyChanges(); } mVSyncModulator->onRefreshed(mHadClientComposition); mLayersWithQueuedFrames.clear(); Loading
services/surfaceflinger/TimeStats/TimeStats.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,15 @@ void TimeStats::incrementRefreshRateSwitches() { mTimeStats.refreshRateSwitches++; } void TimeStats::incrementCompositionStrategyChanges() { if (!mEnabled.load()) return; ATRACE_CALL(); std::lock_guard<std::mutex> lock(mMutex); mTimeStats.compositionStrategyChanges++; } void TimeStats::recordDisplayEventConnectionCount(int32_t count) { if (!mEnabled.load()) return; Loading Loading @@ -844,6 +853,7 @@ void TimeStats::clearGlobalLocked() { mTimeStats.clientCompositionFrames = 0; mTimeStats.clientCompositionReusedFrames = 0; mTimeStats.refreshRateSwitches = 0; mTimeStats.compositionStrategyChanges = 0; mTimeStats.displayEventConnectionsCount = 0; mTimeStats.displayOnTime = 0; mTimeStats.presentToPresent.hist.clear(); Loading
services/surfaceflinger/TimeStats/TimeStats.h +5 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ public: virtual void incrementClientCompositionReusedFrames() = 0; // Increments the number of times the display refresh rate changed. virtual void incrementRefreshRateSwitches() = 0; // Increments the number of changes in composition strategy // The intention is to reflect the number of changes between hwc and gpu // composition, where "gpu composition" may also include mixed composition. virtual void incrementCompositionStrategyChanges() = 0; // Records the most up-to-date count of display event connections. // The stored count will be the maximum ever recoded. virtual void recordDisplayEventConnectionCount(int32_t count) = 0; Loading Loading @@ -218,6 +222,7 @@ public: void incrementClientCompositionFrames() override; void incrementClientCompositionReusedFrames() override; void incrementRefreshRateSwitches() override; void incrementCompositionStrategyChanges() override; void recordDisplayEventConnectionCount(int32_t count) override; void recordFrameDuration(nsecs_t startTime, nsecs_t endTime) override; Loading
services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,7 @@ std::string TimeStatsHelper::TimeStatsGlobal::toString(std::optional<uint32_t> m StringAppendF(&result, "clientCompositionFrames = %d\n", clientCompositionFrames); StringAppendF(&result, "clientCompositionReusedFrames = %d\n", clientCompositionReusedFrames); StringAppendF(&result, "refreshRateSwitches = %d\n", refreshRateSwitches); StringAppendF(&result, "compositionStrategyChanges = %d\n", compositionStrategyChanges); StringAppendF(&result, "displayOnTime = %" PRId64 " ms\n", displayOnTime); StringAppendF(&result, "displayConfigStats is as below:\n"); for (const auto& [fps, duration] : refreshRateStats) { Loading
services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ public: int32_t clientCompositionFrames = 0; int32_t clientCompositionReusedFrames = 0; int32_t refreshRateSwitches = 0; int32_t compositionStrategyChanges = 0; int32_t displayEventConnectionsCount = 0; int64_t displayOnTime = 0; Histogram presentToPresent; Loading