[fuchsia] add robust scheduling for flutter_runner (flutter/engine#18233)

This commit is contained in:
Felipe Archondo
2020-06-09 16:50:51 -04:00
committed by GitHub
parent 2800316cf1
commit b603748c2a
4 changed files with 462 additions and 9 deletions

View File

@@ -99,6 +99,8 @@ void SessionConnection::Present(
next_present_session_trace_id_);
next_present_session_trace_id_++;
present_requested_time_ = fml::TimePoint::Now();
// Throttle frame submission to Scenic if we already have the maximum amount
// of frames in flight. This allows the paint tasks for this frame to execute
// in parallel with the presentation of previous frame but still provides
@@ -129,6 +131,35 @@ void SessionConnection::OnSessionSizeChangeHint(float width_change_factor,
height_change_factor);
}
fml::TimePoint SessionConnection::CalculateNextLatchPoint(
fml::TimePoint present_requested_time,
fml::TimePoint now,
fml::TimePoint last_latch_point_targeted,
fml::TimeDelta flutter_frame_build_time,
fml::TimeDelta vsync_interval,
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>&
future_presentation_infos) {
// The minimum latch point is the largest of:
// Now
// When we expect the Flutter work for the frame to be completed
// The last latch point targeted
fml::TimePoint minimum_latch_point_to_target =
std::max(std::max(now, present_requested_time + flutter_frame_build_time),
last_latch_point_targeted);
for (auto& info : future_presentation_infos) {
fml::TimePoint latch_point = info.first;
if (latch_point >= minimum_latch_point_to_target) {
return latch_point;
}
}
// We could not find a suitable latch point in the list given to us from
// Scenic, so aim for the smallest safe value.
return minimum_latch_point_to_target;
}
void SessionConnection::set_enable_wireframe(bool enable) {
session_wrapper_.Enqueue(
scenic::NewSetEnableDebugViewBoundsCmd(root_view_.id(), enable));
@@ -166,10 +197,37 @@ void SessionConnection::PresentSession() {
// Flush all session ops. Paint tasks may not yet have executed but those are
// fenced. The compositor can start processing ops while we finalize paint
// tasks.
fml::TimeDelta presentation_interval =
VsyncRecorder::GetInstance().GetCurrentVsyncInfo().presentation_interval;
fml::TimePoint next_latch_point = CalculateNextLatchPoint(
fml::TimePoint::Now(), present_requested_time_,
last_latch_point_targeted_,
fml::TimeDelta::FromMicroseconds(0), // flutter_frame_build_time
presentation_interval, future_presentation_infos_);
last_latch_point_targeted_ = next_latch_point;
session_wrapper_.Present2(
/*requested_presentation_time=*/0,
/*requested_prediction_span=*/0,
/*requested_presentation_time=*/next_latch_point.ToEpochDelta()
.ToNanoseconds(),
/*requested_prediction_span=*/presentation_interval.ToNanoseconds() * 10,
[this](fuchsia::scenic::scheduling::FuturePresentationTimes info) {
// Clear |future_presentation_infos_| and replace it with the updated
// information.
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>().swap(
future_presentation_infos_);
for (fuchsia::scenic::scheduling::PresentationInfo& presentation_info :
info.future_presentations) {
future_presentation_infos_.push_back(
{fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromNanoseconds(
presentation_info.latch_point())),
fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromNanoseconds(
presentation_info.presentation_time()))});
}
frames_in_flight_allowed_ = info.remaining_presents_in_flight_allowed;
VsyncRecorder::GetInstance().UpdateNextPresentationInfo(
std::move(info));

View File

@@ -72,6 +72,15 @@ class SessionConnection final {
return surface_producer_.get();
}
static fml::TimePoint CalculateNextLatchPoint(
fml::TimePoint present_requested_time,
fml::TimePoint now,
fml::TimePoint last_latch_point_targeted,
fml::TimeDelta flutter_frame_build_time,
fml::TimeDelta vsync_interval,
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>&
future_presentation_infos);
private:
const std::string debug_label_;
scenic::Session session_wrapper_;
@@ -85,6 +94,14 @@ class SessionConnection final {
zx_handle_t vsync_event_handle_;
fml::TimePoint last_latch_point_targeted_ =
fml::TimePoint::FromEpochDelta(fml::TimeDelta::Zero());
fml::TimePoint present_requested_time_ =
fml::TimePoint::FromEpochDelta(fml::TimeDelta::Zero());
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos_ = {};
bool initialized_ = false;
// A flow event trace id for following |Session::Present| calls into

View File

@@ -69,8 +69,8 @@ TEST_F(SessionConnectionTest, SimplePresentTest) {
on_frame_presented_callback, vsync_event_.get());
for (int i = 0; i < 200; ++i) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
session_connection.Present(nullptr);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
EXPECT_GT(num_presents_handled, 0u);
@@ -92,13 +92,380 @@ TEST_F(SessionConnectionTest, BatchedPresentTest) {
on_frame_presented_callback, vsync_event_.get());
for (int i = 0; i < 200; ++i) {
if (i % 10 == 0) {
session_connection.Present(nullptr);
if (i % 10 == 9) {
std::this_thread::sleep_for(std::chrono::milliseconds(20));
}
session_connection.Present(nullptr);
}
EXPECT_GT(num_presents_handled, 0u);
}
static fml::TimePoint TimePointFromInt(int i) {
return fml::TimePoint::FromEpochDelta(fml::TimeDelta::FromNanoseconds(i));
}
static fml::TimeDelta TimeDeltaFromInt(int i) {
return fml::TimeDelta::FromNanoseconds(i);
}
static int TimePointToInt(fml::TimePoint time) {
return time.ToEpochDelta().ToNanoseconds();
}
// The first set of tests has an empty |future_presentation_infos| passed in.
// Therefore these tests are to ensure that on startup and after not presenting
// for some time that we have correct, reasonable behavior.
TEST(CalculateNextLatchPointTest, PresentAsSoonAsPossible) {
fml::TimePoint present_requested_time = TimePointFromInt(0);
fml::TimePoint now = TimePointFromInt(0);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(0);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(0);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point), TimePointToInt(now));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, LongFrameBuildTime) {
fml::TimePoint present_requested_time = TimePointFromInt(500);
fml::TimePoint now = TimePointFromInt(600);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(0);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(2500);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
EXPECT_GT(flutter_frame_build_time, vsync_interval);
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 3)));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, DelayedPresentRequestWithLongFrameBuildTime) {
fml::TimePoint present_requested_time = TimePointFromInt(0);
fml::TimePoint now = TimePointFromInt(1500);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(0);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(2000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
EXPECT_GT(flutter_frame_build_time, vsync_interval);
EXPECT_GT(now, present_requested_time + vsync_interval);
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point), TimePointToInt(now));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, LastLastPointTargetedLate) {
fml::TimePoint present_requested_time = TimePointFromInt(2000);
fml::TimePoint now = TimePointFromInt(2000);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(2600);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(1000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
EXPECT_GT(last_latch_point_targeted, present_requested_time);
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
// This set of tests provides (latch_point, vsync_time) pairs in
// |future_presentation_infos|. This tests steady state behavior where we're
// presenting frames virtually every vsync interval.
TEST(CalculateNextLatchPointTest, SteadyState_OnTimeFrames) {
fml::TimePoint present_requested_time = TimePointFromInt(5000);
fml::TimePoint now = TimePointFromInt(5000);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(4500);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(1000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {
{TimePointFromInt(3500), TimePointFromInt(4000)},
{TimePointFromInt(4500), TimePointFromInt(5000)},
{TimePointFromInt(5500), TimePointFromInt(6000)},
{TimePointFromInt(6500), TimePointFromInt(7000)},
{TimePointFromInt(7500), TimePointFromInt(8000)},
};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_EQ(TimePointToInt(calculated_latch_point), 6500);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, SteadyState_LongFrameBuildTimes) {
fml::TimePoint present_requested_time = TimePointFromInt(5000);
fml::TimePoint now = TimePointFromInt(5000);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(4500);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(2000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {
{TimePointFromInt(3500), TimePointFromInt(4000)},
{TimePointFromInt(4500), TimePointFromInt(5000)},
{TimePointFromInt(5500), TimePointFromInt(6000)},
{TimePointFromInt(6500), TimePointFromInt(7000)},
{TimePointFromInt(7500), TimePointFromInt(8000)},
};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
EXPECT_GT(flutter_frame_build_time, vsync_interval);
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 3)));
EXPECT_EQ(TimePointToInt(calculated_latch_point), 7500);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, SteadyState_LateLastLatchPointTargeted) {
fml::TimePoint present_requested_time = TimePointFromInt(5000);
fml::TimePoint now = TimePointFromInt(5000);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(6500);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(1000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {
{TimePointFromInt(4500), TimePointFromInt(5000)},
{TimePointFromInt(5500), TimePointFromInt(6000)},
{TimePointFromInt(6500), TimePointFromInt(7000)},
{TimePointFromInt(7500), TimePointFromInt(8000)},
{TimePointFromInt(8500), TimePointFromInt(9000)},
};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
EXPECT_GT(last_latch_point_targeted, now + vsync_interval);
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_EQ(TimePointToInt(calculated_latch_point), 6500);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest,
SteadyState_DelayedPresentRequestWithLongFrameBuildTime) {
fml::TimePoint present_requested_time = TimePointFromInt(4000);
fml::TimePoint now = TimePointFromInt(5500);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(3500);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(2000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {
{TimePointFromInt(4500), TimePointFromInt(5000)},
{TimePointFromInt(5500), TimePointFromInt(6000)},
{TimePointFromInt(6500), TimePointFromInt(7000)},
};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
EXPECT_GT(flutter_frame_build_time, vsync_interval);
EXPECT_GT(now, present_requested_time + vsync_interval);
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_EQ(TimePointToInt(calculated_latch_point), 6500);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, SteadyState_FuzzyLatchPointsBeforeTarget) {
fml::TimePoint present_requested_time = TimePointFromInt(4000);
fml::TimePoint now = TimePointFromInt(4000);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(5490);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(1000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {
{TimePointFromInt(4510), TimePointFromInt(5000)},
{TimePointFromInt(5557), TimePointFromInt(6000)},
{TimePointFromInt(6482), TimePointFromInt(7000)},
{TimePointFromInt(7356), TimePointFromInt(8000)},
};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + vsync_interval));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_EQ(TimePointToInt(calculated_latch_point), 5557);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
TEST(CalculateNextLatchPointTest, SteadyState_FuzzyLatchPointsAfterTarget) {
fml::TimePoint present_requested_time = TimePointFromInt(4000);
fml::TimePoint now = TimePointFromInt(4000);
fml::TimePoint last_latch_point_targeted = TimePointFromInt(5557);
fml::TimeDelta flutter_frame_build_time = TimeDeltaFromInt(1000);
fml::TimeDelta vsync_interval = TimeDeltaFromInt(1000);
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>
future_presentation_infos = {
{TimePointFromInt(4510), TimePointFromInt(5000)},
{TimePointFromInt(5490), TimePointFromInt(6000)},
{TimePointFromInt(6482), TimePointFromInt(7000)},
{TimePointFromInt(7356), TimePointFromInt(8000)},
};
// Assertions about given values.
EXPECT_GE(now, present_requested_time);
EXPECT_GE(flutter_frame_build_time, TimeDeltaFromInt(0));
EXPECT_GT(vsync_interval, TimeDeltaFromInt(0));
fml::TimePoint calculated_latch_point =
SessionConnection::CalculateNextLatchPoint(
present_requested_time, now, last_latch_point_targeted,
flutter_frame_build_time, vsync_interval, future_presentation_infos);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 2)));
EXPECT_LE(TimePointToInt(calculated_latch_point),
TimePointToInt(now + (vsync_interval * 3)));
EXPECT_EQ(TimePointToInt(calculated_latch_point), 6482);
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(present_requested_time + flutter_frame_build_time));
EXPECT_GE(TimePointToInt(calculated_latch_point),
TimePointToInt(last_latch_point_targeted));
}
} // namespace flutter_runner_test

View File

@@ -140,8 +140,14 @@ void VsyncWaiter::AwaitVSync() {
fml::TimePoint now = fml::TimePoint::Now();
fml::TimePoint last_presentation_time =
VsyncRecorder::GetInstance().GetLastPresentationTime();
fml::TimePoint next_vsync = SnapToNextPhase(now, last_presentation_time,
vsync_info.presentation_interval);
fml::TimePoint next_vsync =
VsyncRecorder::GetInstance().GetCurrentVsyncInfo().presentation_time;
if (next_vsync <= now) {
next_vsync = SnapToNextPhase(now, last_presentation_time,
vsync_info.presentation_interval);
}
auto next_vsync_start_time = next_vsync - vsync_offset_;
@@ -182,8 +188,13 @@ void VsyncWaiter::FireCallbackNow() {
fml::TimePoint now = fml::TimePoint::Now();
fml::TimePoint last_presentation_time =
VsyncRecorder::GetInstance().GetLastPresentationTime();
fml::TimePoint next_vsync = SnapToNextPhase(now, last_presentation_time,
vsync_info.presentation_interval);
fml::TimePoint next_vsync =
VsyncRecorder::GetInstance().GetCurrentVsyncInfo().presentation_time;
if (next_vsync <= now) {
next_vsync = SnapToNextPhase(now, last_presentation_time,
vsync_info.presentation_interval);
}
fml::TimePoint previous_vsync = next_vsync - vsync_info.presentation_interval;
FireCallback(previous_vsync, next_vsync);