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 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/atomic_sequence_num.h" | 14 #include "base/atomic_sequence_num.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/containers/scoped_ptr_hash_map.h" | 17 #include "base/containers/scoped_ptr_hash_map.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "gpu/command_buffer/client/gpu_control.h" | 25 #include "gpu/command_buffer/client/gpu_control.h" |
26 #include "gpu/command_buffer/common/command_buffer.h" | 26 #include "gpu/command_buffer/common/command_buffer.h" |
| 27 #include "gpu/command_buffer/service/gpu_preferences.h" |
27 #include "gpu/gpu_export.h" | 28 #include "gpu/gpu_export.h" |
28 #include "ui/gfx/gpu_memory_buffer.h" | 29 #include "ui/gfx/gpu_memory_buffer.h" |
29 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
30 #include "ui/gl/gl_surface.h" | 31 #include "ui/gl/gl_surface.h" |
31 #include "ui/gl/gpu_preference.h" | 32 #include "ui/gl/gpu_preference.h" |
32 | 33 |
33 namespace base { | 34 namespace base { |
34 class SequenceChecker; | 35 class SequenceChecker; |
35 } | 36 } |
36 | 37 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 bool IsFenceSyncRelease(uint64_t release) override; | 134 bool IsFenceSyncRelease(uint64_t release) override; |
134 bool IsFenceSyncFlushed(uint64_t release) override; | 135 bool IsFenceSyncFlushed(uint64_t release) override; |
135 bool IsFenceSyncFlushReceived(uint64_t release) override; | 136 bool IsFenceSyncFlushReceived(uint64_t release) override; |
136 void SignalSyncToken(const SyncToken& sync_token, | 137 void SignalSyncToken(const SyncToken& sync_token, |
137 const base::Closure& callback) override; | 138 const base::Closure& callback) override; |
138 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; | 139 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; |
139 | 140 |
140 // The serializer interface to the GPU service (i.e. thread). | 141 // The serializer interface to the GPU service (i.e. thread). |
141 class Service { | 142 class Service { |
142 public: | 143 public: |
143 Service(); | 144 explicit Service(const gpu::GpuPreferences& gpu_preferences); |
144 virtual ~Service(); | 145 virtual ~Service(); |
145 | 146 |
146 virtual void AddRef() const = 0; | 147 virtual void AddRef() const = 0; |
147 virtual void Release() const = 0; | 148 virtual void Release() const = 0; |
148 | 149 |
149 // Queues a task to run as soon as possible. | 150 // Queues a task to run as soon as possible. |
150 virtual void ScheduleTask(const base::Closure& task) = 0; | 151 virtual void ScheduleTask(const base::Closure& task) = 0; |
151 | 152 |
152 // Schedules |callback| to run at an appropriate time for performing delayed | 153 // Schedules |callback| to run at an appropriate time for performing delayed |
153 // work. | 154 // work. |
154 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; | 155 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; |
155 | 156 |
156 virtual bool UseVirtualizedGLContexts() = 0; | 157 virtual bool UseVirtualizedGLContexts() = 0; |
157 virtual scoped_refptr<gles2::ShaderTranslatorCache> | 158 virtual scoped_refptr<gles2::ShaderTranslatorCache> |
158 shader_translator_cache() = 0; | 159 shader_translator_cache() = 0; |
159 virtual scoped_refptr<gles2::FramebufferCompletenessCache> | 160 virtual scoped_refptr<gles2::FramebufferCompletenessCache> |
160 framebuffer_completeness_cache() = 0; | 161 framebuffer_completeness_cache() = 0; |
161 virtual SyncPointManager* sync_point_manager() = 0; | 162 virtual SyncPointManager* sync_point_manager() = 0; |
| 163 const GpuPreferences& gpu_preferences(); |
162 scoped_refptr<gfx::GLShareGroup> share_group(); | 164 scoped_refptr<gfx::GLShareGroup> share_group(); |
163 scoped_refptr<gles2::MailboxManager> mailbox_manager(); | 165 scoped_refptr<gles2::MailboxManager> mailbox_manager(); |
164 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); | 166 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); |
165 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); | 167 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); |
166 gpu::gles2::ProgramCache* program_cache(); | 168 gpu::gles2::ProgramCache* program_cache(); |
167 | 169 |
168 private: | 170 private: |
| 171 const GpuPreferences& gpu_preferences_; |
169 scoped_refptr<gfx::GLShareGroup> share_group_; | 172 scoped_refptr<gfx::GLShareGroup> share_group_; |
170 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 173 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
171 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; | 174 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; |
172 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 175 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
173 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 176 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
174 }; | 177 }; |
175 | 178 |
176 #if defined(OS_ANDROID) | 179 #if defined(OS_ANDROID) |
177 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); | 180 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); |
178 uint32_t CreateStreamTexture(uint32_t texture_id); | 181 uint32_t CreateStreamTexture(uint32_t texture_id); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache() | 309 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache() |
307 override; | 310 override; |
308 scoped_refptr<gles2::FramebufferCompletenessCache> | 311 scoped_refptr<gles2::FramebufferCompletenessCache> |
309 framebuffer_completeness_cache() override; | 312 framebuffer_completeness_cache() override; |
310 SyncPointManager* sync_point_manager() override; | 313 SyncPointManager* sync_point_manager() override; |
311 | 314 |
312 private: | 315 private: |
313 ~GpuInProcessThread() override; | 316 ~GpuInProcessThread() override; |
314 friend class base::RefCountedThreadSafe<GpuInProcessThread>; | 317 friend class base::RefCountedThreadSafe<GpuInProcessThread>; |
315 | 318 |
| 319 GpuPreferences gpu_preferences_; |
316 SyncPointManager* sync_point_manager_; // Non-owning. | 320 SyncPointManager* sync_point_manager_; // Non-owning. |
317 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
318 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
319 framebuffer_completeness_cache_; | 323 framebuffer_completeness_cache_; |
320 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
321 }; | 325 }; |
322 | 326 |
323 } // namespace gpu | 327 } // namespace gpu |
324 | 328 |
325 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |