diff options
author | ernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-17 06:34:12 +0000 |
---|---|---|
committer | ernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-17 06:34:12 +0000 |
commit | 206a3926590cbf7e9d92fa15cade21f20f9245d7 (patch) | |
tree | afb2060ab5edc3889900c206d4ecc5874355bb20 /cc | |
parent | 884e4d7aee2c082df99654b60e82b47194ed1242 (diff) | |
download | chromium_src-206a3926590cbf7e9d92fa15cade21f20f9245d7.zip chromium_src-206a3926590cbf7e9d92fa15cade21f20f9245d7.tar.gz chromium_src-206a3926590cbf7e9d92fa15cade21f20f9245d7.tar.bz2 |
cc: Added features for more accurate raster benchmark
- Added debug switch to rasterize only visible tiles
- Tagged all tiles and raster tasks with their source frame number
BUG=226489
Review URL: https://chromiumcodereview.appspot.com/14975007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/debug/layer_tree_debug_state.cc | 4 | ||||
-rw-r--r-- | cc/debug/layer_tree_debug_state.h | 1 | ||||
-rw-r--r-- | cc/layers/picture_layer_impl.cc | 3 | ||||
-rw-r--r-- | cc/resources/tile.cc | 6 | ||||
-rw-r--r-- | cc/resources/tile.h | 6 | ||||
-rw-r--r-- | cc/resources/tile_manager.cc | 1 | ||||
-rw-r--r-- | cc/resources/tile_manager.h | 1 | ||||
-rw-r--r-- | cc/resources/tile_manager_unittest.cc | 2 | ||||
-rw-r--r-- | cc/test/fake_picture_layer_tiling_client.cc | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 21 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 2 |
11 files changed, 40 insertions, 8 deletions
diff --git a/cc/debug/layer_tree_debug_state.cc b/cc/debug/layer_tree_debug_state.cc index bde6e79..f6e61b7 100644 --- a/cc/debug/layer_tree_debug_state.cc +++ b/cc/debug/layer_tree_debug_state.cc @@ -22,6 +22,7 @@ LayerTreeDebugState::LayerTreeDebugState() show_occluding_rects(false), show_non_occluding_rects(false), slow_down_raster_scale_factor(0), + rasterize_only_visible_content(false), show_picture_borders(false), record_rendering_stats_(false) {} @@ -66,6 +67,8 @@ bool LayerTreeDebugState::Equal(const LayerTreeDebugState& a, a.show_occluding_rects == b.show_occluding_rects && a.show_non_occluding_rects == b.show_non_occluding_rects && a.slow_down_raster_scale_factor == b.slow_down_raster_scale_factor && + a.rasterize_only_visible_content == + b.rasterize_only_visible_content && a.show_picture_borders == b.show_picture_borders && a.record_rendering_stats_ == b.record_rendering_stats_); } @@ -89,6 +92,7 @@ LayerTreeDebugState LayerTreeDebugState::Unite(const LayerTreeDebugState& a, if (b.slow_down_raster_scale_factor) r.slow_down_raster_scale_factor = b.slow_down_raster_scale_factor; + r.rasterize_only_visible_content |= b.rasterize_only_visible_content; r.show_picture_borders |= b.show_picture_borders; r.record_rendering_stats_ |= b.record_rendering_stats_; diff --git a/cc/debug/layer_tree_debug_state.h b/cc/debug/layer_tree_debug_state.h index e5f6e1d..b7e44a0 100644 --- a/cc/debug/layer_tree_debug_state.h +++ b/cc/debug/layer_tree_debug_state.h @@ -29,6 +29,7 @@ class CC_EXPORT LayerTreeDebugState { bool show_non_occluding_rects; int slow_down_raster_scale_factor; + bool rasterize_only_visible_content; bool show_picture_borders; void SetRecordRenderingStats(bool enabled); diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index e281198..1cc9e6c 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -421,7 +421,8 @@ scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, content_rect, contents_opaque() ? content_rect : gfx::Rect(), tiling->contents_scale(), - id())); + id(), + layer_tree_impl()->source_frame_number())); } void PictureLayerImpl::UpdatePile(Tile* tile) { diff --git a/cc/resources/tile.cc b/cc/resources/tile.cc index 1f98c3c..53f81ce 100644 --- a/cc/resources/tile.cc +++ b/cc/resources/tile.cc @@ -16,13 +16,15 @@ Tile::Tile(TileManager* tile_manager, gfx::Rect content_rect, gfx::Rect opaque_rect, float contents_scale, - int layer_id) + int layer_id, + int source_frame_number) : tile_manager_(tile_manager), tile_size_(tile_size), content_rect_(content_rect), contents_scale_(contents_scale), opaque_rect_(opaque_rect), - layer_id_(layer_id) { + layer_id_(layer_id), + source_frame_number_(source_frame_number) { set_picture_pile(picture_pile); tile_manager_->RegisterTile(this); } diff --git a/cc/resources/tile.h b/cc/resources/tile.h index f68fdf1..fa75bb0 100644 --- a/cc/resources/tile.h +++ b/cc/resources/tile.h @@ -28,7 +28,8 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> { gfx::Rect content_rect, gfx::Rect opaque_rect, float contents_scale, - int layer_id); + int layer_id, + int source_frame_number); PicturePileImpl* picture_pile() { return picture_pile_.get(); @@ -64,6 +65,8 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> { int layer_id() const { return layer_id_; } + int source_frame_number() const { return source_frame_number_; } + void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { DCHECK(pile->CanRaster(contents_scale_, content_rect_)); picture_pile_ = pile; @@ -99,6 +102,7 @@ class CC_EXPORT Tile : public base::RefCounted<Tile> { TilePriority priority_[NUM_BIN_PRIORITIES]; ManagedTileState managed_state_; int layer_id_; + int source_frame_number_; DISALLOW_COPY_AND_ASSIGN(Tile); }; diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 65dbea0..2cb9796 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -748,6 +748,7 @@ TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( metadata.tile_resolution = mts.resolution; metadata.layer_id = tile.layer_id(); metadata.tile_id = &tile; + metadata.source_frame_number = tile.source_frame_number(); return metadata; } diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index 23a16d4..f9b428b 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -114,6 +114,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient { TileResolution tile_resolution; int layer_id; const void* tile_id; + int source_frame_number; }; RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc index 9cbbcad..0231762 100644 --- a/cc/resources/tile_manager_unittest.cc +++ b/cc/resources/tile_manager_unittest.cc @@ -70,6 +70,7 @@ TEST(TileManagerTest, OOM) { gfx::Rect(), gfx::Rect(), 1.0, + 0, 0)); tile->SetPriority(PENDING_TREE, TilePriority()); tile->SetPriority(ACTIVE_TREE, eventual_prio); @@ -84,6 +85,7 @@ TEST(TileManagerTest, OOM) { gfx::Rect(), gfx::Rect(), 1.0, + 0, 0)); tile->SetPriority(PENDING_TREE, now_prio); tile->SetPriority(ACTIVE_TREE, TilePriority()); diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index 77c902b..7c18d35 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -47,6 +47,7 @@ scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( rect, gfx::Rect(), 1, + 0, 0); } diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 7e8d0c0..d8915db 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -909,6 +909,7 @@ bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, void LayerTreeHostImpl::EnforceManagedMemoryPolicy( const ManagedMemoryPolicy& policy) { + bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( visible_ ? policy.bytes_limit_when_visible : policy.bytes_limit_when_not_visible, @@ -996,10 +997,10 @@ void LayerTreeHostImpl::SetManagedMemoryPolicy( // In single-thread mode, this can be called on the main thread by // GLRenderer::OnMemoryAllocationChanged. DebugScopedSetImplThread impl_thread(proxy_); - EnforceManagedMemoryPolicy(managed_memory_policy_); + EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); } else { DCHECK(proxy_->IsImplThread()); - EnforceManagedMemoryPolicy(managed_memory_policy_); + EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); } if (needs_commit) @@ -1345,7 +1346,7 @@ void LayerTreeHostImpl::SetVisible(bool visible) { return; visible_ = visible; DidVisibilityChange(this, visible_); - EnforceManagedMemoryPolicy(managed_memory_policy_); + EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy()); if (!renderer_) return; @@ -1353,6 +1354,18 @@ void LayerTreeHostImpl::SetVisible(bool visible) { renderer_->SetVisible(visible); } +ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const { + if (!debug_state_.rasterize_only_visible_content) + return managed_memory_policy_; + + ManagedMemoryPolicy actual = managed_memory_policy_; + actual.priority_cutoff_when_not_visible = + ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING; + actual.priority_cutoff_when_visible = + ManagedMemoryPolicy::CUTOFF_ALLOW_REQUIRED_ONLY; + return actual; +} + bool LayerTreeHostImpl::InitializeRenderer( scoped_ptr<OutputSurface> output_surface) { // Since we will create a new resource provider, we cannot continue to use @@ -1389,7 +1402,7 @@ bool LayerTreeHostImpl::InitializeRenderer( settings_.num_raster_threads, settings_.use_color_estimator, rendering_stats_instrumentation_)); - UpdateTileManagerMemoryPolicy(managed_memory_policy_); + UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); } if (output_surface->capabilities().has_parent_compositor) { diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 5125c82..8c7edc4 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -248,6 +248,8 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler, void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } void SetNeedsRedraw() { client_->SetNeedsRedrawOnImplThread(); } + ManagedMemoryPolicy ActualManagedMemoryPolicy() const; + size_t memory_allocation_limit_bytes() const { return managed_memory_policy_.bytes_limit_when_visible; } |