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_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 size(size), | 182 size(size), |
183 attribs(attribs), | 183 attribs(attribs), |
184 gpu_preference(gpu_preference), | 184 gpu_preference(gpu_preference), |
185 capabilities(capabilities), | 185 capabilities(capabilities), |
186 context_group(share_group) {} | 186 context_group(share_group) {} |
187 }; | 187 }; |
188 | 188 |
189 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); | 189 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); |
190 bool DestroyOnGpuThread(); | 190 bool DestroyOnGpuThread(); |
191 void FlushOnGpuThread(int32 put_offset); | 191 void FlushOnGpuThread(int32 put_offset); |
| 192 void ScheduleIdleWorkOnGpuThread(); |
192 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); | 193 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); |
193 bool MakeCurrent(); | 194 bool MakeCurrent(); |
194 base::Closure WrapCallback(const base::Closure& callback); | 195 base::Closure WrapCallback(const base::Closure& callback); |
195 State GetStateFast(); | 196 State GetStateFast(); |
196 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } | 197 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } |
197 void CheckSequencedThread(); | 198 void CheckSequencedThread(); |
198 void RetireSyncPointOnGpuThread(uint32 sync_point); | 199 void RetireSyncPointOnGpuThread(uint32 sync_point); |
199 void SignalSyncPointOnGpuThread(uint32 sync_point, | 200 void SignalSyncPointOnGpuThread(uint32 sync_point, |
200 const base::Closure& callback); | 201 const base::Closure& callback); |
201 void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback); | 202 void SignalQueryOnGpuThread(unsigned query_id, const base::Closure& callback); |
202 void DestroyTransferBufferOnGpuThread(int32 id); | 203 void DestroyTransferBufferOnGpuThread(int32 id); |
203 void RegisterGpuMemoryBufferOnGpuThread( | 204 void RegisterGpuMemoryBufferOnGpuThread( |
204 int32 id, | 205 int32 id, |
205 const gfx::GpuMemoryBufferHandle& handle, | 206 const gfx::GpuMemoryBufferHandle& handle, |
206 size_t width, | 207 size_t width, |
207 size_t height, | 208 size_t height, |
208 unsigned internalformat); | 209 unsigned internalformat); |
209 void UnregisterGpuMemoryBufferOnGpuThread(int32 id); | 210 void UnregisterGpuMemoryBufferOnGpuThread(int32 id); |
210 | 211 |
211 // Callbacks: | 212 // Callbacks: |
212 void OnContextLost(); | 213 void OnContextLost(); |
213 void OnResizeView(gfx::Size size, float scale_factor); | 214 void OnResizeView(gfx::Size size, float scale_factor); |
214 bool GetBufferChanged(int32 transfer_buffer_id); | 215 bool GetBufferChanged(int32 transfer_buffer_id); |
215 void PumpCommands(); | 216 void PumpCommands(); |
216 void ScheduleMoreIdleWork(); | 217 void PerformIdleWork(); |
217 | 218 |
218 static scoped_refptr<Service> GetDefaultService(); | 219 static scoped_refptr<Service> GetDefaultService(); |
219 | 220 |
220 // Members accessed on the gpu thread (possibly with the exception of | 221 // Members accessed on the gpu thread (possibly with the exception of |
221 // creation): | 222 // creation): |
222 bool context_lost_; | 223 bool context_lost_; |
223 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 224 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
224 scoped_ptr<GpuScheduler> gpu_scheduler_; | 225 scoped_ptr<GpuScheduler> gpu_scheduler_; |
225 scoped_ptr<gles2::GLES2Decoder> decoder_; | 226 scoped_ptr<gles2::GLES2Decoder> decoder_; |
226 scoped_refptr<gfx::GLContext> context_; | 227 scoped_refptr<gfx::GLContext> context_; |
227 scoped_refptr<gfx::GLSurface> surface_; | 228 scoped_refptr<gfx::GLSurface> surface_; |
228 base::Closure context_lost_callback_; | 229 base::Closure context_lost_callback_; |
| 230 bool idle_work_pending_; // Used to throttle PerformIdleWork. |
229 | 231 |
230 // Members accessed on the client thread: | 232 // Members accessed on the client thread: |
231 State last_state_; | 233 State last_state_; |
232 int32 last_put_offset_; | 234 int32 last_put_offset_; |
233 gpu::Capabilities capabilities_; | 235 gpu::Capabilities capabilities_; |
234 typedef base::ScopedPtrHashMap<int32, gfx::GpuMemoryBuffer> | 236 typedef base::ScopedPtrHashMap<int32, gfx::GpuMemoryBuffer> |
235 GpuMemoryBufferMap; | 237 GpuMemoryBufferMap; |
236 GpuMemoryBufferMap gpu_memory_buffers_; | 238 GpuMemoryBufferMap gpu_memory_buffers_; |
237 | 239 |
238 // Accessed on both threads: | 240 // Accessed on both threads: |
(...skipping 15 matching lines...) Expand all Loading... |
254 | 256 |
255 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 257 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
256 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 258 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
257 | 259 |
258 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 260 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
259 }; | 261 }; |
260 | 262 |
261 } // namespace gpu | 263 } // namespace gpu |
262 | 264 |
263 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 265 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |