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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 public: | 132 public: |
133 Service(); | 133 Service(); |
134 virtual ~Service(); | 134 virtual ~Service(); |
135 | 135 |
136 virtual void AddRef() const = 0; | 136 virtual void AddRef() const = 0; |
137 virtual void Release() const = 0; | 137 virtual void Release() const = 0; |
138 | 138 |
139 // Queues a task to run as soon as possible. | 139 // Queues a task to run as soon as possible. |
140 virtual void ScheduleTask(const base::Closure& task) = 0; | 140 virtual void ScheduleTask(const base::Closure& task) = 0; |
141 | 141 |
142 // Schedules |callback| to run at an appropriate time for performing idle | 142 // Schedules |callback| to run at an appropriate time for performing delayed |
143 // work. | 143 // work. |
144 virtual void ScheduleIdleWork(const base::Closure& task) = 0; | 144 virtual void ScheduleDelayedWork(const base::Closure& task) = 0; |
145 | 145 |
146 virtual bool UseVirtualizedGLContexts() = 0; | 146 virtual bool UseVirtualizedGLContexts() = 0; |
147 virtual scoped_refptr<gles2::ShaderTranslatorCache> | 147 virtual scoped_refptr<gles2::ShaderTranslatorCache> |
148 shader_translator_cache() = 0; | 148 shader_translator_cache() = 0; |
149 virtual scoped_refptr<gles2::FramebufferCompletenessCache> | 149 virtual scoped_refptr<gles2::FramebufferCompletenessCache> |
150 framebuffer_completeness_cache() = 0; | 150 framebuffer_completeness_cache() = 0; |
151 virtual SyncPointManager* sync_point_manager() = 0; | 151 virtual SyncPointManager* sync_point_manager() = 0; |
152 scoped_refptr<gfx::GLShareGroup> share_group(); | 152 scoped_refptr<gfx::GLShareGroup> share_group(); |
153 scoped_refptr<gles2::MailboxManager> mailbox_manager(); | 153 scoped_refptr<gles2::MailboxManager> mailbox_manager(); |
154 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); | 154 scoped_refptr<gles2::SubscriptionRefSet> subscription_ref_set(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 attribs(attribs), | 193 attribs(attribs), |
194 gpu_preference(gpu_preference), | 194 gpu_preference(gpu_preference), |
195 capabilities(capabilities), | 195 capabilities(capabilities), |
196 context_group(share_group), | 196 context_group(share_group), |
197 image_factory(image_factory) {} | 197 image_factory(image_factory) {} |
198 }; | 198 }; |
199 | 199 |
200 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); | 200 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); |
201 bool DestroyOnGpuThread(); | 201 bool DestroyOnGpuThread(); |
202 void FlushOnGpuThread(int32 put_offset); | 202 void FlushOnGpuThread(int32 put_offset); |
203 void ScheduleIdleWorkOnGpuThread(); | 203 void ScheduleDelayedWorkOnGpuThread(); |
204 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); | 204 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); |
205 bool MakeCurrent(); | 205 bool MakeCurrent(); |
206 base::Closure WrapCallback(const base::Closure& callback); | 206 base::Closure WrapCallback(const base::Closure& callback); |
207 State GetStateFast(); | 207 State GetStateFast(); |
208 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } | 208 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } |
209 void CheckSequencedThread(); | 209 void CheckSequencedThread(); |
210 void RetireSyncPointOnGpuThread(uint32 sync_point); | 210 void RetireSyncPointOnGpuThread(uint32 sync_point); |
211 void SignalSyncPointOnGpuThread(uint32 sync_point, | 211 void SignalSyncPointOnGpuThread(uint32 sync_point, |
212 const base::Closure& callback); | 212 const base::Closure& callback); |
213 bool WaitSyncPointOnGpuThread(uint32 sync_point); | 213 bool WaitSyncPointOnGpuThread(uint32 sync_point); |
214 void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback); | 214 void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback); |
215 void DestroyTransferBufferOnGpuThread(int32 id); | 215 void DestroyTransferBufferOnGpuThread(int32 id); |
216 void CreateImageOnGpuThread(int32 id, | 216 void CreateImageOnGpuThread(int32 id, |
217 const gfx::GpuMemoryBufferHandle& handle, | 217 const gfx::GpuMemoryBufferHandle& handle, |
218 const gfx::Size& size, | 218 const gfx::Size& size, |
219 gfx::BufferFormat format, | 219 gfx::BufferFormat format, |
220 uint32 internalformat); | 220 uint32 internalformat); |
221 void DestroyImageOnGpuThread(int32 id); | 221 void DestroyImageOnGpuThread(int32 id); |
222 void SetGetBufferOnGpuThread(int32 shm_id, base::WaitableEvent* completion); | 222 void SetGetBufferOnGpuThread(int32 shm_id, base::WaitableEvent* completion); |
223 | 223 |
224 // Callbacks: | 224 // Callbacks: |
225 void OnContextLost(); | 225 void OnContextLost(); |
226 void OnResizeView(gfx::Size size, float scale_factor); | 226 void OnResizeView(gfx::Size size, float scale_factor); |
227 bool GetBufferChanged(int32 transfer_buffer_id); | 227 bool GetBufferChanged(int32 transfer_buffer_id); |
228 void PumpCommands(); | 228 void PumpCommands(); |
229 void PerformIdleWork(); | 229 void PerformDelayedWork(); |
230 | 230 |
231 // Members accessed on the gpu thread (possibly with the exception of | 231 // Members accessed on the gpu thread (possibly with the exception of |
232 // creation): | 232 // creation): |
233 bool context_lost_; | 233 bool context_lost_; |
234 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 234 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
235 scoped_ptr<GpuScheduler> gpu_scheduler_; | 235 scoped_ptr<GpuScheduler> gpu_scheduler_; |
236 scoped_ptr<gles2::GLES2Decoder> decoder_; | 236 scoped_ptr<gles2::GLES2Decoder> decoder_; |
237 scoped_refptr<gfx::GLContext> context_; | 237 scoped_refptr<gfx::GLContext> context_; |
238 scoped_refptr<gfx::GLSurface> surface_; | 238 scoped_refptr<gfx::GLSurface> surface_; |
239 base::Closure context_lost_callback_; | 239 base::Closure context_lost_callback_; |
240 bool idle_work_pending_; // Used to throttle PerformIdleWork. | 240 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. |
241 ImageFactory* image_factory_; | 241 ImageFactory* image_factory_; |
242 | 242 |
243 // Members accessed on the client thread: | 243 // Members accessed on the client thread: |
244 State last_state_; | 244 State last_state_; |
245 int32 last_put_offset_; | 245 int32 last_put_offset_; |
246 gpu::Capabilities capabilities_; | 246 gpu::Capabilities capabilities_; |
247 GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 247 GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
248 base::AtomicSequenceNumber next_image_id_; | 248 base::AtomicSequenceNumber next_image_id_; |
249 | 249 |
250 // Accessed on both threads: | 250 // Accessed on both threads: |
(...skipping 23 matching lines...) Expand all Loading... |
274 class GPU_EXPORT GpuInProcessThread | 274 class GPU_EXPORT GpuInProcessThread |
275 : public base::Thread, | 275 : public base::Thread, |
276 public NON_EXPORTED_BASE(InProcessCommandBuffer::Service), | 276 public NON_EXPORTED_BASE(InProcessCommandBuffer::Service), |
277 public base::RefCountedThreadSafe<GpuInProcessThread> { | 277 public base::RefCountedThreadSafe<GpuInProcessThread> { |
278 public: | 278 public: |
279 explicit GpuInProcessThread(SyncPointManager* sync_point_manager); | 279 explicit GpuInProcessThread(SyncPointManager* sync_point_manager); |
280 | 280 |
281 void AddRef() const override; | 281 void AddRef() const override; |
282 void Release() const override; | 282 void Release() const override; |
283 void ScheduleTask(const base::Closure& task) override; | 283 void ScheduleTask(const base::Closure& task) override; |
284 void ScheduleIdleWork(const base::Closure& callback) override; | 284 void ScheduleDelayedWork(const base::Closure& callback) override; |
285 bool UseVirtualizedGLContexts() override; | 285 bool UseVirtualizedGLContexts() override; |
286 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache() | 286 scoped_refptr<gles2::ShaderTranslatorCache> shader_translator_cache() |
287 override; | 287 override; |
288 scoped_refptr<gles2::FramebufferCompletenessCache> | 288 scoped_refptr<gles2::FramebufferCompletenessCache> |
289 framebuffer_completeness_cache() override; | 289 framebuffer_completeness_cache() override; |
290 SyncPointManager* sync_point_manager() override; | 290 SyncPointManager* sync_point_manager() override; |
291 | 291 |
292 private: | 292 private: |
293 ~GpuInProcessThread() override; | 293 ~GpuInProcessThread() override; |
294 friend class base::RefCountedThreadSafe<GpuInProcessThread>; | 294 friend class base::RefCountedThreadSafe<GpuInProcessThread>; |
295 | 295 |
296 SyncPointManager* sync_point_manager_; // Non-owning. | 296 SyncPointManager* sync_point_manager_; // Non-owning. |
297 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 297 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
298 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 298 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
299 framebuffer_completeness_cache_; | 299 framebuffer_completeness_cache_; |
300 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 300 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
301 }; | 301 }; |
302 | 302 |
303 } // namespace gpu | 303 } // namespace gpu |
304 | 304 |
305 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 305 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |