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/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
24 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
26 #include "gpu/command_buffer/client/gpu_control.h" | 26 #include "gpu/command_buffer/client/gpu_control.h" |
27 #include "gpu/command_buffer/common/command_buffer.h" | 27 #include "gpu/command_buffer/common/command_buffer.h" |
28 #include "gpu/command_buffer/service/gpu_preferences.h" | 28 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 29 #include "gpu/config/gpu_driver_bug_workarounds.h" |
29 #include "gpu/gpu_export.h" | 30 #include "gpu/gpu_export.h" |
30 #include "ui/gfx/gpu_memory_buffer.h" | 31 #include "ui/gfx/gpu_memory_buffer.h" |
31 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
32 #include "ui/gl/gl_surface.h" | 33 #include "ui/gl/gl_surface.h" |
33 #include "ui/gl/gpu_preference.h" | 34 #include "ui/gl/gpu_preference.h" |
34 | 35 |
35 namespace base { | 36 namespace base { |
36 class SequenceChecker; | 37 class SequenceChecker; |
37 } | 38 } |
38 | 39 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 bool IsFenceSyncFlushed(uint64_t release) override; | 128 bool IsFenceSyncFlushed(uint64_t release) override; |
128 bool IsFenceSyncFlushReceived(uint64_t release) override; | 129 bool IsFenceSyncFlushReceived(uint64_t release) override; |
129 void SignalSyncToken(const SyncToken& sync_token, | 130 void SignalSyncToken(const SyncToken& sync_token, |
130 const base::Closure& callback) override; | 131 const base::Closure& callback) override; |
131 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; | 132 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; |
132 | 133 |
133 // The serializer interface to the GPU service (i.e. thread). | 134 // The serializer interface to the GPU service (i.e. thread). |
134 class Service { | 135 class Service { |
135 public: | 136 public: |
136 Service(); | 137 Service(); |
137 explicit Service(const gpu::GpuPreferences& gpu_preferences); | 138 Service(const gpu::GpuPreferences& gpu_preferences); |
138 virtual ~Service(); | 139 virtual ~Service(); |
139 | 140 |
140 virtual void AddRef() const = 0; | 141 virtual void AddRef() const = 0; |
141 virtual void Release() const = 0; | 142 virtual void Release() const = 0; |
142 | 143 |
143 // Queues a task to run as soon as possible. | 144 // Queues a task to run as soon as possible. |
144 virtual void ScheduleTask(const base::Closure& task) = 0; | 145 virtual void ScheduleTask(const base::Closure& task) = 0; |
145 | 146 |
146 // Schedules |callback| to run at an appropriate time for performing delayed | 147 // Schedules |callback| to run at an appropriate time for performing delayed |
147 // work. | 148 // work. |
148 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; | 149 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; |
149 | 150 |
150 virtual bool UseVirtualizedGLContexts() = 0; | 151 virtual bool UseVirtualizedGLContexts() = 0; |
151 virtual scoped_refptr<gles2::ShaderTranslatorCache> | 152 virtual scoped_refptr<gles2::ShaderTranslatorCache> |
152 shader_translator_cache() = 0; | 153 shader_translator_cache() = 0; |
153 virtual scoped_refptr<gles2::FramebufferCompletenessCache> | 154 virtual scoped_refptr<gles2::FramebufferCompletenessCache> |
154 framebuffer_completeness_cache() = 0; | 155 framebuffer_completeness_cache() = 0; |
155 virtual SyncPointManager* sync_point_manager() = 0; | 156 virtual SyncPointManager* sync_point_manager() = 0; |
156 const GpuPreferences& gpu_preferences(); | 157 const GpuPreferences& gpu_preferences(); |
| 158 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds(); |
157 scoped_refptr<gfx::GLShareGroup> share_group(); | 159 scoped_refptr<gfx::GLShareGroup> share_group(); |
158 scoped_refptr<gles2::MailboxManager> mailbox_manager(); | 160 scoped_refptr<gles2::MailboxManager> mailbox_manager(); |
159 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); | 161 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); |
160 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); | 162 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state(); |
161 gpu::gles2::ProgramCache* program_cache(); | 163 gpu::gles2::ProgramCache* program_cache(); |
162 | 164 |
163 private: | 165 private: |
164 const GpuPreferences gpu_preferences_; | 166 const GpuPreferences gpu_preferences_; |
| 167 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; |
165 scoped_refptr<gfx::GLShareGroup> share_group_; | 168 scoped_refptr<gfx::GLShareGroup> share_group_; |
166 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 169 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
167 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; | 170 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set_; |
168 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; | 171 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
169 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; | 172 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; |
170 }; | 173 }; |
171 | 174 |
172 private: | 175 private: |
173 struct InitializeOnGpuThreadParams { | 176 struct InitializeOnGpuThreadParams { |
174 bool is_offscreen; | 177 bool is_offscreen; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 SyncPointManager* sync_point_manager_; // Non-owning. | 314 SyncPointManager* sync_point_manager_; // Non-owning. |
312 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 315 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
313 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 316 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
314 framebuffer_completeness_cache_; | 317 framebuffer_completeness_cache_; |
315 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 318 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
316 }; | 319 }; |
317 | 320 |
318 } // namespace gpu | 321 } // namespace gpu |
319 | 322 |
320 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 323 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |