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

Commit 71b856ba authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

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

Merge "SurfaceFlinger: use queueTime as well when calculating refresh rate" into rvc-dev am: 16596ab1 am: 86ef06b9

Change-Id: Iec7c196be2dd61149b3e693469b35596e186a994
parents b6298a5e 86ef06b9
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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
    // 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) {
            continue;
                delta = (it + 1)->queueTime - it->queueTime;
            } else {
                delta = (it + 1)->presetTime - it->presetTime;
            }
        const nsecs_t presentTimeDeltas =
                std::max(((it + 1)->presetTime - it->presetTime), mHighRefreshRatePeriod);
        if (std::abs(presentTimeDeltas - averageFrameTime) > 2 * averageFrameTime) {
            return std::max(delta, mHighRefreshRatePeriod);
        }();
        if (std::abs(frameTimeDeltas - averageFrameTime) > 2 * averageFrameTime) {
            return std::nullopt;
        }
    }