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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 void OnDestroyed(gpu::error::ContextLostReason reason); | 160 void OnDestroyed(gpu::error::ContextLostReason reason); |
150 void OnEchoAck(); | 161 void OnEchoAck(); |
151 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); | 162 void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); |
152 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); | 163 void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); |
153 void OnSignalSyncPointAck(uint32 id); | 164 void OnSignalSyncPointAck(uint32 id); |
154 | 165 |
155 // Try to read an updated copy of the state from shared memory. | 166 // Try to read an updated copy of the state from shared memory. |
156 void TryUpdateState(); | 167 void TryUpdateState(); |
157 | 168 |
158 // The shared memory area used to update state. | 169 // The shared memory area used to update state. |
159 gpu::CommandBufferSharedState* shared_state() const { | 170 gpu::CommandBufferSharedState* shared_state() const; |
160 return reinterpret_cast<gpu::CommandBufferSharedState*>( | |
161 shared_state_shm_->memory()); | |
162 } | |
163 | 171 |
164 // Unowned list of DeletionObservers. | 172 // Unowned list of DeletionObservers. |
165 ObserverList<DeletionObserver> deletion_observers_; | 173 ObserverList<DeletionObserver> deletion_observers_; |
166 | 174 |
167 // The last cached state received from the service. | 175 // The last cached state received from the service. |
168 State last_state_; | 176 State last_state_; |
169 | 177 |
170 // The shared memory area used to update state. | 178 // The shared memory area used to update state. |
171 scoped_ptr<base::SharedMemory> shared_state_shm_; | 179 scoped_ptr<base::SharedMemory> shared_state_shm_; |
172 | 180 |
(...skipping 21 matching lines...) Expand all Loading... |
194 GpuMemoryBufferMap gpu_memory_buffers_; | 202 GpuMemoryBufferMap gpu_memory_buffers_; |
195 | 203 |
196 gpu::Capabilities capabilities_; | 204 gpu::Capabilities capabilities_; |
197 | 205 |
198 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 206 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
199 }; | 207 }; |
200 | 208 |
201 } // namespace content | 209 } // namespace content |
202 | 210 |
203 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 211 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |