| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 void RetireSyncPoint(uint32 sync_point) override; | 123 void RetireSyncPoint(uint32 sync_point) override; |
| 124 void SignalSyncPoint(uint32 sync_point, | 124 void SignalSyncPoint(uint32 sync_point, |
| 125 const base::Closure& callback) override; | 125 const base::Closure& callback) override; |
| 126 void SignalQuery(uint32 query_id, const base::Closure& callback) override; | 126 void SignalQuery(uint32 query_id, const base::Closure& callback) override; |
| 127 void SetSurfaceVisible(bool visible) override; | 127 void SetSurfaceVisible(bool visible) override; |
| 128 uint32 CreateStreamTexture(uint32 texture_id) override; | 128 uint32 CreateStreamTexture(uint32 texture_id) override; |
| 129 void SetLock(base::Lock*) override; | 129 void SetLock(base::Lock*) override; |
| 130 bool IsGpuChannelLost() override; | 130 bool IsGpuChannelLost() override; |
| 131 CommandBufferNamespace GetNamespaceID() const override; | 131 CommandBufferNamespace GetNamespaceID() const override; |
| 132 uint64_t GetCommandBufferID() const override; | 132 uint64_t GetCommandBufferID() const override; |
| 133 uint32_t GenerateFenceSyncRelease() override; |
| 134 bool IsFenceSyncRelease(uint32_t release) override; |
| 135 bool IsFenceSyncFlushed(uint32_t release) override; |
| 133 | 136 |
| 134 // The serializer interface to the GPU service (i.e. thread). | 137 // The serializer interface to the GPU service (i.e. thread). |
| 135 class Service { | 138 class Service { |
| 136 public: | 139 public: |
| 137 Service(); | 140 Service(); |
| 138 virtual ~Service(); | 141 virtual ~Service(); |
| 139 | 142 |
| 140 virtual void AddRef() const = 0; | 143 virtual void AddRef() const = 0; |
| 141 virtual void Release() const = 0; | 144 virtual void Release() const = 0; |
| 142 | 145 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); | 211 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); |
| 209 bool MakeCurrent(); | 212 bool MakeCurrent(); |
| 210 base::Closure WrapCallback(const base::Closure& callback); | 213 base::Closure WrapCallback(const base::Closure& callback); |
| 211 State GetStateFast(); | 214 State GetStateFast(); |
| 212 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } | 215 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } |
| 213 void CheckSequencedThread(); | 216 void CheckSequencedThread(); |
| 214 void RetireSyncPointOnGpuThread(uint32 sync_point); | 217 void RetireSyncPointOnGpuThread(uint32 sync_point); |
| 215 void SignalSyncPointOnGpuThread(uint32 sync_point, | 218 void SignalSyncPointOnGpuThread(uint32 sync_point, |
| 216 const base::Closure& callback); | 219 const base::Closure& callback); |
| 217 bool WaitSyncPointOnGpuThread(uint32 sync_point); | 220 bool WaitSyncPointOnGpuThread(uint32 sync_point); |
| 221 void FenceSyncReleaseOnGpuThread(uint32_t release); |
| 222 bool WaitFenceSyncOnGpuThread(gpu::CommandBufferNamespace namespace_id, |
| 223 uint64_t command_buffer_id, |
| 224 uint32_t release); |
| 218 void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback); | 225 void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback); |
| 219 void DestroyTransferBufferOnGpuThread(int32 id); | 226 void DestroyTransferBufferOnGpuThread(int32 id); |
| 220 void CreateImageOnGpuThread(int32 id, | 227 void CreateImageOnGpuThread(int32 id, |
| 221 const gfx::GpuMemoryBufferHandle& handle, | 228 const gfx::GpuMemoryBufferHandle& handle, |
| 222 const gfx::Size& size, | 229 const gfx::Size& size, |
| 223 gfx::BufferFormat format, | 230 gfx::BufferFormat format, |
| 224 uint32 internalformat); | 231 uint32 internalformat); |
| 225 void DestroyImageOnGpuThread(int32 id); | 232 void DestroyImageOnGpuThread(int32 id); |
| 226 void SetGetBufferOnGpuThread(int32 shm_id, base::WaitableEvent* completion); | 233 void SetGetBufferOnGpuThread(int32 shm_id, base::WaitableEvent* completion); |
| 227 | 234 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 247 base::Closure context_lost_callback_; | 254 base::Closure context_lost_callback_; |
| 248 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. | 255 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. |
| 249 ImageFactory* image_factory_; | 256 ImageFactory* image_factory_; |
| 250 | 257 |
| 251 // Members accessed on the client thread: | 258 // Members accessed on the client thread: |
| 252 State last_state_; | 259 State last_state_; |
| 253 int32 last_put_offset_; | 260 int32 last_put_offset_; |
| 254 gpu::Capabilities capabilities_; | 261 gpu::Capabilities capabilities_; |
| 255 GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 262 GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 256 base::AtomicSequenceNumber next_image_id_; | 263 base::AtomicSequenceNumber next_image_id_; |
| 264 uint32_t next_fence_sync_release_; |
| 265 uint32_t flushed_fence_sync_release_; |
| 257 | 266 |
| 258 // Accessed on both threads: | 267 // Accessed on both threads: |
| 259 scoped_ptr<CommandBufferServiceBase> command_buffer_; | 268 scoped_ptr<CommandBufferServiceBase> command_buffer_; |
| 260 base::Lock command_buffer_lock_; | 269 base::Lock command_buffer_lock_; |
| 261 base::WaitableEvent flush_event_; | 270 base::WaitableEvent flush_event_; |
| 262 scoped_refptr<Service> service_; | 271 scoped_refptr<Service> service_; |
| 263 State state_after_last_flush_; | 272 State state_after_last_flush_; |
| 264 base::Lock state_after_last_flush_lock_; | 273 base::Lock state_after_last_flush_lock_; |
| 265 scoped_refptr<gfx::GLShareGroup> gl_share_group_; | 274 scoped_refptr<gfx::GLShareGroup> gl_share_group_; |
| 275 base::WaitableEvent fence_sync_wait_event_; |
| 266 | 276 |
| 267 #if defined(OS_ANDROID) | 277 #if defined(OS_ANDROID) |
| 268 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; | 278 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; |
| 269 #endif | 279 #endif |
| 270 | 280 |
| 271 // Only used with explicit scheduling and the gpu thread is the same as | 281 // Only used with explicit scheduling and the gpu thread is the same as |
| 272 // the client thread. | 282 // the client thread. |
| 273 scoped_ptr<base::SequenceChecker> sequence_checker_; | 283 scoped_ptr<base::SequenceChecker> sequence_checker_; |
| 274 | 284 |
| 275 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 285 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 304 SyncPointManager* sync_point_manager_; // Non-owning. | 314 SyncPointManager* sync_point_manager_; // Non-owning. |
| 305 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 315 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
| 306 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 316 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
| 307 framebuffer_completeness_cache_; | 317 framebuffer_completeness_cache_; |
| 308 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 318 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
| 309 }; | 319 }; |
| 310 | 320 |
| 311 } // namespace gpu | 321 } // namespace gpu |
| 312 | 322 |
| 313 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 323 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |