summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-11 01:40:59 +0000
committerernstm@chromium.org <ernstm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-11 01:40:59 +0000
commitbdd35efadaa30b110d94d188d541d208b252a662 (patch)
tree42a89170576f1f37905b7efe0f076310cfc9120d
parent39ef0a7c5702b00d8a502f58fce6c6ab503b5496 (diff)
downloadchromium_src-bdd35efadaa30b110d94d188d541d208b252a662.zip
chromium_src-bdd35efadaa30b110d94d188d541d208b252a662.tar.gz
chromium_src-bdd35efadaa30b110d94d188d541d208b252a662.tar.bz2
cc: fix pre-painting trigger for GPU rasterization
CUTOFF_ALLOW_NICE_TO_HAVE was only triggered for --force-gpu-rasterization. This patch triggers it when the active or the pending tree uses GPU rasterization. In case of a transition between CPU and GPU rasterization it is preferrable to pre-paint less on the CPU rasterized tree (which may checkerboard) than it is to pre-paint more on the GPU rasterized tree (which may stall the browser compositor). This patch depends on https://codereview.chromium.org/270823003/ R=enne@chromium.org, alokp@chromium.org BUG=368884 Review URL: https://codereview.chromium.org/272033002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269682 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/trees/layer_tree_host_impl.cc8
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc12
2 files changed, 10 insertions, 10 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 1cd0d05..171880e 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1770,13 +1770,13 @@ void LayerTreeHostImpl::SetNeedsRedraw() {
ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const {
ManagedMemoryPolicy actual = cached_managed_memory_policy_;
- // TODO(ernstm): NICE_TO_HAVE is currently triggered for forced GPU
- // rasterization only. Change the trigger to LTHI::UseGpuRasterization, once
- // that is implemented.
+ bool any_tree_use_gpu_rasterization =
+ (active_tree_ && active_tree_->use_gpu_rasterization()) ||
+ (pending_tree_ && pending_tree_->use_gpu_rasterization());
if (debug_state_.rasterize_only_visible_content) {
actual.priority_cutoff_when_visible =
gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY;
- } else if (settings_.gpu_rasterization_forced) {
+ } else if (any_tree_use_gpu_rasterization) {
actual.priority_cutoff_when_visible =
gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
}
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 02f383f..3181410 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -5767,9 +5767,9 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
- // GPU rasterization should be disabled by default.
- EXPECT_FALSE(host_impl_->settings().gpu_rasterization_enabled);
- EXPECT_FALSE(host_impl_->settings().gpu_rasterization_forced);
+ // GPU rasterization should be disabled by default on the tree(s)
+ EXPECT_FALSE(host_impl_->active_tree()->use_gpu_rasterization());
+ EXPECT_TRUE(host_impl_->pending_tree() == NULL);
host_impl_->SetVisible(true);
host_impl_->SetMemoryPolicy(policy1);
@@ -5784,13 +5784,13 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
- // Now enable GPU rasterization and test if we get required only cutoff,
+ // Now enable GPU rasterization and test if we get nice to have cutoff,
// when visible.
LayerTreeSettings settings;
- settings.gpu_rasterization_forced = true;
+ settings.gpu_rasterization_enabled = true;
host_impl_ = LayerTreeHostImpl::Create(
settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
-
+ host_impl_->active_tree()->SetUseGpuRasterization(true);
host_impl_->SetVisible(true);
host_impl_->SetMemoryPolicy(policy1);
EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);