diff options
author | ernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 18:18:49 +0000 |
---|---|---|
committer | ernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 18:18:49 +0000 |
commit | c92195e33ecd19394dc8447948fcdefd32b25d10 (patch) | |
tree | d5dc816ff480f37a53dd0f47331f6532c757d93e /cc | |
parent | f3aa0dd19469722a5a3ca49f94d9e33d582e224e (diff) | |
download | chromium_src-c92195e33ecd19394dc8447948fcdefd32b25d10.zip chromium_src-c92195e33ecd19394dc8447948fcdefd32b25d10.tar.gz chromium_src-c92195e33ecd19394dc8447948fcdefd32b25d10.tar.bz2 |
cc: Allow one frame of pre-rasterization for GPU rasterization.
This patch makes the following changes:
- Set the memory management policy to allow pre-painting for GPU raster.
- Adjust the skewport (soon tiles) to cover only the next estimated frame for GPU raster.
- Switch the skewport_target_time setting from an absolute time value to a
multiplier.
R=nduca@chromium.org,enne@chromium.org,vmpstr@chromium.org,brianderson@chromium.org
BUG=368884
Review URL: https://codereview.chromium.org/265843010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/picture_layer_impl.cc | 16 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 16 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 7 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.h | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_settings.h | 2 |
8 files changed, 43 insertions, 13 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 1d71e07..bd3b9dc 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -32,7 +32,14 @@ const float kMaxScaleRatioDuringPinch = 2.0f; // When creating a new tiling during pinch, snap to an existing // tiling's scale if the desired scale is within this ratio. const float kSnapToExistingTilingRatio = 0.2f; -} + +// Estimate skewport 60 frames ahead for pre-rasterization on the CPU. +const float kCpuSkewportTargetTimeInFrames = 60.0f; + +// Don't pre-rasterize on the GPU (except for kBackflingGuardDistancePixels in +// TileManager::BinFromTilePriority). +const float kGpuSkewportTargetTimeInFrames = 0.0f; +} // namespace namespace cc { @@ -571,7 +578,12 @@ size_t PictureLayerImpl::GetMaxTilesForInterestArea() const { } float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const { - return layer_tree_impl()->settings().skewport_target_time_in_seconds; + float skewport_target_time_in_frames = ShouldUseGpuRasterization() + ? kGpuSkewportTargetTimeInFrames + : kCpuSkewportTargetTimeInFrames; + return skewport_target_time_in_frames * + layer_tree_impl()->begin_impl_frame_interval().InSecondsF() * + layer_tree_impl()->settings().skewport_target_time_multiplier; } int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const { diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 2d1b217..9797c97 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -255,6 +255,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( overhang_ui_resource_id_(0), overdraw_bottom_height_(0.f), device_viewport_valid_for_tile_management_(true), + begin_impl_frame_interval_(BeginFrameArgs::DefaultInterval()), animation_registrar_(AnimationRegistrar::Create()), rendering_stats_instrumentation_(rendering_stats_instrumentation), micro_benchmark_controller_(this), @@ -1555,6 +1556,8 @@ void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { // Sample the frame time now. This time will be used for updating animations // when we draw. UpdateCurrentFrameTime(); + // Cache the begin impl frame interval + begin_impl_frame_interval_ = args.interval; } gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { @@ -1775,14 +1778,15 @@ void LayerTreeHostImpl::SetNeedsRedraw() { ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const { ManagedMemoryPolicy actual = cached_managed_memory_policy_; - // TODO(ernstm): The second condition disables pre-painting for all layers - // when GPU rasterization is enabled. Once we selectively enable GPU - // rasterization per layer, we also need to disable pre-painting selectively: - // crbug.com/335387 - if (debug_state_.rasterize_only_visible_content || - settings_.gpu_rasterization_forced) { + // TODO(ernstm): NICE_TO_HAVE is currently triggered for forced GPU + // rasterization only. Change the trigger to LTHI::UseGpuRasterization, once + // that is implemented. + if (debug_state_.rasterize_only_visible_content) { actual.priority_cutoff_when_visible = gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY; + } else if (settings_.gpu_rasterization_forced) { + actual.priority_cutoff_when_visible = + gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; } if (zero_budget_) { diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index ae69b01..d246a03 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -408,6 +408,11 @@ class CC_EXPORT LayerTreeHostImpl void ResetCurrentFrameTimeForNextFrame(); virtual base::TimeTicks CurrentFrameTimeTicks(); + // Expected time between two begin impl frame calls. + base::TimeDelta begin_impl_frame_interval() const { + return begin_impl_frame_interval_; + } + scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); } scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const; scoped_ptr<base::Value> ActivationStateAsValue() const; @@ -654,6 +659,9 @@ class CC_EXPORT LayerTreeHostImpl base::TimeTicks current_frame_timeticks_; + // Expected time between two begin impl frame calls. + base::TimeDelta begin_impl_frame_interval_; + scoped_ptr<AnimationRegistrar> animation_registrar_; RenderingStatsInstrumentation* rendering_stats_instrumentation_; diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 8f928f7..b77fa1d 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -5760,8 +5760,9 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) { 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); - int required_only_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( - gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY); + int allow_nice_to_have_cutoff_value = + ManagedMemoryPolicy::PriorityCutoffToValue( + gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE); int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); @@ -5792,7 +5793,7 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) { host_impl_->SetVisible(true); host_impl_->SetMemoryPolicy(policy1); EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); - EXPECT_EQ(required_only_cutoff_value, current_priority_cutoff_value_); + EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); host_impl_->SetVisible(false); EXPECT_EQ(0u, current_limit_bytes_); diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 11d691b..465c9cc 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -690,6 +690,10 @@ base::TimeTicks LayerTreeImpl::CurrentFrameTimeTicks() const { return layer_tree_host_impl_->CurrentFrameTimeTicks(); } +base::TimeDelta LayerTreeImpl::begin_impl_frame_interval() const { + return layer_tree_host_impl_->begin_impl_frame_interval(); +} + void LayerTreeImpl::SetNeedsCommit() { layer_tree_host_impl_->SetNeedsCommit(); } diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index ff912a4..bc488db 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -81,6 +81,7 @@ class CC_EXPORT LayerTreeImpl { int MaxTextureSize() const; bool PinchGestureActive() const; base::TimeTicks CurrentFrameTimeTicks() const; + base::TimeDelta begin_impl_frame_interval() const; void SetNeedsCommit(); gfx::Size DrawViewportSize() const; scoped_ptr<ScrollbarAnimationController> CreateScrollbarAnimationController( diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc index 5360bd4..629b4e2 100644 --- a/cc/trees/layer_tree_settings.cc +++ b/cc/trees/layer_tree_settings.cc @@ -52,7 +52,7 @@ LayerTreeSettings::LayerTreeSettings() use_pinch_virtual_viewport(false), // At 256x256 tiles, 128 tiles cover an area of 2048x4096 pixels. max_tiles_for_interest_area(128), - skewport_target_time_in_seconds(1.0f), + skewport_target_time_multiplier(1.0f), skewport_extrapolation_limit_in_content_pixels(2000), max_unused_resource_memory_percentage(100), max_memory_for_prepaint_percentage(100), diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index 6febd84..8192b3d 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -67,7 +67,7 @@ class CC_EXPORT LayerTreeSettings { bool use_pinch_zoom_scrollbars; bool use_pinch_virtual_viewport; size_t max_tiles_for_interest_area; - float skewport_target_time_in_seconds; + float skewport_target_time_multiplier; int skewport_extrapolation_limit_in_content_pixels; size_t max_unused_resource_memory_percentage; size_t max_memory_for_prepaint_percentage; |