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, |
(...skipping 30 matching lines...) Expand all Loading... |
124 int32_t GetExtraCommandBufferData() const override; | 127 int32_t GetExtraCommandBufferData() const override; |
125 uint64_t GenerateFenceSyncRelease() override; | 128 uint64_t GenerateFenceSyncRelease() override; |
126 bool IsFenceSyncRelease(uint64_t release) override; | 129 bool IsFenceSyncRelease(uint64_t release) override; |
127 bool IsFenceSyncFlushed(uint64_t release) override; | 130 bool IsFenceSyncFlushed(uint64_t release) override; |
128 bool IsFenceSyncFlushReceived(uint64_t release) override; | 131 bool IsFenceSyncFlushReceived(uint64_t release) override; |
129 bool IsFenceSyncReleased(uint64_t release) override; | 132 bool IsFenceSyncReleased(uint64_t release) override; |
130 void SignalSyncToken(const SyncToken& sync_token, | 133 void SignalSyncToken(const SyncToken& sync_token, |
131 const base::Closure& callback) override; | 134 const base::Closure& callback) override; |
132 void WaitSyncTokenHint(const SyncToken& sync_token) override; | 135 void WaitSyncTokenHint(const SyncToken& sync_token) override; |
133 bool CanWaitUnverifiedSyncToken(const SyncToken& sync_token) override; | 136 bool CanWaitUnverifiedSyncToken(const SyncToken& sync_token) override; |
| 137 void AddLatencyInfo( |
| 138 const std::vector<ui::LatencyInfo>& latency_info) override; |
134 | 139 |
135 // ImageTransportSurfaceDelegate implementation: | 140 // ImageTransportSurfaceDelegate implementation: |
136 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
137 void DidCreateAcceleratedSurfaceChildWindow( | 142 void DidCreateAcceleratedSurfaceChildWindow( |
138 SurfaceHandle parent_window, | 143 SurfaceHandle parent_window, |
139 SurfaceHandle child_window) override; | 144 SurfaceHandle child_window) override; |
140 #endif | 145 #endif |
141 void DidSwapBuffersComplete(SwapBuffersCompleteParams params) override; | 146 void DidSwapBuffersComplete(SwapBuffersCompleteParams params) override; |
142 const gles2::FeatureInfo* GetFeatureInfo() const override; | 147 const gles2::FeatureInfo* GetFeatureInfo() const override; |
143 void SetLatencyInfoCallback(const LatencyInfoCallback& callback) override; | 148 void SetLatencyInfoCallback(const LatencyInfoCallback& callback) override; |
(...skipping 134 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 scoped_refptr<SyncPointClientState> sync_point_client_state_; | 287 scoped_refptr<SyncPointClientState> sync_point_client_state_; |
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 |