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; | |
16 class GpuMemoryBufferManagerInterface; | 14 class GpuMemoryBufferManagerInterface; |
17 | 15 |
18 namespace gles2 { | 16 namespace gles2 { |
19 class MailboxManager; | |
20 class QueryManager; | 17 class QueryManager; |
21 } | 18 } |
22 | 19 |
23 class GPU_EXPORT GpuControlService : public GpuControl { | 20 class GPU_EXPORT GpuControlService { |
24 public: | 21 public: |
25 GpuControlService(GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager, | 22 GpuControlService(GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager, |
26 GpuMemoryBufferFactory* gpu_memory_buffer_factory, | 23 gles2::QueryManager* query_manager); |
27 gles2::MailboxManager* mailbox_manager, | |
28 gles2::QueryManager* query_manager, | |
29 const gpu::Capabilities& decoder_capabilities); | |
30 virtual ~GpuControlService(); | 24 virtual ~GpuControlService(); |
31 | 25 |
| 26 void SignalQuery(uint32 query, const base::Closure& callback); |
32 | 27 |
33 // GpuControl implementation. | 28 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, | 29 gfx::GpuMemoryBufferHandle buffer, |
56 size_t width, | 30 size_t width, |
57 size_t height, | 31 size_t height, |
58 unsigned internalformat); | 32 unsigned internalformat); |
| 33 void UnregisterGpuMemoryBuffer(int32 id); |
59 | 34 |
60 private: | 35 private: |
61 GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager_; | 36 GpuMemoryBufferManagerInterface* gpu_memory_buffer_manager_; |
62 GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | |
63 gles2::MailboxManager* mailbox_manager_; | |
64 gles2::QueryManager* query_manager_; | 37 gles2::QueryManager* query_manager_; |
65 typedef std::map<int32, linked_ptr<gfx::GpuMemoryBuffer> > GpuMemoryBufferMap; | |
66 GpuMemoryBufferMap gpu_memory_buffers_; | |
67 gpu::Capabilities capabilities_; | |
68 | 38 |
69 DISALLOW_COPY_AND_ASSIGN(GpuControlService); | 39 DISALLOW_COPY_AND_ASSIGN(GpuControlService); |
70 }; | 40 }; |
71 | 41 |
72 } // namespace gpu | 42 } // namespace gpu |
73 | 43 |
74 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ | 44 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_CONTROL_SERVICE_H_ |
OLD | NEW |