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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: | 81 public: |
82 class Service; | 82 class Service; |
83 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); | 83 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); |
84 ~InProcessCommandBuffer() override; | 84 ~InProcessCommandBuffer() override; |
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; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Members accessed on the gpu thread (possibly with the exception of | 249 // Members accessed on the gpu thread (possibly with the exception of |
251 // creation): | 250 // creation): |
252 bool context_lost_; | 251 bool context_lost_; |
253 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 252 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
254 scoped_ptr<CommandExecutor> executor_; | 253 scoped_ptr<CommandExecutor> executor_; |
255 scoped_ptr<gles2::GLES2Decoder> decoder_; | 254 scoped_ptr<gles2::GLES2Decoder> decoder_; |
256 scoped_refptr<gfx::GLContext> context_; | 255 scoped_refptr<gfx::GLContext> context_; |
257 scoped_refptr<gfx::GLSurface> surface_; | 256 scoped_refptr<gfx::GLSurface> surface_; |
258 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 257 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
259 scoped_ptr<SyncPointClient> sync_point_client_; | 258 scoped_ptr<SyncPointClient> sync_point_client_; |
260 base::Closure context_lost_callback_; | |
261 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. | 259 bool delayed_work_pending_; // Used to throttle PerformDelayedWork. |
262 ImageFactory* image_factory_; | 260 ImageFactory* image_factory_; |
263 | 261 |
264 // Members accessed on the client thread: | 262 // Members accessed on the client thread: |
265 State last_state_; | 263 State last_state_; |
266 int32_t last_put_offset_; | 264 int32_t last_put_offset_; |
267 gpu::Capabilities capabilities_; | 265 gpu::Capabilities capabilities_; |
268 GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 266 GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
269 base::AtomicSequenceNumber next_image_id_; | 267 base::AtomicSequenceNumber next_image_id_; |
270 uint64_t next_fence_sync_release_; | 268 uint64_t next_fence_sync_release_; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 SyncPointManager* sync_point_manager_; // Non-owning. | 318 SyncPointManager* sync_point_manager_; // Non-owning. |
321 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 319 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
322 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 320 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
323 framebuffer_completeness_cache_; | 321 framebuffer_completeness_cache_; |
324 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 322 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
325 }; | 323 }; |
326 | 324 |
327 } // namespace gpu | 325 } // namespace gpu |
328 | 326 |
329 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 327 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |