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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1131633003: cc: Use multiple PrepareTiles approaches Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix raster source detection Created 5 years, 7 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_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index d421f84b00c7418f24d41fda48980fa37ef86b96..3a93a670fee0fe69ef388934412882ef07a045e2 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -324,7 +324,8 @@ void LayerTreeHostImpl::CommitComplete() {
sync_tree()->UpdateDrawProperties(update_lcd_text);
// Start working on newly created tiles immediately if needed.
if (tile_manager_ && tile_priorities_dirty_) {
- PrepareTiles();
+ bool for_commit = true;
+ client_->SetNeedsPrepareTilesOnImplThread(for_commit);
} else {
NotifyReadyToActivate();
@@ -406,6 +407,12 @@ void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
}
void LayerTreeHostImpl::PrepareTiles() {
+ bool update_lcd_text = false;
+ if (pending_tree_)
+ pending_tree_->UpdateDrawProperties(update_lcd_text);
+ if (active_tree_)
+ active_tree_->UpdateDrawProperties(update_lcd_text);
+
if (!tile_manager_)
return;
if (!tile_priorities_dirty_)
@@ -413,8 +420,6 @@ void LayerTreeHostImpl::PrepareTiles() {
tile_priorities_dirty_ = false;
tile_manager_->PrepareTiles(global_tile_state_);
-
- client_->DidPrepareTiles();
}
void LayerTreeHostImpl::StartPageScaleAnimation(
@@ -790,6 +795,7 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
const DrawMode draw_mode = GetDrawMode();
+ int num_layers_missing_raster_source = 0;
int num_missing_tiles = 0;
int num_incomplete_tiles = 0;
bool have_copy_request = false;
@@ -872,10 +878,16 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
rendering_stats_instrumentation_->AddCheckerboardedVisibleContentArea(
append_quads_data.checkerboarded_visible_content_area);
+ if (!append_quads_data.raster_source_covers_visible_high_res_tiles)
+ num_layers_missing_raster_source++;
+
num_missing_tiles += append_quads_data.num_missing_tiles;
num_incomplete_tiles += append_quads_data.num_incomplete_tiles;
if (append_quads_data.num_missing_tiles) {
+ // TODO(brianderson): Figure out what to do in this case and
+ // differentiate and prioritize scroll wheel, touch scroll, and
+ // animations.
bool layer_has_animating_transform =
it->screen_space_transform_is_animating() ||
it->draw_transform_is_animating();
@@ -884,24 +896,28 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
}
}
- if (have_missing_animated_tiles)
- draw_result = DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
-
- // When we require high res to draw, abort the draw (almost) always. This does
- // not cause the scheduler to do a main frame, instead it will continue to try
- // drawing until we finally complete, so the copy request will not be lost.
- // TODO(weiliangc): Remove RequiresHighResToDraw. crbug.com/469175
- if (num_incomplete_tiles || num_missing_tiles) {
- if (RequiresHighResToDraw())
- draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT;
- }
-
- // When this capability is set we don't have control over the surface the
- // compositor draws to, so even though the frame may not be complete, the
- // previous frame has already been potentially lost, so an incomplete frame is
- // better than nothing, so this takes highest precidence.
- if (output_surface_->capabilities().draw_and_swap_full_viewport_every_frame)
+ if (output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) {
+ // When this capability is set we don't have control over the surface the
+ // compositor draws to, so even though the frame may not be complete, the
+ // previous frame has already been potentially lost, so an incomplete frame
+ // is
+ // better than nothing, so this takes highest precidence.
+ // TODO(brianderson): Use a forced draw instead of lying about the draw
+ // result.
draw_result = DRAW_SUCCESS;
+ } else if (num_layers_missing_raster_source) {
+ TRACE_EVENT_INSTANT0("cc", "Raster missing source.",
+ TRACE_EVENT_SCOPE_THREAD);
+ draw_result = DRAW_ABORTED_MISSING_RASTER_SOURCE;
enne (OOO) 2015/05/19 22:53:41 Is it possible to separate this change into two pa
brianderson 2015/05/20 01:33:17 Definitely need to split this patch up - I'll see
+ } else if (num_missing_tiles) {
+ TRACE_EVENT_INSTANT0("cc", "Raster missing output.",
+ TRACE_EVENT_SCOPE_THREAD);
+ draw_result = DRAW_ABORTED_MISSING_RASTER_OUTPUT_ANY;
+ } else if (num_incomplete_tiles) {
+ TRACE_EVENT_INSTANT0("cc", "Raster missing high res.",
+ TRACE_EVENT_SCOPE_THREAD);
+ draw_result = DRAW_ABORTED_MISSING_RASTER_OUTPUT_HIGH_RES;
+ }
#if DCHECK_IS_ON()
for (const auto& render_pass : frame->render_passes) {
@@ -1220,7 +1236,8 @@ void LayerTreeHostImpl::DidModifyTilePriorities() {
DCHECK(settings_.impl_side_painting);
// Mark priorities as dirty and schedule a PrepareTiles().
tile_priorities_dirty_ = true;
- client_->SetNeedsPrepareTilesOnImplThread();
+ bool for_commit = false;
+ client_->SetNeedsPrepareTilesOnImplThread(for_commit);
}
scoped_ptr<RasterTilePriorityQueue> LayerTreeHostImpl::BuildRasterQueue(
@@ -1668,7 +1685,7 @@ void LayerTreeHostImpl::UpdateTreeResourcesForGpuRasterizationIfNeeded() {
// We have released tilings for both active and pending tree.
// We would not have any content to draw until the pending tree is activated.
// Prevent the active tree from drawing until activation.
- SetRequiresHighResToDraw();
+ SetRequiresHighResToDraw(true);
tree_resources_for_gpu_rasterization_dirty_ = false;
}
@@ -1680,7 +1697,7 @@ LayerTreeHostImpl::GetRendererCapabilities() const {
}
bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
- ResetRequiresHighResToDraw();
+ SetRequiresHighResToDraw(false);
if (frame.has_no_damage) {
active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS);
return false;
@@ -1942,15 +1959,10 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
// If we just became visible, we have to ensure that we draw high res tiles,
// to prevent checkerboard/low res flashes.
if (visible_)
- SetRequiresHighResToDraw();
+ SetRequiresHighResToDraw(true);
else
EvictAllUIResources();
- // Evict tiles immediately if invisible since this tab may never get another
- // draw or timer tick.
- if (!visible_)
- PrepareTiles();
-
if (!renderer_)
return;
@@ -2242,7 +2254,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
// There will not be anything to draw here, so set high res
// to avoid checkerboards, typically when we are recovering
// from lost context.
- SetRequiresHighResToDraw();
+ SetRequiresHighResToDraw(true);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698