-
Notifications
You must be signed in to change notification settings - Fork 6k
[fuchsia] SnapToNextPhase refactor + add tests and documentation #14158
[fuchsia] SnapToNextPhase refactor + add tests and documentation #14158
Conversation
f68718b to
776c7c5
Compare
| if (delta < presentation_interval) { | ||
| return last_frame_presentation_time + presentation_interval; | ||
| } else { | ||
| int64_t num_phases_passed = delta / presentation_interval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure it matters here since the overloaded division operator in TimeDelta is int64_t though as you point out it ought to be unsigned. Leaving this as is for now.
| /// will be the same. | ||
| /// | ||
| /// Scenario 1: | ||
| /// presentation_interval is 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we clarify here that presentation_interval is a time delta, not the number of frames
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type of the param is fml::TimeDelta as opposed to an integral type, so this should be clear once the reader gets to the method definition.
| } else { | ||
| int64_t num_phases_passed = delta / presentation_interval; | ||
| // this is to ensure that we will be past the "now" time point. | ||
| if (delta % presentation_interval == fml::TimeDelta::Zero()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I fully understand this. I think it's supposed to be iterating over to the first future timepoint at which a presentation is scheduled to occur, so e.g. if we have a delta of 20ms since the last presentation, and the presentation interval is 16ms, we're 4ms into the budget for the n+1 frame, which means we need to return a timepoint 12ms in the future from now, is this correct?
In this expression, 20 % 16 != 0 so we won't be adding to the phases passed, and the integer division above should return the floor so we'd be returning a timepoint in the past?
last_frame_presentation_time = 0
presentation_interval = 16
now = 20
delta = 20
num_phases_passed = 20 / 16 = 1
delta % presentation_interval = 20 % 16 = 4
return 0 + (16 * 1) = 16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to do a ceil and was accounting for the case where there is a perfect division. good catch, will add a test for this.
776c7c5 to
bf40301
Compare
gw280
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with Chinmay's comments
bf40301 to
3fc2e37
Compare
3fc2e37 to
a957ba3
Compare
flutter/engine@e7b69ce...5b870a2 git log e7b69ce..5b870a2 --first-parent --oneline 2019-12-08 [email protected] Add support for setting window size limits for glfw (flutter/engine#13415) 2019-12-06 [email protected] [fuchsia] SnapToNextPhase refactor + add tests and documentation (flutter/engine#14158) 2019-12-06 [email protected] Roll fuchsia/sdk/core/mac-amd64 from VKso5... to 9C6UA... (flutter/engine#14161) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
No description provided.