OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "gpu/command_buffer/common/command_buffer.h" | 18 #include "gpu/command_buffer/common/command_buffer.h" |
19 #include "gpu/command_buffer/common/command_buffer_shared.h" | 19 #include "gpu/command_buffer/common/command_buffer_shared.h" |
20 #include "gpu/command_buffer/common/gpu_control.h" | 20 #include "gpu/command_buffer/common/gpu_control.h" |
21 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 21 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
22 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
23 #include "media/video/video_decode_accelerator.h" | |
24 #include "ui/events/latency_info.h" | 23 #include "ui/events/latency_info.h" |
25 | 24 |
26 struct GPUCommandBufferConsoleMessage; | 25 struct GPUCommandBufferConsoleMessage; |
27 | 26 |
28 namespace base { | 27 namespace base { |
29 class SharedMemory; | 28 class SharedMemory; |
30 } | 29 } |
31 | 30 |
32 namespace gfx { | 31 namespace gfx { |
33 class GpuMemoryBuffer; | 32 class GpuMemoryBuffer; |
34 } | 33 } |
35 | 34 |
36 namespace gpu { | 35 namespace gpu { |
37 struct Mailbox; | 36 struct Mailbox; |
38 } | 37 } |
39 | 38 |
| 39 namespace media { |
| 40 class VideoDecodeAccelerator; |
| 41 class VideoEncodeAccelerator; |
| 42 } |
| 43 |
40 namespace content { | 44 namespace content { |
41 class GpuChannelHost; | 45 class GpuChannelHost; |
42 | 46 |
43 // Client side proxy that forwards messages synchronously to a | 47 // Client side proxy that forwards messages synchronously to a |
44 // CommandBufferStub. | 48 // CommandBufferStub. |
45 class CommandBufferProxyImpl | 49 class CommandBufferProxyImpl |
46 : public gpu::CommandBuffer, | 50 : public gpu::CommandBuffer, |
47 public gpu::GpuControl, | 51 public gpu::GpuControl, |
48 public IPC::Listener, | 52 public IPC::Listener, |
49 public base::SupportsWeakPtr<CommandBufferProxyImpl> { | 53 public base::SupportsWeakPtr<CommandBufferProxyImpl> { |
(...skipping 12 matching lines...) Expand all Loading... |
62 | 66 |
63 CommandBufferProxyImpl(GpuChannelHost* channel, int route_id); | 67 CommandBufferProxyImpl(GpuChannelHost* channel, int route_id); |
64 virtual ~CommandBufferProxyImpl(); | 68 virtual ~CommandBufferProxyImpl(); |
65 | 69 |
66 // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and | 70 // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and |
67 // returns it as an owned pointer to a media::VideoDecodeAccelerator. Returns | 71 // returns it as an owned pointer to a media::VideoDecodeAccelerator. Returns |
68 // NULL on failure to create the GpuVideoDecodeAcceleratorHost. | 72 // NULL on failure to create the GpuVideoDecodeAcceleratorHost. |
69 // Note that the GpuVideoDecodeAccelerator may still fail to be created in | 73 // Note that the GpuVideoDecodeAccelerator may still fail to be created in |
70 // the GPU process, even if this returns non-NULL. In this case the VDA client | 74 // the GPU process, even if this returns non-NULL. In this case the VDA client |
71 // is notified of an error later, after Initialize(). | 75 // is notified of an error later, after Initialize(). |
72 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecoder( | 76 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecoder(); |
73 media::VideoCodecProfile profile); | 77 |
| 78 // Sends an IPC message to create a GpuVideoEncodeAccelerator. Creates and |
| 79 // returns it as an owned pointer to a media::VideoEncodeAccelerator. Returns |
| 80 // NULL on failure to create the GpuVideoEncodeAcceleratorHost. |
| 81 // Note that the GpuVideoEncodeAccelerator may still fail to be created in |
| 82 // the GPU process, even if this returns non-NULL. In this case the VEA client |
| 83 // is notified of an error later, after Initialize(); |
| 84 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncoder(); |
74 | 85 |
75 // IPC::Listener implementation: | 86 // IPC::Listener implementation: |
76 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 87 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
77 virtual void OnChannelError() OVERRIDE; | 88 virtual void OnChannelError() OVERRIDE; |
78 | 89 |
79 // CommandBuffer implementation: | 90 // CommandBuffer implementation: |
80 virtual bool Initialize() OVERRIDE; | 91 virtual bool Initialize() OVERRIDE; |
81 virtual State GetState() OVERRIDE; | 92 virtual State GetState() OVERRIDE; |
82 virtual State GetLastState() OVERRIDE; | 93 virtual State GetLastState() OVERRIDE; |
83 virtual int32 GetLastToken() OVERRIDE; | 94 virtual int32 GetLastToken() OVERRIDE; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void OnDestroyed(gpu::error::ContextLostReason reason); | 165 void OnDestroyed(gpu::error::ContextLostReason reason); |
155 void OnEchoAck(); | 166 void OnEchoAck(); |
156 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 167 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
157 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 168 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
158 void OnSignalSyncPointAck(uint32 id); | 169 void OnSignalSyncPointAck(uint32 id); |
159 | 170 |
160 // Try to read an updated copy of the state from shared memory. | 171 // Try to read an updated copy of the state from shared memory. |
161 void TryUpdateState(); | 172 void TryUpdateState(); |
162 | 173 |
163 // The shared memory area used to update state. | 174 // The shared memory area used to update state. |
164 gpu::CommandBufferSharedState* shared_state() const { | 175 gpu::CommandBufferSharedState* shared_state() const; |
165 return reinterpret_cast<gpu::CommandBufferSharedState*>( | |
166 shared_state_shm_->memory()); | |
167 } | |
168 | 176 |
169 // Local cache of id to transfer buffer mapping. | 177 // Local cache of id to transfer buffer mapping. |
170 TransferBufferMap transfer_buffers_; | 178 TransferBufferMap transfer_buffers_; |
171 | 179 |
172 // Unowned list of DeletionObservers. | 180 // Unowned list of DeletionObservers. |
173 ObserverList<DeletionObserver> deletion_observers_; | 181 ObserverList<DeletionObserver> deletion_observers_; |
174 | 182 |
175 // The last cached state received from the service. | 183 // The last cached state received from the service. |
176 State last_state_; | 184 State last_state_; |
177 | 185 |
(...skipping 24 matching lines...) Expand all Loading... |
202 GpuMemoryBufferMap gpu_memory_buffers_; | 210 GpuMemoryBufferMap gpu_memory_buffers_; |
203 | 211 |
204 gpu::Capabilities capabilities_; | 212 gpu::Capabilities capabilities_; |
205 | 213 |
206 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 214 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
207 }; | 215 }; |
208 | 216 |
209 } // namespace content | 217 } // namespace content |
210 | 218 |
211 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 219 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |