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

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: 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 61253372be19003f42f111f0856321cc61acb389..5ad085c8aaf1925bd0e68289aab5db940385401e 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -321,7 +321,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();
@@ -410,8 +411,6 @@ void LayerTreeHostImpl::PrepareTiles() {
tile_priorities_dirty_ = false;
tile_manager_->PrepareTiles(global_tile_state_);
-
- client_->DidPrepareTiles();
}
void LayerTreeHostImpl::StartPageScaleAnimation(
@@ -787,6 +786,7 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
const DrawMode draw_mode = GetDrawMode();
+ int num_tiles_missing_raster_source = 0;
int num_missing_tiles = 0;
int num_incomplete_tiles = 0;
bool have_copy_request = false;
@@ -869,10 +869,15 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
rendering_stats_instrumentation_->AddCheckerboardedVisibleContentArea(
append_quads_data.checkerboarded_visible_content_area);
+ num_tiles_missing_raster_source +=
+ append_quads_data.num_tiles_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();
@@ -881,24 +886,22 @@ 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_tiles_missing_raster_source) {
+ draw_result = DRAW_ABORTED_MISSING_RASTER_SOURCE;
+ } else if (num_missing_tiles) {
+ draw_result = DRAW_ABORTED_MISSING_RASTER_OUTPUT_ANY;
+ } else if (num_incomplete_tiles) {
+ draw_result = DRAW_ABORTED_MISSING_RASTER_OUTPUT_HIGH_RES;
+ }
#if DCHECK_IS_ON()
for (const auto& render_pass : frame->render_passes) {
@@ -1217,7 +1220,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(
@@ -1633,7 +1637,7 @@ void LayerTreeHostImpl::UpdateGpuRasterizationStatus() {
// 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);
}
const RendererCapabilitiesImpl&
@@ -1643,7 +1647,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;
@@ -1905,15 +1909,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;
@@ -2204,7 +2203,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