Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: gpu/ipc/in_process_command_buffer.h

Issue 2806163004: Plumbing input event latency reporting through Mus GPU. (Closed)
Patch Set: Inline LatencyTracker in DIsplayOutputService. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.cc ('k') | gpu/ipc/in_process_command_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 window(window), 230 window(window),
226 attribs(attribs), 231 attribs(attribs),
227 capabilities(capabilities), 232 capabilities(capabilities),
228 context_group(share_group), 233 context_group(share_group),
229 image_factory(image_factory) {} 234 image_factory(image_factory) {}
230 }; 235 };
231 236
232 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); 237 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params);
233 void Destroy(); 238 void Destroy();
234 bool DestroyOnGpuThread(); 239 bool DestroyOnGpuThread();
235 void FlushOnGpuThread(int32_t put_offset); 240 void FlushOnGpuThread(int32_t put_offset,
241 std::vector<ui::LatencyInfo>* latency_info);
236 void UpdateLastStateOnGpuThread(); 242 void UpdateLastStateOnGpuThread();
237 void ScheduleDelayedWorkOnGpuThread(); 243 void ScheduleDelayedWorkOnGpuThread();
238 bool MakeCurrent(); 244 bool MakeCurrent();
239 base::Closure WrapCallback(const base::Closure& callback); 245 base::Closure WrapCallback(const base::Closure& callback);
240 void QueueTask(bool out_of_order, const base::Closure& task); 246 void QueueTask(bool out_of_order, const base::Closure& task);
241 void ProcessTasksOnGpuThread(); 247 void ProcessTasksOnGpuThread();
242 void CheckSequencedThread(); 248 void CheckSequencedThread();
243 void FenceSyncReleaseOnGpuThread(uint64_t release); 249 void FenceSyncReleaseOnGpuThread(uint64_t release);
244 bool WaitSyncTokenOnGpuThread(const SyncToken& sync_token); 250 bool WaitSyncTokenOnGpuThread(const SyncToken& sync_token);
245 void OnWaitSyncTokenCompleted(const SyncToken& sync_token); 251 void OnWaitSyncTokenCompleted(const SyncToken& sync_token);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 std::unique_ptr<gles2::GLES2Decoder> decoder_; 284 std::unique_ptr<gles2::GLES2Decoder> decoder_;
279 scoped_refptr<gl::GLContext> context_; 285 scoped_refptr<gl::GLContext> context_;
280 scoped_refptr<gl::GLSurface> surface_; 286 scoped_refptr<gl::GLSurface> surface_;
281 scoped_refptr<SyncPointOrderData> sync_point_order_data_; 287 scoped_refptr<SyncPointOrderData> sync_point_order_data_;
282 scoped_refptr<SyncPointClientState> sync_point_client_state_; 288 scoped_refptr<SyncPointClientState> sync_point_client_state_;
283 base::Closure context_lost_callback_; 289 base::Closure context_lost_callback_;
284 // Used to throttle PerformDelayedWorkOnGpuThread. 290 // Used to throttle PerformDelayedWorkOnGpuThread.
285 bool delayed_work_pending_; 291 bool delayed_work_pending_;
286 ImageFactory* image_factory_; 292 ImageFactory* image_factory_;
287 293
294 LatencyInfoCallback latency_info_callback_;
295
296 // Should only be accessed on the client thread.
297 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info_;
298
288 // Members accessed on the client thread: 299 // Members accessed on the client thread:
289 GpuControlClient* gpu_control_client_; 300 GpuControlClient* gpu_control_client_;
290 #if DCHECK_IS_ON() 301 #if DCHECK_IS_ON()
291 bool context_lost_; 302 bool context_lost_;
292 #endif 303 #endif
293 State last_state_; 304 State last_state_;
294 base::Lock last_state_lock_; 305 base::Lock last_state_lock_;
295 int32_t last_put_offset_; 306 int32_t last_put_offset_;
296 gpu::Capabilities capabilities_; 307 gpu::Capabilities capabilities_;
297 GpuMemoryBufferManager* gpu_memory_buffer_manager_; 308 GpuMemoryBufferManager* gpu_memory_buffer_manager_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; 342 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_;
332 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_; 343 base::WeakPtrFactory<InProcessCommandBuffer> client_thread_weak_ptr_factory_;
333 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; 344 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_;
334 345
335 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); 346 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer);
336 }; 347 };
337 348
338 } // namespace gpu 349 } // namespace gpu
339 350
340 #endif // GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_ 351 #endif // GPU_IPC_IN_PROCESS_COMMAND_BUFFER_H_
OLDNEW
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.cc ('k') | gpu/ipc/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698