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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "cc/debug/lap_timer.h" | 12 #include "cc/debug/lap_timer.h" |
13 #include "cc/output/context_cache_controller.h" | |
13 #include "cc/output/context_provider.h" | 14 #include "cc/output/context_provider.h" |
14 #include "cc/raster/bitmap_raster_buffer_provider.h" | 15 #include "cc/raster/bitmap_raster_buffer_provider.h" |
15 #include "cc/raster/gpu_raster_buffer_provider.h" | 16 #include "cc/raster/gpu_raster_buffer_provider.h" |
16 #include "cc/raster/one_copy_raster_buffer_provider.h" | 17 #include "cc/raster/one_copy_raster_buffer_provider.h" |
17 #include "cc/raster/raster_buffer_provider.h" | 18 #include "cc/raster/raster_buffer_provider.h" |
18 #include "cc/raster/synchronous_task_graph_runner.h" | 19 #include "cc/raster/synchronous_task_graph_runner.h" |
19 #include "cc/raster/zero_copy_raster_buffer_provider.h" | 20 #include "cc/raster/zero_copy_raster_buffer_provider.h" |
20 #include "cc/resources/platform_color.h" | 21 #include "cc/resources/platform_color.h" |
21 #include "cc/resources/resource_pool.h" | 22 #include "cc/resources/resource_pool.h" |
22 #include "cc/resources/resource_provider.h" | 23 #include "cc/resources/resource_provider.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 GLbyte* sync_token) override { | 74 GLbyte* sync_token) override { |
74 // Copy the data over after setting the data to ensure alignment. | 75 // Copy the data over after setting the data to ensure alignment. |
75 gpu::SyncToken sync_token_data(gpu::CommandBufferNamespace::GPU_IO, 0, | 76 gpu::SyncToken sync_token_data(gpu::CommandBufferNamespace::GPU_IO, 0, |
76 gpu::CommandBufferId(), fence_sync); | 77 gpu::CommandBufferId(), fence_sync); |
77 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 78 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
78 } | 79 } |
79 }; | 80 }; |
80 | 81 |
81 class PerfContextProvider : public ContextProvider { | 82 class PerfContextProvider : public ContextProvider { |
82 public: | 83 public: |
83 PerfContextProvider() : context_gl_(new PerfGLES2Interface) {} | 84 PerfContextProvider() |
85 : context_gl_(new PerfGLES2Interface), cache_controller_(&support_) {} | |
84 | 86 |
85 bool BindToCurrentThread() override { return true; } | 87 bool BindToCurrentThread() override { return true; } |
86 gpu::Capabilities ContextCapabilities() override { | 88 gpu::Capabilities ContextCapabilities() override { |
87 gpu::Capabilities capabilities; | 89 gpu::Capabilities capabilities; |
88 capabilities.image = true; | 90 capabilities.image = true; |
89 capabilities.sync_query = true; | 91 capabilities.sync_query = true; |
90 return capabilities; | 92 return capabilities; |
91 } | 93 } |
92 gpu::gles2::GLES2Interface* ContextGL() override { return context_gl_.get(); } | 94 gpu::gles2::GLES2Interface* ContextGL() override { return context_gl_.get(); } |
93 gpu::ContextSupport* ContextSupport() override { return &support_; } | 95 gpu::ContextSupport* ContextSupport() override { return &support_; } |
94 class GrContext* GrContext() override { | 96 class GrContext* GrContext() override { |
95 if (gr_context_) | 97 if (gr_context_) |
96 return gr_context_.get(); | 98 return gr_context_.get(); |
97 | 99 |
98 sk_sp<const GrGLInterface> null_interface(GrGLCreateNullInterface()); | 100 sk_sp<const GrGLInterface> null_interface(GrGLCreateNullInterface()); |
99 gr_context_ = sk_sp<class GrContext>(GrContext::Create( | 101 gr_context_ = sk_sp<class GrContext>(GrContext::Create( |
100 kOpenGL_GrBackend, | 102 kOpenGL_GrBackend, |
101 reinterpret_cast<GrBackendContext>(null_interface.get()))); | 103 reinterpret_cast<GrBackendContext>(null_interface.get()))); |
102 return gr_context_.get(); | 104 return gr_context_.get(); |
danakj
2016/08/26 23:49:08
setgrcontext?
ericrk
2016/08/29 22:43:22
yeah
| |
103 } | 105 } |
106 ContextCacheController* CacheController() override { | |
107 return &cache_controller_; | |
108 } | |
104 void InvalidateGrContext(uint32_t state) override { | 109 void InvalidateGrContext(uint32_t state) override { |
105 if (gr_context_) | 110 if (gr_context_) |
106 gr_context_.get()->resetContext(state); | 111 gr_context_.get()->resetContext(state); |
107 } | 112 } |
108 base::Lock* GetLock() override { return &context_lock_; } | 113 base::Lock* GetLock() override { return &context_lock_; } |
109 void DeleteCachedResources() override {} | |
110 void SetLostContextCallback(const LostContextCallback& cb) override {} | 114 void SetLostContextCallback(const LostContextCallback& cb) override {} |
111 | 115 |
112 private: | 116 private: |
113 ~PerfContextProvider() override {} | 117 ~PerfContextProvider() override {} |
114 | 118 |
115 std::unique_ptr<PerfGLES2Interface> context_gl_; | 119 std::unique_ptr<PerfGLES2Interface> context_gl_; |
116 sk_sp<class GrContext> gr_context_; | 120 sk_sp<class GrContext> gr_context_; |
117 TestContextSupport support_; | 121 TestContextSupport support_; |
122 ContextCacheController cache_controller_; | |
118 base::Lock context_lock_; | 123 base::Lock context_lock_; |
119 }; | 124 }; |
120 | 125 |
121 enum RasterBufferProviderType { | 126 enum RasterBufferProviderType { |
122 RASTER_BUFFER_PROVIDER_TYPE_ZERO_COPY, | 127 RASTER_BUFFER_PROVIDER_TYPE_ZERO_COPY, |
123 RASTER_BUFFER_PROVIDER_TYPE_ONE_COPY, | 128 RASTER_BUFFER_PROVIDER_TYPE_ONE_COPY, |
124 RASTER_BUFFER_PROVIDER_TYPE_GPU, | 129 RASTER_BUFFER_PROVIDER_TYPE_GPU, |
125 RASTER_BUFFER_PROVIDER_TYPE_BITMAP | 130 RASTER_BUFFER_PROVIDER_TYPE_BITMAP |
126 }; | 131 }; |
127 | 132 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 RunBuildTileTaskGraphTest("1_0", 1, 0); | 598 RunBuildTileTaskGraphTest("1_0", 1, 0); |
594 RunBuildTileTaskGraphTest("32_0", 32, 0); | 599 RunBuildTileTaskGraphTest("32_0", 32, 0); |
595 RunBuildTileTaskGraphTest("1_1", 1, 1); | 600 RunBuildTileTaskGraphTest("1_1", 1, 1); |
596 RunBuildTileTaskGraphTest("32_1", 32, 1); | 601 RunBuildTileTaskGraphTest("32_1", 32, 1); |
597 RunBuildTileTaskGraphTest("1_4", 1, 4); | 602 RunBuildTileTaskGraphTest("1_4", 1, 4); |
598 RunBuildTileTaskGraphTest("32_4", 32, 4); | 603 RunBuildTileTaskGraphTest("32_4", 32, 4); |
599 } | 604 } |
600 | 605 |
601 } // namespace | 606 } // namespace |
602 } // namespace cc | 607 } // namespace cc |
OLD | NEW |