| 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 "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/raster/bitmap_tile_task_worker_pool.h" | 11 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 12 #include "cc/raster/gpu_rasterizer.h" | 12 #include "cc/raster/gpu_rasterizer.h" |
| 13 #include "cc/raster/gpu_tile_task_worker_pool.h" | 13 #include "cc/raster/gpu_tile_task_worker_pool.h" |
| 14 #include "cc/raster/one_copy_tile_task_worker_pool.h" | 14 #include "cc/raster/one_copy_tile_task_worker_pool.h" |
| 15 #include "cc/raster/pixel_buffer_tile_task_worker_pool.h" | |
| 16 #include "cc/raster/raster_buffer.h" | 15 #include "cc/raster/raster_buffer.h" |
| 17 #include "cc/raster/tile_task_runner.h" | 16 #include "cc/raster/tile_task_runner.h" |
| 18 #include "cc/raster/zero_copy_tile_task_worker_pool.h" | 17 #include "cc/raster/zero_copy_tile_task_worker_pool.h" |
| 19 #include "cc/resources/resource_pool.h" | 18 #include "cc/resources/resource_pool.h" |
| 20 #include "cc/resources/resource_provider.h" | 19 #include "cc/resources/resource_provider.h" |
| 21 #include "cc/resources/scoped_resource.h" | 20 #include "cc/resources/scoped_resource.h" |
| 22 #include "cc/test/fake_output_surface.h" | 21 #include "cc/test/fake_output_surface.h" |
| 23 #include "cc/test/fake_output_surface_client.h" | 22 #include "cc/test/fake_output_surface_client.h" |
| 24 #include "cc/test/fake_resource_provider.h" | 23 #include "cc/test/fake_resource_provider.h" |
| 25 #include "cc/test/test_context_support.h" | 24 #include "cc/test/test_context_support.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 private: | 106 private: |
| 108 ~PerfContextProvider() override {} | 107 ~PerfContextProvider() override {} |
| 109 | 108 |
| 110 scoped_ptr<PerfGLES2Interface> context_gl_; | 109 scoped_ptr<PerfGLES2Interface> context_gl_; |
| 111 skia::RefPtr<class GrContext> gr_context_; | 110 skia::RefPtr<class GrContext> gr_context_; |
| 112 TestContextSupport support_; | 111 TestContextSupport support_; |
| 113 base::Lock context_lock_; | 112 base::Lock context_lock_; |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 enum TileTaskWorkerPoolType { | 115 enum TileTaskWorkerPoolType { |
| 117 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | |
| 118 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 116 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 119 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 117 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 120 TILE_TASK_WORKER_POOL_TYPE_GPU, | 118 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 121 TILE_TASK_WORKER_POOL_TYPE_BITMAP | 119 TILE_TASK_WORKER_POOL_TYPE_BITMAP |
| 122 }; | 120 }; |
| 123 | 121 |
| 124 static const int kTimeLimitMillis = 2000; | 122 static const int kTimeLimitMillis = 2000; |
| 125 static const int kWarmupRuns = 5; | 123 static const int kWarmupRuns = 5; |
| 126 static const int kTimeCheckInterval = 10; | 124 static const int kTimeCheckInterval = 10; |
| 127 | 125 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 }; | 241 }; |
| 244 | 242 |
| 245 class TileTaskWorkerPoolPerfTest | 243 class TileTaskWorkerPoolPerfTest |
| 246 : public TileTaskWorkerPoolPerfTestBase, | 244 : public TileTaskWorkerPoolPerfTestBase, |
| 247 public testing::TestWithParam<TileTaskWorkerPoolType>, | 245 public testing::TestWithParam<TileTaskWorkerPoolType>, |
| 248 public TileTaskRunnerClient { | 246 public TileTaskRunnerClient { |
| 249 public: | 247 public: |
| 250 // Overridden from testing::Test: | 248 // Overridden from testing::Test: |
| 251 void SetUp() override { | 249 void SetUp() override { |
| 252 switch (GetParam()) { | 250 switch (GetParam()) { |
| 253 case TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER: | |
| 254 Create3dOutputSurfaceAndResourceProvider(); | |
| 255 tile_task_worker_pool_ = PixelBufferTileTaskWorkerPool::Create( | |
| 256 task_runner_.get(), task_graph_runner_.get(), | |
| 257 context_provider_.get(), resource_provider_.get(), | |
| 258 std::numeric_limits<size_t>::max()); | |
| 259 break; | |
| 260 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: | 251 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: |
| 261 Create3dOutputSurfaceAndResourceProvider(); | 252 Create3dOutputSurfaceAndResourceProvider(); |
| 262 tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create( | 253 tile_task_worker_pool_ = ZeroCopyTileTaskWorkerPool::Create( |
| 263 task_runner_.get(), task_graph_runner_.get(), | 254 task_runner_.get(), task_graph_runner_.get(), |
| 264 resource_provider_.get()); | 255 resource_provider_.get()); |
| 265 break; | 256 break; |
| 266 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: | 257 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: |
| 267 Create3dOutputSurfaceAndResourceProvider(); | 258 Create3dOutputSurfaceAndResourceProvider(); |
| 268 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( | 259 tile_task_worker_pool_ = OneCopyTileTaskWorkerPool::Create( |
| 269 task_runner_.get(), task_graph_runner_.get(), | 260 task_runner_.get(), task_graph_runner_.get(), |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void CreateSoftwareOutputSurfaceAndResourceProvider() { | 398 void CreateSoftwareOutputSurfaceAndResourceProvider() { |
| 408 output_surface_ = FakeOutputSurface::CreateSoftware( | 399 output_surface_ = FakeOutputSurface::CreateSoftware( |
| 409 make_scoped_ptr(new SoftwareOutputDevice)); | 400 make_scoped_ptr(new SoftwareOutputDevice)); |
| 410 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 401 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 411 resource_provider_ = FakeResourceProvider::Create( | 402 resource_provider_ = FakeResourceProvider::Create( |
| 412 output_surface_.get(), &shared_bitmap_manager_, nullptr); | 403 output_surface_.get(), &shared_bitmap_manager_, nullptr); |
| 413 } | 404 } |
| 414 | 405 |
| 415 std::string TestModifierString() const { | 406 std::string TestModifierString() const { |
| 416 switch (GetParam()) { | 407 switch (GetParam()) { |
| 417 case TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER: | |
| 418 return std::string("_pixel_tile_task_worker_pool"); | |
| 419 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: | 408 case TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY: |
| 420 return std::string("_zero_copy_tile_task_worker_pool"); | 409 return std::string("_zero_copy_tile_task_worker_pool"); |
| 421 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: | 410 case TILE_TASK_WORKER_POOL_TYPE_ONE_COPY: |
| 422 return std::string("_one_copy_tile_task_worker_pool"); | 411 return std::string("_one_copy_tile_task_worker_pool"); |
| 423 case TILE_TASK_WORKER_POOL_TYPE_GPU: | 412 case TILE_TASK_WORKER_POOL_TYPE_GPU: |
| 424 return std::string("_gpu_tile_task_worker_pool"); | 413 return std::string("_gpu_tile_task_worker_pool"); |
| 425 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: | 414 case TILE_TASK_WORKER_POOL_TYPE_BITMAP: |
| 426 return std::string("_bitmap_tile_task_worker_pool"); | 415 return std::string("_bitmap_tile_task_worker_pool"); |
| 427 } | 416 } |
| 428 NOTREACHED(); | 417 NOTREACHED(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 454 | 443 |
| 455 TEST_P(TileTaskWorkerPoolPerfTest, ScheduleAndExecuteTasks) { | 444 TEST_P(TileTaskWorkerPoolPerfTest, ScheduleAndExecuteTasks) { |
| 456 RunScheduleAndExecuteTasksTest("1_0", 1, 0); | 445 RunScheduleAndExecuteTasksTest("1_0", 1, 0); |
| 457 RunScheduleAndExecuteTasksTest("32_0", 32, 0); | 446 RunScheduleAndExecuteTasksTest("32_0", 32, 0); |
| 458 RunScheduleAndExecuteTasksTest("1_1", 1, 1); | 447 RunScheduleAndExecuteTasksTest("1_1", 1, 1); |
| 459 RunScheduleAndExecuteTasksTest("32_1", 32, 1); | 448 RunScheduleAndExecuteTasksTest("32_1", 32, 1); |
| 460 RunScheduleAndExecuteTasksTest("1_4", 1, 4); | 449 RunScheduleAndExecuteTasksTest("1_4", 1, 4); |
| 461 RunScheduleAndExecuteTasksTest("32_4", 32, 4); | 450 RunScheduleAndExecuteTasksTest("32_4", 32, 4); |
| 462 } | 451 } |
| 463 | 452 |
| 464 INSTANTIATE_TEST_CASE_P( | 453 INSTANTIATE_TEST_CASE_P(TileTaskWorkerPoolPerfTests, |
| 465 TileTaskWorkerPoolPerfTests, | 454 TileTaskWorkerPoolPerfTest, |
| 466 TileTaskWorkerPoolPerfTest, | 455 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 467 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 456 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 468 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 457 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 469 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 458 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); |
| 470 TILE_TASK_WORKER_POOL_TYPE_GPU, | |
| 471 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); | |
| 472 | 459 |
| 473 class TileTaskWorkerPoolCommonPerfTest : public TileTaskWorkerPoolPerfTestBase, | 460 class TileTaskWorkerPoolCommonPerfTest : public TileTaskWorkerPoolPerfTestBase, |
| 474 public testing::Test { | 461 public testing::Test { |
| 475 public: | 462 public: |
| 476 // Overridden from testing::Test: | 463 // Overridden from testing::Test: |
| 477 void SetUp() override { | 464 void SetUp() override { |
| 478 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); | 465 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); |
| 479 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 466 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 480 resource_provider_ = | 467 resource_provider_ = |
| 481 FakeResourceProvider::Create(output_surface_.get(), nullptr); | 468 FakeResourceProvider::Create(output_surface_.get(), nullptr); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 508 RunBuildTileTaskQueueTest("1_0", 1, 0); | 495 RunBuildTileTaskQueueTest("1_0", 1, 0); |
| 509 RunBuildTileTaskQueueTest("32_0", 32, 0); | 496 RunBuildTileTaskQueueTest("32_0", 32, 0); |
| 510 RunBuildTileTaskQueueTest("1_1", 1, 1); | 497 RunBuildTileTaskQueueTest("1_1", 1, 1); |
| 511 RunBuildTileTaskQueueTest("32_1", 32, 1); | 498 RunBuildTileTaskQueueTest("32_1", 32, 1); |
| 512 RunBuildTileTaskQueueTest("1_4", 1, 4); | 499 RunBuildTileTaskQueueTest("1_4", 1, 4); |
| 513 RunBuildTileTaskQueueTest("32_4", 32, 4); | 500 RunBuildTileTaskQueueTest("32_4", 32, 4); |
| 514 } | 501 } |
| 515 | 502 |
| 516 } // namespace | 503 } // namespace |
| 517 } // namespace cc | 504 } // namespace cc |
| OLD | NEW |