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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 733773005: cc: GPU rasterize tiles synchronously in PrepareToDraw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant completed_tasks_.clear() Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (pending_tree_) 321 if (pending_tree_)
322 pending_tree_->ApplyScrollDeltasSinceBeginMainFrame(); 322 pending_tree_->ApplyScrollDeltasSinceBeginMainFrame();
323 sync_tree()->set_needs_update_draw_properties(); 323 sync_tree()->set_needs_update_draw_properties();
324 324
325 if (settings_.impl_side_painting) { 325 if (settings_.impl_side_painting) {
326 // Impl-side painting needs an update immediately post-commit to have the 326 // Impl-side painting needs an update immediately post-commit to have the
327 // opportunity to create tilings. Other paths can call UpdateDrawProperties 327 // opportunity to create tilings. Other paths can call UpdateDrawProperties
328 // more lazily when needed prior to drawing. 328 // more lazily when needed prior to drawing.
329 sync_tree()->UpdateDrawProperties(); 329 sync_tree()->UpdateDrawProperties();
330 // Start working on newly created tiles immediately if needed. 330 // Start working on newly created tiles immediately if needed.
331 if (tile_manager_ && tile_priorities_dirty_) 331 if (tile_manager_ && tile_priorities_dirty_ && !use_gpu_rasterization_)
vmiura 2014/11/20 02:27:11 Remove check for use_gpu_rasterization_, as we che
vmiura 2014/11/20 02:53:45 I take that back, since we need to run the "else"
332 ManageTiles(); 332 ManageTiles();
333 else 333 else
334 NotifyReadyToActivate(); 334 NotifyReadyToActivate();
335 } else { 335 } else {
336 // If we're not in impl-side painting, the tree is immediately considered 336 // If we're not in impl-side painting, the tree is immediately considered
337 // active. 337 // active.
338 ActivateSyncTree(); 338 ActivateSyncTree();
339 } 339 }
340 340
341 micro_benchmark_controller_.DidCompleteCommit(); 341 micro_benchmark_controller_.DidCompleteCommit();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { 396 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
397 if (input_handler_client_) 397 if (input_handler_client_)
398 input_handler_client_->Animate(monotonic_time); 398 input_handler_client_->Animate(monotonic_time);
399 AnimatePageScale(monotonic_time); 399 AnimatePageScale(monotonic_time);
400 AnimateLayers(monotonic_time); 400 AnimateLayers(monotonic_time);
401 AnimateScrollbars(monotonic_time); 401 AnimateScrollbars(monotonic_time);
402 AnimateTopControls(monotonic_time); 402 AnimateTopControls(monotonic_time);
403 } 403 }
404 404
405 void LayerTreeHostImpl::RasterizeTiles() {
406 if (!tile_manager_)
407 return;
408 if (!tile_priorities_dirty_)
409 return;
410
411 tile_priorities_dirty_ = false;
412 tile_manager_->RasterizeTiles(global_tile_state_);
413 }
414
405 void LayerTreeHostImpl::ManageTiles() { 415 void LayerTreeHostImpl::ManageTiles() {
406 if (!tile_manager_) 416 if (!tile_manager_)
407 return; 417 return;
408 if (!tile_priorities_dirty_) 418 if (!tile_priorities_dirty_)
409 return; 419 return;
420 if (use_gpu_rasterization_)
421 return;
410 422
411 tile_priorities_dirty_ = false; 423 tile_priorities_dirty_ = false;
412 tile_manager_->ManageTiles(global_tile_state_); 424 tile_manager_->ManageTiles(global_tile_state_);
413 425
414 client_->DidManageTiles(); 426 client_->DidManageTiles();
415 } 427 }
416 428
417 bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt( 429 bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt(
418 const gfx::Point& viewport_point, 430 const gfx::Point& viewport_point,
419 InputHandler::ScrollInputType type) { 431 InputHandler::ScrollInputType type) {
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // as part of the current frame being drawn. 1049 // as part of the current frame being drawn.
1038 if (settings().impl_side_painting) 1050 if (settings().impl_side_painting)
1039 tile_manager_->UpdateVisibleTiles(); 1051 tile_manager_->UpdateVisibleTiles();
1040 1052
1041 UMA_HISTOGRAM_CUSTOM_COUNTS( 1053 UMA_HISTOGRAM_CUSTOM_COUNTS(
1042 "Compositing.NumActiveLayers", active_tree_->NumLayers(), 1, 400, 20); 1054 "Compositing.NumActiveLayers", active_tree_->NumLayers(), 1, 400, 20);
1043 1055
1044 bool ok = active_tree_->UpdateDrawProperties(); 1056 bool ok = active_tree_->UpdateDrawProperties();
1045 DCHECK(ok) << "UpdateDrawProperties failed during draw"; 1057 DCHECK(ok) << "UpdateDrawProperties failed during draw";
1046 1058
1059 if (use_gpu_rasterization_)
1060 RasterizeTiles();
brianderson 2014/11/20 02:40:19 Should we only RasterizeTiles if draw_result == DR
reveman 2014/11/20 15:20:59 How you considered rasterizing at draw time instea
vmiura 2014/11/20 18:28:57 I put it here in the prototype as it needs to be d
reveman 2014/11/20 19:07:54 Why before CalculateRenderPasses()?
1061
1047 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); 1062 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList();
1048 frame->render_passes.clear(); 1063 frame->render_passes.clear();
1049 frame->render_passes_by_id.clear(); 1064 frame->render_passes_by_id.clear();
1050 frame->will_draw_layers.clear(); 1065 frame->will_draw_layers.clear();
1051 frame->has_no_damage = false; 1066 frame->has_no_damage = false;
1052 1067
1053 if (active_tree_->root_layer()) { 1068 if (active_tree_->root_layer()) {
1054 gfx::Rect device_viewport_damage_rect = viewport_damage_rect_; 1069 gfx::Rect device_viewport_damage_rect = viewport_damage_rect_;
1055 viewport_damage_rect_ = gfx::Rect(); 1070 viewport_damage_rect_ = gfx::Rect();
1056 1071
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 1843
1829 // If we just became visible, we have to ensure that we draw high res tiles, 1844 // If we just became visible, we have to ensure that we draw high res tiles,
1830 // to prevent checkerboard/low res flashes. 1845 // to prevent checkerboard/low res flashes.
1831 if (visible_) 1846 if (visible_)
1832 SetRequiresHighResToDraw(); 1847 SetRequiresHighResToDraw();
1833 else 1848 else
1834 EvictAllUIResources(); 1849 EvictAllUIResources();
1835 1850
1836 // Evict tiles immediately if invisible since this tab may never get another 1851 // Evict tiles immediately if invisible since this tab may never get another
1837 // draw or timer tick. 1852 // draw or timer tick.
1838 if (!visible_) 1853 if (!visible_ && !use_gpu_rasterization_)
vmiura 2014/11/20 02:27:11 Remove check for use_gpu_rasterization_, as we che
1839 ManageTiles(); 1854 ManageTiles();
1840 1855
1841 if (!renderer_) 1856 if (!renderer_)
1842 return; 1857 return;
1843 1858
1844 renderer_->SetVisible(visible); 1859 renderer_->SetVisible(visible);
1845 } 1860 }
1846 1861
1847 void LayerTreeHostImpl::SetNeedsAnimate() { 1862 void LayerTreeHostImpl::SetNeedsAnimate() {
1848 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); 1863 NotifySwapPromiseMonitorsOfSetNeedsRedraw();
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 } 3457 }
3443 3458
3444 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3459 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3445 std::vector<PictureLayerImpl*>::iterator it = 3460 std::vector<PictureLayerImpl*>::iterator it =
3446 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3461 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3447 DCHECK(it != picture_layers_.end()); 3462 DCHECK(it != picture_layers_.end());
3448 picture_layers_.erase(it); 3463 picture_layers_.erase(it);
3449 } 3464 }
3450 3465
3451 } // namespace cc 3466 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698