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

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

Issue 1134123005: cc: split UpdateGpuRasterizationStatus() into two parts. (Closed) 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 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 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 188 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
189 TaskGraphRunner* task_graph_runner, 189 TaskGraphRunner* task_graph_runner,
190 int id) 190 int id)
191 : client_(client), 191 : client_(client),
192 proxy_(proxy), 192 proxy_(proxy),
193 content_is_suitable_for_gpu_rasterization_(true), 193 content_is_suitable_for_gpu_rasterization_(true),
194 has_gpu_rasterization_trigger_(false), 194 has_gpu_rasterization_trigger_(false),
195 use_gpu_rasterization_(false), 195 use_gpu_rasterization_(false),
196 use_msaa_(false), 196 use_msaa_(false),
197 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), 197 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE),
198 tree_resources_dirty_(false),
198 input_handler_client_(NULL), 199 input_handler_client_(NULL),
199 did_lock_scrolling_layer_(false), 200 did_lock_scrolling_layer_(false),
200 should_bubble_scrolls_(false), 201 should_bubble_scrolls_(false),
201 wheel_scrolling_(false), 202 wheel_scrolling_(false),
202 scroll_affects_scroll_handler_(false), 203 scroll_affects_scroll_handler_(false),
203 scroll_layer_id_when_mouse_over_scrollbar_(0), 204 scroll_layer_id_when_mouse_over_scrollbar_(0),
204 tile_priorities_dirty_(false), 205 tile_priorities_dirty_(false),
205 root_layer_scroll_offset_delegate_(NULL), 206 root_layer_scroll_offset_delegate_(NULL),
206 settings_(settings), 207 settings_(settings),
207 visible_(true), 208 visible_(true),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (!settings_.impl_side_painting && output_surface_) 302 if (!settings_.impl_side_painting && output_surface_)
302 output_surface_->ForceReclaimResources(); 303 output_surface_->ForceReclaimResources();
303 304
304 if (settings_.impl_side_painting && !proxy_->CommitToActiveTree()) 305 if (settings_.impl_side_painting && !proxy_->CommitToActiveTree())
305 CreatePendingTree(); 306 CreatePendingTree();
306 } 307 }
307 308
308 void LayerTreeHostImpl::CommitComplete() { 309 void LayerTreeHostImpl::CommitComplete() {
309 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); 310 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
310 311
311 UpdateGpuRasterizationStatus(); 312 UpdateTreeResourcesIfNeeded();
danakj 2015/05/13 19:50:58 I would UpdateGpuRasterizationStatus() here then U
Stephen White 2015/05/13 20:15:20 Having to remember to call UpdateGpuRasterizationS
312 sync_tree()->set_needs_update_draw_properties(); 313 sync_tree()->set_needs_update_draw_properties();
313 314
314 if (settings_.impl_side_painting) { 315 if (settings_.impl_side_painting) {
315 // Impl-side painting needs an update immediately post-commit to have the 316 // Impl-side painting needs an update immediately post-commit to have the
316 // opportunity to create tilings. Other paths can call UpdateDrawProperties 317 // opportunity to create tilings. Other paths can call UpdateDrawProperties
317 // more lazily when needed prior to drawing. Because invalidations may 318 // more lazily when needed prior to drawing. Because invalidations may
318 // be coming from the main thread, it's safe to do an update for lcd text 319 // be coming from the main thread, it's safe to do an update for lcd text
319 // at this point and see if lcd text needs to be disabled on any layers. 320 // at this point and see if lcd text needs to be disabled on any layers.
320 bool update_lcd_text = true; 321 bool update_lcd_text = true;
321 sync_tree()->UpdateDrawProperties(update_lcd_text); 322 sync_tree()->UpdateDrawProperties(update_lcd_text);
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1615 }
1615 1616
1616 if (use_gpu == use_gpu_rasterization_ && use_msaa == use_msaa_) 1617 if (use_gpu == use_gpu_rasterization_ && use_msaa == use_msaa_)
1617 return; 1618 return;
1618 1619
1619 // Note that this must happen first, in case the rest of the calls want to 1620 // Note that this must happen first, in case the rest of the calls want to
1620 // query the new state of |use_gpu_rasterization_|. 1621 // query the new state of |use_gpu_rasterization_|.
1621 use_gpu_rasterization_ = use_gpu; 1622 use_gpu_rasterization_ = use_gpu;
1622 use_msaa_ = use_msaa; 1623 use_msaa_ = use_msaa;
1623 1624
1625 tree_resources_dirty_ = true;
1626 }
1627
1628 void LayerTreeHostImpl::UpdateTreeResourcesIfNeeded() {
1629 if (!tree_resources_dirty_) {
danakj 2015/05/13 19:50:58 We need to do the following stuff unconditionally
danakj 2015/05/13 19:53:45 Oh no I'm mistaken, the unconditional of the follo
Stephen White 2015/05/13 20:15:20 Yeah, it was conditional before in both cases. I'v
1630 return;
1631 }
1632
1624 // Clean up and replace existing tile manager with another one that uses 1633 // Clean up and replace existing tile manager with another one that uses
1625 // appropriate rasterizer. 1634 // appropriate rasterizer.
1626 ReleaseTreeResources(); 1635 ReleaseTreeResources();
1627 if (tile_manager_) { 1636 if (tile_manager_) {
1628 DestroyTileManager(); 1637 DestroyTileManager();
1629 CreateAndSetTileManager(); 1638 CreateAndSetTileManager();
1630 } 1639 }
1631 RecreateTreeResources(); 1640 RecreateTreeResources();
1632 1641
1633 // We have released tilings for both active and pending tree. 1642 // We have released tilings for both active and pending tree.
1634 // We would not have any content to draw until the pending tree is activated. 1643 // We would not have any content to draw until the pending tree is activated.
1635 // Prevent the active tree from drawing until activation. 1644 // Prevent the active tree from drawing until activation.
1636 SetRequiresHighResToDraw(); 1645 SetRequiresHighResToDraw();
1646
1647 tree_resources_dirty_ = false;
1637 } 1648 }
1638 1649
1639 const RendererCapabilitiesImpl& 1650 const RendererCapabilitiesImpl&
1640 LayerTreeHostImpl::GetRendererCapabilities() const { 1651 LayerTreeHostImpl::GetRendererCapabilities() const {
1641 CHECK(renderer_); 1652 CHECK(renderer_);
1642 return renderer_->Capabilities(); 1653 return renderer_->Capabilities();
1643 } 1654 }
1644 1655
1645 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { 1656 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
1646 ResetRequiresHighResToDraw(); 1657 ResetRequiresHighResToDraw();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 resource_provider_.get(), texture_mailbox_deleter_.get(), 1995 resource_provider_.get(), texture_mailbox_deleter_.get(),
1985 settings_.renderer_settings.highp_threshold_min); 1996 settings_.renderer_settings.highp_threshold_min);
1986 } else if (output_surface_->software_device()) { 1997 } else if (output_surface_->software_device()) {
1987 renderer_ = SoftwareRenderer::Create(this, &settings_.renderer_settings, 1998 renderer_ = SoftwareRenderer::Create(this, &settings_.renderer_settings,
1988 output_surface_.get(), 1999 output_surface_.get(),
1989 resource_provider_.get()); 2000 resource_provider_.get());
1990 } 2001 }
1991 DCHECK(renderer_); 2002 DCHECK(renderer_);
1992 2003
1993 // Since the new renderer may be capable of MSAA, update status here. 2004 // Since the new renderer may be capable of MSAA, update status here.
1994 UpdateGpuRasterizationStatus(); 2005 UpdateGpuRasterizationStatus();
danakj 2015/05/13 19:50:58 Move this out to InitializeRenderer?
Stephen White 2015/05/13 20:15:20 Done.
2006 UpdateTreeResourcesIfNeeded();
Stephen White 2015/05/13 20:15:20 I see now that InitializeRenderer() is doing Relea
2007
1995 renderer_->SetVisible(visible_); 2008 renderer_->SetVisible(visible_);
1996 SetFullRootLayerDamage(); 2009 SetFullRootLayerDamage();
1997 2010
1998 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be 2011 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be
1999 // initialized to get max texture size. Also, after releasing resources, 2012 // initialized to get max texture size. Also, after releasing resources,
2000 // trees need another update to generate new ones. 2013 // trees need another update to generate new ones.
2001 active_tree_->set_needs_update_draw_properties(); 2014 active_tree_->set_needs_update_draw_properties();
2002 if (pending_tree_) 2015 if (pending_tree_)
2003 pending_tree_->set_needs_update_draw_properties(); 2016 pending_tree_->set_needs_update_draw_properties();
2004 client_->UpdateRendererCapabilitiesOnImplThread(); 2017 client_->UpdateRendererCapabilitiesOnImplThread();
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3399 new_target.SetToMin(layer_impl->MaxScrollOffset()); 3412 new_target.SetToMin(layer_impl->MaxScrollOffset());
3400 3413
3401 curve->UpdateTarget( 3414 curve->UpdateTarget(
3402 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) 3415 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time)
3403 .InSecondsF(), 3416 .InSecondsF(),
3404 new_target); 3417 new_target);
3405 3418
3406 return true; 3419 return true;
3407 } 3420 }
3408 } // namespace cc 3421 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698