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