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

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

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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/containers/scoped_ptr_hash_map.h"
11 #include "base/id_map.h" 12 #include "base/id_map.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/process/process.h" 17 #include "base/process/process.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "content/common/gpu/gpu_command_buffer_stub.h" 19 #include "content/common/gpu/gpu_command_buffer_stub.h"
19 #include "content/common/gpu/gpu_memory_manager.h" 20 #include "content/common/gpu/gpu_memory_manager.h"
20 #include "content/common/gpu/gpu_result_codes.h" 21 #include "content/common/gpu/gpu_result_codes.h"
22 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
21 #include "content/common/message_router.h" 23 #include "content/common/message_router.h"
22 #include "gpu/command_buffer/service/valuebuffer_manager.h" 24 #include "gpu/command_buffer/service/valuebuffer_manager.h"
23 #include "ipc/ipc_sync_channel.h" 25 #include "ipc/ipc_sync_channel.h"
24 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/size.h"
25 #include "ui/gfx/native_widget_types.h" 27 #include "ui/gfx/native_widget_types.h"
26 #include "ui/gl/gl_share_group.h" 28 #include "ui/gl/gl_share_group.h"
27 #include "ui/gl/gpu_preference.h" 29 #include "ui/gl/gpu_preference.h"
28 30
29 struct GPUCreateCommandBufferConfig; 31 struct GPUCreateCommandBufferConfig;
30 32
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 bool allow_future_sync_points() const { return allow_future_sync_points_; } 164 bool allow_future_sync_points() const { return allow_future_sync_points_; }
163 165
164 void HandleUpdateValueState(unsigned int target, 166 void HandleUpdateValueState(unsigned int target,
165 const gpu::ValueState& state); 167 const gpu::ValueState& state);
166 168
167 // Visible for testing. 169 // Visible for testing.
168 const gpu::ValueStateMap* pending_valuebuffer_state() const { 170 const gpu::ValueStateMap* pending_valuebuffer_state() const {
169 return pending_valuebuffer_state_.get(); 171 return pending_valuebuffer_state_.get();
170 } 172 }
171 173
174 void ReleaseJpegDecoder(int32 route_id);
175
172 private: 176 private:
173 friend class GpuChannelMessageFilter; 177 friend class GpuChannelMessageFilter;
174 178
175 void OnDestroy(); 179 void OnDestroy();
176 180
177 bool OnControlMessageReceived(const IPC::Message& msg); 181 bool OnControlMessageReceived(const IPC::Message& msg);
178 182
179 void HandleMessage(); 183 void HandleMessage();
180 184
181 // Message handlers. 185 // Message handlers.
182 void OnCreateOffscreenCommandBuffer( 186 void OnCreateOffscreenCommandBuffer(
183 const gfx::Size& size, 187 const gfx::Size& size,
184 const GPUCreateCommandBufferConfig& init_params, 188 const GPUCreateCommandBufferConfig& init_params,
185 int32 route_id, 189 int32 route_id,
186 bool* succeeded); 190 bool* succeeded);
187 void OnDestroyCommandBuffer(int32 route_id); 191 void OnDestroyCommandBuffer(int32 route_id);
192 void OnCreateJpegDecoder(int32 route_id, bool* succeeded);
188 193
189 // Decrement the count of unhandled IPC messages and defer preemption. 194 // Decrement the count of unhandled IPC messages and defer preemption.
190 void MessageProcessed(); 195 void MessageProcessed();
191 196
192 // The lifetime of objects of this class is managed by a GpuChannelManager. 197 // The lifetime of objects of this class is managed by a GpuChannelManager.
193 // The GpuChannelManager destroy all the GpuChannels that they own when they 198 // The GpuChannelManager destroy all the GpuChannels that they own when they
194 // are destroyed. So a raw pointer is safe. 199 // are destroyed. So a raw pointer is safe.
195 GpuChannelManager* gpu_channel_manager_; 200 GpuChannelManager* gpu_channel_manager_;
196 201
197 scoped_ptr<IPC::SyncChannel> channel_; 202 scoped_ptr<IPC::SyncChannel> channel_;
(...skipping 25 matching lines...) Expand all
223 228
224 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 229 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
225 230
226 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; 231 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_;
227 232
228 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; 233 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_;
229 234
230 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; 235 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap;
231 StubMap stubs_; 236 StubMap stubs_;
232 237
238 // A map from route id to Jpeg decoder.
239 base::ScopedPtrHashMap<int32, scoped_ptr<content::GpuJpegDecodeAccelerator>>
240 jpeg_decoder_map_;
241
233 bool log_messages_; // True if we should log sent and received messages. 242 bool log_messages_; // True if we should log sent and received messages.
234 gpu::gles2::DisallowedFeatures disallowed_features_; 243 gpu::gles2::DisallowedFeatures disallowed_features_;
235 GpuWatchdog* watchdog_; 244 GpuWatchdog* watchdog_;
236 bool software_; 245 bool software_;
237 bool handle_messages_scheduled_; 246 bool handle_messages_scheduled_;
238 IPC::Message* currently_processing_message_; 247 IPC::Message* currently_processing_message_;
239 248
240 scoped_refptr<GpuChannelMessageFilter> filter_; 249 scoped_refptr<GpuChannelMessageFilter> filter_;
241 scoped_refptr<base::MessageLoopProxy> io_message_loop_; 250 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
242 251
243 size_t num_stubs_descheduled_; 252 size_t num_stubs_descheduled_;
244 253
245 bool allow_future_sync_points_; 254 bool allow_future_sync_points_;
246 255
247 // Member variables should appear before the WeakPtrFactory, to ensure 256 // Member variables should appear before the WeakPtrFactory, to ensure
248 // that any WeakPtrs to Controller are invalidated before its members 257 // that any WeakPtrs to Controller are invalidated before its members
249 // variable's destructors are executed, rendering them invalid. 258 // variable's destructors are executed, rendering them invalid.
250 base::WeakPtrFactory<GpuChannel> weak_factory_; 259 base::WeakPtrFactory<GpuChannel> weak_factory_;
251 260
252 DISALLOW_COPY_AND_ASSIGN(GpuChannel); 261 DISALLOW_COPY_AND_ASSIGN(GpuChannel);
253 }; 262 };
254 263
255 } // namespace content 264 } // namespace content
256 265
257 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 266 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698