-
Notifications
You must be signed in to change notification settings - Fork 6k
[fuchsia] Restructure Flatland vsync loop #45531
Conversation
dc03d52 to
54713b2
Compare
arbreng
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 % comments
|
|
||
| } // namespace | ||
|
|
||
| // This function takes in all relevant information to determining when should |
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.
Nit: Does this comment belong on the constructor or somewhere else?
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.
Ahh leftover comment from an old helper function that is removed now. Erased it.
| threadsafe_state_.on_next_frame_pending_ = true; | ||
| } | ||
| threadsafe_state_.next_presentation_time_ = next_presentation_time; | ||
| // Update vsync_interval_ by calculating. |
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.
Calculating how? For future readers
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.
Added it.
| } | ||
| threadsafe_state_.next_presentation_time_ = next_presentation_time; | ||
| // Update vsync_interval_ by calculating. | ||
| FML_CHECK(values.has_future_presentation_infos() && |
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.
Should we CHECK here? Is it possible to warn instead and then use an approximation?
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.
Added a warning in case.
| view_protocols = std::move(view_protocols), | ||
| request = parent_viewport_watcher.NewRequest(), | ||
| view_ref_pair = std::move(view_ref_pair), | ||
| max_frames_in_flight = product_config.get_max_frames_in_flight(), |
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.
Nice, I think this means we can get rid of the product config file soon.
Please remove these fields from the flutter_runner_product_config.h
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.
Done.
| bool first_feedback_received_ = false; | ||
| FireCallbackCallback pending_fire_callback_; | ||
| uint32_t present_credits_ = 1; | ||
| std::queue<fml::TimePoint> next_presentation_times_; |
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.
Nit: queue first, then other fields, then boolean last (more readable, and fields pack into structure better)
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.
Done.
| // Throttle case. | ||
| if (threadsafe_state_.pending_fire_callback_ && | ||
| threadsafe_state_.present_credits_ > 0) { | ||
| RunVsyncCallback(now, threadsafe_state_.pending_fire_callback_); |
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.
Make a note here or below (at the definition of RunVsyncCallback) this is run on the Raster thread, but it is safe b/c the Vsync callback will be posted to the UI thread
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.
Added to the definition of RunVsyncCallback.
54713b2 to
77ea7c2
Compare
…134240) flutter/engine@f0b718e...8d07c29 2023-09-07 [email protected] [Impeller] Document and slightly refactor `ResourceManagerVK` & friends. (flutter/engine#45474) 2023-09-07 [email protected] [fuchsia] Restructure Flatland vsync loop (flutter/engine#45531) 2023-09-07 [email protected] Roll Skia from 16df0c27bc0e to c3d6534b0ac3 (3 revisions) (flutter/engine#45543) 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],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose 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/+doc/main/autoroll/README.md
This CL restructures Flatland vsync loop to fire for each vsync instead of each OnNextFrameBegin. As shown in the traces attached to the bug, the current implementation of firing callbacks on each OnNextFrameBegin causes skips when Flutter has longer draw calls. By scheduling frames in between, we are increasing the chance of sending one before the latch point. OnNextFrameBegin is now used to keep track of present credits and future presentation times as well as when to start frame, replacing the need for max_frames_in_flight and vsync_offset fields. Bug: b/296272449 (cherry picked from commit 633ba42)
This CL restructures Flatland vsync loop to fire for each vsync instead of each OnNextFrameBegin. As shown in the traces attached to the bug, the current implementation of firing callbacks on each OnNextFrameBegin causes skips when Flutter has longer draw calls. By scheduling frames in between, we are increasing the chance of sending one before the latch point. OnNextFrameBegin is now used to keep track of present credits and future presentation times as well as when to start frame, replacing the need for max_frames_in_flight and vsync_offset fields. Bug: b/296272449
This CL restructures Flatland vsync loop to fire for each vsync instead of each OnNextFrameBegin. As shown in the traces attached to the bug, the current implementation of firing callbacks on each OnNextFrameBegin causes skips when Flutter has longer draw calls. By scheduling frames in between, we are increasing the chance of sending one before the latch point. OnNextFrameBegin is now used to keep track of present credits and future presentation times as well as when to start frame, replacing the need for max_frames_in_flight and vsync_offset fields. Bug: b/296272449 (cherry picked from commit 633ba42)
This CL restructures Flatland vsync loop to fire for each vsync instead of each OnNextFrameBegin. As shown in the traces attached to the bug, the current implementation of firing callbacks on each OnNextFrameBegin causes skips when Flutter has longer draw calls. By scheduling frames in between, we are increasing the chance of sending one before the latch point. OnNextFrameBegin is now used to keep track of present credits and future presentation times as well as when to start frame, replacing the need for max_frames_in_flight and vsync_offset fields.
Bug: b/296272449