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

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

Issue 2726263003: cc::ResourcePool - Re-use larger resources for smaller requests (Closed)
Patch Set: fix compile Created 3 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/test/layer_tree_pixel_resource_test.cc ('k') | cc/trees/layer_tree_settings.h » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 // TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is 2240 // TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is
2241 // resolved. 2241 // resolved.
2242 CHECK(resource_provider_); 2242 CHECK(resource_provider_);
2243 2243
2244 ContextProvider* compositor_context_provider = 2244 ContextProvider* compositor_context_provider =
2245 compositor_frame_sink_->context_provider(); 2245 compositor_frame_sink_->context_provider();
2246 if (!compositor_context_provider) { 2246 if (!compositor_context_provider) {
2247 *resource_pool = 2247 *resource_pool =
2248 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), 2248 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(),
2249 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 2249 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
2250 ResourcePool::kDefaultExpirationDelay); 2250 ResourcePool::kDefaultExpirationDelay,
2251 settings_.disallow_non_exact_resource_reuse);
2251 2252
2252 *raster_buffer_provider = 2253 *raster_buffer_provider =
2253 BitmapRasterBufferProvider::Create(resource_provider_.get()); 2254 BitmapRasterBufferProvider::Create(resource_provider_.get());
2254 return; 2255 return;
2255 } 2256 }
2256 2257
2257 ContextProvider* worker_context_provider = 2258 ContextProvider* worker_context_provider =
2258 compositor_frame_sink_->worker_context_provider(); 2259 compositor_frame_sink_->worker_context_provider();
2259 if (use_gpu_rasterization_) { 2260 if (use_gpu_rasterization_) {
2260 DCHECK(worker_context_provider); 2261 DCHECK(worker_context_provider);
2261 2262
2262 *resource_pool = ResourcePool::Create( 2263 *resource_pool = ResourcePool::Create(
2263 resource_provider_.get(), GetTaskRunner(), 2264 resource_provider_.get(), GetTaskRunner(),
2264 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, 2265 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
2265 ResourcePool::kDefaultExpirationDelay); 2266 ResourcePool::kDefaultExpirationDelay,
2267 settings_.disallow_non_exact_resource_reuse);
2266 2268
2267 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0; 2269 int msaa_sample_count = use_msaa_ ? RequestedMSAASampleCount() : 0;
2268 2270
2269 *raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>( 2271 *raster_buffer_provider = base::MakeUnique<GpuRasterBufferProvider>(
2270 compositor_context_provider, worker_context_provider, 2272 compositor_context_provider, worker_context_provider,
2271 resource_provider_.get(), settings_.use_distance_field_text, 2273 resource_provider_.get(), settings_.use_distance_field_text,
2272 msaa_sample_count, settings_.renderer_settings.preferred_tile_format, 2274 msaa_sample_count, settings_.renderer_settings.preferred_tile_format,
2273 settings_.async_worker_context_enabled); 2275 settings_.async_worker_context_enabled);
2274 return; 2276 return;
2275 } 2277 }
2276 2278
2277 bool use_zero_copy = settings_.use_zero_copy; 2279 bool use_zero_copy = settings_.use_zero_copy;
2278 // TODO(reveman): Remove this when mojo supports worker contexts. 2280 // TODO(reveman): Remove this when mojo supports worker contexts.
2279 // crbug.com/522440 2281 // crbug.com/522440
2280 if (!use_zero_copy && !worker_context_provider) { 2282 if (!use_zero_copy && !worker_context_provider) {
2281 LOG(ERROR) 2283 LOG(ERROR)
2282 << "Forcing zero-copy tile initialization as worker context is missing"; 2284 << "Forcing zero-copy tile initialization as worker context is missing";
2283 use_zero_copy = true; 2285 use_zero_copy = true;
2284 } 2286 }
2285 2287
2286 if (use_zero_copy) { 2288 if (use_zero_copy) {
2287 *resource_pool = ResourcePool::CreateForGpuMemoryBufferResources( 2289 *resource_pool = ResourcePool::CreateForGpuMemoryBufferResources(
2288 resource_provider_.get(), GetTaskRunner(), 2290 resource_provider_.get(), GetTaskRunner(),
2289 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, 2291 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
2290 ResourcePool::kDefaultExpirationDelay); 2292 ResourcePool::kDefaultExpirationDelay,
2293 settings_.disallow_non_exact_resource_reuse);
2291 2294
2292 *raster_buffer_provider = ZeroCopyRasterBufferProvider::Create( 2295 *raster_buffer_provider = ZeroCopyRasterBufferProvider::Create(
2293 resource_provider_.get(), 2296 resource_provider_.get(),
2294 settings_.renderer_settings.preferred_tile_format); 2297 settings_.renderer_settings.preferred_tile_format);
2295 return; 2298 return;
2296 } 2299 }
2297 2300
2298 *resource_pool = 2301 *resource_pool =
2299 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), 2302 ResourcePool::Create(resource_provider_.get(), GetTaskRunner(),
2300 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 2303 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
2301 ResourcePool::kDefaultExpirationDelay); 2304 ResourcePool::kDefaultExpirationDelay,
2305 settings_.disallow_non_exact_resource_reuse);
2302 2306
2303 const int max_copy_texture_chromium_size = 2307 const int max_copy_texture_chromium_size =
2304 compositor_context_provider->ContextCapabilities() 2308 compositor_context_provider->ContextCapabilities()
2305 .max_copy_texture_chromium_size; 2309 .max_copy_texture_chromium_size;
2306 2310
2307 *raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>( 2311 *raster_buffer_provider = base::MakeUnique<OneCopyRasterBufferProvider>(
2308 GetTaskRunner(), compositor_context_provider, worker_context_provider, 2312 GetTaskRunner(), compositor_context_provider, worker_context_provider,
2309 resource_provider_.get(), max_copy_texture_chromium_size, 2313 resource_provider_.get(), max_copy_texture_chromium_size,
2310 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes, 2314 settings_.use_partial_raster, settings_.max_staging_buffer_usage_in_bytes,
2311 settings_.renderer_settings.preferred_tile_format, 2315 settings_.renderer_settings.preferred_tile_format,
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 4302
4299 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { 4303 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) {
4300 if (!element_id) 4304 if (!element_id)
4301 return; 4305 return;
4302 if (ScrollbarAnimationController* animation_controller = 4306 if (ScrollbarAnimationController* animation_controller =
4303 ScrollbarAnimationControllerForElementId(element_id)) 4307 ScrollbarAnimationControllerForElementId(element_id))
4304 animation_controller->DidScrollUpdate(); 4308 animation_controller->DidScrollUpdate();
4305 } 4309 }
4306 4310
4307 } // namespace cc 4311 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_pixel_resource_test.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698