| 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/resources/raster_worker_pool.h" | 5 #include "cc/resources/raster_worker_pool.h" |
| 6 | 6 |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "cc/debug/lap_timer.h" | 9 #include "cc/debug/lap_timer.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| 11 #include "cc/resources/gpu_raster_worker_pool.h" | 11 #include "cc/resources/gpu_raster_worker_pool.h" |
| 12 #include "cc/resources/image_copy_raster_worker_pool.h" | 12 #include "cc/resources/one_copy_raster_worker_pool.h" |
| 13 #include "cc/resources/image_raster_worker_pool.h" | |
| 14 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 13 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
| 15 #include "cc/resources/raster_buffer.h" | 14 #include "cc/resources/raster_buffer.h" |
| 16 #include "cc/resources/rasterizer.h" | 15 #include "cc/resources/rasterizer.h" |
| 17 #include "cc/resources/resource_pool.h" | 16 #include "cc/resources/resource_pool.h" |
| 18 #include "cc/resources/resource_provider.h" | 17 #include "cc/resources/resource_provider.h" |
| 19 #include "cc/resources/scoped_resource.h" | 18 #include "cc/resources/scoped_resource.h" |
| 19 #include "cc/resources/zero_copy_raster_worker_pool.h" |
| 20 #include "cc/test/fake_output_surface.h" | 20 #include "cc/test/fake_output_surface.h" |
| 21 #include "cc/test/fake_output_surface_client.h" | 21 #include "cc/test/fake_output_surface_client.h" |
| 22 #include "cc/test/test_context_support.h" | 22 #include "cc/test/test_context_support.h" |
| 23 #include "cc/test/test_shared_bitmap_manager.h" | 23 #include "cc/test/test_shared_bitmap_manager.h" |
| 24 #include "cc/test/test_web_graphics_context_3d.h" | 24 #include "cc/test/test_web_graphics_context_3d.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "testing/perf/perf_test.h" | 26 #include "testing/perf/perf_test.h" |
| 27 #include "third_party/khronos/GLES2/gl2.h" | 27 #include "third_party/khronos/GLES2/gl2.h" |
| 28 | 28 |
| 29 namespace cc { | 29 namespace cc { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 virtual ~PerfContextProvider() {} | 89 virtual ~PerfContextProvider() {} |
| 90 | 90 |
| 91 scoped_ptr<PerfGLES2Interface> context_gl_; | 91 scoped_ptr<PerfGLES2Interface> context_gl_; |
| 92 TestContextSupport support_; | 92 TestContextSupport support_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 enum RasterWorkerPoolType { | 95 enum RasterWorkerPoolType { |
| 96 RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 96 RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 97 RASTER_WORKER_POOL_TYPE_IMAGE, | 97 RASTER_WORKER_POOL_TYPE_ZERO_COPY, |
| 98 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, | 98 RASTER_WORKER_POOL_TYPE_ONE_COPY, |
| 99 RASTER_WORKER_POOL_TYPE_GPU | 99 RASTER_WORKER_POOL_TYPE_GPU |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 static const int kTimeLimitMillis = 2000; | 102 static const int kTimeLimitMillis = 2000; |
| 103 static const int kWarmupRuns = 5; | 103 static const int kWarmupRuns = 5; |
| 104 static const int kTimeCheckInterval = 10; | 104 static const int kTimeCheckInterval = 10; |
| 105 | 105 |
| 106 class PerfImageDecodeTaskImpl : public ImageDecodeTask { | 106 class PerfImageDecodeTaskImpl : public ImageDecodeTask { |
| 107 public: | 107 public: |
| 108 PerfImageDecodeTaskImpl() {} | 108 PerfImageDecodeTaskImpl() {} |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 RasterWorkerPoolPerfTest() { | 243 RasterWorkerPoolPerfTest() { |
| 244 switch (GetParam()) { | 244 switch (GetParam()) { |
| 245 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: | 245 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: |
| 246 raster_worker_pool_ = PixelBufferRasterWorkerPool::Create( | 246 raster_worker_pool_ = PixelBufferRasterWorkerPool::Create( |
| 247 task_runner_.get(), | 247 task_runner_.get(), |
| 248 task_graph_runner_.get(), | 248 task_graph_runner_.get(), |
| 249 context_provider_.get(), | 249 context_provider_.get(), |
| 250 resource_provider_.get(), | 250 resource_provider_.get(), |
| 251 std::numeric_limits<size_t>::max()); | 251 std::numeric_limits<size_t>::max()); |
| 252 break; | 252 break; |
| 253 case RASTER_WORKER_POOL_TYPE_IMAGE: | 253 case RASTER_WORKER_POOL_TYPE_ZERO_COPY: |
| 254 raster_worker_pool_ = | 254 raster_worker_pool_ = |
| 255 ImageRasterWorkerPool::Create(task_runner_.get(), | 255 ZeroCopyRasterWorkerPool::Create(task_runner_.get(), |
| 256 task_graph_runner_.get(), | 256 task_graph_runner_.get(), |
| 257 resource_provider_.get()); | 257 resource_provider_.get()); |
| 258 break; | 258 break; |
| 259 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: | 259 case RASTER_WORKER_POOL_TYPE_ONE_COPY: |
| 260 raster_worker_pool_ = | 260 raster_worker_pool_ = |
| 261 ImageCopyRasterWorkerPool::Create(task_runner_.get(), | 261 OneCopyRasterWorkerPool::Create(task_runner_.get(), |
| 262 task_graph_runner_.get(), | 262 task_graph_runner_.get(), |
| 263 context_provider_.get(), | 263 context_provider_.get(), |
| 264 resource_provider_.get(), | 264 resource_provider_.get(), |
| 265 staging_resource_pool_.get()); | 265 staging_resource_pool_.get()); |
| 266 break; | 266 break; |
| 267 case RASTER_WORKER_POOL_TYPE_GPU: | 267 case RASTER_WORKER_POOL_TYPE_GPU: |
| 268 raster_worker_pool_ = | 268 raster_worker_pool_ = |
| 269 GpuRasterWorkerPool::Create(task_runner_.get(), | 269 GpuRasterWorkerPool::Create(task_runner_.get(), |
| 270 context_provider_.get(), | 270 context_provider_.get(), |
| 271 resource_provider_.get()); | 271 resource_provider_.get()); |
| 272 break; | 272 break; |
| 273 } | 273 } |
| 274 | 274 |
| 275 DCHECK(raster_worker_pool_); | 275 DCHECK(raster_worker_pool_); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 timer_.LapsPerSecond(), | 395 timer_.LapsPerSecond(), |
| 396 "runs/s", | 396 "runs/s", |
| 397 true); | 397 true); |
| 398 } | 398 } |
| 399 | 399 |
| 400 private: | 400 private: |
| 401 std::string TestModifierString() const { | 401 std::string TestModifierString() const { |
| 402 switch (GetParam()) { | 402 switch (GetParam()) { |
| 403 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: | 403 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: |
| 404 return std::string("_pixel_raster_worker_pool"); | 404 return std::string("_pixel_raster_worker_pool"); |
| 405 case RASTER_WORKER_POOL_TYPE_IMAGE: | 405 case RASTER_WORKER_POOL_TYPE_ZERO_COPY: |
| 406 return std::string("_image_raster_worker_pool"); | 406 return std::string("_zero_copy_raster_worker_pool"); |
| 407 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: | 407 case RASTER_WORKER_POOL_TYPE_ONE_COPY: |
| 408 return std::string("_image_copy_raster_worker_pool"); | 408 return std::string("_one_copy_raster_worker_pool"); |
| 409 case RASTER_WORKER_POOL_TYPE_GPU: | 409 case RASTER_WORKER_POOL_TYPE_GPU: |
| 410 return std::string("_gpu_raster_worker_pool"); | 410 return std::string("_gpu_raster_worker_pool"); |
| 411 } | 411 } |
| 412 NOTREACHED(); | 412 NOTREACHED(); |
| 413 return std::string(); | 413 return std::string(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 416 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
| 417 }; | 417 }; |
| 418 | 418 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 439 RunScheduleAndExecuteTasksTest("32_0", 32, 0); | 439 RunScheduleAndExecuteTasksTest("32_0", 32, 0); |
| 440 RunScheduleAndExecuteTasksTest("1_1", 1, 1); | 440 RunScheduleAndExecuteTasksTest("1_1", 1, 1); |
| 441 RunScheduleAndExecuteTasksTest("32_1", 32, 1); | 441 RunScheduleAndExecuteTasksTest("32_1", 32, 1); |
| 442 RunScheduleAndExecuteTasksTest("1_4", 1, 4); | 442 RunScheduleAndExecuteTasksTest("1_4", 1, 4); |
| 443 RunScheduleAndExecuteTasksTest("32_4", 32, 4); | 443 RunScheduleAndExecuteTasksTest("32_4", 32, 4); |
| 444 } | 444 } |
| 445 | 445 |
| 446 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, | 446 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, |
| 447 RasterWorkerPoolPerfTest, | 447 RasterWorkerPoolPerfTest, |
| 448 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 448 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 449 RASTER_WORKER_POOL_TYPE_IMAGE, | 449 RASTER_WORKER_POOL_TYPE_ZERO_COPY, |
| 450 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, | 450 RASTER_WORKER_POOL_TYPE_ONE_COPY, |
| 451 RASTER_WORKER_POOL_TYPE_GPU)); | 451 RASTER_WORKER_POOL_TYPE_GPU)); |
| 452 | 452 |
| 453 class RasterWorkerPoolCommonPerfTest : public RasterWorkerPoolPerfTestBase, | 453 class RasterWorkerPoolCommonPerfTest : public RasterWorkerPoolPerfTestBase, |
| 454 public testing::Test { | 454 public testing::Test { |
| 455 public: | 455 public: |
| 456 void RunBuildRasterTaskQueueTest(const std::string& test_name, | 456 void RunBuildRasterTaskQueueTest(const std::string& test_name, |
| 457 unsigned num_raster_tasks, | 457 unsigned num_raster_tasks, |
| 458 unsigned num_image_decode_tasks) { | 458 unsigned num_image_decode_tasks) { |
| 459 ImageDecodeTask::Vector image_decode_tasks; | 459 ImageDecodeTask::Vector image_decode_tasks; |
| 460 RasterTaskVector raster_tasks; | 460 RasterTaskVector raster_tasks; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 484 RunBuildRasterTaskQueueTest("1_0", 1, 0); | 484 RunBuildRasterTaskQueueTest("1_0", 1, 0); |
| 485 RunBuildRasterTaskQueueTest("32_0", 32, 0); | 485 RunBuildRasterTaskQueueTest("32_0", 32, 0); |
| 486 RunBuildRasterTaskQueueTest("1_1", 1, 1); | 486 RunBuildRasterTaskQueueTest("1_1", 1, 1); |
| 487 RunBuildRasterTaskQueueTest("32_1", 32, 1); | 487 RunBuildRasterTaskQueueTest("32_1", 32, 1); |
| 488 RunBuildRasterTaskQueueTest("1_4", 1, 4); | 488 RunBuildRasterTaskQueueTest("1_4", 1, 4); |
| 489 RunBuildRasterTaskQueueTest("32_4", 32, 4); | 489 RunBuildRasterTaskQueueTest("32_4", 32, 4); |
| 490 } | 490 } |
| 491 | 491 |
| 492 } // namespace | 492 } // namespace |
| 493 } // namespace cc | 493 } // namespace cc |
| OLD | NEW |