Chromium Code Reviews| 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_GPU_CONTROL_SERVICE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include "base/callback.h" |
| 9 | 9 #include "gpu/command_buffer/common/capabilities.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "gpu/gpu_export.h" |
| 11 #include "gpu/command_buffer/common/gpu_control.h" | |
| 12 #include "ui/gfx/gpu_memory_buffer.h" | 11 #include "ui/gfx/gpu_memory_buffer.h" |
| 13 | 12 |
| 14 namespace gpu { | 13 namespace gpu { |
| 15 class GpuMemoryBufferFactory; | 14 class GpuMemoryBufferFactory; |
| 16 class GpuMemoryBufferManagerInterface; | 15 class GpuMemoryBufferManagerInterface; |
| 17 | 16 |
| 18 namespace gles2 { | 17 namespace gles2 { |
| 19 class MailboxManager; | 18 class MailboxManager; |
| 20 class QueryManager; | 19 class QueryManager; |
| 21 } | 20 } |
| 22 | 21 |
| 23 class GPU_EXPORT GpuControlService : public GpuControl { | 22 class GPU_EXPORT GpuControlService { |
|
no sievers
2014/04/25 01:16:35
Is it possible to move GpuControl to command_buffe
| |
| 24 public: | 23 public: |
| 25 GpuControlService(GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager, | 24 GpuControlService(GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager, |
| 26 GpuMemoryBufferFactory* gpu_memory_buffer_factory, | |
| 27 gles2::MailboxManager* mailbox_manager, | 25 gles2::MailboxManager* mailbox_manager, |
| 28 gles2::QueryManager* query_manager, | 26 gles2::QueryManager* query_manager); |
| 29 const gpu::Capabilities& decoder_capabilities); | |
| 30 virtual ~GpuControlService(); | 27 virtual ~GpuControlService(); |
| 31 | 28 |
| 29 void SignalQuery(uint32 query, const base::Closure& callback); | |
| 32 | 30 |
| 33 // GpuControl implementation. | 31 void RegisterGpuMemoryBuffer(int32 id, |
| 34 virtual gpu::Capabilities GetCapabilities() OVERRIDE; | |
| 35 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( | |
| 36 size_t width, | |
| 37 size_t height, | |
| 38 unsigned internalformat, | |
| 39 int32* id) OVERRIDE; | |
| 40 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; | |
| 41 virtual uint32 InsertSyncPoint() OVERRIDE; | |
| 42 virtual void SignalSyncPoint(uint32 sync_point, | |
| 43 const base::Closure& callback) OVERRIDE; | |
| 44 virtual void SignalQuery(uint32 query, | |
| 45 const base::Closure& callback) OVERRIDE; | |
| 46 virtual void SetSurfaceVisible(bool visible) OVERRIDE; | |
| 47 virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) | |
| 48 OVERRIDE; | |
| 49 virtual void Echo(const base::Closure& callback) OVERRIDE; | |
| 50 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; | |
| 51 | |
| 52 // Register an existing gpu memory buffer and get an ID that can be used | |
| 53 // to identify it in the command buffer. | |
| 54 bool RegisterGpuMemoryBuffer(int32 id, | |
| 55 gfx::GpuMemoryBufferHandle buffer, | 32 gfx::GpuMemoryBufferHandle buffer, |
| 56 size_t width, | 33 size_t width, |
| 57 size_t height, | 34 size_t height, |
| 58 unsigned internalformat); | 35 unsigned internalformat); |
| 36 void UnregisterGpuMemoryBuffer(int32 id); | |
| 59 | 37 |
| 60 private: | 38 private: |
| 61 GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager_; | 39 GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager_; |
| 62 GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | |
| 63 gles2::MailboxManager* mailbox_manager_; | 40 gles2::MailboxManager* mailbox_manager_; |
| 64 gles2::QueryManager* query_manager_; | 41 gles2::QueryManager* query_manager_; |
| 65 typedef std::map<int32, linked_ptr<gfx::GpuMemoryBuffer> > GpuMemoryBufferMap; | |
| 66 GpuMemoryBufferMap gpu_memory_buffers_; | |
| 67 gpu::Capabilities capabilities_; | |
| 68 | 42 |
| 69 DISALLOW_COPY_AND_ASSIGN(GpuControlService); | 43 DISALLOW_COPY_AND_ASSIGN(GpuControlService); |
| 70 }; | 44 }; |
| 71 | 45 |
| 72 } // namespace gpu | 46 } // namespace gpu |
| 73 | 47 |
| 74 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ | 48 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ |
| OLD | NEW |