| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // This class provides a thread-safe interface to the global GPU service (for | 75 // This class provides a thread-safe interface to the global GPU service (for |
| 76 // example GPU thread) when being run in single process mode. | 76 // example GPU thread) when being run in single process mode. |
| 77 // However, the behavior for accessing one context (i.e. one instance of this | 77 // However, the behavior for accessing one context (i.e. one instance of this |
| 78 // class) from different client threads is undefined. | 78 // class) from different client threads is undefined. |
| 79 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, | 79 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| 80 public GpuControl, | 80 public GpuControl, |
| 81 public ImageTransportSurfaceDelegate { | 81 public ImageTransportSurfaceDelegate { |
| 82 public: | 82 public: |
| 83 class Service; | 83 class Service; |
| 84 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)> |
| 85 LatencyInfoCallback; |
| 86 |
| 84 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); | 87 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); |
| 85 ~InProcessCommandBuffer() override; | 88 ~InProcessCommandBuffer() override; |
| 86 | 89 |
| 87 // If |surface| is not null, use it directly; in this case, the command | 90 // If |surface| is not null, use it directly; in this case, the command |
| 88 // buffer gpu thread must be the same as the client thread. Otherwise create | 91 // buffer gpu thread must be the same as the client thread. Otherwise create |
| 89 // a new GLSurface. | 92 // a new GLSurface. |
| 90 bool Initialize(scoped_refptr<gl::GLSurface> surface, | 93 bool Initialize(scoped_refptr<gl::GLSurface> surface, |
| 91 bool is_offscreen, | 94 bool is_offscreen, |
| 92 SurfaceHandle window, | 95 SurfaceHandle window, |
| 93 const gles2::ContextCreationAttribHelper& attribs, | 96 const gles2::ContextCreationAttribHelper& attribs, |
| 94 InProcessCommandBuffer* share_group, | 97 InProcessCommandBuffer* share_group, |
| 95 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 98 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 96 ImageFactory* image_factory, | 99 ImageFactory* image_factory, |
| 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 100 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 98 | 101 |
| 102 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 103 |
| 99 // CommandBuffer implementation: | 104 // CommandBuffer implementation: |
| 100 State GetLastState() override; | 105 State GetLastState() override; |
| 101 void Flush(int32_t put_offset) override; | 106 void Flush(int32_t put_offset) override; |
| 102 void OrderingBarrier(int32_t put_offset) override; | 107 void OrderingBarrier(int32_t put_offset) override; |
| 103 State WaitForTokenInRange(int32_t start, int32_t end) override; | 108 State WaitForTokenInRange(int32_t start, int32_t end) override; |
| 104 State WaitForGetOffsetInRange(int32_t start, int32_t end) override; | 109 State WaitForGetOffsetInRange(int32_t start, int32_t end) override; |
| 105 void SetGetBuffer(int32_t shm_id) override; | 110 void SetGetBuffer(int32_t shm_id) override; |
| 106 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 111 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
| 107 int32_t* id) override; | 112 int32_t* id) override; |
| 108 void DestroyTransferBuffer(int32_t id) override; | 113 void DestroyTransferBuffer(int32_t id) override; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 std::unique_ptr<gles2::GLES2Decoder> decoder_; | 283 std::unique_ptr<gles2::GLES2Decoder> decoder_; |
| 279 scoped_refptr<gl::GLContext> context_; | 284 scoped_refptr<gl::GLContext> context_; |
| 280 scoped_refptr<gl::GLSurface> surface_; | 285 scoped_refptr<gl::GLSurface> surface_; |
| 281 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 286 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
| 282 std::unique_ptr<SyncPointClient> sync_point_client_; | 287 std::unique_ptr<SyncPointClient> sync_point_client_; |
| 283 base::Closure context_lost_callback_; | 288 base::Closure context_lost_callback_; |
| 284 // Used to throttle PerformDelayedWorkOnGpuThread. | 289 // Used to throttle PerformDelayedWorkOnGpuThread. |
| 285 bool delayed_work_pending_; | 290 bool delayed_work_pending_; |
| 286 ImageFactory* image_factory_; | 291 ImageFactory* image_factory_; |
| 287 | 292 |
| 293 LatencyInfoCallback latency_info_callback_; |
| 294 std::vector<ui::LatencyInfo> latency_info_; |
| 295 |
| 288 // Members accessed on the client thread: | 296 // Members accessed on the client thread: |
| 289 GpuControlClient* gpu_control_client_; | 297 GpuControlClient* gpu_control_client_; |
| 290 #if DCHECK_IS_ON() | 298 #if DCHECK_IS_ON() |
| 291 bool context_lost_; | 299 bool context_lost_; |
| 292 #endif | 300 #endif |
| 293 State last_state_; | 301 State last_state_; |
| 294 base::Lock last_state_lock_; | 302 base::Lock last_state_lock_; |
| 295 int32_t last_put_offset_; | 303 int32_t last_put_offset_; |
| 296 gpu::Capabilities capabilities_; | 304 gpu::Capabilities capabilities_; |
| 297 GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 305 GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 339 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| 332 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; | 340 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; |
| 333 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 341 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
| 334 | 342 |
| 335 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 343 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
| 336 }; | 344 }; |
| 337 | 345 |
| 338 } // namespace gpu | 346 } // namespace gpu |
| 339 | 347 |
| 340 #endif // GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ | 348 #endif // GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |