Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Side by Side Diff: content/common/gpu/gpu_channel.h

Issue 1124423008: MJPEG acceleration for video capture using VAAPI, the GPU and IPC part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mjpeg-1-media
Patch Set: gpu_jpeg_decode_accelerator.cc filter to dispatch decode task Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_GPU_CHANNEL_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/common/gpu/gpu_command_buffer_stub.h" 18 #include "content/common/gpu/gpu_command_buffer_stub.h"
19 #include "content/common/gpu/gpu_memory_manager.h" 19 #include "content/common/gpu/gpu_memory_manager.h"
20 #include "content/common/gpu/gpu_result_codes.h" 20 #include "content/common/gpu/gpu_result_codes.h"
21 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
21 #include "content/common/message_router.h" 22 #include "content/common/message_router.h"
22 #include "gpu/command_buffer/service/valuebuffer_manager.h" 23 #include "gpu/command_buffer/service/valuebuffer_manager.h"
23 #include "ipc/ipc_sync_channel.h" 24 #include "ipc/ipc_sync_channel.h"
24 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
25 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gl/gl_share_group.h" 27 #include "ui/gl/gl_share_group.h"
27 #include "ui/gl/gpu_preference.h" 28 #include "ui/gl/gpu_preference.h"
28 29
29 struct GPUCreateCommandBufferConfig; 30 struct GPUCreateCommandBufferConfig;
30 31
(...skipping 10 matching lines...) Expand all
41 } 42 }
42 } 43 }
43 44
44 namespace IPC { 45 namespace IPC {
45 class MessageFilter; 46 class MessageFilter;
46 } 47 }
47 48
48 namespace content { 49 namespace content {
49 class GpuChannelManager; 50 class GpuChannelManager;
50 class GpuChannelMessageFilter; 51 class GpuChannelMessageFilter;
52 class GpuJpegDecodeAccelerator;
51 class GpuWatchdog; 53 class GpuWatchdog;
52 54
53 // Encapsulates an IPC channel between the GPU process and one renderer 55 // Encapsulates an IPC channel between the GPU process and one renderer
54 // process. On the renderer side there's a corresponding GpuChannelHost. 56 // process. On the renderer side there's a corresponding GpuChannelHost.
55 class GpuChannel : public IPC::Listener, public IPC::Sender, 57 class GpuChannel : public IPC::Listener, public IPC::Sender,
56 public gpu::gles2::SubscriptionRefSet::Observer { 58 public gpu::gles2::SubscriptionRefSet::Observer {
57 public: 59 public:
58 // Takes ownership of the renderer process handle. 60 // Takes ownership of the renderer process handle.
59 GpuChannel(GpuChannelManager* gpu_channel_manager, 61 GpuChannel(GpuChannelManager* gpu_channel_manager,
60 GpuWatchdog* watchdog, 62 GpuWatchdog* watchdog,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool allow_future_sync_points() const { return allow_future_sync_points_; } 163 bool allow_future_sync_points() const { return allow_future_sync_points_; }
162 164
163 void HandleUpdateValueState(unsigned int target, 165 void HandleUpdateValueState(unsigned int target,
164 const gpu::ValueState& state); 166 const gpu::ValueState& state);
165 167
166 // Visible for testing. 168 // Visible for testing.
167 const gpu::ValueStateMap* pending_valuebuffer_state() const { 169 const gpu::ValueStateMap* pending_valuebuffer_state() const {
168 return pending_valuebuffer_state_.get(); 170 return pending_valuebuffer_state_.get();
169 } 171 }
170 172
173 #if 0
174 void ReleaseJpegDecoder(int32 route_id);
175 #endif
piman 2015/05/26 23:31:53 nit: remove.
kcwu 2015/05/27 14:13:23 Done.
176
171 private: 177 private:
172 friend class GpuChannelMessageFilter; 178 friend class GpuChannelMessageFilter;
173 179
174 void OnDestroy(); 180 void OnDestroy();
175 181
176 bool OnControlMessageReceived(const IPC::Message& msg); 182 bool OnControlMessageReceived(const IPC::Message& msg);
177 183
178 void HandleMessage(); 184 void HandleMessage();
179 185
180 // Message handlers. 186 // Message handlers.
181 void OnCreateOffscreenCommandBuffer( 187 void OnCreateOffscreenCommandBuffer(
182 const gfx::Size& size, 188 const gfx::Size& size,
183 const GPUCreateCommandBufferConfig& init_params, 189 const GPUCreateCommandBufferConfig& init_params,
184 int32 route_id, 190 int32 route_id,
185 bool* succeeded); 191 bool* succeeded);
186 void OnDestroyCommandBuffer(int32 route_id); 192 void OnDestroyCommandBuffer(int32 route_id);
193 void OnCreateJpegDecoder(int32 route_id, IPC::Message* reply_msg);
187 194
188 // Decrement the count of unhandled IPC messages and defer preemption. 195 // Decrement the count of unhandled IPC messages and defer preemption.
189 void MessageProcessed(); 196 void MessageProcessed();
190 197
191 // The lifetime of objects of this class is managed by a GpuChannelManager. 198 // The lifetime of objects of this class is managed by a GpuChannelManager.
192 // The GpuChannelManager destroy all the GpuChannels that they own when they 199 // The GpuChannelManager destroy all the GpuChannels that they own when they
193 // are destroyed. So a raw pointer is safe. 200 // are destroyed. So a raw pointer is safe.
194 GpuChannelManager* gpu_channel_manager_; 201 GpuChannelManager* gpu_channel_manager_;
195 202
196 scoped_ptr<IPC::SyncChannel> channel_; 203 scoped_ptr<IPC::SyncChannel> channel_;
(...skipping 25 matching lines...) Expand all
222 229
223 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 230 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
224 231
225 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; 232 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_;
226 233
227 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; 234 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_;
228 235
229 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; 236 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap;
230 StubMap stubs_; 237 StubMap stubs_;
231 238
239 scoped_ptr<GpuJpegDecodeAccelerator> jpeg_decoder_;
240
232 bool log_messages_; // True if we should log sent and received messages. 241 bool log_messages_; // True if we should log sent and received messages.
233 gpu::gles2::DisallowedFeatures disallowed_features_; 242 gpu::gles2::DisallowedFeatures disallowed_features_;
234 GpuWatchdog* watchdog_; 243 GpuWatchdog* watchdog_;
235 bool software_; 244 bool software_;
236 bool handle_messages_scheduled_; 245 bool handle_messages_scheduled_;
237 IPC::Message* currently_processing_message_; 246 IPC::Message* currently_processing_message_;
238 247
239 scoped_refptr<GpuChannelMessageFilter> filter_; 248 scoped_refptr<GpuChannelMessageFilter> filter_;
240 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 249 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
241 250
242 size_t num_stubs_descheduled_; 251 size_t num_stubs_descheduled_;
243 252
244 bool allow_future_sync_points_; 253 bool allow_future_sync_points_;
245 254
246 // Member variables should appear before the WeakPtrFactory, to ensure 255 // Member variables should appear before the WeakPtrFactory, to ensure
247 // that any WeakPtrs to Controller are invalidated before its members 256 // that any WeakPtrs to Controller are invalidated before its members
248 // variable's destructors are executed, rendering them invalid. 257 // variable's destructors are executed, rendering them invalid.
249 base::WeakPtrFactory<GpuChannel> weak_factory_; 258 base::WeakPtrFactory<GpuChannel> weak_factory_;
250 259
251 DISALLOW_COPY_AND_ASSIGN(GpuChannel); 260 DISALLOW_COPY_AND_ASSIGN(GpuChannel);
252 }; 261 };
253 262
254 } // namespace content 263 } // namespace content
255 264
256 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 265 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698