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

Commit 07c01735 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "SF: wait instead of presenting early" into sc-dev am: 344d6a62

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14258408

Change-Id: I45f7ae42d70a66ff3e9dc29e4048eedcd5268a85
parents 6beabd37 344d6a62
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ struct CompositionRefreshArgs {

    // If set, causes the dirty regions to flash with the delay
    std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay;

    // The earliest time to send the present command to the HAL
    std::chrono::steady_clock::time_point earliestPresentTime;
};

} // namespace android::compositionengine
+3 −0
Original line number Diff line number Diff line
@@ -115,6 +115,9 @@ struct OutputCompositionState {
    // Current target dataspace
    ui::Dataspace targetDataspace{ui::Dataspace::UNKNOWN};

    // The earliest time to send the present command to the HAL
    std::chrono::steady_clock::time_point earliestPresentTime;

    // Debugging
    void dump(std::string& result) const;
};
+5 −0
Original line number Diff line number Diff line
@@ -367,6 +367,11 @@ compositionengine::Output::FrameFences Display::presentAndGetFrameFences() {
        return fences;
    }

    {
        ATRACE_NAME("wait for earliest present time");
        std::this_thread::sleep_until(getState().earliestPresentTime);
    }

    auto& hwc = getCompositionEngine().getHwComposer();
    hwc.presentAndGetReleaseFences(*halDisplayIdOpt);

+2 −0
Original line number Diff line number Diff line
@@ -711,6 +711,8 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr
        return;
    }

    editState().earliestPresentTime = refreshArgs.earliestPresentTime;

    sp<GraphicBuffer> previousOverride = nullptr;
    for (auto* layer : getOutputLayersOrderedByZ()) {
        bool skipLayer = false;
+7 −0
Original line number Diff line number Diff line
@@ -927,4 +927,11 @@ void Scheduler::setPreferredRefreshRateForUid(FrameRateOverride frameRateOverrid
    }
}

std::chrono::steady_clock::time_point Scheduler::getPreviousVsyncFrom(
        nsecs_t expectedPresentTime) const {
    const auto presentTime = std::chrono::nanoseconds(expectedPresentTime);
    const auto vsyncPeriod = std::chrono::nanoseconds(mVsyncSchedule.tracker->currentPeriod());
    return std::chrono::steady_clock::time_point(presentTime - vsyncPeriod);
}

} // namespace android
Loading