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

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: Rebase to ToT 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_for_gpu_rasterization_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 // LayerTreeHost may have changed the GPU rasterization flags state, which
313 // may require an update of the tree resources.
314 UpdateTreeResourcesForGpuRasterizationIfNeeded();
312 sync_tree()->set_needs_update_draw_properties(); 315 sync_tree()->set_needs_update_draw_properties();
313 316
314 if (settings_.impl_side_painting) { 317 if (settings_.impl_side_painting) {
315 // Impl-side painting needs an update immediately post-commit to have the 318 // Impl-side painting needs an update immediately post-commit to have the
316 // opportunity to create tilings. Other paths can call UpdateDrawProperties 319 // opportunity to create tilings. Other paths can call UpdateDrawProperties
317 // more lazily when needed prior to drawing. Because invalidations may 320 // 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 321 // 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. 322 // at this point and see if lcd text needs to be disabled on any layers.
320 bool update_lcd_text = true; 323 bool update_lcd_text = true;
321 sync_tree()->UpdateDrawProperties(update_lcd_text); 324 sync_tree()->UpdateDrawProperties(update_lcd_text);
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 } 1642 }
1640 1643
1641 if (use_gpu == use_gpu_rasterization_ && use_msaa == use_msaa_) 1644 if (use_gpu == use_gpu_rasterization_ && use_msaa == use_msaa_)
1642 return; 1645 return;
1643 1646
1644 // Note that this must happen first, in case the rest of the calls want to 1647 // Note that this must happen first, in case the rest of the calls want to
1645 // query the new state of |use_gpu_rasterization_|. 1648 // query the new state of |use_gpu_rasterization_|.
1646 use_gpu_rasterization_ = use_gpu; 1649 use_gpu_rasterization_ = use_gpu;
1647 use_msaa_ = use_msaa; 1650 use_msaa_ = use_msaa;
1648 1651
1652 tree_resources_for_gpu_rasterization_dirty_ = true;
1653 }
1654
1655 void LayerTreeHostImpl::UpdateTreeResourcesForGpuRasterizationIfNeeded() {
1656 if (!tree_resources_for_gpu_rasterization_dirty_)
1657 return;
1658
1649 // Clean up and replace existing tile manager with another one that uses 1659 // Clean up and replace existing tile manager with another one that uses
1650 // appropriate rasterizer. 1660 // appropriate rasterizer.
1651 ReleaseTreeResources(); 1661 ReleaseTreeResources();
1652 if (tile_manager_) { 1662 if (tile_manager_) {
1653 DestroyTileManager(); 1663 DestroyTileManager();
1654 CreateAndSetTileManager(); 1664 CreateAndSetTileManager();
1655 } 1665 }
1656 RecreateTreeResources(); 1666 RecreateTreeResources();
1657 1667
1658 // We have released tilings for both active and pending tree. 1668 // We have released tilings for both active and pending tree.
1659 // We would not have any content to draw until the pending tree is activated. 1669 // We would not have any content to draw until the pending tree is activated.
1660 // Prevent the active tree from drawing until activation. 1670 // Prevent the active tree from drawing until activation.
1661 SetRequiresHighResToDraw(); 1671 SetRequiresHighResToDraw();
1672
1673 tree_resources_for_gpu_rasterization_dirty_ = false;
1662 } 1674 }
1663 1675
1664 const RendererCapabilitiesImpl& 1676 const RendererCapabilitiesImpl&
1665 LayerTreeHostImpl::GetRendererCapabilities() const { 1677 LayerTreeHostImpl::GetRendererCapabilities() const {
1666 CHECK(renderer_); 1678 CHECK(renderer_);
1667 return renderer_->Capabilities(); 1679 return renderer_->Capabilities();
1668 } 1680 }
1669 1681
1670 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { 1682 bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
1671 ResetRequiresHighResToDraw(); 1683 ResetRequiresHighResToDraw();
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 this, &settings_.renderer_settings, output_surface_.get(), 2020 this, &settings_.renderer_settings, output_surface_.get(),
2009 resource_provider_.get(), texture_mailbox_deleter_.get(), 2021 resource_provider_.get(), texture_mailbox_deleter_.get(),
2010 settings_.renderer_settings.highp_threshold_min); 2022 settings_.renderer_settings.highp_threshold_min);
2011 } else if (output_surface_->software_device()) { 2023 } else if (output_surface_->software_device()) {
2012 renderer_ = SoftwareRenderer::Create(this, &settings_.renderer_settings, 2024 renderer_ = SoftwareRenderer::Create(this, &settings_.renderer_settings,
2013 output_surface_.get(), 2025 output_surface_.get(),
2014 resource_provider_.get()); 2026 resource_provider_.get());
2015 } 2027 }
2016 DCHECK(renderer_); 2028 DCHECK(renderer_);
2017 2029
2018 // Since the new renderer may be capable of MSAA, update status here.
2019 UpdateGpuRasterizationStatus();
2020 renderer_->SetVisible(visible_); 2030 renderer_->SetVisible(visible_);
2021 SetFullRootLayerDamage(); 2031 SetFullRootLayerDamage();
2022 2032
2023 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be 2033 // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs to be
2024 // initialized to get max texture size. Also, after releasing resources, 2034 // initialized to get max texture size. Also, after releasing resources,
2025 // trees need another update to generate new ones. 2035 // trees need another update to generate new ones.
2026 active_tree_->set_needs_update_draw_properties(); 2036 active_tree_->set_needs_update_draw_properties();
2027 if (pending_tree_) 2037 if (pending_tree_)
2028 pending_tree_->set_needs_update_draw_properties(); 2038 pending_tree_->set_needs_update_draw_properties();
2029 client_->UpdateRendererCapabilitiesOnImplThread(); 2039 client_->UpdateRendererCapabilitiesOnImplThread();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 output_surface_ = output_surface.Pass(); 2204 output_surface_ = output_surface.Pass();
2195 resource_provider_ = ResourceProvider::Create( 2205 resource_provider_ = ResourceProvider::Create(
2196 output_surface_.get(), shared_bitmap_manager_, gpu_memory_buffer_manager_, 2206 output_surface_.get(), shared_bitmap_manager_, gpu_memory_buffer_manager_,
2197 proxy_->blocking_main_thread_task_runner(), 2207 proxy_->blocking_main_thread_task_runner(),
2198 settings_.renderer_settings.highp_threshold_min, 2208 settings_.renderer_settings.highp_threshold_min,
2199 settings_.renderer_settings.use_rgba_4444_textures, 2209 settings_.renderer_settings.use_rgba_4444_textures,
2200 settings_.renderer_settings.texture_id_allocation_chunk_size); 2210 settings_.renderer_settings.texture_id_allocation_chunk_size);
2201 2211
2202 CreateAndSetRenderer(); 2212 CreateAndSetRenderer();
2203 2213
2214 // Since the new renderer may be capable of MSAA, update status here.
2215 UpdateGpuRasterizationStatus();
2216
2204 if (settings_.impl_side_painting && settings_.raster_enabled) 2217 if (settings_.impl_side_painting && settings_.raster_enabled)
2205 CreateAndSetTileManager(); 2218 CreateAndSetTileManager();
2206 RecreateTreeResources(); 2219 RecreateTreeResources();
2207 2220
2208 // Initialize vsync parameters to sane values. 2221 // Initialize vsync parameters to sane values.
2209 const base::TimeDelta display_refresh_interval = 2222 const base::TimeDelta display_refresh_interval =
2210 base::TimeDelta::FromMicroseconds( 2223 base::TimeDelta::FromMicroseconds(
2211 base::Time::kMicrosecondsPerSecond / 2224 base::Time::kMicrosecondsPerSecond /
2212 settings_.renderer_settings.refresh_rate); 2225 settings_.renderer_settings.refresh_rate);
2213 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval); 2226 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval);
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3421 new_target.SetToMin(layer_impl->MaxScrollOffset()); 3434 new_target.SetToMin(layer_impl->MaxScrollOffset());
3422 3435
3423 curve->UpdateTarget( 3436 curve->UpdateTarget(
3424 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) 3437 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time)
3425 .InSecondsF(), 3438 .InSecondsF(),
3426 new_target); 3439 new_target);
3427 3440
3428 return true; 3441 return true;
3429 } 3442 }
3430 } // namespace cc 3443 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698