OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tile_task_worker_pool.h" | 5 #include "cc/raster/tile_task_worker_pool.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "cc/test/test_task_graph_runner.h" | 34 #include "cc/test/test_task_graph_runner.h" |
35 #include "cc/test/test_web_graphics_context_3d.h" | 35 #include "cc/test/test_web_graphics_context_3d.h" |
36 #include "gpu/GLES2/gl2extchromium.h" | 36 #include "gpu/GLES2/gl2extchromium.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
38 | 38 |
39 namespace cc { | 39 namespace cc { |
40 namespace { | 40 namespace { |
41 | 41 |
42 const size_t kMaxTransferBufferUsageBytes = 10000U; | 42 const size_t kMaxTransferBufferUsageBytes = 10000U; |
43 const size_t kMaxBytesPerCopyOperation = 1000U; | 43 const size_t kMaxBytesPerCopyOperation = 1000U; |
| 44 const size_t kMaxStagingBuffers = 32U; |
44 | 45 |
45 // A resource of this dimension^2 * 4 must be greater than the above transfer | 46 // A resource of this dimension^2 * 4 must be greater than the above transfer |
46 // buffer constant. | 47 // buffer constant. |
47 const size_t kLargeResourceDimension = 1000U; | 48 const size_t kLargeResourceDimension = 1000U; |
48 | 49 |
49 enum TileTaskWorkerPoolType { | 50 enum TileTaskWorkerPoolType { |
50 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 51 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, |
51 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 52 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
52 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 53 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
53 TILE_TASK_WORKER_POOL_TYPE_GPU, | 54 TILE_TASK_WORKER_POOL_TYPE_GPU, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 kMaxTransferBufferUsageBytes); | 159 kMaxTransferBufferUsageBytes); |
159 break; | 160 break; |
160 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: | 161 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: |
161 Create3dOutputSurfaceAndResourceProvider(); | 162 Create3dOutputSurfaceAndResourceProvider(); |
162 tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create( | 163 tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create( |
163 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 164 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
164 resource_provider_.get()); | 165 resource_provider_.get()); |
165 break; | 166 break; |
166 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: | 167 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: |
167 Create3dOutputSurfaceAndResourceProvider(); | 168 Create3dOutputSurfaceAndResourceProvider(); |
168 staging_resource_pool_ = ResourcePool::Create(resource_provider_.get(), | |
169 GL_TEXTURE_2D); | |
170 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( | 169 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( |
171 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 170 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
172 context_provider_.get(), resource_provider_.get(), | 171 context_provider_.get(), resource_provider_.get(), |
173 staging_resource_pool_.get(), kMaxBytesPerCopyOperation, false); | 172 kMaxBytesPerCopyOperation, false, kMaxStagingBuffers); |
174 break; | 173 break; |
175 case TILE_TASK_WORKER_POOL_TYPE_GPU: | 174 case TILE_TASK_WORKER_POOL_TYPE_GPU: |
176 Create3dOutputSurfaceAndResourceProvider(); | 175 Create3dOutputSurfaceAndResourceProvider(); |
177 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( | 176 tile_task_worker_pool_ = GpuTileTaskWorkerPool::Create( |
178 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, | 177 base::ThreadTaskRunnerHandle::Get().get(), &task_graph_runner_, |
179 context_provider_.get(), resource_provider_.get(), false, 0); | 178 context_provider_.get(), resource_provider_.get(), false, 0); |
180 break; | 179 break; |
181 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: | 180 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: |
182 CreateSoftwareOutputSurfaceAndResourceProvider(); | 181 CreateSoftwareOutputSurfaceAndResourceProvider(); |
183 tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create( | 182 tile_task_worker_pool_ = BitmapTileTaskWorkerPool::Create( |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 timed_out_ = true; | 324 timed_out_ = true; |
326 base::MessageLoop::current()->Quit(); | 325 base::MessageLoop::current()->Quit(); |
327 } | 326 } |
328 | 327 |
329 protected: | 328 protected: |
330 scoped_refptr<TestContextProvider> context_provider_; | 329 scoped_refptr<TestContextProvider> context_provider_; |
331 scoped_refptr<TestContextProvider> worker_context_provider_; | 330 scoped_refptr<TestContextProvider> worker_context_provider_; |
332 FakeOutputSurfaceClient output_surface_client_; | 331 FakeOutputSurfaceClient output_surface_client_; |
333 scoped_ptr<FakeOutputSurface> output_surface_; | 332 scoped_ptr<FakeOutputSurface> output_surface_; |
334 scoped_ptr<ResourceProvider> resource_provider_; | 333 scoped_ptr<ResourceProvider> resource_provider_; |
335 scoped_ptr<ResourcePool> staging_resource_pool_; | |
336 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; | 334 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; |
337 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 335 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
338 TestSharedBitmapManager shared_bitmap_manager_; | 336 TestSharedBitmapManager shared_bitmap_manager_; |
339 TestTaskGraphRunner task_graph_runner_; | 337 TestTaskGraphRunner task_graph_runner_; |
340 base::CancelableClosure timeout_; | 338 base::CancelableClosure timeout_; |
341 UniqueNotifier all_tile_tasks_finished_; | 339 UniqueNotifier all_tile_tasks_finished_; |
342 int timeout_seconds_; | 340 int timeout_seconds_; |
343 bool timed_out_; | 341 bool timed_out_; |
344 RasterTaskVector tasks_; | 342 RasterTaskVector tasks_; |
345 std::vector<RasterTaskResult> completed_tasks_; | 343 std::vector<RasterTaskResult> completed_tasks_; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 TileTaskWorkerPoolTests, | 453 TileTaskWorkerPoolTests, |
456 TileTaskWorkerPoolTest, | 454 TileTaskWorkerPoolTest, |
457 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 455 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, |
458 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 456 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
459 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 457 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
460 TILE_TASK_WORKER_POOL_TYPE_GPU, | 458 TILE_TASK_WORKER_POOL_TYPE_GPU, |
461 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | 459 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
462 | 460 |
463 } // namespace | 461 } // namespace |
464 } // namespace cc | 462 } // namespace cc |
OLD | NEW |