diff options
4 files changed, 13 insertions, 1 deletions
diff --git a/services/surfaceflinger/Scheduler/LayerHistory.cpp b/services/surfaceflinger/Scheduler/LayerHistory.cpp index 7c9cedfab8..55fa402fa6 100644 --- a/services/surfaceflinger/Scheduler/LayerHistory.cpp +++ b/services/surfaceflinger/Scheduler/LayerHistory.cpp @@ -22,9 +22,9 @@ #include <android-base/stringprintf.h> #include <cutils/properties.h> +#include <gui/TraceUtils.h> #include <utils/Log.h> #include <utils/Timers.h> -#include <utils/Trace.h> #include <algorithm> #include <cmath> @@ -165,6 +165,7 @@ void LayerHistory::setDefaultFrameRateCompatibility(Layer* layer, bool contentDe } auto LayerHistory::summarize(const RefreshRateSelector& selector, nsecs_t now) -> Summary { + ATRACE_CALL(); Summary summary; std::lock_guard lock(mLock); @@ -178,6 +179,7 @@ auto LayerHistory::summarize(const RefreshRateSelector& selector, nsecs_t now) - ALOGV("%s has priority: %d %s focused", info->getName().c_str(), frameRateSelectionPriority, layerFocused ? "" : "not"); + ATRACE_FORMAT("%s", info->getName().c_str()); const auto vote = info->getRefreshRateVote(selector, now); // Skip NoVote layer as those don't have any requirements if (vote.type == LayerVoteType::NoVote) { @@ -192,6 +194,8 @@ auto LayerHistory::summarize(const RefreshRateSelector& selector, nsecs_t now) - const float layerArea = transformed.getWidth() * transformed.getHeight(); float weight = mDisplayArea ? layerArea / mDisplayArea : 0.0f; + ATRACE_FORMAT_INSTANT("%s %s (%d%)", ftl::enum_string(vote.type).c_str(), + to_string(vote.fps).c_str(), weight * 100); summary.push_back({info->getName(), info->getOwnerUid(), vote.type, vote.fps, vote.seamlessness, weight, layerFocused}); @@ -204,6 +208,7 @@ auto LayerHistory::summarize(const RefreshRateSelector& selector, nsecs_t now) - } void LayerHistory::partitionLayers(nsecs_t now) { + ATRACE_CALL(); const nsecs_t threshold = getActiveLayerThreshold(now); // iterate over inactive map diff --git a/services/surfaceflinger/Scheduler/LayerInfo.cpp b/services/surfaceflinger/Scheduler/LayerInfo.cpp index 7247e4b260..f9c9023bd9 100644 --- a/services/surfaceflinger/Scheduler/LayerInfo.cpp +++ b/services/surfaceflinger/Scheduler/LayerInfo.cpp @@ -29,6 +29,7 @@ #include <cutils/compiler.h> #include <cutils/trace.h> #include <ftl/enum.h> +#include <gui/TraceUtils.h> #undef LOG_TAG #define LOG_TAG "LayerInfo" @@ -189,6 +190,7 @@ std::optional<nsecs_t> LayerInfo::calculateAverageFrameTime() const { std::optional<Fps> LayerInfo::calculateRefreshRateIfPossible(const RefreshRateSelector& selector, nsecs_t now) { + ATRACE_CALL(); static constexpr float MARGIN = 1.0f; // 1Hz if (!hasEnoughDataForHeuristic()) { ALOGV("Not enough data"); @@ -224,18 +226,21 @@ std::optional<Fps> LayerInfo::calculateRefreshRateIfPossible(const RefreshRateSe LayerInfo::LayerVote LayerInfo::getRefreshRateVote(const RefreshRateSelector& selector, nsecs_t now) { + ATRACE_CALL(); if (mLayerVote.type != LayerHistory::LayerVoteType::Heuristic) { ALOGV("%s voted %d ", mName.c_str(), static_cast<int>(mLayerVote.type)); return mLayerVote; } if (isAnimating(now)) { + ATRACE_FORMAT_INSTANT("animating"); ALOGV("%s is animating", mName.c_str()); mLastRefreshRate.animatingOrInfrequent = true; return {LayerHistory::LayerVoteType::Max, Fps()}; } if (!isFrequent(now)) { + ATRACE_FORMAT_INSTANT("infrequent"); ALOGV("%s is infrequent", mName.c_str()); mLastRefreshRate.animatingOrInfrequent = true; // Infrequent layers vote for mininal refresh rate for diff --git a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp index 21f5c6848f..04c2d4177f 100644 --- a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp +++ b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp @@ -354,6 +354,7 @@ float RefreshRateSelector::calculateDistanceScoreFromMax(Fps refreshRate) const float RefreshRateSelector::calculateLayerScoreLocked(const LayerRequirement& layer, Fps refreshRate, bool isSeamlessSwitch) const { + ATRACE_CALL(); // Slightly prefer seamless switches. constexpr float kSeamedSwitchPenalty = 0.95f; const float seamlessness = isSeamlessSwitch ? 1.0f : kSeamedSwitchPenalty; diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index 856fda0f6c..74a81b7258 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -661,6 +661,7 @@ void Scheduler::demoteLeaderDisplay() { template <typename S, typename T> auto Scheduler::applyPolicy(S Policy::*statePtr, T&& newState) -> GlobalSignals { + ATRACE_CALL(); std::vector<display::DisplayModeRequest> modeRequests; GlobalSignals consideredSignals; |