Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4203)

Unified Diff: cc/trees/layer_tree_host.cc

Issue 2108033004: cc: Re-enable GPU rasterization after content veto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 903236ec060f00df4cf06b52e4188581bda9c359..c68e9f525224e135f45fb0191ea672f5d028652d 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -775,6 +775,7 @@ void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
// This flag is sticky until a new tree comes along.
content_is_suitable_for_gpu_rasterization_ = true;
gpu_rasterization_histogram_recorded_ = false;
+ num_times_gpu_rasterization_reenabled_ = 0;
SetNeedsFullTreeSync();
}
@@ -1050,11 +1051,23 @@ bool LayerTreeHost::DoUpdateLayers(Layer* root_layer) {
base::AutoReset<bool> painting(&in_paint_layer_contents_, true);
bool did_paint_content = false;
+ bool old_content_is_suitable_for_gpu_rasterization =
+ content_is_suitable_for_gpu_rasterization_;
+ // Every |kFramePeriodToReeanbleGpuRasterization|, try to re-enable GPU
+ // raserization. Only do this if we haven't re-enabled it too many times.
+ if ((source_frame_number_ % kFramePeriodToReeanbleGpuRasterization) == 0 &&
enne (OOO) 2016/06/30 01:02:24 I think it might be safer to say "if the last N fr
+ num_times_gpu_rasterization_reenabled_ <
+ kMaxTimesToEnableGpuRasterization) {
+ content_is_suitable_for_gpu_rasterization_ = true;
ericrk 2016/06/30 18:46:00 Can we always set this to true? Or do we want to c
+ }
for (const auto& layer : update_layer_list) {
did_paint_content |= layer->Update();
content_is_suitable_for_gpu_rasterization_ &=
layer->IsSuitableForGpuRasterization();
}
+ num_times_gpu_rasterization_reenabled_ +=
+ !old_content_is_suitable_for_gpu_rasterization &&
+ content_is_suitable_for_gpu_rasterization_;
return did_paint_content;
}

Powered by Google App Engine
This is Rietveld 408576698