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

Side by Side Diff: chrome/common/gpu_messages.h

Issue 6646005: Creates the ipclist utility that chrome security team has wanted to dump... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Multiply-included file, hence no traditional include guard
6
7 #include <string>
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/process.h"
12 #include "base/shared_memory.h"
13 #include "base/string_piece.h"
14 #include "base/sys_string_conversions.h"
15 #include "chrome/common/common_param_traits.h"
16 #include "chrome/common/dx_diag_node.h"
17 #include "chrome/common/gpu_create_command_buffer_config.h"
18 #include "chrome/common/gpu_info.h"
19 #include "chrome/common/gpu_param_traits.h"
20 #include "chrome/common/gpu_video_common.h"
21 #include "gpu/command_buffer/common/command_buffer.h"
22 #include "ipc/ipc_channel_handle.h"
23 #include "ipc/ipc_message_macros.h"
24 #include "ui/gfx/native_widget_types.h"
25 #include "ui/gfx/rect.h"
26 #include "ui/gfx/size.h"
27
28 #define IPC_MESSAGE_START GpuMsgStart
29
30 // Singly-included portion not yet converted
5 #ifndef CHROME_COMMON_GPU_MESSAGES_H_ 31 #ifndef CHROME_COMMON_GPU_MESSAGES_H_
6 #define CHROME_COMMON_GPU_MESSAGES_H_ 32 #define CHROME_COMMON_GPU_MESSAGES_H_
7 #pragma once 33
8 34 namespace gfx {
jam 2011/03/09 06:33:45 nit: looks like these four forward declarations ar
9 #include "base/basictypes.h" 35 class Size;
10 #include "base/process.h" 36 }
11 #include "chrome/common/common_param_traits.h" 37
12 #include "chrome/common/gpu_param_traits.h" 38 namespace IPC {
13 #include "gpu/command_buffer/common/command_buffer.h" 39 struct ChannelHandle;
14 #include "ui/gfx/native_widget_types.h" 40 }
15 41
16 #include "chrome/common/gpu_messages_internal.h" 42 struct GPUCreateCommandBufferConfig;
43 struct GPUInfo;
17 44
18 #endif // CHROME_COMMON_GPU_MESSAGES_H_ 45 #endif // CHROME_COMMON_GPU_MESSAGES_H_
46
47 //------------------------------------------------------------------------------
48 // GPU Messages
49 // These are messages from the browser to the GPU process.
50
51 // Tells the GPU process to initialize itself. The browser explicitly
52 // requests this be done so that we are guaranteed that the channel is set
53 // up between the browser and GPU process before doing any work that might
54 // potentially crash the GPU process. Detection of the child process
55 // exiting abruptly is predicated on having the IPC channel set up.
56 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
57
58 // Tells the GPU process to create a new channel for communication with a
59 // given renderer. The channel name is returned in a
60 // GpuHostMsg_ChannelEstablished message. The renderer ID is passed so that
61 // the GPU process reuses an existing channel to that process if it exists.
62 // This ID is a unique opaque identifier generated by the browser process.
63 IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel,
64 int /* renderer_id */)
65
66 // Tells the GPU process to close the channel identified by IPC channel
67 // handle. If no channel can be identified, do nothing.
68 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
69 IPC::ChannelHandle /* channel_handle */)
70
71 // Provides a synchronization point to guarantee that the processing of
72 // previous asynchronous messages (i.e., GpuMsg_EstablishChannel) has
73 // completed. (This message can't be synchronous because the
74 // GpuProcessHost uses an IPC::ChannelProxy, which sends all messages
75 // asynchronously.) Results in a GpuHostMsg_SynchronizeReply.
76 IPC_MESSAGE_CONTROL0(GpuMsg_Synchronize)
77
78 // Tells the GPU process to create a new command buffer that renders directly
79 // to a native view. A corresponding GpuCommandBufferStub is created.
80 IPC_MESSAGE_CONTROL4(GpuMsg_CreateViewCommandBuffer,
81 gfx::PluginWindowHandle, /* view */
82 int32, /* render_view_id */
83 int32, /* renderer_id */
84 GPUCreateCommandBufferConfig /* init_params */)
85
86 // Tells the GPU process to create a context for collecting graphics card
87 // information.
88 IPC_MESSAGE_CONTROL1(GpuMsg_CollectGraphicsInfo,
89 GPUInfo::Level /* level */)
90
91 #if defined(OS_MACOSX)
92 // Tells the GPU process that the browser process handled the swap
93 // buffers request with the given number. Note that it is possible
94 // for the browser process to coalesce frames; it is not guaranteed
95 // that every GpuHostMsg_AcceleratedSurfaceBuffersSwapped message
96 // will result in a buffer swap on the browser side.
97 IPC_MESSAGE_CONTROL3(GpuMsg_AcceleratedSurfaceBuffersSwappedACK,
98 int /* renderer_id */,
99 int32 /* route_id */,
100 uint64 /* swap_buffers_count */)
101
102 // Tells the GPU process that the IOSurface of the buffer belonging to
103 // |renderer_route_id| a given id was destroyed, either by the user closing the
104 // tab hosting the surface, or by the renderer navigating to a new page.
105 IPC_MESSAGE_CONTROL2(GpuMsg_DidDestroyAcceleratedSurface,
106 int /* renderer_id */,
107 int32 /* renderer_route_id */)
108 #endif
109
110 // Tells the GPU process to crash.
111 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
112
113 // Tells the GPU process to hang.
114 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
115
116 //------------------------------------------------------------------------------
117 // GPU Host Messages
118 // These are messages to the browser.
119
120 // A renderer sends this when it wants to create a connection to the GPU
121 // process. The browser will create the GPU process if necessary, and will
122 // return a handle to the channel via a GpuChannelEstablished message.
123 IPC_MESSAGE_CONTROL0(GpuHostMsg_EstablishGpuChannel)
124
125 // A renderer sends this to the browser process to provide a synchronization
126 // point for GPU operations, in particular to make sure the GPU channel has
127 // been established.
128 IPC_SYNC_MESSAGE_CONTROL0_0(GpuHostMsg_SynchronizeGpu)
129
130 // A renderer sends this to the browser process when it wants to
131 // create a GL context associated with the given view_id.
132 IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateViewCommandBuffer,
133 int32, /* render_view_id */
134 GPUCreateCommandBufferConfig, /* init_params */
135 int32 /* route_id */)
136
137 // Response from GPU to a GpuHostMsg_EstablishChannel message.
138 IPC_MESSAGE_CONTROL2(GpuHostMsg_ChannelEstablished,
139 IPC::ChannelHandle, /* channel_handle */
140 GPUInfo /* GPU logging stats */)
141
142 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
143 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
144 int32 /* route_id */)
145
146 // Request from GPU to free the browser resources associated with the
147 // command buffer.
148 IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer,
149 gfx::PluginWindowHandle, /* view */
150 int32, /* render_view_id */
151 int32 /* renderer_id */)
152
153 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
154 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
155 GPUInfo /* GPU logging stats */)
156
157 // Message from GPU to add a GPU log message to the about:gpu page.
158 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
159 int /*severity*/,
160 std::string /* header */,
161 std::string /* message */)
162
163 // Response from GPU to a GpuMsg_Synchronize message.
164 IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply)
165
166 #if defined(OS_LINUX) && !defined(TOUCH_UI)
167 // Resize the window that is being drawn into. It's important that this
168 // resize be synchronized with the swapping of the front and back buffers.
169 IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_ResizeXID,
170 unsigned long, /* xid */
171 gfx::Size, /* size */
172 bool /* success */)
173 #elif defined(OS_MACOSX)
174 // This message, used on Mac OS X 10.6 and later (where IOSurface is
175 // supported), is sent from the GPU process to the browser to indicate that a
176 // new backing store was allocated for the given "window" (fake
177 // PluginWindowHandle). The renderer ID and render view ID are needed in
178 // order to uniquely identify the RenderWidgetHostView on the browser side.
179 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
180 GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params)
181
182 // This message notifies the browser process that the renderer
183 // swapped the buffers associated with the given "window", which
184 // should cause the browser to redraw the compositor's contents.
185 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
186 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
187 #elif defined(OS_WIN)
188 IPC_MESSAGE_CONTROL2(GpuHostMsg_ScheduleComposite,
189 int32, /* renderer_id */
190 int32 /* render_view_id */)
191 #endif
192
193 //------------------------------------------------------------------------------
194 // GPU Channel Messages
195 // These are messages from a renderer process to the GPU process.
196
197 // Initialize a channel between a renderer process and a GPU process. The
198 // renderer passes its process handle to the GPU process, which gives gives the
199 // GPU process the ability to map handles from the renderer process. This must
200 // be the first message sent on a newly connected channel.
201 IPC_MESSAGE_CONTROL1(GpuChannelMsg_Initialize,
202 base::ProcessHandle /* renderer_process_for_gpu */)
203
204 // Tells the GPU process to create a new command buffer that renders to an
205 // offscreen frame buffer. If parent_route_id is not zero, the texture backing
206 // the frame buffer is mapped into the corresponding parent command buffer's
207 // namespace, with the name of parent_texture_id. This ID is in the parent's
208 // namespace.
209 IPC_SYNC_MESSAGE_CONTROL4_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
210 int32, /* parent_route_id */
211 gfx::Size, /* size */
212 GPUCreateCommandBufferConfig, /* init_params */
213 uint32, /* parent_texture_id */
214 int32 /* route_id */)
215
216 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
217 // destructor, so that the stub deletes the actual CommandBufferService
218 // object that it's hosting.
219 // TODO(apatrick): Implement this.
220 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
221 int32 /* instance_id */)
222
223 // Create hardware video decoder && associate it with the output |decoder_id|;
224 // We need this to be control message because we had to map the GpuChannel and
225 // |decoder_id|.
226 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateVideoDecoder,
227 int32, /* context_route_id */
228 int32) /* decoder_id */
229
230 // Release all resource of the hardware video decoder which was assocaited
231 // with the input |decoder_id|.
232 // TODO(hclam): This message needs to be asynchronous.
233 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder,
234 int32 /* decoder_id */)
235
236 //------------------------------------------------------------------------------
237 // GPU Command Buffer Messages
238 // These are messages between a renderer process to the GPU process relating to
239 // a single OpenGL context.
240 // Initialize a command buffer with the given number of command entries.
241 // Returns the shared memory handle for the command buffer mapped to the
242 // calling process.
243 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize,
244 base::SharedMemoryHandle /* ring_buffer */,
245 int32 /* size */,
246 bool /* result */)
247
248 // Get the current state of the command buffer.
249 IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_GetState,
250 gpu::CommandBuffer::State /* state */)
251
252 // Get the current state of the command buffer asynchronously. State is
253 // returned via UpdateState message.
254 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_AsyncGetState)
255
256 // Synchronize the put and get offsets of both processes. Caller passes its
257 // current put offset. Current state (including get offset) is returned.
258 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Flush,
259 int32 /* put_offset */,
260 gpu::CommandBuffer::State /* state */)
261
262 // Asynchronously synchronize the put and get offsets of both processes.
263 // Caller passes its current put offset. Current state (including get offset)
264 // is returned via an UpdateState message.
265 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_AsyncFlush,
266 int32 /* put_offset */)
267
268 // Return the current state of the command buffer following a request via
269 // an AsyncGetState or AsyncFlush message. (This message is sent from the
270 // GPU process to the renderer process.)
271 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UpdateState,
272 gpu::CommandBuffer::State /* state */)
273
274 // Indicates that a SwapBuffers call has been issued.
275 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_SwapBuffers)
276
277 // Create a shared memory transfer buffer. Returns an id that can be used to
278 // identify the transfer buffer from a comment.
279 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_CreateTransferBuffer,
280 int32 /* size */,
281 int32 /* id */)
282
283 // Register an existing shared memory transfer buffer. Returns an id that can be
284 // used to identify the transfer buffer from a command buffer.
285 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_RegisterTransferBuffer,
286 base::SharedMemoryHandle /* transfer_buffer */,
287 size_t /* size */,
288 int32 /* id */)
289
290 // Destroy a previously created transfer buffer.
291 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_DestroyTransferBuffer,
292 int32 /* id */)
293
294 // Get the shared memory handle for a transfer buffer mapped to the callers
295 // process.
296 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_GetTransferBuffer,
297 int32 /* id */,
298 base::SharedMemoryHandle /* transfer_buffer */,
299 uint32 /* size */)
300
301 // Send from command buffer stub to proxy when window is invalid and must be
302 // repainted.
303 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_NotifyRepaint)
304
305 // Tells the GPU process to resize an offscreen frame buffer.
306 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer,
307 gfx::Size /* size */)
308
309 #if defined(OS_MACOSX)
310 // On Mac OS X the GPU plugin must be offscreen, because there is no
311 // true cross-process window hierarchy. For this reason we must send
312 // resize events explicitly to the command buffer stub so it can
313 // reallocate its backing store and send the new one back to the
314 // browser. This message is currently used only on 10.6 and later.
315 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize,
316 gfx::Size /* size */)
317 #endif
318
319 //------------------------------------------------------------------------------
320 // GPU Video Decoder Messages
321 // These messages are sent from Renderer process to GPU process.
322 // Initialize and configure GpuVideoDecoder asynchronously.
323 IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_Initialize,
324 GpuVideoDecoderInitParam)
325
326 // Destroy and release GpuVideoDecoder asynchronously.
327 IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Destroy)
328
329 // Start decoder flushing operation.
330 IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Flush)
331
332 // Tell the decoder to start prerolling.
333 IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Preroll)
334
335 // Send input buffer to GpuVideoDecoder.
336 IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_EmptyThisBuffer,
337 GpuVideoDecoderInputBufferParam)
338
339 // Ask the GPU process to produce a video frame with the ID.
340 IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_ProduceVideoFrame,
341 int32) /* Video Frame ID */
342
343 // Sent from Renderer process to the GPU process to notify that textures are
344 // generated for a video frame.
345 IPC_MESSAGE_ROUTED2(GpuVideoDecoderMsg_VideoFrameAllocated,
346 int32, /* Video Frame ID */
347 std::vector<uint32>) /* Textures for video frame */
348
349 //------------------------------------------------------------------------------
350 // GPU Video Decoder Host Messages
351 // These messages are sent from GPU process to Renderer process.
352 // Inform GpuVideoDecoderHost that a GpuVideoDecoder is created.
353 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_CreateVideoDecoderDone,
354 int32) /* decoder_id */
355
356 // Confirm GpuVideoDecoder had been initialized or failed to initialize.
357 // TODO(hclam): Change this to Done instead of ACK.
358 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_InitializeACK,
359 GpuVideoDecoderInitDoneParam)
360
361 // Confrim GpuVideoDecoder had been destroyed properly.
362 // TODO(hclam): Change this to Done instead of ACK.
363 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_DestroyACK)
364
365 // Confirm decoder had been flushed.
366 // TODO(hclam): Change this to Done instead of ACK.
367 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_FlushACK)
368
369 // Confirm preroll operation is done.
370 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_PrerollDone)
371
372 // GpuVideoDecoder has consumed input buffer from transfer buffer.
373 // TODO(hclam): Change this to Done instead of ACK.
374 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferACK)
375
376 // GpuVideoDecoder require new input buffer.
377 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferDone)
378
379 // GpuVideoDecoder reports that a video frame is ready to be consumed.
380 IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_ConsumeVideoFrame,
381 int32, /* Video Frame ID */
382 int64, /* Timestamp in microseconds */
383 int64, /* Duration in microseconds */
384 int32) /* Flags */
385
386 // Allocate video frames for output of the hardware video decoder.
387 IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_AllocateVideoFrames,
388 int32, /* Number of video frames to generate */
389 uint32, /* Width of the video frame */
390 uint32, /* Height of the video frame */
391 int32 /* Format of the video frame */)
392
393 // Release all video frames allocated for a hardware video decoder.
394 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames)
395
396 // GpuVideoDecoder report output format change.
397 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_MediaFormatChange,
398 GpuVideoDecoderFormatChangeParam)
399
400 // GpuVideoDecoder report error.
401 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_ErrorNotification,
402 GpuVideoDecoderErrorInfoParam)
403
404
jam 2011/03/09 06:33:45 nit: extra line
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698