Loading services/surfaceflinger/Scheduler/LayerInfoV2.cpp +10 −6 Original line number Original line Diff line number Diff line Loading @@ -130,12 +130,16 @@ std::optional<float> LayerInfoV2::calculateRefreshRateIfPossible() { // Now once we calculated the refresh rate we need to make sure that all the frames we captured // Now once we calculated the refresh rate we need to make sure that all the frames we captured // are evenly distributed and we don't calculate the average across some burst of frames. // are evenly distributed and we don't calculate the average across some burst of frames. for (auto it = mFrameTimes.begin(); it != mFrameTimes.end() - 1; ++it) { for (auto it = mFrameTimes.begin(); it != mFrameTimes.end() - 1; ++it) { const nsecs_t frameTimeDeltas = [&] { nsecs_t delta; if (it->presetTime == 0 || (it + 1)->presetTime == 0) { if (it->presetTime == 0 || (it + 1)->presetTime == 0) { continue; delta = (it + 1)->queueTime - it->queueTime; } else { delta = (it + 1)->presetTime - it->presetTime; } } const nsecs_t presentTimeDeltas = return std::max(delta, mHighRefreshRatePeriod); std::max(((it + 1)->presetTime - it->presetTime), mHighRefreshRatePeriod); }(); if (std::abs(presentTimeDeltas - averageFrameTime) > 2 * averageFrameTime) { if (std::abs(frameTimeDeltas - averageFrameTime) > 2 * averageFrameTime) { return std::nullopt; return std::nullopt; } } } } Loading Loading
services/surfaceflinger/Scheduler/LayerInfoV2.cpp +10 −6 Original line number Original line Diff line number Diff line Loading @@ -130,12 +130,16 @@ std::optional<float> LayerInfoV2::calculateRefreshRateIfPossible() { // Now once we calculated the refresh rate we need to make sure that all the frames we captured // Now once we calculated the refresh rate we need to make sure that all the frames we captured // are evenly distributed and we don't calculate the average across some burst of frames. // are evenly distributed and we don't calculate the average across some burst of frames. for (auto it = mFrameTimes.begin(); it != mFrameTimes.end() - 1; ++it) { for (auto it = mFrameTimes.begin(); it != mFrameTimes.end() - 1; ++it) { const nsecs_t frameTimeDeltas = [&] { nsecs_t delta; if (it->presetTime == 0 || (it + 1)->presetTime == 0) { if (it->presetTime == 0 || (it + 1)->presetTime == 0) { continue; delta = (it + 1)->queueTime - it->queueTime; } else { delta = (it + 1)->presetTime - it->presetTime; } } const nsecs_t presentTimeDeltas = return std::max(delta, mHighRefreshRatePeriod); std::max(((it + 1)->presetTime - it->presetTime), mHighRefreshRatePeriod); }(); if (std::abs(presentTimeDeltas - averageFrameTime) > 2 * averageFrameTime) { if (std::abs(frameTimeDeltas - averageFrameTime) > 2 * averageFrameTime) { return std::nullopt; return std::nullopt; } } } } Loading