OLD | NEW |
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 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 pending_tree_->ReleaseResources(); | 1800 pending_tree_->ReleaseResources(); |
1801 if (recycle_tree_) | 1801 if (recycle_tree_) |
1802 recycle_tree_->ReleaseResources(); | 1802 recycle_tree_->ReleaseResources(); |
1803 | 1803 |
1804 EvictAllUIResources(); | 1804 EvictAllUIResources(); |
1805 } | 1805 } |
1806 | 1806 |
1807 void LayerTreeHostImpl::CreateAndSetRenderer( | 1807 void LayerTreeHostImpl::CreateAndSetRenderer( |
1808 OutputSurface* output_surface, | 1808 OutputSurface* output_surface, |
1809 ResourceProvider* resource_provider, | 1809 ResourceProvider* resource_provider, |
1810 bool skip_gl_renderer) { | 1810 bool force_software_renderer) { |
1811 DCHECK(!renderer_); | 1811 DCHECK(!renderer_); |
1812 if (output_surface->capabilities().delegated_rendering) { | 1812 if (output_surface->capabilities().delegated_rendering && |
| 1813 !force_software_renderer) { |
1813 renderer_ = DelegatingRenderer::Create( | 1814 renderer_ = DelegatingRenderer::Create( |
1814 this, &settings_, output_surface, resource_provider); | 1815 this, &settings_, output_surface, resource_provider); |
1815 } else if (output_surface->context_provider() && !skip_gl_renderer) { | 1816 } else if (output_surface->context_provider() && !force_software_renderer) { |
1816 renderer_ = GLRenderer::Create(this, | 1817 renderer_ = GLRenderer::Create(this, |
1817 &settings_, | 1818 &settings_, |
1818 output_surface, | 1819 output_surface, |
1819 resource_provider, | 1820 resource_provider, |
1820 texture_mailbox_deleter_.get(), | 1821 texture_mailbox_deleter_.get(), |
1821 settings_.highp_threshold_min); | 1822 settings_.highp_threshold_min); |
1822 } else if (output_surface->software_device()) { | 1823 } else if (output_surface->software_device()) { |
1823 renderer_ = SoftwareRenderer::Create( | 1824 renderer_ = SoftwareRenderer::Create( |
1824 this, &settings_, output_surface, resource_provider); | 1825 this, &settings_, output_surface, resource_provider); |
1825 } | 1826 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 ResourceProvider::Create(output_surface.get(), | 1933 ResourceProvider::Create(output_surface.get(), |
1933 shared_bitmap_manager_, | 1934 shared_bitmap_manager_, |
1934 settings_.highp_threshold_min, | 1935 settings_.highp_threshold_min, |
1935 settings_.use_rgba_4444_textures, | 1936 settings_.use_rgba_4444_textures, |
1936 settings_.texture_id_allocation_chunk_size, | 1937 settings_.texture_id_allocation_chunk_size, |
1937 settings_.use_distance_field_text); | 1938 settings_.use_distance_field_text); |
1938 | 1939 |
1939 if (output_surface->capabilities().deferred_gl_initialization) | 1940 if (output_surface->capabilities().deferred_gl_initialization) |
1940 EnforceZeroBudget(true); | 1941 EnforceZeroBudget(true); |
1941 | 1942 |
1942 bool skip_gl_renderer = false; | 1943 bool force_software_renderer = |
| 1944 output_surface->capabilities().deferred_gl_initialization; |
1943 CreateAndSetRenderer( | 1945 CreateAndSetRenderer( |
1944 output_surface.get(), resource_provider.get(), skip_gl_renderer); | 1946 output_surface.get(), resource_provider.get(), force_software_renderer); |
1945 | 1947 |
1946 transfer_buffer_memory_limit_ = | 1948 transfer_buffer_memory_limit_ = |
1947 GetMaxTransferBufferUsageBytes(output_surface->context_provider().get()); | 1949 GetMaxTransferBufferUsageBytes(output_surface->context_provider().get()); |
1948 | 1950 |
1949 if (settings_.impl_side_painting) { | 1951 if (settings_.impl_side_painting) { |
1950 // Note: we use zero-copy rasterizer by default when the renderer is using | 1952 // Note: we use zero-copy rasterizer by default when the renderer is using |
1951 // shared memory resources. | 1953 // shared memory resources. |
1952 bool use_zero_copy = | 1954 bool use_zero_copy = |
1953 (settings_.use_zero_copy || | 1955 (settings_.use_zero_copy || |
1954 GetRendererCapabilities().using_shared_memory_resources) && | 1956 GetRendererCapabilities().using_shared_memory_resources) && |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 void LayerTreeHostImpl::DeferredInitialize() { | 2004 void LayerTreeHostImpl::DeferredInitialize() { |
2003 DCHECK(output_surface_->capabilities().deferred_gl_initialization); | 2005 DCHECK(output_surface_->capabilities().deferred_gl_initialization); |
2004 DCHECK(settings_.impl_side_painting); | 2006 DCHECK(settings_.impl_side_painting); |
2005 DCHECK(output_surface_->context_provider()); | 2007 DCHECK(output_surface_->context_provider()); |
2006 | 2008 |
2007 ReleaseTreeResources(); | 2009 ReleaseTreeResources(); |
2008 renderer_.reset(); | 2010 renderer_.reset(); |
2009 | 2011 |
2010 resource_provider_->InitializeGL(); | 2012 resource_provider_->InitializeGL(); |
2011 | 2013 |
2012 bool skip_gl_renderer = false; | 2014 bool force_software_renderer = false; |
2013 CreateAndSetRenderer( | 2015 CreateAndSetRenderer( |
2014 output_surface_.get(), resource_provider_.get(), skip_gl_renderer); | 2016 output_surface_.get(), resource_provider_.get(), force_software_renderer); |
2015 | 2017 |
2016 EnforceZeroBudget(false); | 2018 EnforceZeroBudget(false); |
2017 client_->SetNeedsCommitOnImplThread(); | 2019 client_->SetNeedsCommitOnImplThread(); |
2018 } | 2020 } |
2019 | 2021 |
2020 void LayerTreeHostImpl::ReleaseGL() { | 2022 void LayerTreeHostImpl::ReleaseGL() { |
2021 DCHECK(output_surface_->capabilities().deferred_gl_initialization); | 2023 DCHECK(output_surface_->capabilities().deferred_gl_initialization); |
2022 DCHECK(settings_.impl_side_painting); | 2024 DCHECK(settings_.impl_side_painting); |
2023 DCHECK(output_surface_->context_provider()); | 2025 DCHECK(output_surface_->context_provider()); |
2024 | 2026 |
2025 ReleaseTreeResources(); | 2027 ReleaseTreeResources(); |
2026 renderer_.reset(); | 2028 renderer_.reset(); |
2027 tile_manager_.reset(); | 2029 tile_manager_.reset(); |
2028 resource_pool_.reset(); | 2030 resource_pool_.reset(); |
2029 raster_worker_pool_.reset(); | 2031 raster_worker_pool_.reset(); |
2030 direct_raster_worker_pool_.reset(); | 2032 direct_raster_worker_pool_.reset(); |
2031 staging_resource_pool_.reset(); | 2033 staging_resource_pool_.reset(); |
2032 resource_provider_->InitializeSoftware(); | 2034 resource_provider_->InitializeSoftware(); |
2033 | 2035 |
2034 bool skip_gl_renderer = true; | 2036 bool force_software_renderer = true; |
2035 CreateAndSetRenderer( | 2037 CreateAndSetRenderer( |
2036 output_surface_.get(), resource_provider_.get(), skip_gl_renderer); | 2038 output_surface_.get(), resource_provider_.get(), force_software_renderer); |
2037 | 2039 |
2038 EnforceZeroBudget(true); | 2040 EnforceZeroBudget(true); |
2039 DCHECK(GetRendererCapabilities().using_map_image); | 2041 DCHECK(GetRendererCapabilities().using_map_image); |
2040 CreateAndSetTileManager(resource_provider_.get(), | 2042 CreateAndSetTileManager(resource_provider_.get(), |
2041 NULL, | 2043 NULL, |
2042 true, | 2044 true, |
2043 false, | 2045 false, |
2044 GetRendererCapabilities().allow_rasterize_on_demand); | 2046 GetRendererCapabilities().allow_rasterize_on_demand); |
2045 DCHECK(tile_manager_); | 2047 DCHECK(tile_manager_); |
2046 | 2048 |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 swap_promise_monitor_.erase(monitor); | 3129 swap_promise_monitor_.erase(monitor); |
3128 } | 3130 } |
3129 | 3131 |
3130 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3132 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3131 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3133 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3132 for (; it != swap_promise_monitor_.end(); it++) | 3134 for (; it != swap_promise_monitor_.end(); it++) |
3133 (*it)->OnSetNeedsRedrawOnImpl(); | 3135 (*it)->OnSetNeedsRedrawOnImpl(); |
3134 } | 3136 } |
3135 | 3137 |
3136 } // namespace cc | 3138 } // namespace cc |
OLD | NEW |