| 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_IPC_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ |
| 6 #define GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_IPC_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 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bool is_offscreen, | 91 bool is_offscreen, |
| 92 SurfaceHandle window, | 92 SurfaceHandle window, |
| 93 const gles2::ContextCreationAttribHelper& attribs, | 93 const gles2::ContextCreationAttribHelper& attribs, |
| 94 InProcessCommandBuffer* share_group, | 94 InProcessCommandBuffer* share_group, |
| 95 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 95 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 96 ImageFactory* image_factory, | 96 ImageFactory* image_factory, |
| 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 98 | 98 |
| 99 // CommandBuffer implementation: | 99 // CommandBuffer implementation: |
| 100 State GetLastState() override; | 100 State GetLastState() override; |
| 101 int32_t GetLastToken() override; | |
| 102 void Flush(int32_t put_offset) override; | 101 void Flush(int32_t put_offset) override; |
| 103 void OrderingBarrier(int32_t put_offset) override; | 102 void OrderingBarrier(int32_t put_offset) override; |
| 104 void WaitForTokenInRange(int32_t start, int32_t end) override; | 103 State WaitForTokenInRange(int32_t start, int32_t end) override; |
| 105 void WaitForGetOffsetInRange(int32_t start, int32_t end) override; | 104 State WaitForGetOffsetInRange(int32_t start, int32_t end) override; |
| 106 void SetGetBuffer(int32_t shm_id) override; | 105 void SetGetBuffer(int32_t shm_id) override; |
| 107 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 106 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
| 108 int32_t* id) override; | 107 int32_t* id) override; |
| 109 void DestroyTransferBuffer(int32_t id) override; | 108 void DestroyTransferBuffer(int32_t id) override; |
| 110 gpu::error::Error GetLastError() override; | |
| 111 | 109 |
| 112 // GpuControl implementation: | 110 // GpuControl implementation: |
| 113 // NOTE: The GpuControlClient will be called on the client thread. | 111 // NOTE: The GpuControlClient will be called on the client thread. |
| 114 void SetGpuControlClient(GpuControlClient*) override; | 112 void SetGpuControlClient(GpuControlClient*) override; |
| 115 gpu::Capabilities GetCapabilities() override; | 113 gpu::Capabilities GetCapabilities() override; |
| 116 int32_t CreateImage(ClientBuffer buffer, | 114 int32_t CreateImage(ClientBuffer buffer, |
| 117 size_t width, | 115 size_t width, |
| 118 size_t height, | 116 size_t height, |
| 119 unsigned internalformat) override; | 117 unsigned internalformat) override; |
| 120 void DestroyImage(int32_t id) override; | 118 void DestroyImage(int32_t id) override; |
| 121 int32_t CreateGpuMemoryBufferImage(size_t width, | 119 int32_t CreateGpuMemoryBufferImage(size_t width, |
| 122 size_t height, | 120 size_t height, |
| 123 unsigned internalformat, | 121 unsigned internalformat, |
| 124 unsigned usage) override; | 122 unsigned usage) override; |
| 125 void SignalQuery(uint32_t query_id, const base::Closure& callback) override; | 123 void SignalQuery(uint32_t query_id, const base::Closure& callback) override; |
| 126 void SetLock(base::Lock*) override; | 124 void SetLock(base::Lock*) override; |
| 127 void EnsureWorkVisible() override; | 125 void EnsureWorkVisible() override; |
| 128 CommandBufferNamespace GetNamespaceID() const override; | 126 CommandBufferNamespace GetNamespaceID() const override; |
| 129 CommandBufferId GetCommandBufferID() const override; | 127 CommandBufferId GetCommandBufferID() const override; |
| 130 int32_t GetExtraCommandBufferData() const override; | 128 int32_t GetExtraCommandBufferData() const override; |
| 131 uint64_t GenerateFenceSyncRelease() override; | 129 uint64_t GenerateFenceSyncRelease() override; |
| 132 bool IsFenceSyncRelease(uint64_t release) override; | 130 bool IsFenceSyncRelease(uint64_t release) override; |
| 133 bool IsFenceSyncFlushed(uint64_t release) override; | 131 bool IsFenceSyncFlushed(uint64_t release) override; |
| 134 bool IsFenceSyncFlushReceived(uint64_t release) override; | 132 bool IsFenceSyncFlushReceived(uint64_t release) override; |
| 133 bool IsFenceSyncReleased(uint64_t release) override; |
| 135 void SignalSyncToken(const SyncToken& sync_token, | 134 void SignalSyncToken(const SyncToken& sync_token, |
| 136 const base::Closure& callback) override; | 135 const base::Closure& callback) override; |
| 137 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; | 136 bool CanWaitUnverifiedSyncToken(const SyncToken* sync_token) override; |
| 138 | 137 |
| 139 // ImageTransportSurfaceDelegate implementation: | 138 // ImageTransportSurfaceDelegate implementation: |
| 140 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 141 void DidCreateAcceleratedSurfaceChildWindow( | 140 void DidCreateAcceleratedSurfaceChildWindow( |
| 142 SurfaceHandle parent_window, | 141 SurfaceHandle parent_window, |
| 143 SurfaceHandle child_window) override; | 142 SurfaceHandle child_window) override; |
| 144 #endif | 143 #endif |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 attribs(attribs), | 225 attribs(attribs), |
| 227 capabilities(capabilities), | 226 capabilities(capabilities), |
| 228 context_group(share_group), | 227 context_group(share_group), |
| 229 image_factory(image_factory) {} | 228 image_factory(image_factory) {} |
| 230 }; | 229 }; |
| 231 | 230 |
| 232 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); | 231 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); |
| 233 void Destroy(); | 232 void Destroy(); |
| 234 bool DestroyOnGpuThread(); | 233 bool DestroyOnGpuThread(); |
| 235 void FlushOnGpuThread(int32_t put_offset); | 234 void FlushOnGpuThread(int32_t put_offset); |
| 235 void UpdateLastStateOnGpuThread(); |
| 236 void ScheduleDelayedWorkOnGpuThread(); | 236 void ScheduleDelayedWorkOnGpuThread(); |
| 237 bool MakeCurrent(); | 237 bool MakeCurrent(); |
| 238 base::Closure WrapCallback(const base::Closure& callback); | 238 base::Closure WrapCallback(const base::Closure& callback); |
| 239 State GetStateFast(); | |
| 240 void QueueTask(bool out_of_order, const base::Closure& task); | 239 void QueueTask(bool out_of_order, const base::Closure& task); |
| 241 void ProcessTasksOnGpuThread(); | 240 void ProcessTasksOnGpuThread(); |
| 242 void CheckSequencedThread(); | 241 void CheckSequencedThread(); |
| 243 void FenceSyncReleaseOnGpuThread(uint64_t release); | 242 void FenceSyncReleaseOnGpuThread(uint64_t release); |
| 244 bool WaitFenceSyncOnGpuThread(gpu::CommandBufferNamespace namespace_id, | 243 bool WaitFenceSyncOnGpuThread(gpu::CommandBufferNamespace namespace_id, |
| 245 gpu::CommandBufferId command_buffer_id, | 244 gpu::CommandBufferId command_buffer_id, |
| 246 uint64_t release); | 245 uint64_t release); |
| 247 void OnWaitFenceSyncCompleted(CommandBufferNamespace namespace_id, | 246 void OnWaitFenceSyncCompleted(CommandBufferNamespace namespace_id, |
| 248 CommandBufferId command_buffer_id, | 247 CommandBufferId command_buffer_id, |
| 249 uint64_t release); | 248 uint64_t release); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // Used to throttle PerformDelayedWorkOnGpuThread. | 287 // Used to throttle PerformDelayedWorkOnGpuThread. |
| 289 bool delayed_work_pending_; | 288 bool delayed_work_pending_; |
| 290 ImageFactory* image_factory_; | 289 ImageFactory* image_factory_; |
| 291 | 290 |
| 292 // Members accessed on the client thread: | 291 // Members accessed on the client thread: |
| 293 GpuControlClient* gpu_control_client_; | 292 GpuControlClient* gpu_control_client_; |
| 294 #if DCHECK_IS_ON() | 293 #if DCHECK_IS_ON() |
| 295 bool context_lost_; | 294 bool context_lost_; |
| 296 #endif | 295 #endif |
| 297 State last_state_; | 296 State last_state_; |
| 297 base::Lock last_state_lock_; |
| 298 int32_t last_put_offset_; | 298 int32_t last_put_offset_; |
| 299 gpu::Capabilities capabilities_; | 299 gpu::Capabilities capabilities_; |
| 300 GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 300 GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 301 base::AtomicSequenceNumber next_image_id_; | 301 base::AtomicSequenceNumber next_image_id_; |
| 302 uint64_t next_fence_sync_release_; | 302 uint64_t next_fence_sync_release_; |
| 303 uint64_t flushed_fence_sync_release_; | 303 uint64_t flushed_fence_sync_release_; |
| 304 | 304 |
| 305 // Accessed on both threads: | 305 // Accessed on both threads: |
| 306 std::unique_ptr<CommandBufferServiceBase> command_buffer_; | 306 std::unique_ptr<CommandBufferServiceBase> command_buffer_; |
| 307 base::Lock command_buffer_lock_; | 307 base::Lock command_buffer_lock_; |
| 308 base::WaitableEvent flush_event_; | 308 base::WaitableEvent flush_event_; |
| 309 scoped_refptr<Service> service_; | 309 scoped_refptr<Service> service_; |
| 310 State state_after_last_flush_; | |
| 311 base::Lock state_after_last_flush_lock_; | |
| 312 | 310 |
| 313 // The group of contexts that share namespaces with this context. | 311 // The group of contexts that share namespaces with this context. |
| 314 scoped_refptr<gles2::ContextGroup> context_group_; | 312 scoped_refptr<gles2::ContextGroup> context_group_; |
| 315 | 313 |
| 316 scoped_refptr<gl::GLShareGroup> gl_share_group_; | 314 scoped_refptr<gl::GLShareGroup> gl_share_group_; |
| 317 base::WaitableEvent fence_sync_wait_event_; | 315 base::WaitableEvent fence_sync_wait_event_; |
| 318 | 316 |
| 319 // Only used with explicit scheduling and the gpu thread is the same as | 317 // Only used with explicit scheduling and the gpu thread is the same as |
| 320 // the client thread. | 318 // the client thread. |
| 321 std::unique_ptr<base::SequenceChecker> sequence_checker_; | 319 std::unique_ptr<base::SequenceChecker> sequence_checker_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 336 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 334 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| 337 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; | 335 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; |
| 338 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 336 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
| 339 | 337 |
| 340 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 338 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
| 341 }; | 339 }; |
| 342 | 340 |
| 343 } // namespace gpu | 341 } // namespace gpu |
| 344 | 342 |
| 345 #endif // GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ | 343 #endif // GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |