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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1230203007: Re-land: cc: Use worker context for one-copy tile initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_pixeltest_tiles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 926964120880ee030d4644e1491bd22c9b26616d..a3a9b2cc3f19c36783e007d71f4d11a23e3f7e9b 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -153,11 +153,6 @@ size_t GetMaxTransferBufferUsageBytes(
max_transfer_buffer_usage_bytes);
}
-size_t GetMaxStagingResourceCount() {
- // Upper bound for number of staging resource to allow.
- return 32;
-}
-
size_t GetDefaultMemoryAllocationLimit() {
// TODO(ccameron): (http://crbug.com/137094) This 64MB default is a straggler
// from the old texture manager and is just to give us a default memory
@@ -1236,7 +1231,7 @@ void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
100);
DCHECK(resource_pool_);
- resource_pool_->CheckBusyResources(false);
+ resource_pool_->CheckBusyResources();
// Soft limit is used for resource pool such that memory returns to soft
// limit after going over.
resource_pool_->SetResourceUsageLimits(
@@ -1244,15 +1239,6 @@ void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
unused_memory_limit_in_bytes,
global_tile_state_.num_resources_limit);
- // Release all staging resources when invisible.
- if (staging_resource_pool_) {
- staging_resource_pool_->CheckBusyResources(false);
- staging_resource_pool_->SetResourceUsageLimits(
- std::numeric_limits<size_t>::max(),
- std::numeric_limits<size_t>::max(),
- visible_ ? GetMaxStagingResourceCount() : 0);
- }
-
DidModifyTilePriorities();
}
@@ -1466,7 +1452,7 @@ void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) {
// In OOM, we now might be able to release more resources that were held
// because they were exported.
if (resource_pool_) {
- resource_pool_->CheckBusyResources(false);
+ resource_pool_->CheckBusyResources();
resource_pool_->ReduceResourceUsage();
}
// If we're not visible, we likely released resources, so we want to
@@ -2077,8 +2063,7 @@ void LayerTreeHostImpl::CreateAndSetRenderer() {
}
void LayerTreeHostImpl::CreateTileManagerResources() {
- CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_,
- &staging_resource_pool_);
+ CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_);
// TODO(vmpstr): Initialize tile task limit at ctor time.
tile_manager_->SetResources(
resource_pool_.get(), tile_task_worker_pool_->AsTileTaskRunner(),
@@ -2089,8 +2074,7 @@ void LayerTreeHostImpl::CreateTileManagerResources() {
void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
- scoped_ptr<ResourcePool>* resource_pool,
- scoped_ptr<ResourcePool>* staging_resource_pool) {
+ scoped_ptr<ResourcePool>* resource_pool) {
DCHECK(GetTaskRunner());
// TODO(vmpstr): Make this a DCHECK (or remove) when crbug.com/419086 is
// resolved.
@@ -2116,6 +2100,8 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
}
if (use_gpu_rasterization_) {
+ DCHECK(resource_provider_->output_surface()->worker_context_provider());
+
*resource_pool =
ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
@@ -2130,7 +2116,16 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
DCHECK(GetRendererCapabilities().using_image);
- if (settings_.use_zero_copy) {
+ bool use_zero_copy = settings_.use_zero_copy;
+ // TODO(reveman): Remove this when mojo supports worker contexts.
+ // crbug.com/522440
+ if (!resource_provider_->output_surface()->worker_context_provider()) {
+ LOG(ERROR)
+ << "Forcing zero-copy tile initialization as worker context is missing";
+ use_zero_copy = true;
+ }
+
+ if (use_zero_copy) {
*resource_pool = ResourcePool::Create(resource_provider_.get());
*tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create(
@@ -2139,13 +2134,6 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
}
if (settings_.use_one_copy) {
- // Synchronous single-threaded mode depends on tiles being ready to
- // draw when raster is complete. Therefore, it must use one of zero
- // copy, software raster, or GPU raster.
- DCHECK(!is_synchronous_single_threaded_);
-
- // We need to create a staging resource pool when using copy rasterizer.
- *staging_resource_pool = ResourcePool::Create(resource_provider_.get());
*resource_pool =
ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D);
@@ -2155,9 +2143,9 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool(
*tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create(
GetTaskRunner(), task_graph_runner, context_provider,
- resource_provider_.get(), staging_resource_pool_.get(),
- max_copy_texture_chromium_size,
- settings_.use_persistent_map_for_gpu_memory_buffers);
+ resource_provider_.get(), max_copy_texture_chromium_size,
+ settings_.use_persistent_map_for_gpu_memory_buffers,
+ settings_.max_staging_buffers);
return;
}
@@ -2200,7 +2188,6 @@ void LayerTreeHostImpl::PostFrameTimingEvents(
void LayerTreeHostImpl::CleanUpTileManager() {
tile_manager_->FinishTasksAndCleanUp();
resource_pool_ = nullptr;
- staging_resource_pool_ = nullptr;
tile_task_worker_pool_ = nullptr;
single_thread_synchronous_task_graph_runner_ = nullptr;
}
@@ -2234,7 +2221,6 @@ bool LayerTreeHostImpl::InitializeRenderer(
settings_.renderer_settings.highp_threshold_min,
settings_.renderer_settings.use_rgba_4444_textures,
settings_.renderer_settings.texture_id_allocation_chunk_size,
- settings_.use_persistent_map_for_gpu_memory_buffers,
settings_.use_image_texture_targets);
CreateAndSetRenderer();
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_pixeltest_tiles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698