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 286953008: cc: Allow DeferredInitialize to use DelegatingRenderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bring back force_software_renderer Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/fake_output_surface.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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 render_passes.push_back(render_pass.Pass()); 565 render_passes.push_back(render_pass.Pass());
566 } 566 }
567 567
568 static DrawMode GetDrawMode(OutputSurface* output_surface) { 568 static DrawMode GetDrawMode(OutputSurface* output_surface) {
569 if (output_surface->ForcedDrawToSoftwareDevice()) { 569 if (output_surface->ForcedDrawToSoftwareDevice()) {
570 return DRAW_MODE_RESOURCELESS_SOFTWARE; 570 return DRAW_MODE_RESOURCELESS_SOFTWARE;
571 } else if (output_surface->context_provider()) { 571 } else if (output_surface->context_provider()) {
572 return DRAW_MODE_HARDWARE; 572 return DRAW_MODE_HARDWARE;
573 } else { 573 } else {
574 DCHECK_EQ(!output_surface->software_device(), 574 DCHECK_EQ(!output_surface->software_device(),
575 output_surface->capabilities().delegated_rendering); 575 output_surface->capabilities().delegated_rendering &&
576 !output_surface->capabilities().deferred_gl_initialization)
577 << output_surface->capabilities().delegated_rendering << " "
578 << output_surface->capabilities().deferred_gl_initialization;
576 return DRAW_MODE_SOFTWARE; 579 return DRAW_MODE_SOFTWARE;
577 } 580 }
578 } 581 }
579 582
580 static void AppendQuadsForLayer( 583 static void AppendQuadsForLayer(
581 RenderPass* target_render_pass, 584 RenderPass* target_render_pass,
582 LayerImpl* layer, 585 LayerImpl* layer,
583 const OcclusionTracker<LayerImpl>& occlusion_tracker, 586 const OcclusionTracker<LayerImpl>& occlusion_tracker,
584 AppendQuadsData* append_quads_data) { 587 AppendQuadsData* append_quads_data) {
585 QuadCuller quad_culler(target_render_pass, layer, occlusion_tracker); 588 QuadCuller quad_culler(target_render_pass, layer, occlusion_tracker);
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 pending_tree_->ReleaseResources(); 1809 pending_tree_->ReleaseResources();
1807 if (recycle_tree_) 1810 if (recycle_tree_)
1808 recycle_tree_->ReleaseResources(); 1811 recycle_tree_->ReleaseResources();
1809 1812
1810 EvictAllUIResources(); 1813 EvictAllUIResources();
1811 } 1814 }
1812 1815
1813 void LayerTreeHostImpl::CreateAndSetRenderer( 1816 void LayerTreeHostImpl::CreateAndSetRenderer(
1814 OutputSurface* output_surface, 1817 OutputSurface* output_surface,
1815 ResourceProvider* resource_provider, 1818 ResourceProvider* resource_provider,
1816 bool skip_gl_renderer) { 1819 bool force_software_renderer) {
1817 DCHECK(!renderer_); 1820 DCHECK(!renderer_);
1818 if (output_surface->capabilities().delegated_rendering) { 1821 if (output_surface->capabilities().delegated_rendering &&
1822 !force_software_renderer) {
1819 renderer_ = DelegatingRenderer::Create( 1823 renderer_ = DelegatingRenderer::Create(
1820 this, &settings_, output_surface, resource_provider); 1824 this, &settings_, output_surface, resource_provider);
1821 } else if (output_surface->context_provider() && !skip_gl_renderer) { 1825 } else if (output_surface->context_provider() && !force_software_renderer) {
1822 renderer_ = GLRenderer::Create(this, 1826 renderer_ = GLRenderer::Create(this,
1823 &settings_, 1827 &settings_,
1824 output_surface, 1828 output_surface,
1825 resource_provider, 1829 resource_provider,
1826 texture_mailbox_deleter_.get(), 1830 texture_mailbox_deleter_.get(),
1827 settings_.highp_threshold_min); 1831 settings_.highp_threshold_min);
1828 } else if (output_surface->software_device()) { 1832 } else if (output_surface->software_device()) {
1829 renderer_ = SoftwareRenderer::Create( 1833 renderer_ = SoftwareRenderer::Create(
1830 this, &settings_, output_surface, resource_provider); 1834 this, &settings_, output_surface, resource_provider);
1831 } 1835 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 ResourceProvider::Create(output_surface.get(), 1942 ResourceProvider::Create(output_surface.get(),
1939 shared_bitmap_manager_, 1943 shared_bitmap_manager_,
1940 settings_.highp_threshold_min, 1944 settings_.highp_threshold_min,
1941 settings_.use_rgba_4444_textures, 1945 settings_.use_rgba_4444_textures,
1942 settings_.texture_id_allocation_chunk_size, 1946 settings_.texture_id_allocation_chunk_size,
1943 settings_.use_distance_field_text); 1947 settings_.use_distance_field_text);
1944 1948
1945 if (output_surface->capabilities().deferred_gl_initialization) 1949 if (output_surface->capabilities().deferred_gl_initialization)
1946 EnforceZeroBudget(true); 1950 EnforceZeroBudget(true);
1947 1951
1948 bool skip_gl_renderer = false; 1952 bool force_software_renderer =
1953 output_surface->capabilities().deferred_gl_initialization;
1949 CreateAndSetRenderer( 1954 CreateAndSetRenderer(
1950 output_surface.get(), resource_provider.get(), skip_gl_renderer); 1955 output_surface.get(), resource_provider.get(), force_software_renderer);
1951 1956
1952 transfer_buffer_memory_limit_ = 1957 transfer_buffer_memory_limit_ =
1953 GetMaxTransferBufferUsageBytes(output_surface->context_provider().get()); 1958 GetMaxTransferBufferUsageBytes(output_surface->context_provider().get());
1954 1959
1955 if (settings_.impl_side_painting) { 1960 if (settings_.impl_side_painting) {
1956 // Note: we use zero-copy rasterizer by default when the renderer is using 1961 // Note: we use zero-copy rasterizer by default when the renderer is using
1957 // shared memory resources. 1962 // shared memory resources.
1958 bool use_zero_copy = 1963 bool use_zero_copy =
1959 (settings_.use_zero_copy || 1964 (settings_.use_zero_copy ||
1960 GetRendererCapabilities().using_shared_memory_resources) && 1965 GetRendererCapabilities().using_shared_memory_resources) &&
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 void LayerTreeHostImpl::DeferredInitialize() { 2013 void LayerTreeHostImpl::DeferredInitialize() {
2009 DCHECK(output_surface_->capabilities().deferred_gl_initialization); 2014 DCHECK(output_surface_->capabilities().deferred_gl_initialization);
2010 DCHECK(settings_.impl_side_painting); 2015 DCHECK(settings_.impl_side_painting);
2011 DCHECK(output_surface_->context_provider()); 2016 DCHECK(output_surface_->context_provider());
2012 2017
2013 ReleaseTreeResources(); 2018 ReleaseTreeResources();
2014 renderer_.reset(); 2019 renderer_.reset();
2015 2020
2016 resource_provider_->InitializeGL(); 2021 resource_provider_->InitializeGL();
2017 2022
2018 bool skip_gl_renderer = false; 2023 bool force_software_renderer = false;
2019 CreateAndSetRenderer( 2024 CreateAndSetRenderer(
2020 output_surface_.get(), resource_provider_.get(), skip_gl_renderer); 2025 output_surface_.get(), resource_provider_.get(), force_software_renderer);
2021 2026
2022 EnforceZeroBudget(false); 2027 EnforceZeroBudget(false);
2023 client_->SetNeedsCommitOnImplThread(); 2028 client_->SetNeedsCommitOnImplThread();
2024 } 2029 }
2025 2030
2026 void LayerTreeHostImpl::ReleaseGL() { 2031 void LayerTreeHostImpl::ReleaseGL() {
2027 DCHECK(output_surface_->capabilities().deferred_gl_initialization); 2032 DCHECK(output_surface_->capabilities().deferred_gl_initialization);
2028 DCHECK(settings_.impl_side_painting); 2033 DCHECK(settings_.impl_side_painting);
2029 DCHECK(output_surface_->context_provider()); 2034 DCHECK(output_surface_->context_provider());
2030 2035
2031 ReleaseTreeResources(); 2036 ReleaseTreeResources();
2032 renderer_.reset(); 2037 renderer_.reset();
2033 tile_manager_.reset(); 2038 tile_manager_.reset();
2034 resource_pool_.reset(); 2039 resource_pool_.reset();
2035 raster_worker_pool_.reset(); 2040 raster_worker_pool_.reset();
2036 direct_raster_worker_pool_.reset(); 2041 direct_raster_worker_pool_.reset();
2037 staging_resource_pool_.reset(); 2042 staging_resource_pool_.reset();
2038 resource_provider_->InitializeSoftware(); 2043 resource_provider_->InitializeSoftware();
2039 2044
2040 bool skip_gl_renderer = true; 2045 bool force_software_renderer = true;
2041 CreateAndSetRenderer( 2046 CreateAndSetRenderer(
2042 output_surface_.get(), resource_provider_.get(), skip_gl_renderer); 2047 output_surface_.get(), resource_provider_.get(), force_software_renderer);
2043 2048
2044 EnforceZeroBudget(true); 2049 EnforceZeroBudget(true);
2045 DCHECK(GetRendererCapabilities().using_map_image); 2050 DCHECK(GetRendererCapabilities().using_map_image);
boliu 2014/05/20 20:37:49 Sorry, realized we do need force_software_renderer
2046 CreateAndSetTileManager(resource_provider_.get(), 2051 CreateAndSetTileManager(resource_provider_.get(),
2047 NULL, 2052 NULL,
2048 true, 2053 true,
2049 false, 2054 false,
2050 GetRendererCapabilities().allow_rasterize_on_demand); 2055 GetRendererCapabilities().allow_rasterize_on_demand);
2051 DCHECK(tile_manager_); 2056 DCHECK(tile_manager_);
2052 2057
2053 client_->SetNeedsCommitOnImplThread(); 2058 client_->SetNeedsCommitOnImplThread();
2054 } 2059 }
2055 2060
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 swap_promise_monitor_.erase(monitor); 3128 swap_promise_monitor_.erase(monitor);
3124 } 3129 }
3125 3130
3126 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3131 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3127 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3132 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3128 for (; it != swap_promise_monitor_.end(); it++) 3133 for (; it != swap_promise_monitor_.end(); it++)
3129 (*it)->OnSetNeedsRedrawOnImpl(); 3134 (*it)->OnSetNeedsRedrawOnImpl();
3130 } 3135 }
3131 3136
3132 } // namespace cc 3137 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.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