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