diff options
-rw-r--r-- | cc/debug/rendering_stats.cc | 13 | ||||
-rw-r--r-- | cc/debug/rendering_stats.h | 2 | ||||
-rw-r--r-- | cc/debug/rendering_stats_instrumentation.cc | 18 | ||||
-rw-r--r-- | cc/debug/rendering_stats_instrumentation.h | 2 | ||||
-rw-r--r-- | cc/layers/append_quads_data.h | 10 | ||||
-rw-r--r-- | cc/layers/picture_layer_impl.cc | 19 | ||||
-rw-r--r-- | cc/layers/picture_layer_impl_unittest.cc | 28 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 18 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 26 |
9 files changed, 129 insertions, 7 deletions
diff --git a/cc/debug/rendering_stats.cc b/cc/debug/rendering_stats.cc index 582c763..a3d7a43 100644 --- a/cc/debug/rendering_stats.cc +++ b/cc/debug/rendering_stats.cc @@ -38,8 +38,9 @@ RenderingStats::RenderingStats() : frame_count(0), visible_content_area(0), approximated_visible_content_area(0), - checkerboarded_visible_content_area(0) { -} + checkerboarded_visible_content_area(0), + checkerboarded_no_recording_content_area(0), + checkerboarded_needs_raster_content_area(0) {} RenderingStats::~RenderingStats() { } @@ -54,6 +55,10 @@ RenderingStats::AsTraceableData() const { approximated_visible_content_area); record_data->SetInteger("checkerboarded_visible_content_area", checkerboarded_visible_content_area); + record_data->SetInteger("checkerboarded_no_recording_content_area", + checkerboarded_no_recording_content_area); + record_data->SetInteger("checkerboarded_needs_raster_content_area", + checkerboarded_needs_raster_content_area); draw_duration.AddToTracedValue("draw_duration_ms", record_data.get()); draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms", @@ -79,6 +84,10 @@ void RenderingStats::Add(const RenderingStats& other) { approximated_visible_content_area += other.approximated_visible_content_area; checkerboarded_visible_content_area += other.checkerboarded_visible_content_area; + checkerboarded_no_recording_content_area += + other.checkerboarded_no_recording_content_area; + checkerboarded_needs_raster_content_area += + other.checkerboarded_needs_raster_content_area; draw_duration.Add(other.draw_duration); draw_duration_estimate.Add(other.draw_duration_estimate); diff --git a/cc/debug/rendering_stats.h b/cc/debug/rendering_stats.h index cb7ebb2c..fbe0d63 100644 --- a/cc/debug/rendering_stats.h +++ b/cc/debug/rendering_stats.h @@ -45,6 +45,8 @@ struct CC_EXPORT RenderingStats { int64 visible_content_area; int64 approximated_visible_content_area; int64 checkerboarded_visible_content_area; + int64 checkerboarded_no_recording_content_area; + int64 checkerboarded_needs_raster_content_area; TimeDeltaList draw_duration; TimeDeltaList draw_duration_estimate; diff --git a/cc/debug/rendering_stats_instrumentation.cc b/cc/debug/rendering_stats_instrumentation.cc index 315743b..e793c50 100644 --- a/cc/debug/rendering_stats_instrumentation.cc +++ b/cc/debug/rendering_stats_instrumentation.cc @@ -90,6 +90,24 @@ void RenderingStatsInstrumentation::AddCheckerboardedVisibleContentArea( impl_thread_rendering_stats_.checkerboarded_visible_content_area += area; } +void RenderingStatsInstrumentation::AddCheckerboardedNoRecordingContentArea( + int64 area) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + impl_thread_rendering_stats_.checkerboarded_no_recording_content_area += area; +} + +void RenderingStatsInstrumentation::AddCheckerboardedNeedsRasterContentArea( + int64 area) { + if (!record_rendering_stats_) + return; + + base::AutoLock scoped_lock(lock_); + impl_thread_rendering_stats_.checkerboarded_needs_raster_content_area += area; +} + void RenderingStatsInstrumentation::AddDrawDuration( base::TimeDelta draw_duration, base::TimeDelta draw_duration_estimate) { diff --git a/cc/debug/rendering_stats_instrumentation.h b/cc/debug/rendering_stats_instrumentation.h index 4779688..92351e6 100644 --- a/cc/debug/rendering_stats_instrumentation.h +++ b/cc/debug/rendering_stats_instrumentation.h @@ -44,6 +44,8 @@ class CC_EXPORT RenderingStatsInstrumentation { void AddVisibleContentArea(int64 area); void AddApproximatedVisibleContentArea(int64 area); void AddCheckerboardedVisibleContentArea(int64 area); + void AddCheckerboardedNoRecordingContentArea(int64 area); + void AddCheckerboardedNeedsRasterContentArea(int64 area); void AddDrawDuration(base::TimeDelta draw_duration, base::TimeDelta draw_duration_estimate); void AddBeginMainFrameToCommitDuration( diff --git a/cc/layers/append_quads_data.h b/cc/layers/append_quads_data.h index 45b0c17..3d05109 100644 --- a/cc/layers/append_quads_data.h +++ b/cc/layers/append_quads_data.h @@ -16,7 +16,9 @@ struct AppendQuadsData { num_missing_tiles(0), visible_layer_area(0), approximated_visible_content_area(0), - checkerboarded_visible_content_area(0) {} + checkerboarded_visible_content_area(0), + checkerboarded_no_recording_content_area(0), + checkerboarded_needs_raster_content_area(0) {} // Set by the layer appending quads. int64 num_incomplete_tiles; @@ -26,8 +28,12 @@ struct AppendQuadsData { int64 visible_layer_area; // Set by the layer appending quads. int64 approximated_visible_content_area; - // Set by the layer appending quads. + // Set by the layer appending quads. This is total of the following two areas. int64 checkerboarded_visible_content_area; + // Set by the layer appending quads. This is the area outside interest rect. + int64 checkerboarded_no_recording_content_area; + // Set by the layer appending quads. This is the area within interest rect. + int64 checkerboarded_needs_raster_content_area; }; } // namespace cc diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index a550968..f8aa213 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -270,6 +270,8 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass, size_t missing_tile_count = 0u; size_t on_demand_missing_tile_count = 0u; only_used_low_res_last_append_quads_ = true; + gfx::Rect scaled_recorded_viewport = gfx::ScaleToEnclosingRect( + raster_source_->RecordedViewport(), max_contents_scale); for (PictureLayerTilingSet::CoverageIterator iter( tilings_.get(), max_contents_scale, shared_quad_state->visible_quad_layer_rect, ideal_contents_scale_); @@ -346,8 +348,23 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass, append_quads_data->num_missing_tiles++; ++missing_tile_count; } - append_quads_data->checkerboarded_visible_content_area += + int64 checkerboarded_area = visible_geometry_rect.width() * visible_geometry_rect.height(); + append_quads_data->checkerboarded_visible_content_area += + checkerboarded_area; + // Intersect checkerboard rect with interest rect to generate rect where + // we checkerboarded and has recording. The area where we don't have + // recording is not necessarily a Rect, and its area is calculated using + // subtraction. + gfx::Rect visible_rect_has_recording = visible_geometry_rect; + visible_rect_has_recording.Intersect(scaled_recorded_viewport); + int64 checkerboarded_has_recording_area = + visible_rect_has_recording.width() * + visible_rect_has_recording.height(); + append_quads_data->checkerboarded_needs_raster_content_area += + checkerboarded_has_recording_area; + append_quads_data->checkerboarded_no_recording_content_area += + checkerboarded_area - checkerboarded_has_recording_area; continue; } diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 78f56fd..93c1f1f 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -2067,6 +2067,34 @@ TEST_F(PictureLayerImplTest, EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); } +TEST_F(PictureLayerImplTest, AppendQuadsDataForCheckerboard) { + host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); + + gfx::Size tile_size(100, 100); + gfx::Size layer_bounds(200, 200); + gfx::Rect recorded_viewport(0, 0, 150, 150); + + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = + FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds, + recorded_viewport); + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); + ActivateTree(); + + scoped_ptr<RenderPass> render_pass = RenderPass::Create(); + AppendQuadsData data; + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); + active_layer_->AppendQuads(render_pass.get(), &data); + active_layer_->DidDraw(nullptr); + + EXPECT_EQ(1u, render_pass->quad_list.size()); + EXPECT_EQ(1u, data.num_missing_tiles); + EXPECT_EQ(0u, data.num_incomplete_tiles); + EXPECT_EQ(40000, data.checkerboarded_visible_content_area); + EXPECT_EQ(17500, data.checkerboarded_no_recording_content_area); + EXPECT_EQ(22500, data.checkerboarded_needs_raster_content_area); + EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); +} + TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveAllReady) { gfx::Size layer_bounds(400, 400); gfx::Size tile_size(100, 100); diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 807ec03f..3b10fb7 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -834,6 +834,8 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses( int num_missing_tiles = 0; int num_incomplete_tiles = 0; + int64 checkerboarded_no_recording_content_area = 0; + int64 checkerboarded_needs_raster_content_area = 0; bool have_copy_request = false; bool have_missing_animated_tiles = false; @@ -910,9 +912,17 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses( append_quads_data.approximated_visible_content_area); rendering_stats_instrumentation_->AddCheckerboardedVisibleContentArea( append_quads_data.checkerboarded_visible_content_area); + rendering_stats_instrumentation_->AddCheckerboardedNoRecordingContentArea( + append_quads_data.checkerboarded_no_recording_content_area); + rendering_stats_instrumentation_->AddCheckerboardedNeedsRasterContentArea( + append_quads_data.checkerboarded_needs_raster_content_area); num_missing_tiles += append_quads_data.num_missing_tiles; num_incomplete_tiles += append_quads_data.num_incomplete_tiles; + checkerboarded_no_recording_content_area += + append_quads_data.checkerboarded_no_recording_content_area; + checkerboarded_needs_raster_content_area += + append_quads_data.checkerboarded_needs_raster_content_area; if (append_quads_data.num_missing_tiles) { bool layer_has_animating_transform = @@ -982,6 +992,14 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses( UMA_HISTOGRAM_COUNTS_100( "Compositing.RenderPass.AppendQuadData.NumIncompleteTiles", num_incomplete_tiles); + UMA_HISTOGRAM_COUNTS( + "Compositing.RenderPass.AppendQuadData." + "CheckerboardedNoRecordingContentArea", + checkerboarded_no_recording_content_area); + UMA_HISTOGRAM_COUNTS( + "Compositing.RenderPass.AppendQuadData." + "CheckerboardedNeedRasterContentArea", + checkerboarded_needs_raster_content_area); } // Should only have one render pass in resourceless software mode. diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index bf2dd23..29768a8 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -4660,8 +4660,30 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </summary> </histogram> +<histogram + name="Compositing.RenderPass.AppendQuadData.CheckerboardedNeedsRasterContentArea" + units="pixels/frame"> + <owner>weiliangc@chromium.org</owner> + <summary> + Checkerboarded area, in number of pixels, that has recording but does not + have time to finish rastering yet. A sample is recorded everytime a frame is + drawn while a scroll is in progress. Tracking bug 535732. + </summary> +</histogram> + +<histogram + name="Compositing.RenderPass.AppendQuadData.CheckerboardedNoRecordingContentArea" + units="pixels/frame"> + <owner>weiliangc@chromium.org</owner> + <summary> + Checkerboarded area, in number of pixels, that has no recording to raster + from. A sample is recorded everytime a frame is drawn while a scroll is in + progress. Tracking bug 535732. + </summary> +</histogram> + <histogram name="Compositing.RenderPass.AppendQuadData.NumIncompleteTiles"> - <owner>weiliangc@chromium.org.</owner> + <owner>weiliangc@chromium.org</owner> <summary> Keeps track of number of incomplete tiles in a drawn compositor frame while scrolling. This is a rough measurement of ugliness during user interaction. @@ -4671,7 +4693,7 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </histogram> <histogram name="Compositing.RenderPass.AppendQuadData.NumMissingTiles"> - <owner>weiliangc@chromium.org.</owner> + <owner>weiliangc@chromium.org</owner> <summary> Keeps track of number of missing tiles in a drawn compositor frame while scrolling. This is a rough measurement of ugliness during user interaction. |