Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / common / gpu / gpu_messages.h
blobd984ac394935f9405d96d75b971ba2767ae31169
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
3 // found in the LICENSE file.
5 // Multiply-included message file, hence no include guard here, but see below
6 // for a much smaller-than-usual include guard section.
8 #include <string>
9 #include <vector>
11 #include "base/memory/shared_memory.h"
12 #include "content/common/content_export.h"
13 #include "content/common/content_param_traits.h"
14 #include "content/common/gpu/gpu_memory_uma_stats.h"
15 #include "content/common/gpu/gpu_process_launch_causes.h"
16 #include "content/common/gpu/gpu_result_codes.h"
17 #include "content/public/common/common_param_traits.h"
18 #include "content/public/common/gpu_memory_stats.h"
19 #include "gpu/command_buffer/common/capabilities.h"
20 #include "gpu/command_buffer/common/command_buffer.h"
21 #include "gpu/command_buffer/common/constants.h"
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
23 #include "gpu/command_buffer/common/mailbox.h"
24 #include "gpu/command_buffer/common/value_state.h"
25 #include "gpu/config/gpu_info.h"
26 #include "gpu/ipc/gpu_command_buffer_traits.h"
27 #include "ipc/ipc_channel_handle.h"
28 #include "ipc/ipc_message_macros.h"
29 #include "media/base/video_frame.h"
30 #include "media/video/video_decode_accelerator.h"
31 #include "media/video/video_encode_accelerator.h"
32 #include "ui/events/latency_info.h"
33 #include "ui/gfx/geometry/size.h"
34 #include "ui/gfx/gpu_memory_buffer.h"
35 #include "ui/gfx/native_widget_types.h"
36 #include "ui/gl/gpu_preference.h"
38 #if defined(OS_ANDROID)
39 #include "content/common/android/surface_texture_peer.h"
40 #endif
42 #undef IPC_MESSAGE_EXPORT
43 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
45 #define IPC_MESSAGE_START GpuMsgStart
47 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
48 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
49 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult,
50 content::CREATE_COMMAND_BUFFER_RESULT_LAST)
51 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
52 gfx::GpuPreferenceLast)
53 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
54 gfx::SURFACE_TYPE_LAST)
55 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
56 gpu::MemoryAllocation::CUTOFF_LAST)
57 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
58 gpu::error::kContextLostReasonLast)
59 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
60 media::VideoEncodeAccelerator::kErrorMax)
61 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format,
62 media::VideoFrame::FORMAT_MAX)
63 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
64 media::VIDEO_CODEC_PROFILE_MIN,
65 media::VIDEO_CODEC_PROFILE_MAX)
66 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
67 gpu::kCollectInfoNone,
68 gpu::kCollectInfoFatalFailure)
69 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
70 gpu::VIDEO_CODEC_PROFILE_MIN,
71 gpu::VIDEO_CODEC_PROFILE_MAX)
73 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
74 IPC_STRUCT_MEMBER(int32, share_group_id)
75 IPC_STRUCT_MEMBER(std::vector<int>, attribs)
76 IPC_STRUCT_MEMBER(GURL, active_url)
77 IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference)
78 IPC_STRUCT_END()
80 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params)
81 IPC_STRUCT_MEMBER(int32, id)
82 IPC_STRUCT_MEMBER(gfx::Size, size)
83 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Format, format)
84 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Usage, usage)
85 IPC_STRUCT_MEMBER(int32, client_id)
86 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, surface_handle)
87 IPC_STRUCT_END()
89 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
90 IPC_STRUCT_MEMBER(int32, surface_id)
91 IPC_STRUCT_MEMBER(uint64, surface_handle)
92 IPC_STRUCT_MEMBER(int32, route_id)
93 IPC_STRUCT_MEMBER(gfx::Size, size)
94 IPC_STRUCT_MEMBER(float, scale_factor)
95 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
96 IPC_STRUCT_END()
98 #if defined(OS_MACOSX)
99 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
100 // If the browser needs framerate throttling based on GPU back-pressure to be
101 // disabled (e.g, because the NSView isn't visible but tab capture is active),
102 // then this is set to true.
103 IPC_STRUCT_MEMBER(bool, disable_throttling)
104 // If the browser is drawing to the screen, this is the CGL renderer ID of
105 // the GL context that the brower is using.
106 IPC_STRUCT_MEMBER(int32, renderer_id)
107 IPC_STRUCT_END()
108 #endif
110 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
111 IPC_STRUCT_MEMBER(int32, id)
112 IPC_STRUCT_MEMBER(std::string, message)
113 IPC_STRUCT_END()
115 #if defined(OS_ANDROID)
116 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params)
117 IPC_STRUCT_MEMBER(float, m00)
118 IPC_STRUCT_MEMBER(float, m01)
119 IPC_STRUCT_MEMBER(float, m02)
120 IPC_STRUCT_MEMBER(float, m03)
121 IPC_STRUCT_MEMBER(float, m10)
122 IPC_STRUCT_MEMBER(float, m11)
123 IPC_STRUCT_MEMBER(float, m12)
124 IPC_STRUCT_MEMBER(float, m13)
125 IPC_STRUCT_MEMBER(float, m20)
126 IPC_STRUCT_MEMBER(float, m21)
127 IPC_STRUCT_MEMBER(float, m22)
128 IPC_STRUCT_MEMBER(float, m23)
129 IPC_STRUCT_MEMBER(float, m30)
130 IPC_STRUCT_MEMBER(float, m31)
131 IPC_STRUCT_MEMBER(float, m32)
132 IPC_STRUCT_MEMBER(float, m33)
133 IPC_STRUCT_END()
134 #endif
136 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
137 IPC_STRUCT_TRAITS_MEMBER(values)
138 IPC_STRUCT_TRAITS_MEMBER(children)
139 IPC_STRUCT_TRAITS_END()
141 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
142 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
143 IPC_STRUCT_TRAITS_MEMBER(device_id)
144 IPC_STRUCT_TRAITS_MEMBER(active)
145 IPC_STRUCT_TRAITS_MEMBER(vendor_string)
146 IPC_STRUCT_TRAITS_MEMBER(device_string)
147 IPC_STRUCT_TRAITS_END()
149 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile)
150 IPC_STRUCT_TRAITS_MEMBER(profile)
151 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
152 IPC_STRUCT_TRAITS_MEMBER(min_resolution)
153 IPC_STRUCT_TRAITS_END()
155 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
156 IPC_STRUCT_TRAITS_MEMBER(profile)
157 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
158 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
159 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator)
160 IPC_STRUCT_TRAITS_END()
162 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
163 IPC_STRUCT_TRAITS_MEMBER(initialization_time)
164 IPC_STRUCT_TRAITS_MEMBER(optimus)
165 IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
166 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
167 IPC_STRUCT_TRAITS_MEMBER(gpu)
168 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
169 IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
170 IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
171 IPC_STRUCT_TRAITS_MEMBER(driver_version)
172 IPC_STRUCT_TRAITS_MEMBER(driver_date)
173 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
174 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
175 IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples)
176 IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
177 IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
178 IPC_STRUCT_TRAITS_MEMBER(gl_version)
179 IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
180 IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
181 IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
182 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
183 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
184 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
185 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
186 IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
187 IPC_STRUCT_TRAITS_MEMBER(software_rendering)
188 IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
189 IPC_STRUCT_TRAITS_MEMBER(sandboxed)
190 IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
191 IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
192 IPC_STRUCT_TRAITS_MEMBER(context_info_state)
193 #if defined(OS_WIN)
194 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
195 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
196 #endif
197 IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_supported_profiles)
198 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles)
199 IPC_STRUCT_TRAITS_END()
201 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats)
202 IPC_STRUCT_TRAITS_MEMBER(video_memory)
203 IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
204 IPC_STRUCT_TRAITS_END()
206 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats)
207 IPC_STRUCT_TRAITS_MEMBER(process_map)
208 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
209 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
210 IPC_STRUCT_TRAITS_END()
212 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
213 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
214 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
215 IPC_STRUCT_TRAITS_MEMBER(bytes_limit)
216 IPC_STRUCT_TRAITS_END()
218 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
219 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
220 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
221 IPC_STRUCT_TRAITS_END()
223 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle)
224 IPC_STRUCT_TRAITS_MEMBER(handle)
225 IPC_STRUCT_TRAITS_MEMBER(transport_type)
226 IPC_STRUCT_TRAITS_MEMBER(parent_client_id)
227 IPC_STRUCT_TRAITS_END()
229 //------------------------------------------------------------------------------
230 // GPU Messages
231 // These are messages from the browser to the GPU process.
233 // Tells the GPU process to initialize itself. The browser explicitly
234 // requests this be done so that we are guaranteed that the channel is set
235 // up between the browser and GPU process before doing any work that might
236 // potentially crash the GPU process. Detection of the child process
237 // exiting abruptly is predicated on having the IPC channel set up.
238 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
240 // Tells the GPU process to create a new channel for communication with a
241 // given client. The channel name is returned in a
242 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
243 // the GPU process reuses an existing channel to that process if it exists.
244 // This ID is a unique opaque identifier generated by the browser process.
245 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel,
246 int /* client_id */,
247 bool /* share_context */,
248 bool /* allow_future_sync_points */)
250 // Tells the GPU process to close the channel identified by IPC channel
251 // handle. If no channel can be identified, do nothing.
252 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
253 IPC::ChannelHandle /* channel_handle */)
255 // Tells the GPU process to create a new command buffer that renders directly
256 // to a native view. A corresponding GpuCommandBufferStub is created.
257 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer,
258 gfx::GLSurfaceHandle, /* compositing_surface */
259 int32, /* surface_id */
260 int32, /* client_id */
261 GPUCreateCommandBufferConfig, /* init_params */
262 int32 /* route_id */)
264 // Tells the GPU process to create a new gpu memory buffer.
265 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
266 GpuMsg_CreateGpuMemoryBuffer_Params)
268 // Tells the GPU process to destroy buffer.
269 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
270 gfx::GpuMemoryBufferId, /* id */
271 int32, /* client_id */
272 int32 /* sync_point */)
274 // Tells the GPU process to create a context for collecting graphics card
275 // information.
276 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
278 // Tells the GPU process to report video_memory information for the task manager
279 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
281 #if defined(OS_MACOSX)
282 // Tells the GPU process that the browser process has handled the swap
283 // buffers or post sub-buffer request.
284 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented,
285 AcceleratedSurfaceMsg_BufferPresented_Params)
286 #endif
288 // Tells the GPU process to wake up the GPU because we're about to draw.
289 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu)
291 // Tells the GPU process to remove all contexts.
292 IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
294 // Tells the GPU process to crash.
295 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
297 // Tells the GPU process to hang.
298 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
300 // Tells the GPU process to disable the watchdog thread.
301 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
303 // Tells the GPU process that the browser has seen a GPU switch.
304 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched)
306 // Tells the GPU process to delete the default_offscreen surface. It will also
307 // close the display and any other resources when the last GL surface is
308 // deleted. GPU process will respond with GphHosMsg_ResourcesRelinquished.
309 IPC_MESSAGE_CONTROL0(GpuMsg_RelinquishResources)
311 // Sends an input event to the gpu service.
312 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState,
313 int, /* client_id */
314 unsigned int, /* target */
315 gpu::ValueState /* valuestate */)
317 //------------------------------------------------------------------------------
318 // GPU Host Messages
319 // These are messages to the browser.
321 // A renderer sends this when it wants to create a connection to the GPU
322 // process. The browser will create the GPU process if necessary, and will
323 // return a handle to the channel via a GpuChannelEstablished message.
324 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
325 content::CauseForGpuLaunch,
326 int /* client id */,
327 IPC::ChannelHandle /* handle to channel */,
328 gpu::GPUInfo /* stats about GPU process*/)
330 // A renderer sends this to the browser process when it wants to
331 // create a GL context associated with the given view_id.
332 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer,
333 int32, /* surface_id */
334 GPUCreateCommandBufferConfig, /* init_params */
335 int32, /* route_id */
336 content::CreateCommandBufferResult /* result */)
338 // Response from GPU to a GputMsg_Initialize message.
339 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
340 bool /* result */,
341 ::gpu::GPUInfo /* gpu_info */)
343 // Response from GPU to a GpuHostMsg_EstablishChannel message.
344 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
345 IPC::ChannelHandle /* channel_handle */)
347 // Message from GPU to notify to destroy the channel.
348 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel,
349 int32 /* client_id */)
351 // Message to cache the given shader information.
352 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
353 int32 /* client_id */,
354 std::string /* key */,
355 std::string /* shader */)
357 // Message to the GPU that a shader was loaded from disk.
358 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader,
359 std::string /* encoded shader */)
361 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
362 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
363 content::CreateCommandBufferResult /* result */)
365 // Request from GPU to free the browser resources associated with the
366 // command buffer.
367 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer,
368 int32 /* surface_id */)
370 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
371 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
372 gfx::GpuMemoryBufferHandle /* handle */)
374 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
375 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
376 gpu::GPUInfo /* GPU logging stats */)
378 // Response from GPU to a GpuMsg_GetVideoMemory.
379 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
380 content::GPUVideoMemoryUsageStats /* GPU memory stats */)
382 // Message from GPU to add a GPU log message to the about:gpu page.
383 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
384 int /*severity*/,
385 std::string /* header */,
386 std::string /* message */)
388 // Tells the browser that a new accelerated surface was initialized.
389 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized,
390 int32 /* surface_id */,
391 int32 /* route_id */)
393 // Same as above with a rect of the part of the surface that changed.
394 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
395 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
397 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext,
398 GURL /* url */)
400 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
401 bool /* offscreen */,
402 gpu::error::ContextLostReason /* reason */,
403 GURL /* url */)
405 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext,
406 GURL /* url */)
408 // Tells the browser about GPU memory usage statistics for UMA logging.
409 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
410 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
412 // Response to GpuMsg_RelinquishResources.
413 IPC_MESSAGE_CONTROL0(GpuHostMsg_ResourcesRelinquished)
415 // Tells the browser that a context has subscribed to a new target and
416 // the browser should start sending the corresponding information
417 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription,
418 int32 /* client_id */,
419 unsigned int /* target */)
421 // Tells the browser that no contexts are subscribed to the target anymore
422 // so the browser should stop sending the corresponding information
423 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription,
424 int32 /* client_id */,
425 unsigned int /* target */)
427 //------------------------------------------------------------------------------
428 // GPU Channel Messages
429 // These are messages from a renderer process to the GPU process.
431 // Tells the GPU process to create a new command buffer that renders to an
432 // offscreen frame buffer.
433 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
434 gfx::Size, /* size */
435 GPUCreateCommandBufferConfig, /* init_params */
436 int32, /* route_id */
437 bool /* succeeded */)
439 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
440 // destructor, so that the stub deletes the actual CommandBufferService
441 // object that it's hosting.
442 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
443 int32 /* instance_id */)
445 #if defined(OS_ANDROID)
446 //------------------------------------------------------------------------------
447 // Stream Texture Messages
448 // Tells the GPU process create and send the java surface texture object to
449 // the renderer process through the binder thread.
450 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer,
451 int32, /* primary_id */
452 int32 /* secondary_id */)
454 // Tells the GPU process to set the size of StreamTexture from the given
455 // stream Id.
456 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize,
457 gfx::Size /* size */)
459 // Tells the service-side instance to start sending frame available
460 // notifications.
461 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening)
463 // Inform the renderer that a new frame is available.
464 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable)
466 // Inform the renderer process that the transform matrix has changed.
467 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged,
468 GpuStreamTextureMsg_MatrixChanged_Params /* params */)
469 #endif
471 //------------------------------------------------------------------------------
472 // GPU Command Buffer Messages
473 // These are messages between a renderer process to the GPU process relating to
474 // a single OpenGL context.
475 // Initialize a command buffer with the given number of command entries.
476 // Returns the shared memory handle for the command buffer mapped to the
477 // calling process.
478 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize,
479 base::SharedMemoryHandle /* shared_state */,
480 bool /* result */,
481 gpu::Capabilities /* capabilities */)
483 // Sets the shared memory buffer used for commands.
484 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer,
485 int32 /* shm_id */)
487 // Produces the front buffer into a mailbox. This allows another context to draw
488 // the output of this context.
489 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer,
490 gpu::Mailbox /* mailbox */)
492 // Wait until the token is in a specific range, inclusive.
493 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange,
494 int32 /* start */,
495 int32 /* end */,
496 gpu::CommandBuffer::State /* state */)
498 // Wait until the get offset is in a specific range, inclusive.
499 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange,
500 int32 /* start */,
501 int32 /* end */,
502 gpu::CommandBuffer::State /* state */)
504 // Asynchronously synchronize the put and get offsets of both processes.
505 // Caller passes its current put offset. Current state (including get offset)
506 // is returned in shared memory. The input latency info for the current
507 // frame is also sent to the GPU process.
508 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush,
509 int32 /* put_offset */,
510 uint32 /* flush_count */,
511 std::vector<ui::LatencyInfo> /* latency_info */)
513 // Asynchronously process any commands known to the GPU process. This is only
514 // used in the event that a channel is unscheduled and needs to be flushed
515 // again to process any commands issued subsequent to unscheduling. The GPU
516 // process actually sends it (deferred) to itself.
517 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled)
519 // Sent by the GPU process to display messages in the console.
520 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg,
521 GPUCommandBufferConsoleMessage /* msg */)
523 // Register an existing shared memory transfer buffer. The id that can be
524 // used to identify the transfer buffer from a command buffer.
525 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer,
526 int32 /* id */,
527 base::SharedMemoryHandle /* transfer_buffer */,
528 uint32 /* size */)
530 // Destroy a previously created transfer buffer.
531 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer,
532 int32 /* id */)
534 // Create and initialize a hardware video decoder using the specified route_id.
535 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
536 // no longer needed.
537 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder,
538 media::VideoCodecProfile /* profile */,
539 int32, /* route_id */
540 bool /* succeeded */)
542 // Create and initialize a hardware video encoder using the specified route_id.
543 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
544 // no longer needed.
545 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder,
546 media::VideoFrame::Format /* input_format */,
547 gfx::Size /* input_visible_size */,
548 media::VideoCodecProfile /* output_profile */,
549 uint32 /* initial_bitrate */,
550 int32, /* route_id */
551 bool /* succeeded */)
553 // Tells the proxy that there was an error and the command buffer had to be
554 // destroyed for some reason.
555 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed,
556 gpu::error::ContextLostReason /* reason */)
558 // Tells the browser that SwapBuffers returned and passes latency info
559 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted,
560 std::vector<ui::LatencyInfo> /* latency_info */)
562 // Tells the browser about updated parameters for vsync alignment.
563 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters,
564 base::TimeTicks /* timebase */,
565 base::TimeDelta /* interval */)
567 // Send to stub on surface visibility change.
568 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */)
570 // Sent to proxy when the gpu memory manager changes its memory allocation.
571 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation,
572 gpu::MemoryAllocation /* allocation */)
574 // Sent to stub when proxy is assigned a memory allocation changed callback.
575 IPC_MESSAGE_ROUTED1(
576 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
577 bool /* has_callback */)
579 // Inserts a sync point into the channel. This is handled on the IO thread, so
580 // can be expected to be reasonably fast, but the sync point is actually
581 // retired in order with respect to the other calls. The sync point is shared
582 // across channels.
583 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint,
584 bool /* retire */,
585 uint32 /* sync_point */)
587 // Retires the sync point. Note: this message is not sent explicitly by the
588 // renderer, but is synthesized by the GPU process.
589 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint,
590 uint32 /* sync_point */)
592 // Makes this command buffer signal when a sync point is reached, by sending
593 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
594 // signal_id.
595 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint,
596 uint32 /* sync_point */,
597 uint32 /* signal_id */)
599 // Response to GpuCommandBufferMsg_SignalSyncPoint.
600 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck,
601 uint32 /* signal_id */)
603 // Makes this command buffer signal when a query is reached, by sending
604 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
605 // signal_id.
606 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery,
607 uint32 /* query */,
608 uint32 /* signal_id */)
610 // Create an image from an existing gpu memory buffer. The id that can be
611 // used to identify the image from a command buffer.
612 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage,
613 int32 /* id */,
614 gfx::GpuMemoryBufferHandle /* gpu_memory_buffer */,
615 gfx::Size /* size */,
616 gfx::GpuMemoryBuffer::Format /* format */,
617 uint32 /* internalformat */)
619 // Destroy a previously created image.
620 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage,
621 int32 /* id */)
623 // Attaches an external image stream to the client texture.
624 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture,
625 uint32, /* client_texture_id */
626 int32, /* stream_id */
627 bool /* succeeded */)
629 //------------------------------------------------------------------------------
630 // Accelerated Video Decoder Messages
631 // These messages are sent from Renderer process to GPU process.
633 // Send input buffer for decoding.
634 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode,
635 base::SharedMemoryHandle, /* input_buffer_handle */
636 int32, /* bitstream_buffer_id */
637 uint32) /* size */
639 // Sent from Renderer process to the GPU process to give the texture IDs for
640 // the textures the decoder will use for output.
641 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers,
642 std::vector<int32>, /* Picture buffer ID */
643 std::vector<uint32>) /* Texture ID */
645 // Send from Renderer process to the GPU process to recycle the given picture
646 // buffer for further decoding.
647 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
648 int32) /* Picture buffer ID */
650 // Send flush request to the decoder.
651 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush)
653 // Send reset request to the decoder.
654 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset)
656 // Send destroy request to the decoder.
657 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy)
659 //------------------------------------------------------------------------------
660 // Accelerated Video Decoder Host Messages
661 // These messages are sent from GPU process to Renderer process.
662 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
663 // created.
665 // Accelerated video decoder has consumed input buffer from transfer buffer.
666 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
667 int32) /* Processed buffer ID */
669 // Allocate video frames for output of the hardware video decoder.
670 IPC_MESSAGE_ROUTED3(
671 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
672 int32, /* Number of video frames to generate */
673 gfx::Size, /* Requested size of buffer */
674 uint32 ) /* Texture target */
676 // Decoder reports that a picture is ready and buffer does not need to be passed
677 // back to the decoder.
678 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
679 int32) /* Picture buffer ID */
681 // Decoder reports that a picture is ready.
682 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady,
683 int32, /* Picture buffer ID */
684 int32, /* Bitstream buffer ID */
685 gfx::Rect, /* Visible rectangle */
686 bool) /* Buffer is HW overlay capable */
688 // Confirm decoder has been flushed.
689 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone)
691 // Confirm decoder has been reset.
692 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone)
694 // Video decoder has encountered an error.
695 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
696 uint32) /* Error ID */
698 //------------------------------------------------------------------------------
699 // Accelerated Video Encoder Messages
700 // These messages are sent from the Renderer process to GPU process.
702 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
703 // AcceleratedVideoEncoderHostMsg_NotifyInputDone.
704 IPC_MESSAGE_ROUTED5(AcceleratedVideoEncoderMsg_Encode,
705 int32 /* frame_id */,
706 base::SharedMemoryHandle /* buffer_handle */,
707 uint32 /* buffer_offset */,
708 uint32 /* buffer_size */,
709 bool /* force_keyframe */)
711 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
712 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
713 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer,
714 int32 /* buffer_id */,
715 base::SharedMemoryHandle /* buffer_handle */,
716 uint32 /* buffer_size */)
718 // Request a runtime encoding parameter change.
719 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange,
720 uint32 /* bitrate */,
721 uint32 /* framerate */)
723 //------------------------------------------------------------------------------
724 // Accelerated Video Encoder Host Messages
725 // These messages are sent from GPU process to Renderer process.
727 // Notify renderer of the input/output buffer requirements of the encoder.
728 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers,
729 uint32 /* input_count */,
730 gfx::Size /* input_coded_size */,
731 uint32 /* output_buffer_size */)
733 // Notify the renderer that the encoder has finished using an input buffer.
734 // There is no congruent entry point in the media::VideoEncodeAccelerator
735 // interface, in VEA this same done condition is indicated by dropping the
736 // reference to the media::VideoFrame passed to VEA::Encode().
737 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone,
738 int32 /* frame_id */)
740 // Notify the renderer that an output buffer has been filled with encoded data.
741 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady,
742 int32 /* bitstream_buffer_id */,
743 uint32 /* payload_size */,
744 bool /* key_frame */)
746 // Report error condition.
747 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
748 media::VideoEncodeAccelerator::Error /* error */)
750 // Send destroy request to the encoder.
751 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)