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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // If |surface| is not NULL, use it directly; in this case, the command | 86 // If |surface| is not NULL, use it directly; in this case, the command |
87 // buffer gpu thread must be the same as the client thread. Otherwise create | 87 // buffer gpu thread must be the same as the client thread. Otherwise create |
88 // a new GLSurface. | 88 // a new GLSurface. |
89 bool Initialize(scoped_refptr<gfx::GLSurface> surface, | 89 bool Initialize(scoped_refptr<gfx::GLSurface> surface, |
90 bool is_offscreen, | 90 bool is_offscreen, |
91 gfx::AcceleratedWidget window, | 91 gfx::AcceleratedWidget window, |
92 const gfx::Size& size, | 92 const gfx::Size& size, |
93 const std::vector<int32_t>& attribs, | 93 const std::vector<int32_t>& attribs, |
94 gfx::GpuPreference gpu_preference, | 94 gfx::GpuPreference gpu_preference, |
95 const base::Closure& context_lost_callback, | |
96 InProcessCommandBuffer* share_group, | 95 InProcessCommandBuffer* share_group, |
97 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 96 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
98 ImageFactory* image_factory); | 97 ImageFactory* image_factory); |
99 void Destroy(); | 98 void Destroy(); |
100 | 99 |
101 // CommandBuffer implementation: | 100 // CommandBuffer implementation: |
102 bool Initialize() override; | 101 bool Initialize() override; |
103 State GetLastState() override; | 102 State GetLastState() override; |
104 int32_t GetLastToken() override; | 103 int32_t GetLastToken() override; |
105 void Flush(int32_t put_offset) override; | 104 void Flush(int32_t put_offset) override; |
106 void OrderingBarrier(int32_t put_offset) override; | 105 void OrderingBarrier(int32_t put_offset) override; |
107 void WaitForTokenInRange(int32_t start, int32_t end) override; | 106 void WaitForTokenInRange(int32_t start, int32_t end) override; |
108 void WaitForGetOffsetInRange(int32_t start, int32_t end) override; | 107 void WaitForGetOffsetInRange(int32_t start, int32_t end) override; |
109 void SetGetBuffer(int32_t shm_id) override; | 108 void SetGetBuffer(int32_t shm_id) override; |
110 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 109 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
111 int32_t* id) override; | 110 int32_t* id) override; |
112 void DestroyTransferBuffer(int32_t id) override; | 111 void DestroyTransferBuffer(int32_t id) override; |
113 gpu::error::Error GetLastError() override; | 112 gpu::error::Error GetLastError() override; |
114 | 113 |
115 // GpuControl implementation: | 114 // GpuControl implementation: |
| 115 // NOTE: The GpuControlClient will be called on the GPU thread. |
| 116 void SetGpuControlClient(GpuControlClient*) override; |
116 gpu::Capabilities GetCapabilities() override; | 117 gpu::Capabilities GetCapabilities() override; |
117 int32_t CreateImage(ClientBuffer buffer, | 118 int32_t CreateImage(ClientBuffer buffer, |
118 size_t width, | 119 size_t width, |
119 size_t height, | 120 size_t height, |
120 unsigned internalformat) override; | 121 unsigned internalformat) override; |
121 void DestroyImage(int32_t id) override; | 122 void DestroyImage(int32_t id) override; |
122 int32_t CreateGpuMemoryBufferImage(size_t width, | 123 int32_t CreateGpuMemoryBufferImage(size_t width, |
123 size_t height, | 124 size_t height, |
124 unsigned internalformat, | 125 unsigned internalformat, |
125 unsigned usage) override; | 126 unsigned usage) override; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Callbacks: | 243 // Callbacks: |
243 void OnContextLost(); | 244 void OnContextLost(); |
244 bool GetBufferChanged(int32_t transfer_buffer_id); | 245 bool GetBufferChanged(int32_t transfer_buffer_id); |
245 void PumpCommands(); | 246 void PumpCommands(); |
246 void PerformDelayedWork(); | 247 void PerformDelayedWork(); |
247 | 248 |
248 const CommandBufferId command_buffer_id_; | 249 const CommandBufferId command_buffer_id_; |
249 | 250 |
250 // Members accessed on the gpu thread (possibly with the exception of | 251 // Members accessed on the gpu thread (possibly with the exception of |
251 // creation): | 252 // creation): |
| 253 GpuControlClient* gpu_control_client_; |
252 bool context_lost_; | 254 bool context_lost_; |
253 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 255 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
254 scoped_ptr<CommandExecutor> executor_; | 256 scoped_ptr<CommandExecutor> executor_; |
255 scoped_ptr<gles2::GLES2Decoder> decoder_; | 257 scoped_ptr<gles2::GLES2Decoder> decoder_; |
256 scoped_refptr<gfx::GLContext> context_; | 258 scoped_refptr<gfx::GLContext> context_; |
257 scoped_refptr<gfx::GLSurface> surface_; | 259 scoped_refptr<gfx::GLSurface> surface_; |
258 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 260 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
259 scoped_ptr<SyncPointClient> sync_point_client_; | 261 scoped_ptr<SyncPointClient> sync_point_client_; |
260 base::Closure context_lost_callback_; | 262 base::Closure context_lost_callback_; |
261 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. | 263 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 SyncPointManager* sync_point_manager_; // Non-owning. | 322 SyncPointManager* sync_point_manager_; // Non-owning. |
321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 323 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 324 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
323 framebuffer_completeness_cache_; | 325 framebuffer_completeness_cache_; |
324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 326 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
325 }; | 327 }; |
326 | 328 |
327 } // namespace gpu | 329 } // namespace gpu |
328 | 330 |
329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 331 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |