| 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/tile_task_worker_pool.h" | 5 #include "cc/resources/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/resources/bitmap_tile_task_worker_pool.h" | 11 #include "cc/resources/bitmap_tile_task_worker_pool.h" |
| 12 #include "cc/resources/gpu_tile_task_worker_pool.h" | 12 #include "cc/resources/gpu_tile_task_worker_pool.h" |
| 13 #include "cc/resources/one_copy_tile_task_worker_pool.h" | 13 #include "cc/resources/one_copy_tile_task_worker_pool.h" |
| 14 #include "cc/resources/pixel_buffer_tile_task_worker_pool.h" | 14 #include "cc/resources/pixel_buffer_tile_task_worker_pool.h" |
| 15 #include "cc/resources/raster_buffer.h" | 15 #include "cc/resources/raster_buffer.h" |
| 16 #include "cc/resources/resource_pool.h" | 16 #include "cc/resources/resource_pool.h" |
| 17 #include "cc/resources/resource_provider.h" | 17 #include "cc/resources/resource_provider.h" |
| 18 #include "cc/resources/scoped_resource.h" | 18 #include "cc/resources/scoped_resource.h" |
| 19 #include "cc/resources/tile_task_runner.h" | 19 #include "cc/resources/tile_task_runner.h" |
| 20 #include "cc/resources/zero_copy_tile_task_worker_pool.h" | 20 #include "cc/resources/zero_copy_tile_task_worker_pool.h" |
| 21 #include "cc/test/fake_output_surface.h" | 21 #include "cc/test/fake_output_surface.h" |
| 22 #include "cc/test/fake_output_surface_client.h" | 22 #include "cc/test/fake_output_surface_client.h" |
| 23 #include "cc/test/test_context_support.h" | 23 #include "cc/test/test_context_support.h" |
| 24 #include "cc/test/test_gpu_memory_buffer_manager.h" | 24 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 25 #include "cc/test/test_shared_bitmap_manager.h" | 25 #include "cc/test/test_shared_bitmap_manager.h" |
| 26 #include "cc/test/test_web_graphics_context_3d.h" | 26 #include "cc/test/test_web_graphics_context_3d.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 #include "testing/perf/perf_test.h" | 28 #include "testing/perf/perf_test.h" |
| 29 #include "third_party/khronos/GLES2/gl2.h" | 29 #include "third_party/khronos/GLES2/gl2.h" |
| 30 #include "third_party/skia/include/gpu/GrContext.h" |
| 31 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 30 | 32 |
| 31 namespace cc { | 33 namespace cc { |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub { | 36 class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub { |
| 35 // Overridden from gpu::gles2::GLES2Interface: | 37 // Overridden from gpu::gles2::GLES2Interface: |
| 36 GLuint CreateImageCHROMIUM(ClientBuffer buffer, | 38 GLuint CreateImageCHROMIUM(ClientBuffer buffer, |
| 37 GLsizei width, | 39 GLsizei width, |
| 38 GLsizei height, | 40 GLsizei height, |
| 39 GLenum internalformat) override { | 41 GLenum internalformat) override { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 70 bool BindToCurrentThread() override { return true; } | 72 bool BindToCurrentThread() override { return true; } |
| 71 Capabilities ContextCapabilities() override { | 73 Capabilities ContextCapabilities() override { |
| 72 Capabilities capabilities; | 74 Capabilities capabilities; |
| 73 capabilities.gpu.image = true; | 75 capabilities.gpu.image = true; |
| 74 capabilities.gpu.sync_query = true; | 76 capabilities.gpu.sync_query = true; |
| 75 return capabilities; | 77 return capabilities; |
| 76 } | 78 } |
| 77 gpu::gles2::GLES2Interface* ContextGL() override { return context_gl_.get(); } | 79 gpu::gles2::GLES2Interface* ContextGL() override { return context_gl_.get(); } |
| 78 gpu::ContextSupport* ContextSupport() override { return &support_; } | 80 gpu::ContextSupport* ContextSupport() override { return &support_; } |
| 79 class GrContext* GrContext() override { | 81 class GrContext* GrContext() override { |
| 80 return NULL; | 82 if (gr_context_) |
| 83 return gr_context_.get(); |
| 84 |
| 85 skia::RefPtr<const GrGLInterface> null_interface = |
| 86 skia::AdoptRef(GrGLCreateNullInterface()); |
| 87 gr_context_ = skia::AdoptRef(GrContext::Create( |
| 88 kOpenGL_GrBackend, |
| 89 reinterpret_cast<GrBackendContext>(null_interface.get()))); |
| 90 return gr_context_.get(); |
| 81 } | 91 } |
| 82 bool IsContextLost() override { return false; } | 92 bool IsContextLost() override { return false; } |
| 83 void VerifyContexts() override {} | 93 void VerifyContexts() override {} |
| 84 void DeleteCachedResources() override {} | 94 void DeleteCachedResources() override {} |
| 85 bool DestroyedOnMainThread() override { return false; } | 95 bool DestroyedOnMainThread() override { return false; } |
| 86 void SetLostContextCallback(const LostContextCallback& cb) override {} | 96 void SetLostContextCallback(const LostContextCallback& cb) override {} |
| 87 void SetMemoryPolicyChangedCallback( | 97 void SetMemoryPolicyChangedCallback( |
| 88 const MemoryPolicyChangedCallback& cb) override {} | 98 const MemoryPolicyChangedCallback& cb) override {} |
| 89 | 99 |
| 90 private: | 100 private: |
| 91 ~PerfContextProvider() override {} | 101 ~PerfContextProvider() override {} |
| 92 | 102 |
| 93 scoped_ptr<PerfGLES2Interface> context_gl_; | 103 scoped_ptr<PerfGLES2Interface> context_gl_; |
| 104 skia::RefPtr<class GrContext> gr_context_; |
| 94 TestContextSupport support_; | 105 TestContextSupport support_; |
| 95 }; | 106 }; |
| 96 | 107 |
| 97 enum TileTaskWorkerPoolType { | 108 enum TileTaskWorkerPoolType { |
| 98 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, | 109 TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, |
| 99 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, | 110 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, |
| 100 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, | 111 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, |
| 101 TILE_TASK_WORKER_POOL_TYPE_GPU, | 112 TILE_TASK_WORKER_POOL_TYPE_GPU, |
| 102 TILE_TASK_WORKER_POOL_TYPE_BITMAP | 113 TILE_TASK_WORKER_POOL_TYPE_BITMAP |
| 103 }; | 114 }; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 RunBuildTileTaskQueueTest("1_0", 1, 0); | 504 RunBuildTileTaskQueueTest("1_0", 1, 0); |
| 494 RunBuildTileTaskQueueTest("32_0", 32, 0); | 505 RunBuildTileTaskQueueTest("32_0", 32, 0); |
| 495 RunBuildTileTaskQueueTest("1_1", 1, 1); | 506 RunBuildTileTaskQueueTest("1_1", 1, 1); |
| 496 RunBuildTileTaskQueueTest("32_1", 32, 1); | 507 RunBuildTileTaskQueueTest("32_1", 32, 1); |
| 497 RunBuildTileTaskQueueTest("1_4", 1, 4); | 508 RunBuildTileTaskQueueTest("1_4", 1, 4); |
| 498 RunBuildTileTaskQueueTest("32_4", 32, 4); | 509 RunBuildTileTaskQueueTest("32_4", 32, 4); |
| 499 } | 510 } |
| 500 | 511 |
| 501 } // namespace | 512 } // namespace |
| 502 } // namespace cc | 513 } // namespace cc |
| OLD | NEW |