Loading services/surfaceflinger/CompositionEngine/include/compositionengine/CompositionRefreshArgs.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,9 @@ struct CompositionRefreshArgs { // If set, causes the dirty regions to flash with the delay // If set, causes the dirty regions to flash with the delay std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay; 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 } // namespace android::compositionengine services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputCompositionState.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -115,6 +115,9 @@ struct OutputCompositionState { // Current target dataspace // Current target dataspace ui::Dataspace targetDataspace{ui::Dataspace::UNKNOWN}; 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 // Debugging void dump(std::string& result) const; void dump(std::string& result) const; }; }; Loading services/surfaceflinger/CompositionEngine/src/Display.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -367,6 +367,11 @@ compositionengine::Output::FrameFences Display::presentAndGetFrameFences() { return fences; return fences; } } { ATRACE_NAME("wait for earliest present time"); std::this_thread::sleep_until(getState().earliestPresentTime); } auto& hwc = getCompositionEngine().getHwComposer(); auto& hwc = getCompositionEngine().getHwComposer(); hwc.presentAndGetReleaseFences(*halDisplayIdOpt); hwc.presentAndGetReleaseFences(*halDisplayIdOpt); Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -711,6 +711,8 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr return; return; } } editState().earliestPresentTime = refreshArgs.earliestPresentTime; sp<GraphicBuffer> previousOverride = nullptr; sp<GraphicBuffer> previousOverride = nullptr; for (auto* layer : getOutputLayersOrderedByZ()) { for (auto* layer : getOutputLayersOrderedByZ()) { bool skipLayer = false; bool skipLayer = false; Loading services/surfaceflinger/Scheduler/Scheduler.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -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 } // namespace android Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/CompositionRefreshArgs.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,9 @@ struct CompositionRefreshArgs { // If set, causes the dirty regions to flash with the delay // If set, causes the dirty regions to flash with the delay std::optional<std::chrono::microseconds> devOptFlashDirtyRegionsDelay; 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 } // namespace android::compositionengine
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputCompositionState.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -115,6 +115,9 @@ struct OutputCompositionState { // Current target dataspace // Current target dataspace ui::Dataspace targetDataspace{ui::Dataspace::UNKNOWN}; 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 // Debugging void dump(std::string& result) const; void dump(std::string& result) const; }; }; Loading
services/surfaceflinger/CompositionEngine/src/Display.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -367,6 +367,11 @@ compositionengine::Output::FrameFences Display::presentAndGetFrameFences() { return fences; return fences; } } { ATRACE_NAME("wait for earliest present time"); std::this_thread::sleep_until(getState().earliestPresentTime); } auto& hwc = getCompositionEngine().getHwComposer(); auto& hwc = getCompositionEngine().getHwComposer(); hwc.presentAndGetReleaseFences(*halDisplayIdOpt); hwc.presentAndGetReleaseFences(*halDisplayIdOpt); Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -711,6 +711,8 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr return; return; } } editState().earliestPresentTime = refreshArgs.earliestPresentTime; sp<GraphicBuffer> previousOverride = nullptr; sp<GraphicBuffer> previousOverride = nullptr; for (auto* layer : getOutputLayersOrderedByZ()) { for (auto* layer : getOutputLayersOrderedByZ()) { bool skipLayer = false; bool skipLayer = false; Loading
services/surfaceflinger/Scheduler/Scheduler.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -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 } // namespace android