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/command_buffer/service/gpu_preferences.h" |
| 28 #include "gpu/config/gpu_driver_bug_workarounds.h" |
28 #include "gpu/gpu_export.h" | 29 #include "gpu/gpu_export.h" |
29 #include "ui/gfx/gpu_memory_buffer.h" | 30 #include "ui/gfx/gpu_memory_buffer.h" |
30 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" |
31 #include "ui/gl/gl_surface.h" | 32 #include "ui/gl/gl_surface.h" |
32 #include "ui/gl/gpu_preference.h" | 33 #include "ui/gl/gpu_preference.h" |
33 | 34 |
34 namespace base { | 35 namespace base { |
35 class SequenceChecker; | 36 class SequenceChecker; |
36 } | 37 } |
37 | 38 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool IsFenceSyncFlushed(uint64_t release) override; | 136 bool IsFenceSyncFlushed(uint64_t release) override; |
136 bool IsFenceSyncFlushReceived(uint64_t release) override; | 137 bool IsFenceSyncFlushReceived(uint64_t release) override; |
137 void SignalSyncToken(const SyncToken& sync_token, | 138 void SignalSyncToken(const SyncToken& sync_token, |
138 const base::Closure& callback) override; | 139 const base::Closure& callback) override; |
139 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; | 140 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; |
140 | 141 |
141 // The serializer interface to the GPU service (i.e. thread). | 142 // The serializer interface to the GPU service (i.e. thread). |
142 class Service { | 143 class Service { |
143 public: | 144 public: |
144 Service(); | 145 Service(); |
145 explicit Service(const gpu::GpuPreferences& gpu_preferences); | 146 explicit Service( |
| 147 const gpu::GpuPreferences& gpu_preferences, |
| 148 const gpu::GpuDriverBugWorkarounds& gpu_driver_bug_workarounds); |
146 virtual ~Service(); | 149 virtual ~Service(); |
147 | 150 |
148 virtual void AddRef() const = 0; | 151 virtual void AddRef() const = 0; |
149 virtual void Release() const = 0; | 152 virtual void Release() const = 0; |
150 | 153 |
151 // Queues a task to run as soon as possible. | 154 // Queues a task to run as soon as possible. |
152 virtual void ScheduleTask(const base::Closure& task) = 0; | 155 virtual void ScheduleTask(const base::Closure& task) = 0; |
153 | 156 |
154 // Schedules |callback| to run at an appropriate time for performing delayed | 157 // Schedules |callback| to run at an appropriate time for performing delayed |
155 // work. | 158 // work. |
156 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; | 159 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; |
157 | 160 |
158 virtual bool UseVirtualizedGLContexts() = 0; | 161 virtual bool UseVirtualizedGLContexts() = 0; |
159 virtual scoped_refptr<gles2::ShaderTranslatorCache> | 162 virtual scoped_refptr<gles2::ShaderTranslatorCache> |
160 shader_translator_cache() = 0; | 163 shader_translator_cache() = 0; |
161 virtual scoped_refptr<gles2::FramebufferCompletenessCache> | 164 virtual scoped_refptr<gles2::FramebufferCompletenessCache> |
162 framebuffer_completeness_cache() = 0; | 165 framebuffer_completeness_cache() = 0; |
163 virtual SyncPointManager* sync_point_manager() = 0; | 166 virtual SyncPointManager* sync_point_manager() = 0; |
164 const GpuPreferences& gpu_preferences(); | 167 const GpuPreferences& gpu_preferences(); |
| 168 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds(); |
165 scoped_refptr<gfx::GLShareGroup> share_group(); | 169 scoped_refptr<gfx::GLShareGroup> share_group(); |
166 scoped_refptr<gles2::MailboxManager> mailbox_manager(); | 170 scoped_refptr<gles2::MailboxManager> mailbox_manager(); |
167 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); | 171 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); |
168 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); | 172 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); |
169 gpu::gles2::ProgramCache* program_cache(); | 173 gpu::gles2::ProgramCache* program_cache(); |
170 | 174 |
171 private: | 175 private: |
172 const GpuPreferences gpu_preferences_; | 176 const GpuPreferences gpu_preferences_; |
| 177 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; |
173 scoped_refptr<gfx::GLShareGroup> share_group_; | 178 scoped_refptr<gfx::GLShareGroup> share_group_; |
174 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 179 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
175 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; | 180 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; |
176 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 181 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
177 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 182 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
178 }; | 183 }; |
179 | 184 |
180 #if defined(OS_ANDROID) | 185 #if defined(OS_ANDROID) |
181 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); | 186 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(uint32_t stream_id); |
182 uint32_t CreateStreamTexture(uint32_t texture_id); | 187 uint32_t CreateStreamTexture(uint32_t texture_id); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 SyncPointManager* sync_point_manager_; // Non-owning. | 325 SyncPointManager* sync_point_manager_; // Non-owning. |
321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 326 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 327 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
323 framebuffer_completeness_cache_; | 328 framebuffer_completeness_cache_; |
324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 329 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
325 }; | 330 }; |
326 | 331 |
327 } // namespace gpu | 332 } // namespace gpu |
328 | 333 |
329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 334 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |