Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7d408ee authored by Ady Abraham's avatar Ady Abraham Committed by Automerger Merge Worker
Browse files

Revert "SurfaceFlinger: use queueTime as well when calculating refresh rate"...

Revert "SurfaceFlinger: use queueTime as well when calculating refresh rate" am: 5f489bd9 am: 9c689b33

Change-Id: Idb1273e9996447c5c02f68efe6589f2943485711
parents 8d44c463 9c689b33
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -130,16 +130,12 @@ std::optional<float> LayerInfoV2::calculateRefreshRateIfPossible() {
    // 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.
    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) {
                delta = (it + 1)->queueTime - it->queueTime;
            } else {
                delta = (it + 1)->presetTime - it->presetTime;
            continue;
        }
            return std::max(delta, mHighRefreshRatePeriod);
        }();
        if (std::abs(frameTimeDeltas - averageFrameTime) > 2 * averageFrameTime) {
        const nsecs_t presentTimeDeltas =
                std::max(((it + 1)->presetTime - it->presetTime), mHighRefreshRatePeriod);
        if (std::abs(presentTimeDeltas - averageFrameTime) > 2 * averageFrameTime) {
            return std::nullopt;
        }
    }