| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 namespace gpu { | 47 namespace gpu { |
| 48 | 48 |
| 49 namespace gles2 { | 49 namespace gles2 { |
| 50 class GLES2Decoder; | 50 class GLES2Decoder; |
| 51 class ShaderTranslatorCache; | 51 class ShaderTranslatorCache; |
| 52 } | 52 } |
| 53 | 53 |
| 54 class CommandBufferServiceBase; | 54 class CommandBufferServiceBase; |
| 55 class GpuControlService; | 55 class GpuControlService; |
| 56 class GpuMemoryBufferFactory; | |
| 57 class GpuScheduler; | 56 class GpuScheduler; |
| 58 class TransferBufferManagerInterface; | 57 class TransferBufferManagerInterface; |
| 59 | 58 |
| 60 // This class provides a thread-safe interface to the global GPU service (for | 59 // This class provides a thread-safe interface to the global GPU service (for |
| 61 // example GPU thread) when being run in single process mode. | 60 // example GPU thread) when being run in single process mode. |
| 62 // However, the behavior for accessing one context (i.e. one instance of this | 61 // However, the behavior for accessing one context (i.e. one instance of this |
| 63 // class) from different client threads is undefined. | 62 // class) from different client threads is undefined. |
| 64 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, | 63 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| 65 public GpuControl { | 64 public GpuControl { |
| 66 public: | 65 public: |
| 67 class Service; | 66 class Service; |
| 68 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); | 67 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); |
| 69 virtual ~InProcessCommandBuffer(); | 68 virtual ~InProcessCommandBuffer(); |
| 70 | 69 |
| 71 static void SetGpuMemoryBufferFactory(GpuMemoryBufferFactory* factory); | |
| 72 | |
| 73 // If |surface| is not NULL, use it directly; in this case, the command | 70 // If |surface| is not NULL, use it directly; in this case, the command |
| 74 // buffer gpu thread must be the same as the client thread. Otherwise create | 71 // buffer gpu thread must be the same as the client thread. Otherwise create |
| 75 // a new GLSurface. | 72 // a new GLSurface. |
| 76 bool Initialize(scoped_refptr<gfx::GLSurface> surface, | 73 bool Initialize(scoped_refptr<gfx::GLSurface> surface, |
| 77 bool is_offscreen, | 74 bool is_offscreen, |
| 78 gfx::AcceleratedWidget window, | 75 gfx::AcceleratedWidget window, |
| 79 const gfx::Size& size, | 76 const gfx::Size& size, |
| 80 const std::vector<int32>& attribs, | 77 const std::vector<int32>& attribs, |
| 81 gfx::GpuPreference gpu_preference, | 78 gfx::GpuPreference gpu_preference, |
| 82 const base::Closure& context_lost_callback, | 79 const base::Closure& context_lost_callback, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void FlushOnGpuThread(int32 put_offset); | 167 void FlushOnGpuThread(int32 put_offset); |
| 171 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); | 168 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); |
| 172 bool MakeCurrent(); | 169 bool MakeCurrent(); |
| 173 base::Closure WrapCallback(const base::Closure& callback); | 170 base::Closure WrapCallback(const base::Closure& callback); |
| 174 State GetStateFast(); | 171 State GetStateFast(); |
| 175 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } | 172 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } |
| 176 void CheckSequencedThread(); | 173 void CheckSequencedThread(); |
| 177 void RetireSyncPointOnGpuThread(uint32 sync_point); | 174 void RetireSyncPointOnGpuThread(uint32 sync_point); |
| 178 void SignalSyncPointOnGpuThread(uint32 sync_point, | 175 void SignalSyncPointOnGpuThread(uint32 sync_point, |
| 179 const base::Closure& callback); | 176 const base::Closure& callback); |
| 180 void DestroyTransferBufferOnGputhread(int32 id); | 177 void DestroyTransferBufferOnGpuThread(int32 id); |
| 178 void RegisterGpuMemoryBufferOnGpuThread( |
| 179 int32 id, |
| 180 const gfx::GpuMemoryBufferHandle& handle, |
| 181 size_t width, |
| 182 size_t height, |
| 183 unsigned internalformat); |
| 184 void UnregisterGpuMemoryBufferOnGpuThread(int32 id); |
| 181 | 185 |
| 182 // Callbacks: | 186 // Callbacks: |
| 183 void OnContextLost(); | 187 void OnContextLost(); |
| 184 void OnResizeView(gfx::Size size, float scale_factor); | 188 void OnResizeView(gfx::Size size, float scale_factor); |
| 185 bool GetBufferChanged(int32 transfer_buffer_id); | 189 bool GetBufferChanged(int32 transfer_buffer_id); |
| 186 void PumpCommands(); | 190 void PumpCommands(); |
| 187 void ScheduleMoreIdleWork(); | 191 void ScheduleMoreIdleWork(); |
| 188 | 192 |
| 189 static scoped_refptr<Service> GetDefaultService(); | 193 static scoped_refptr<Service> GetDefaultService(); |
| 190 | 194 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 229 |
| 226 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 230 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| 227 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 231 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
| 228 | 232 |
| 229 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 233 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
| 230 }; | 234 }; |
| 231 | 235 |
| 232 } // namespace gpu | 236 } // namespace gpu |
| 233 | 237 |
| 234 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 238 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |