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

Side by Side Diff: cc/raster/one_copy_tile_task_worker_pool.cc

Issue 1159833002: content: Partial copy workaround for devices with known upload performance problems. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sort Created 5 years, 6 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/raster/one_copy_tile_task_worker_pool.h ('k') | cc/trees/layer_tree_host_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/raster/one_copy_tile_task_worker_pool.h" 5 #include "cc/raster/one_copy_tile_task_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Number of in-flight copy operations to allow. 102 // Number of in-flight copy operations to allow.
103 const int kMaxCopyOperations = 32; 103 const int kMaxCopyOperations = 32;
104 104
105 // Delay been checking for copy operations to complete. 105 // Delay been checking for copy operations to complete.
106 const int kCheckForCompletedCopyOperationsTickRateMs = 1; 106 const int kCheckForCompletedCopyOperationsTickRateMs = 1;
107 107
108 // Number of failed attempts to allow before we perform a check that will 108 // Number of failed attempts to allow before we perform a check that will
109 // wait for copy operations to complete if needed. 109 // wait for copy operations to complete if needed.
110 const int kFailedAttemptsBeforeWaitIfNeeded = 256; 110 const int kFailedAttemptsBeforeWaitIfNeeded = 256;
111 111
112 // 4MiB is the size of 4 512x512 tiles, which has proven to be a good
113 // default batch size for copy operations.
114 const int kMaxBytesPerCopyOperation = 1024 * 1024 * 4;
115
112 } // namespace 116 } // namespace
113 117
114 OneCopyTileTaskWorkerPool::CopyOperation::CopyOperation( 118 OneCopyTileTaskWorkerPool::CopyOperation::CopyOperation(
115 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> src_write_lock, 119 scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> src_write_lock,
116 const Resource* src, 120 const Resource* src,
117 const Resource* dst, 121 const Resource* dst,
118 const gfx::Rect& rect) 122 const gfx::Rect& rect)
119 : src_write_lock(src_write_lock.Pass()), src(src), dst(dst), rect(rect) { 123 : src_write_lock(src_write_lock.Pass()), src(src), dst(dst), rect(rect) {
120 } 124 }
121 125
122 OneCopyTileTaskWorkerPool::CopyOperation::~CopyOperation() { 126 OneCopyTileTaskWorkerPool::CopyOperation::~CopyOperation() {
123 } 127 }
124 128
125 // static 129 // static
126 scoped_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create( 130 scoped_ptr<TileTaskWorkerPool> OneCopyTileTaskWorkerPool::Create(
127 base::SequencedTaskRunner* task_runner, 131 base::SequencedTaskRunner* task_runner,
128 TaskGraphRunner* task_graph_runner, 132 TaskGraphRunner* task_graph_runner,
129 ContextProvider* context_provider, 133 ContextProvider* context_provider,
130 ResourceProvider* resource_provider, 134 ResourceProvider* resource_provider,
131 ResourcePool* resource_pool, 135 ResourcePool* resource_pool,
132 int max_bytes_per_copy_operation, 136 int max_copy_texture_chromium_size,
133 bool have_persistent_gpu_memory_buffers) { 137 bool have_persistent_gpu_memory_buffers) {
134 return make_scoped_ptr<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool( 138 return make_scoped_ptr<TileTaskWorkerPool>(new OneCopyTileTaskWorkerPool(
135 task_runner, task_graph_runner, context_provider, resource_provider, 139 task_runner, task_graph_runner, context_provider, resource_provider,
136 resource_pool, max_bytes_per_copy_operation, 140 resource_pool, max_copy_texture_chromium_size,
137 have_persistent_gpu_memory_buffers)); 141 have_persistent_gpu_memory_buffers));
138 } 142 }
139 143
140 OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool( 144 OneCopyTileTaskWorkerPool::OneCopyTileTaskWorkerPool(
141 base::SequencedTaskRunner* task_runner, 145 base::SequencedTaskRunner* task_runner,
142 TaskGraphRunner* task_graph_runner, 146 TaskGraphRunner* task_graph_runner,
143 ContextProvider* context_provider, 147 ContextProvider* context_provider,
144 ResourceProvider* resource_provider, 148 ResourceProvider* resource_provider,
145 ResourcePool* resource_pool, 149 ResourcePool* resource_pool,
146 int max_bytes_per_copy_operation, 150 int max_copy_texture_chromium_size,
147 bool have_persistent_gpu_memory_buffers) 151 bool have_persistent_gpu_memory_buffers)
148 : task_runner_(task_runner), 152 : task_runner_(task_runner),
149 task_graph_runner_(task_graph_runner), 153 task_graph_runner_(task_graph_runner),
150 namespace_token_(task_graph_runner->GetNamespaceToken()), 154 namespace_token_(task_graph_runner->GetNamespaceToken()),
151 context_provider_(context_provider), 155 context_provider_(context_provider),
152 resource_provider_(resource_provider), 156 resource_provider_(resource_provider),
153 resource_pool_(resource_pool), 157 resource_pool_(resource_pool),
154 max_bytes_per_copy_operation_(max_bytes_per_copy_operation), 158 max_bytes_per_copy_operation_(
159 max_copy_texture_chromium_size
160 ? std::min(kMaxBytesPerCopyOperation,
161 max_copy_texture_chromium_size)
162 : kMaxBytesPerCopyOperation),
155 have_persistent_gpu_memory_buffers_(have_persistent_gpu_memory_buffers), 163 have_persistent_gpu_memory_buffers_(have_persistent_gpu_memory_buffers),
156 last_issued_copy_operation_(0), 164 last_issued_copy_operation_(0),
157 last_flushed_copy_operation_(0), 165 last_flushed_copy_operation_(0),
158 lock_(), 166 lock_(),
159 copy_operation_count_cv_(&lock_), 167 copy_operation_count_cv_(&lock_),
160 bytes_scheduled_since_last_flush_(0), 168 bytes_scheduled_since_last_flush_(0),
161 issued_copy_operation_count_(0), 169 issued_copy_operation_count_(0),
162 next_copy_operation_sequence_(1), 170 next_copy_operation_sequence_(1),
163 check_for_completed_copy_operations_pending_(false), 171 check_for_completed_copy_operations_pending_(false),
164 shutdown_(false), 172 shutdown_(false),
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 "pending_copy_count", 576 "pending_copy_count",
569 static_cast<int>(resource_pool_->total_resource_count() - 577 static_cast<int>(resource_pool_->total_resource_count() -
570 resource_pool_->acquired_resource_count())); 578 resource_pool_->acquired_resource_count()));
571 staging_state->SetInteger( 579 staging_state->SetInteger(
572 "bytes_pending_copy", 580 "bytes_pending_copy",
573 static_cast<int>(resource_pool_->total_memory_usage_bytes() - 581 static_cast<int>(resource_pool_->total_memory_usage_bytes() -
574 resource_pool_->acquired_memory_usage_bytes())); 582 resource_pool_->acquired_memory_usage_bytes()));
575 } 583 }
576 584
577 } // namespace cc 585 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/one_copy_tile_task_worker_pool.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698