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/time/time.h" | 7 #include "base/time/time.h" |
8 #include "cc/debug/lap_timer.h" | 8 #include "cc/debug/lap_timer.h" |
9 #include "cc/output/context_provider.h" | 9 #include "cc/output/context_provider.h" |
10 #include "cc/resources/direct_raster_worker_pool.h" | 10 #include "cc/resources/gpu_raster_worker_pool.h" |
11 #include "cc/resources/image_copy_raster_worker_pool.h" | 11 #include "cc/resources/image_copy_raster_worker_pool.h" |
12 #include "cc/resources/image_raster_worker_pool.h" | 12 #include "cc/resources/image_raster_worker_pool.h" |
13 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 13 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
14 #include "cc/resources/rasterizer.h" | 14 #include "cc/resources/rasterizer.h" |
15 #include "cc/resources/resource_pool.h" | 15 #include "cc/resources/resource_pool.h" |
16 #include "cc/resources/resource_provider.h" | 16 #include "cc/resources/resource_provider.h" |
17 #include "cc/resources/scoped_resource.h" | 17 #include "cc/resources/scoped_resource.h" |
18 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
19 #include "cc/test/fake_output_surface_client.h" | 19 #include "cc/test/fake_output_surface_client.h" |
20 #include "cc/test/test_context_support.h" | 20 #include "cc/test/test_context_support.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual ~PerfContextProvider() {} | 72 virtual ~PerfContextProvider() {} |
73 | 73 |
74 scoped_ptr<PerfGLES2Interface> context_gl_; | 74 scoped_ptr<PerfGLES2Interface> context_gl_; |
75 TestContextSupport support_; | 75 TestContextSupport support_; |
76 }; | 76 }; |
77 | 77 |
78 enum RasterWorkerPoolType { | 78 enum RasterWorkerPoolType { |
79 RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 79 RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
80 RASTER_WORKER_POOL_TYPE_IMAGE, | 80 RASTER_WORKER_POOL_TYPE_IMAGE, |
81 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, | 81 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, |
82 RASTER_WORKER_POOL_TYPE_DIRECT | 82 RASTER_WORKER_POOL_TYPE_GPU |
83 }; | 83 }; |
84 | 84 |
85 static const int kTimeLimitMillis = 2000; | 85 static const int kTimeLimitMillis = 2000; |
86 static const int kWarmupRuns = 5; | 86 static const int kWarmupRuns = 5; |
87 static const int kTimeCheckInterval = 10; | 87 static const int kTimeCheckInterval = 10; |
88 | 88 |
89 class PerfImageDecodeTaskImpl : public ImageDecodeTask { | 89 class PerfImageDecodeTaskImpl : public ImageDecodeTask { |
90 public: | 90 public: |
91 PerfImageDecodeTaskImpl() {} | 91 PerfImageDecodeTaskImpl() {} |
92 | 92 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 task_graph_runner_.get(), | 227 task_graph_runner_.get(), |
228 resource_provider_.get()); | 228 resource_provider_.get()); |
229 break; | 229 break; |
230 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: | 230 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: |
231 raster_worker_pool_ = ImageCopyRasterWorkerPool::Create( | 231 raster_worker_pool_ = ImageCopyRasterWorkerPool::Create( |
232 base::MessageLoopProxy::current().get(), | 232 base::MessageLoopProxy::current().get(), |
233 task_graph_runner_.get(), | 233 task_graph_runner_.get(), |
234 resource_provider_.get(), | 234 resource_provider_.get(), |
235 staging_resource_pool_.get()); | 235 staging_resource_pool_.get()); |
236 break; | 236 break; |
237 case RASTER_WORKER_POOL_TYPE_DIRECT: | 237 case RASTER_WORKER_POOL_TYPE_GPU: |
238 raster_worker_pool_ = DirectRasterWorkerPool::Create( | 238 raster_worker_pool_ = |
239 base::MessageLoopProxy::current().get(), | 239 GpuRasterWorkerPool::Create(base::MessageLoopProxy::current().get(), |
240 resource_provider_.get(), | 240 resource_provider_.get(), |
241 context_provider_.get()); | 241 context_provider_.get()); |
242 break; | 242 break; |
243 } | 243 } |
244 | 244 |
245 DCHECK(raster_worker_pool_); | 245 DCHECK(raster_worker_pool_); |
246 raster_worker_pool_->AsRasterizer()->SetClient(this); | 246 raster_worker_pool_->AsRasterizer()->SetClient(this); |
247 } | 247 } |
248 | 248 |
249 // Overridden from testing::Test: | 249 // Overridden from testing::Test: |
250 virtual void TearDown() OVERRIDE { | 250 virtual void TearDown() OVERRIDE { |
251 raster_worker_pool_->AsRasterizer()->Shutdown(); | 251 raster_worker_pool_->AsRasterizer()->Shutdown(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 private: | 373 private: |
374 std::string TestModifierString() const { | 374 std::string TestModifierString() const { |
375 switch (GetParam()) { | 375 switch (GetParam()) { |
376 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: | 376 case RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER: |
377 return std::string("_pixel_raster_worker_pool"); | 377 return std::string("_pixel_raster_worker_pool"); |
378 case RASTER_WORKER_POOL_TYPE_IMAGE: | 378 case RASTER_WORKER_POOL_TYPE_IMAGE: |
379 return std::string("_image_raster_worker_pool"); | 379 return std::string("_image_raster_worker_pool"); |
380 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: | 380 case RASTER_WORKER_POOL_TYPE_IMAGE_COPY: |
381 return std::string("_image_copy_raster_worker_pool"); | 381 return std::string("_image_copy_raster_worker_pool"); |
382 case RASTER_WORKER_POOL_TYPE_DIRECT: | 382 case RASTER_WORKER_POOL_TYPE_GPU: |
383 return std::string("_direct_raster_worker_pool"); | 383 return std::string("_gpu_raster_worker_pool"); |
384 } | 384 } |
385 NOTREACHED(); | 385 NOTREACHED(); |
386 return std::string(); | 386 return std::string(); |
387 } | 387 } |
388 | 388 |
389 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 389 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
390 }; | 390 }; |
391 | 391 |
392 TEST_P(RasterWorkerPoolPerfTest, ScheduleTasks) { | 392 TEST_P(RasterWorkerPoolPerfTest, ScheduleTasks) { |
393 RunScheduleTasksTest("1_0", 1, 0); | 393 RunScheduleTasksTest("1_0", 1, 0); |
(...skipping 20 matching lines...) Expand all Loading... |
414 RunScheduleAndExecuteTasksTest("32_1", 32, 1); | 414 RunScheduleAndExecuteTasksTest("32_1", 32, 1); |
415 RunScheduleAndExecuteTasksTest("1_4", 1, 4); | 415 RunScheduleAndExecuteTasksTest("1_4", 1, 4); |
416 RunScheduleAndExecuteTasksTest("32_4", 32, 4); | 416 RunScheduleAndExecuteTasksTest("32_4", 32, 4); |
417 } | 417 } |
418 | 418 |
419 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, | 419 INSTANTIATE_TEST_CASE_P(RasterWorkerPoolPerfTests, |
420 RasterWorkerPoolPerfTest, | 420 RasterWorkerPoolPerfTest, |
421 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, | 421 ::testing::Values(RASTER_WORKER_POOL_TYPE_PIXEL_BUFFER, |
422 RASTER_WORKER_POOL_TYPE_IMAGE, | 422 RASTER_WORKER_POOL_TYPE_IMAGE, |
423 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, | 423 RASTER_WORKER_POOL_TYPE_IMAGE_COPY, |
424 RASTER_WORKER_POOL_TYPE_DIRECT)); | 424 RASTER_WORKER_POOL_TYPE_GPU)); |
425 | 425 |
426 class RasterWorkerPoolCommonPerfTest : public RasterWorkerPoolPerfTestBase, | 426 class RasterWorkerPoolCommonPerfTest : public RasterWorkerPoolPerfTestBase, |
427 public testing::Test { | 427 public testing::Test { |
428 public: | 428 public: |
429 void RunBuildRasterTaskQueueTest(const std::string& test_name, | 429 void RunBuildRasterTaskQueueTest(const std::string& test_name, |
430 unsigned num_raster_tasks, | 430 unsigned num_raster_tasks, |
431 unsigned num_image_decode_tasks) { | 431 unsigned num_image_decode_tasks) { |
432 ImageDecodeTask::Vector image_decode_tasks; | 432 ImageDecodeTask::Vector image_decode_tasks; |
433 RasterTaskVector raster_tasks; | 433 RasterTaskVector raster_tasks; |
434 CreateImageDecodeTasks(num_image_decode_tasks, &image_decode_tasks); | 434 CreateImageDecodeTasks(num_image_decode_tasks, &image_decode_tasks); |
(...skipping 22 matching lines...) Expand all Loading... |
457 RunBuildRasterTaskQueueTest("1_0", 1, 0); | 457 RunBuildRasterTaskQueueTest("1_0", 1, 0); |
458 RunBuildRasterTaskQueueTest("32_0", 32, 0); | 458 RunBuildRasterTaskQueueTest("32_0", 32, 0); |
459 RunBuildRasterTaskQueueTest("1_1", 1, 1); | 459 RunBuildRasterTaskQueueTest("1_1", 1, 1); |
460 RunBuildRasterTaskQueueTest("32_1", 32, 1); | 460 RunBuildRasterTaskQueueTest("32_1", 32, 1); |
461 RunBuildRasterTaskQueueTest("1_4", 1, 4); | 461 RunBuildRasterTaskQueueTest("1_4", 1, 4); |
462 RunBuildRasterTaskQueueTest("32_4", 32, 4); | 462 RunBuildRasterTaskQueueTest("32_4", 32, 4); |
463 } | 463 } |
464 | 464 |
465 } // namespace | 465 } // namespace |
466 } // namespace cc | 466 } // namespace cc |
OLD | NEW |