Commit 808c1f33 authored by yiyix's avatar yiyix Committed by Commit Bot

FrameMetrics: Adding frame metrics analysis to LayerTreeHostImpl

Added frame metrics analysis to LayerTreeHostImpl. The frame presentation
callback times are sent to frame metrics for every nth scrolling.

Bug:851088

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I32aee9b5401c056ed3be64e17a45cc1958188199
Reviewed-on: https://chromium-review.googlesource.com/1147921
Commit-Queue: Yi Xu <yiyix@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581782}
parent 61efda22
...@@ -119,6 +119,11 @@ namespace { ...@@ -119,6 +119,11 @@ namespace {
// V1 saw errors of ~0.065 between computed window and content widths. // V1 saw errors of ~0.065 between computed window and content widths.
const float kMobileViewportWidthEpsilon = 0.15f; const float kMobileViewportWidthEpsilon = 0.15f;
// We report frames and their display time to the FrameMetrics to analyze fps
// for every |kFrameMetricsScrollReportFrequency|th scroll event after the last
// report.
const int kFrameMetricsScrollReportFrequency = 10;
bool HasFixedPageScale(LayerTreeImpl* active_tree) { bool HasFixedPageScale(LayerTreeImpl* active_tree) {
return active_tree->min_page_scale_factor() == return active_tree->min_page_scale_factor() ==
active_tree->max_page_scale_factor(); active_tree->max_page_scale_factor();
...@@ -1908,13 +1913,17 @@ viz::CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() { ...@@ -1908,13 +1913,17 @@ viz::CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() {
active_tree_->GetViewportSelection(&metadata.selection); active_tree_->GetViewportSelection(&metadata.selection);
// Skip recording frame metrics for android_webview
// (using_synchronous_renderer_compositor) scrolls because different
// application is handling frame presentation in android webview.
if (active_tree_->has_presentation_callbacks() || if (active_tree_->has_presentation_callbacks() ||
settings_.always_request_presentation_time) { settings_.always_request_presentation_time ||
(scroll_events_after_reporting_ == 0 && CurrentlyScrollingNode() &&
!settings_.using_synchronous_renderer_compositor)) {
metadata.request_presentation_feedback = true; metadata.request_presentation_feedback = true;
frame_token_infos_.emplace_back(metadata.frame_token, frame_token_infos_.emplace_back(metadata.frame_token,
CurrentBeginFrameArgs().frame_time, CurrentBeginFrameArgs().frame_time,
active_tree_->TakePresentationCallbacks()); active_tree_->TakePresentationCallbacks());
DCHECK_LE(frame_token_infos_.size(), 25u); DCHECK_LE(frame_token_infos_.size(), 25u);
} }
...@@ -4410,6 +4419,14 @@ void LayerTreeHostImpl::ScrollEndImpl(ScrollState* scroll_state) { ...@@ -4410,6 +4419,14 @@ void LayerTreeHostImpl::ScrollEndImpl(ScrollState* scroll_state) {
DistributeScrollDelta(scroll_state); DistributeScrollDelta(scroll_state);
browser_controls_offset_manager_->ScrollEnd(); browser_controls_offset_manager_->ScrollEnd();
ClearCurrentlyScrollingNode(); ClearCurrentlyScrollingNode();
// At the end of a scrolling event, increases |scroll_events_after_reporting_|
// by 1. If it is the |kFrameMetricsScrollReportFrequency| scrolling event
// after the previous report to the frame metrics, then
// |scroll_events_after_reporting_| becomes 0 and the data will be reported
// back the frame metrics.
scroll_events_after_reporting_ =
(scroll_events_after_reporting_ + 1) % kFrameMetricsScrollReportFrequency;
} }
void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state, bool should_snap) { void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state, bool should_snap) {
......
...@@ -1102,6 +1102,9 @@ class CC_EXPORT LayerTreeHostImpl ...@@ -1102,6 +1102,9 @@ class CC_EXPORT LayerTreeHostImpl
ui::FrameMetrics frame_metrics_; ui::FrameMetrics frame_metrics_;
ui::SkippedFrameTracker skipped_frame_tracker_; ui::SkippedFrameTracker skipped_frame_tracker_;
bool is_animating_for_snap_; bool is_animating_for_snap_;
// The number of scroll events happened after the last report to frame
// metrics.
int scroll_events_after_reporting_ = 0;
DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment