This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
FrameTiming build start timestamp fix and add vsync start timestamp #20229
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
01ace70
Change frame build time start timestamp
CareF 84a11d6
add vsync start to layer_tree
CareF 0ec79db
add test
CareF 35d1bd8
formatting
CareF 87d0982
move tracing
CareF 8c7178c
remove vsync_time method
CareF 3d14526
bug fix and formatting
CareF ecca65e
update constructor
CareF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ Animator::Animator(Delegate& delegate, | |
task_runners_(std::move(task_runners)), | ||
waiter_(std::move(waiter)), | ||
last_frame_begin_time_(), | ||
last_vsync_start_time_(), | ||
last_frame_target_time_(), | ||
dart_frame_deadline_(0), | ||
#if FLUTTER_SHELL_ENABLE_METAL | ||
|
@@ -98,7 +99,7 @@ static int64_t FxlToDartOrEarlier(fml::TimePoint time) { | |
return (time - fxl_now).ToMicroseconds() + dart_now; | ||
} | ||
|
||
void Animator::BeginFrame(fml::TimePoint frame_start_time, | ||
void Animator::BeginFrame(fml::TimePoint vsync_start_time, | ||
fml::TimePoint frame_target_time) { | ||
TRACE_EVENT_ASYNC_END0("flutter", "Frame Request Pending", frame_number_++); | ||
|
||
|
@@ -133,7 +134,11 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, | |
// to service potential frame. | ||
FML_DCHECK(producer_continuation_); | ||
|
||
last_frame_begin_time_ = frame_start_time; | ||
last_frame_begin_time_ = fml::TimePoint::Now(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when we post a trace event for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not 100% sure I understand but I made a commit moving the TaceEventAsyncComplete line. PTAL. |
||
last_vsync_start_time_ = vsync_start_time; | ||
fml::tracing::TraceEventAsyncComplete("flutter", "VsyncSchedulingOverhead", | ||
last_vsync_start_time_, | ||
last_frame_begin_time_); | ||
last_frame_target_time_ = frame_target_time; | ||
dart_frame_deadline_ = FxlToDartOrEarlier(frame_target_time); | ||
{ | ||
|
@@ -179,7 +184,8 @@ void Animator::Render(std::unique_ptr<flutter::LayerTree> layer_tree) { | |
last_layer_tree_size_ = layer_tree->frame_size(); | ||
|
||
// Note the frame time for instrumentation. | ||
layer_tree->RecordBuildTime(last_frame_begin_time_, last_frame_target_time_); | ||
layer_tree->RecordBuildTime(last_vsync_start_time_, last_frame_begin_time_, | ||
last_frame_target_time_); | ||
|
||
// Commit the pending continuation. | ||
bool result = producer_continuation_.Complete(std::move(layer_tree)); | ||
|
@@ -233,13 +239,13 @@ void Animator::RequestFrame(bool regenerate_layer_tree) { | |
|
||
void Animator::AwaitVSync() { | ||
waiter_->AsyncWaitForVsync( | ||
[self = weak_factory_.GetWeakPtr()](fml::TimePoint frame_start_time, | ||
[self = weak_factory_.GetWeakPtr()](fml::TimePoint vsync_start_time, | ||
fml::TimePoint frame_target_time) { | ||
if (self) { | ||
if (self->CanReuseLastLayerTree()) { | ||
self->DrawLastLayerTree(); | ||
} else { | ||
self->BeginFrame(frame_start_time, frame_target_time); | ||
self->BeginFrame(vsync_start_time, frame_target_time); | ||
} | ||
} | ||
}); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.