OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void RetireSyncPoint(uint32_t sync_point) override; | 116 void RetireSyncPoint(uint32_t sync_point) override; |
117 void SignalSyncPoint(uint32 sync_point, | 117 void SignalSyncPoint(uint32 sync_point, |
118 const base::Closure& callback) override; | 118 const base::Closure& callback) override; |
119 void SignalQuery(uint32 query, const base::Closure& callback) override; | 119 void SignalQuery(uint32 query, const base::Closure& callback) override; |
120 void SetSurfaceVisible(bool visible) override; | 120 void SetSurfaceVisible(bool visible) override; |
121 uint32 CreateStreamTexture(uint32 texture_id) override; | 121 uint32 CreateStreamTexture(uint32 texture_id) override; |
122 void SetLock(base::Lock* lock) override; | 122 void SetLock(base::Lock* lock) override; |
123 bool IsGpuChannelLost() override; | 123 bool IsGpuChannelLost() override; |
124 gpu::CommandBufferNamespace GetNamespaceID() const override; | 124 gpu::CommandBufferNamespace GetNamespaceID() const override; |
125 uint64_t GetCommandBufferID() const override; | 125 uint64_t GetCommandBufferID() const override; |
| 126 uint64_t GenerateFenceSyncRelease() override; |
| 127 bool IsFenceSyncRelease(uint64_t release) override; |
| 128 bool IsFenceSyncFlushed(uint64_t release) override; |
126 | 129 |
127 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); | 130 bool ProduceFrontBuffer(const gpu::Mailbox& mailbox); |
128 void SetContextLostCallback(const base::Closure& callback); | 131 void SetContextLostCallback(const base::Closure& callback); |
129 | 132 |
130 void AddDeletionObserver(DeletionObserver* observer); | 133 void AddDeletionObserver(DeletionObserver* observer); |
131 void RemoveDeletionObserver(DeletionObserver* observer); | 134 void RemoveDeletionObserver(DeletionObserver* observer); |
132 | 135 |
133 bool EnsureBackbuffer(); | 136 bool EnsureBackbuffer(); |
134 | 137 |
135 void SetOnConsoleMessageCallback( | 138 void SetOnConsoleMessageCallback( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 187 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
185 void OnSignalSyncPointAck(uint32 id); | 188 void OnSignalSyncPointAck(uint32 id); |
186 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | 189 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, |
187 gfx::SwapResult result); | 190 gfx::SwapResult result); |
188 void OnUpdateVSyncParameters(base::TimeTicks timebase, | 191 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
189 base::TimeDelta interval); | 192 base::TimeDelta interval); |
190 | 193 |
191 // Try to read an updated copy of the state from shared memory. | 194 // Try to read an updated copy of the state from shared memory. |
192 void TryUpdateState(); | 195 void TryUpdateState(); |
193 | 196 |
| 197 // Updates the highest verified release fence sync. |
| 198 void UpdateVerifiedReleases(uint32_t verified_flush); |
| 199 |
194 // The shared memory area used to update state. | 200 // The shared memory area used to update state. |
195 gpu::CommandBufferSharedState* shared_state() const; | 201 gpu::CommandBufferSharedState* shared_state() const; |
196 | 202 |
197 base::Lock* lock_; | 203 base::Lock* lock_; |
198 | 204 |
199 // Unowned list of DeletionObservers. | 205 // Unowned list of DeletionObservers. |
200 base::ObserverList<DeletionObserver> deletion_observers_; | 206 base::ObserverList<DeletionObserver> deletion_observers_; |
201 | 207 |
202 // The last cached state received from the service. | 208 // The last cached state received from the service. |
203 State last_state_; | 209 State last_state_; |
204 | 210 |
205 // The shared memory area used to update state. | 211 // The shared memory area used to update state. |
206 scoped_ptr<base::SharedMemory> shared_state_shm_; | 212 scoped_ptr<base::SharedMemory> shared_state_shm_; |
207 | 213 |
208 // |*this| is owned by |*channel_| and so is always outlived by it, so using a | 214 // |*this| is owned by |*channel_| and so is always outlived by it, so using a |
209 // raw pointer is ok. | 215 // raw pointer is ok. |
210 GpuChannelHost* channel_; | 216 GpuChannelHost* channel_; |
211 const uint64_t command_buffer_id_; | 217 const uint64_t command_buffer_id_; |
212 const int32 route_id_; | 218 const int32 route_id_; |
213 const int32 stream_id_; | 219 const int32 stream_id_; |
214 uint32 flush_count_; | 220 uint32 flush_count_; |
215 int32 last_put_offset_; | 221 int32 last_put_offset_; |
216 int32 last_barrier_put_offset_; | 222 int32 last_barrier_put_offset_; |
217 | 223 |
| 224 // Next generated fence sync. |
| 225 uint64_t next_fence_sync_release_; |
| 226 |
| 227 // Unverified flushed fence syncs with their corresponding flush id. |
| 228 std::queue<std::pair<uint64_t, uint32_t>> flushed_release_flush_id_; |
| 229 |
| 230 // Last flushed fence sync release, same as last item in queue if not empty. |
| 231 uint64_t flushed_fence_sync_release_; |
| 232 |
| 233 // Last verified fence sync. |
| 234 uint64_t verified_fence_sync_release_; |
| 235 |
218 base::Closure context_lost_callback_; | 236 base::Closure context_lost_callback_; |
219 | 237 |
220 GpuConsoleMessageCallback console_message_callback_; | 238 GpuConsoleMessageCallback console_message_callback_; |
221 | 239 |
222 // Tasks to be invoked in SignalSyncPoint responses. | 240 // Tasks to be invoked in SignalSyncPoint responses. |
223 uint32 next_signal_id_; | 241 uint32 next_signal_id_; |
224 SignalTaskMap signal_tasks_; | 242 SignalTaskMap signal_tasks_; |
225 | 243 |
226 gpu::Capabilities capabilities_; | 244 gpu::Capabilities capabilities_; |
227 | 245 |
228 std::vector<ui::LatencyInfo> latency_info_; | 246 std::vector<ui::LatencyInfo> latency_info_; |
229 | 247 |
230 SwapBuffersCompletionCallback swap_buffers_completion_callback_; | 248 SwapBuffersCompletionCallback swap_buffers_completion_callback_; |
231 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; | 249 UpdateVSyncParametersCallback update_vsync_parameters_completion_callback_; |
232 | 250 |
233 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 251 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
234 }; | 252 }; |
235 | 253 |
236 } // namespace content | 254 } // namespace content |
237 | 255 |
238 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 256 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |