Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / content / common / gpu / gpu_messages.h
blob59b89fc4e6568e0b44fc740bea5cfe158d3e0403
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/common/gpu/gpu_stream_priority.h"
18 #include "content/public/common/common_param_traits.h"
19 #include "content/public/common/gpu_memory_stats.h"
20 #include "gpu/command_buffer/common/capabilities.h"
21 #include "gpu/command_buffer/common/command_buffer.h"
22 #include "gpu/command_buffer/common/constants.h"
23 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
24 #include "gpu/command_buffer/common/mailbox.h"
25 #include "gpu/command_buffer/common/value_state.h"
26 #include "gpu/config/gpu_info.h"
27 #include "gpu/ipc/gpu_command_buffer_traits.h"
28 #include "ipc/ipc_channel_handle.h"
29 #include "ipc/ipc_message_macros.h"
30 #include "media/base/video_types.h"
31 #include "media/video/jpeg_decode_accelerator.h"
32 #include "media/video/video_decode_accelerator.h"
33 #include "media/video/video_encode_accelerator.h"
34 #include "ui/events/latency_info.h"
35 #include "ui/gfx/geometry/size.h"
36 #include "ui/gfx/gpu_memory_buffer.h"
37 #include "ui/gfx/ipc/gfx_param_traits.h"
38 #include "ui/gfx/native_widget_types.h"
39 #include "ui/gfx/swap_result.h"
40 #include "ui/gl/gpu_preference.h"
42 #if defined(OS_ANDROID)
43 #include "content/common/android/surface_texture_peer.h"
44 #endif
46 #undef IPC_MESSAGE_EXPORT
47 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
49 #define IPC_MESSAGE_START GpuMsgStart
51 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
52 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
53 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult,
54 content::CREATE_COMMAND_BUFFER_RESULT_LAST)
55 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
56 gfx::GpuPreferenceLast)
57 IPC_ENUM_TRAITS_MAX_VALUE(content::GpuStreamPriority,
58 content::GpuStreamPriority::LAST)
59 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
60 gfx::SURFACE_TYPE_LAST)
61 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST)
62 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
63 gpu::MemoryAllocation::CUTOFF_LAST)
64 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error, gpu::error::kErrorLast)
65 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
66 gpu::error::kContextLostReasonLast)
67 IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error,
68 media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM)
69 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
70 media::VideoEncodeAccelerator::kErrorMax)
71 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
72 media::VIDEO_CODEC_PROFILE_MIN,
73 media::VIDEO_CODEC_PROFILE_MAX)
74 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
75 gpu::kCollectInfoNone,
76 gpu::kCollectInfoFatalFailure)
77 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
78 gpu::VIDEO_CODEC_PROFILE_MIN,
79 gpu::VIDEO_CODEC_PROFILE_MAX)
81 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
82 IPC_STRUCT_MEMBER(int32, share_group_id)
83 IPC_STRUCT_MEMBER(int32, stream_id)
84 IPC_STRUCT_MEMBER(content::GpuStreamPriority, stream_priority)
85 IPC_STRUCT_MEMBER(std::vector<int>, attribs)
86 IPC_STRUCT_MEMBER(GURL, active_url)
87 IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference)
88 IPC_STRUCT_END()
90 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params)
91 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id)
92 IPC_STRUCT_MEMBER(gfx::Size, size)
93 IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
94 IPC_STRUCT_MEMBER(gfx::BufferUsage, usage)
95 IPC_STRUCT_MEMBER(int32, client_id)
96 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, surface_handle)
97 IPC_STRUCT_END()
99 #if defined(OS_MACOSX)
100 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
101 IPC_STRUCT_MEMBER(int32, surface_id)
102 IPC_STRUCT_MEMBER(uint64, surface_handle)
103 IPC_STRUCT_MEMBER(int32, route_id)
104 IPC_STRUCT_MEMBER(gfx::Size, size)
105 IPC_STRUCT_MEMBER(gfx::Rect, damage_rect)
106 IPC_STRUCT_MEMBER(float, scale_factor)
107 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
108 IPC_STRUCT_END()
110 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
111 // If the browser needs framerate throttling based on GPU back-pressure to be
112 // disabled (e.g, because the NSView isn't visible but tab capture is active),
113 // then this is set to true.
114 IPC_STRUCT_MEMBER(bool, disable_throttling)
115 // If the browser is drawing to the screen, this is the CGL renderer ID of
116 // the GL context that the brower is using.
117 IPC_STRUCT_MEMBER(int32, renderer_id)
118 // The vsync parameters, to synchronize presentation with the display.
119 IPC_STRUCT_MEMBER(base::TimeTicks, vsync_timebase)
120 IPC_STRUCT_MEMBER(base::TimeDelta, vsync_interval)
121 IPC_STRUCT_END()
122 #endif
124 IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params)
125 IPC_STRUCT_MEMBER(int32, input_buffer_id)
126 IPC_STRUCT_MEMBER(gfx::Size, coded_size)
127 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle)
128 IPC_STRUCT_MEMBER(uint32, input_buffer_size)
129 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, output_video_frame_handle)
130 IPC_STRUCT_MEMBER(uint32, output_buffer_size)
131 IPC_STRUCT_END()
133 IPC_STRUCT_BEGIN(AcceleratedVideoEncoderMsg_Encode_Params)
134 IPC_STRUCT_MEMBER(int32_t, frame_id)
135 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, buffer_handle)
136 IPC_STRUCT_MEMBER(uint32_t, buffer_offset)
137 IPC_STRUCT_MEMBER(uint32_t, buffer_size)
138 IPC_STRUCT_MEMBER(bool, force_keyframe)
139 IPC_STRUCT_END()
141 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
142 IPC_STRUCT_MEMBER(int32, id)
143 IPC_STRUCT_MEMBER(std::string, message)
144 IPC_STRUCT_END()
146 #if defined(OS_ANDROID)
147 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params)
148 IPC_STRUCT_MEMBER(float, m00)
149 IPC_STRUCT_MEMBER(float, m01)
150 IPC_STRUCT_MEMBER(float, m02)
151 IPC_STRUCT_MEMBER(float, m03)
152 IPC_STRUCT_MEMBER(float, m10)
153 IPC_STRUCT_MEMBER(float, m11)
154 IPC_STRUCT_MEMBER(float, m12)
155 IPC_STRUCT_MEMBER(float, m13)
156 IPC_STRUCT_MEMBER(float, m20)
157 IPC_STRUCT_MEMBER(float, m21)
158 IPC_STRUCT_MEMBER(float, m22)
159 IPC_STRUCT_MEMBER(float, m23)
160 IPC_STRUCT_MEMBER(float, m30)
161 IPC_STRUCT_MEMBER(float, m31)
162 IPC_STRUCT_MEMBER(float, m32)
163 IPC_STRUCT_MEMBER(float, m33)
164 IPC_STRUCT_END()
165 #endif
167 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
168 IPC_STRUCT_TRAITS_MEMBER(values)
169 IPC_STRUCT_TRAITS_MEMBER(children)
170 IPC_STRUCT_TRAITS_END()
172 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
173 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
174 IPC_STRUCT_TRAITS_MEMBER(device_id)
175 IPC_STRUCT_TRAITS_MEMBER(active)
176 IPC_STRUCT_TRAITS_MEMBER(vendor_string)
177 IPC_STRUCT_TRAITS_MEMBER(device_string)
178 IPC_STRUCT_TRAITS_END()
180 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile)
181 IPC_STRUCT_TRAITS_MEMBER(profile)
182 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
183 IPC_STRUCT_TRAITS_MEMBER(min_resolution)
184 IPC_STRUCT_TRAITS_END()
186 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
187 IPC_STRUCT_TRAITS_MEMBER(profile)
188 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
189 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
190 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator)
191 IPC_STRUCT_TRAITS_END()
193 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
194 IPC_STRUCT_TRAITS_MEMBER(initialization_time)
195 IPC_STRUCT_TRAITS_MEMBER(optimus)
196 IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
197 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
198 IPC_STRUCT_TRAITS_MEMBER(gpu)
199 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
200 IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
201 IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
202 IPC_STRUCT_TRAITS_MEMBER(driver_version)
203 IPC_STRUCT_TRAITS_MEMBER(driver_date)
204 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
205 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
206 IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples)
207 IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
208 IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
209 IPC_STRUCT_TRAITS_MEMBER(gl_version)
210 IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
211 IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
212 IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
213 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
214 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
215 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
216 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
217 IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
218 IPC_STRUCT_TRAITS_MEMBER(software_rendering)
219 IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
220 IPC_STRUCT_TRAITS_MEMBER(sandboxed)
221 IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
222 IPC_STRUCT_TRAITS_MEMBER(in_process_gpu)
223 IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
224 IPC_STRUCT_TRAITS_MEMBER(context_info_state)
225 #if defined(OS_WIN)
226 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
227 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
228 #endif
229 IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_supported_profiles)
230 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles)
231 IPC_STRUCT_TRAITS_MEMBER(jpeg_decode_accelerator_supported)
232 IPC_STRUCT_TRAITS_END()
234 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats)
235 IPC_STRUCT_TRAITS_MEMBER(video_memory)
236 IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
237 IPC_STRUCT_TRAITS_END()
239 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats)
240 IPC_STRUCT_TRAITS_MEMBER(process_map)
241 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
242 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
243 IPC_STRUCT_TRAITS_END()
245 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
246 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
247 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
248 IPC_STRUCT_TRAITS_MEMBER(bytes_limit)
249 IPC_STRUCT_TRAITS_END()
251 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
252 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
253 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
254 IPC_STRUCT_TRAITS_END()
256 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle)
257 IPC_STRUCT_TRAITS_MEMBER(handle)
258 IPC_STRUCT_TRAITS_MEMBER(transport_type)
259 IPC_STRUCT_TRAITS_MEMBER(parent_client_id)
260 IPC_STRUCT_TRAITS_END()
262 //------------------------------------------------------------------------------
263 // GPU Messages
264 // These are messages from the browser to the GPU process.
266 // Tells the GPU process to initialize itself. The browser explicitly
267 // requests this be done so that we are guaranteed that the channel is set
268 // up between the browser and GPU process before doing any work that might
269 // potentially crash the GPU process. Detection of the child process
270 // exiting abruptly is predicated on having the IPC channel set up.
271 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
273 // Tells the GPU process to shutdown itself.
274 IPC_MESSAGE_CONTROL0(GpuMsg_Finalize)
276 // Tells the GPU process to create a new channel for communication with a
277 // given client. The channel name is returned in a
278 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
279 // the GPU process reuses an existing channel to that process if it exists.
280 // This ID is a unique opaque identifier generated by the browser process.
281 // The client_tracing_id is a unique ID used for the purposes of tracing.
282 IPC_MESSAGE_CONTROL5(GpuMsg_EstablishChannel,
283 int /* client_id */,
284 uint64 /* client_tracing_id */,
285 bool /* share_context */,
286 bool /* allow_future_sync_points */,
287 bool /* allow_real_time_streams */)
289 // Tells the GPU process to close the channel identified by IPC channel
290 // handle. If no channel can be identified, do nothing.
291 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
292 IPC::ChannelHandle /* channel_handle */)
294 // Tells the GPU process to create a new command buffer that renders directly
295 // to a native view. A corresponding GpuCommandBufferStub is created.
296 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer,
297 gfx::GLSurfaceHandle, /* compositing_surface */
298 int32, /* surface_id */
299 int32, /* client_id */
300 GPUCreateCommandBufferConfig, /* init_params */
301 int32 /* route_id */)
303 // Tells the GPU process to create a new gpu memory buffer.
304 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
305 GpuMsg_CreateGpuMemoryBuffer_Params)
307 // Tells the GPU process to destroy buffer.
308 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
309 gfx::GpuMemoryBufferId, /* id */
310 int32, /* client_id */
311 int32 /* sync_point */)
313 // Create and initialize a hardware jpeg decoder using the specified route_id.
314 // Created decoders should be freed with AcceleratedJpegDecoderMsg_Destroy when
315 // no longer needed.
316 IPC_SYNC_MESSAGE_CONTROL1_1(GpuMsg_CreateJpegDecoder,
317 int32 /* route_id */,
318 bool /* succeeded */)
320 // Tells the GPU process to create a context for collecting graphics card
321 // information.
322 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
324 // Tells the GPU process to report video_memory information for the task manager
325 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
327 #if defined(OS_MACOSX)
328 // Tells the GPU process that the browser process has handled the swap
329 // buffers or post sub-buffer request.
330 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented,
331 AcceleratedSurfaceMsg_BufferPresented_Params)
332 #endif
334 // Tells the GPU process to wake up the GPU because we're about to draw.
335 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu)
337 // Tells the GPU process to remove all contexts.
338 IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
340 // Tells the GPU process to crash.
341 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
343 // Tells the GPU process to hang.
344 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
346 // Tells the GPU process to disable the watchdog thread.
347 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
349 // Tells the GPU process that the browser has seen a GPU switch.
350 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched)
352 // Sends an input event to the gpu service.
353 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState,
354 int, /* client_id */
355 unsigned int, /* target */
356 gpu::ValueState /* valuestate */)
358 //------------------------------------------------------------------------------
359 // GPU Host Messages
360 // These are messages to the browser.
362 // A renderer sends this when it wants to create a connection to the GPU
363 // process. The browser will create the GPU process if necessary, and will
364 // return a handle to the channel via a GpuChannelEstablished message.
365 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
366 content::CauseForGpuLaunch,
367 int /* client id */,
368 IPC::ChannelHandle /* handle to channel */,
369 gpu::GPUInfo /* stats about GPU process*/)
371 // A renderer sends this to the browser process when it wants to
372 // create a GL context associated with the given view_id.
373 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer,
374 int32, /* surface_id */
375 GPUCreateCommandBufferConfig, /* init_params */
376 int32, /* route_id */
377 content::CreateCommandBufferResult /* result */)
379 // Response from GPU to a GputMsg_Initialize message.
380 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
381 bool /* result */,
382 ::gpu::GPUInfo /* gpu_info */)
384 // Response from GPU to a GpuHostMsg_EstablishChannel message.
385 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
386 IPC::ChannelHandle /* channel_handle */)
388 // Message from GPU to notify to destroy the channel.
389 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel,
390 int32 /* client_id */)
392 // Message to cache the given shader information.
393 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
394 int32 /* client_id */,
395 std::string /* key */,
396 std::string /* shader */)
398 // Message to the GPU that a shader was loaded from disk.
399 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader,
400 std::string /* encoded shader */)
402 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
403 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
404 content::CreateCommandBufferResult /* result */)
406 // Request from GPU to free the browser resources associated with the
407 // command buffer.
408 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer,
409 int32 /* surface_id */)
411 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
412 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
413 gfx::GpuMemoryBufferHandle /* handle */)
415 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
416 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
417 gpu::GPUInfo /* GPU logging stats */)
419 // Response from GPU to a GpuMsg_GetVideoMemory.
420 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
421 content::GPUVideoMemoryUsageStats /* GPU memory stats */)
423 // Message from GPU to add a GPU log message to the about:gpu page.
424 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
425 int /*severity*/,
426 std::string /* header */,
427 std::string /* message */)
429 // Tells the browser that a new accelerated surface was initialized.
430 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized,
431 int32 /* surface_id */,
432 int32 /* route_id */)
435 #if defined(OS_MACOSX)
436 // Tells the browser that an accelerated surface has swapped.
437 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
438 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
439 #endif
441 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext,
442 GURL /* url */)
444 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
445 bool /* offscreen */,
446 gpu::error::ContextLostReason /* reason */,
447 GURL /* url */)
449 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext,
450 GURL /* url */)
452 // Tells the browser about GPU memory usage statistics for UMA logging.
453 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
454 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
456 // Tells the browser that a context has subscribed to a new target and
457 // the browser should start sending the corresponding information
458 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription,
459 int32 /* client_id */,
460 unsigned int /* target */)
462 // Tells the browser that no contexts are subscribed to the target anymore
463 // so the browser should stop sending the corresponding information
464 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription,
465 int32 /* client_id */,
466 unsigned int /* target */)
468 //------------------------------------------------------------------------------
469 // GPU Channel Messages
470 // These are messages from a renderer process to the GPU process.
472 // Tells the GPU process to create a new command buffer that renders to an
473 // offscreen frame buffer.
474 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
475 gfx::Size, /* size */
476 GPUCreateCommandBufferConfig, /* init_params */
477 int32, /* route_id */
478 bool /* succeeded */)
480 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
481 // destructor, so that the stub deletes the actual CommandBufferService
482 // object that it's hosting.
483 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
484 int32 /* instance_id */)
486 #if defined(OS_ANDROID)
487 //------------------------------------------------------------------------------
488 // Stream Texture Messages
489 // Tells the GPU process create and send the java surface texture object to
490 // the renderer process through the binder thread.
491 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer,
492 int32, /* primary_id */
493 int32 /* secondary_id */)
495 // Tells the GPU process to set the size of StreamTexture from the given
496 // stream Id.
497 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize,
498 gfx::Size /* size */)
500 // Tells the service-side instance to start sending frame available
501 // notifications.
502 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening)
504 // Inform the renderer that a new frame is available.
505 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable)
507 // Inform the renderer process that the transform matrix has changed.
508 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged,
509 GpuStreamTextureMsg_MatrixChanged_Params /* params */)
510 #endif
512 //------------------------------------------------------------------------------
513 // GPU Command Buffer Messages
514 // These are messages between a renderer process to the GPU process relating to
515 // a single OpenGL context.
516 // Initialize a command buffer with the given number of command entries.
517 // Returns the shared memory handle for the command buffer mapped to the
518 // calling process.
519 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize,
520 base::SharedMemoryHandle /* shared_state */,
521 bool /* result */,
522 gpu::Capabilities /* capabilities */)
524 // Sets the shared memory buffer used for commands.
525 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer,
526 int32 /* shm_id */)
528 // Produces the front buffer into a mailbox. This allows another context to draw
529 // the output of this context.
530 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer,
531 gpu::Mailbox /* mailbox */)
533 // Wait until the token is in a specific range, inclusive.
534 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange,
535 int32 /* start */,
536 int32 /* end */,
537 gpu::CommandBuffer::State /* state */)
539 // Wait until the get offset is in a specific range, inclusive.
540 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange,
541 int32 /* start */,
542 int32 /* end */,
543 gpu::CommandBuffer::State /* state */)
545 // Asynchronously synchronize the put and get offsets of both processes.
546 // Caller passes its current put offset. Current state (including get offset)
547 // is returned in shared memory. The input latency info for the current
548 // frame is also sent to the GPU process.
549 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush,
550 int32 /* put_offset */,
551 uint32 /* flush_count */,
552 std::vector<ui::LatencyInfo> /* latency_info */)
554 // Sent by the GPU process to display messages in the console.
555 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg,
556 GPUCommandBufferConsoleMessage /* msg */)
558 // Register an existing shared memory transfer buffer. The id that can be
559 // used to identify the transfer buffer from a command buffer.
560 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer,
561 int32 /* id */,
562 base::SharedMemoryHandle /* transfer_buffer */,
563 uint32 /* size */)
565 // Destroy a previously created transfer buffer.
566 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer,
567 int32 /* id */)
569 // Create and initialize a hardware video decoder using the specified route_id.
570 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
571 // no longer needed.
572 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder,
573 media::VideoCodecProfile /* profile */,
574 int32, /* route_id */
575 bool /* succeeded */)
577 // Create and initialize a hardware video encoder using the specified route_id.
578 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
579 // no longer needed.
580 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder,
581 media::VideoPixelFormat /* input_format */,
582 gfx::Size /* input_visible_size */,
583 media::VideoCodecProfile /* output_profile */,
584 uint32 /* initial_bitrate */,
585 int32, /* route_id */
586 bool /* succeeded */)
588 // Tells the proxy that there was an error and the command buffer had to be
589 // destroyed for some reason.
590 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed,
591 gpu::error::ContextLostReason, /* reason */
592 gpu::error::Error /* error */)
594 // Tells the browser that SwapBuffers returned and passes latency info
595 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted,
596 std::vector<ui::LatencyInfo> /* latency_info */,
597 gfx::SwapResult /* result */)
599 // Tells the browser about updated parameters for vsync alignment.
600 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters,
601 base::TimeTicks /* timebase */,
602 base::TimeDelta /* interval */)
604 // Send to stub on surface visibility change.
605 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */)
607 // Sent to proxy when the gpu memory manager changes its memory allocation.
608 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation,
609 gpu::MemoryAllocation /* allocation */)
611 // Sent to stub when proxy is assigned a memory allocation changed callback.
612 IPC_MESSAGE_ROUTED1(
613 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
614 bool /* has_callback */)
616 // Inserts a sync point into the channel. This is handled on the IO thread, so
617 // can be expected to be reasonably fast, but the sync point is actually
618 // retired in order with respect to the other calls. The sync point is shared
619 // across channels.
620 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint,
621 bool /* retire */,
622 uint32 /* sync_point */)
624 // Retires the sync point.
625 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint,
626 uint32 /* sync_point */)
628 // Makes this command buffer signal when a sync point is reached, by sending
629 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
630 // signal_id.
631 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint,
632 uint32 /* sync_point */,
633 uint32 /* signal_id */)
635 // Response to GpuCommandBufferMsg_SignalSyncPoint.
636 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck,
637 uint32 /* signal_id */)
639 // Makes this command buffer signal when a query is reached, by sending
640 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
641 // signal_id.
642 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery,
643 uint32 /* query */,
644 uint32 /* signal_id */)
646 // Create an image from an existing gpu memory buffer. The id that can be
647 // used to identify the image from a command buffer.
648 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage,
649 int32 /* id */,
650 gfx::GpuMemoryBufferHandle /* gpu_memory_buffer */,
651 gfx::Size /* size */,
652 gfx::BufferFormat /* format */,
653 uint32 /* internalformat */)
655 // Destroy a previously created image.
656 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage,
657 int32 /* id */)
659 // Attaches an external image stream to the client texture.
660 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture,
661 uint32, /* client_texture_id */
662 int32, /* stream_id */
663 bool /* succeeded */)
665 //------------------------------------------------------------------------------
666 // Accelerated Video Decoder Messages
667 // These messages are sent from Renderer process to GPU process.
669 // Send input buffer for decoding.
670 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_Decode,
671 base::SharedMemoryHandle, /* input_buffer_handle */
672 int32, /* bitstream_buffer_id */
673 uint32, /* size */
674 base::TimeDelta) /* presentation_timestamp */
676 // Sent from Renderer process to the GPU process to give the texture IDs for
677 // the textures the decoder will use for output.
678 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers,
679 std::vector<int32>, /* Picture buffer ID */
680 std::vector<uint32>) /* Texture ID */
682 // Send from Renderer process to the GPU process to recycle the given picture
683 // buffer for further decoding.
684 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
685 int32) /* Picture buffer ID */
687 // Send flush request to the decoder.
688 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush)
690 // Send reset request to the decoder.
691 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset)
693 // Send destroy request to the decoder.
694 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy)
696 //------------------------------------------------------------------------------
697 // Accelerated Video Decoder Host Messages
698 // These messages are sent from GPU process to Renderer process.
699 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
700 // created.
702 // Accelerated video decoder has consumed input buffer from transfer buffer.
703 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
704 int32) /* Processed buffer ID */
706 // Allocate video frames for output of the hardware video decoder.
707 IPC_MESSAGE_ROUTED3(
708 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
709 int32, /* Number of video frames to generate */
710 gfx::Size, /* Requested size of buffer */
711 uint32 ) /* Texture target */
713 // Decoder reports that a picture is ready and buffer does not need to be passed
714 // back to the decoder.
715 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
716 int32) /* Picture buffer ID */
718 // Decoder reports that a picture is ready.
719 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady,
720 int32, /* Picture buffer ID */
721 int32, /* Bitstream buffer ID */
722 gfx::Rect, /* Visible rectangle */
723 bool) /* Buffer is HW overlay capable */
725 // Confirm decoder has been flushed.
726 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone)
728 // Confirm decoder has been reset.
729 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone)
731 // Video decoder has encountered an error.
732 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
733 uint32) /* Error ID */
735 //------------------------------------------------------------------------------
736 // Accelerated Video Encoder Messages
737 // These messages are sent from the Renderer process to GPU process.
739 // Queue a video frame to the encoder to encode. |frame_id| will be returned
740 // by AcceleratedVideoEncoderHostMsg_NotifyInputDone.
741 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode,
742 AcceleratedVideoEncoderMsg_Encode_Params)
744 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
745 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
746 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer,
747 int32 /* buffer_id */,
748 base::SharedMemoryHandle /* buffer_handle */,
749 uint32 /* buffer_size */)
751 // Request a runtime encoding parameter change.
752 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange,
753 uint32 /* bitrate */,
754 uint32 /* framerate */)
756 //------------------------------------------------------------------------------
757 // Accelerated Video Encoder Host Messages
758 // These messages are sent from GPU process to Renderer process.
760 // Notify renderer of the input/output buffer requirements of the encoder.
761 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers,
762 uint32 /* input_count */,
763 gfx::Size /* input_coded_size */,
764 uint32 /* output_buffer_size */)
766 // Notify the renderer that the encoder has finished using an input buffer.
767 // There is no congruent entry point in the media::VideoEncodeAccelerator
768 // interface, in VEA this same done condition is indicated by dropping the
769 // reference to the media::VideoFrame passed to VEA::Encode().
770 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone,
771 int32 /* frame_id */)
773 // Notify the renderer that an output buffer has been filled with encoded data.
774 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady,
775 int32 /* bitstream_buffer_id */,
776 uint32 /* payload_size */,
777 bool /* key_frame */)
779 // Report error condition.
780 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
781 media::VideoEncodeAccelerator::Error /* error */)
783 // Send destroy request to the encoder.
784 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)
786 //------------------------------------------------------------------------------
787 // Accelerated JPEG Decoder Messages
788 // These messages are sent from the Browser process to GPU process.
790 // Decode one JPEG image from shared memory |input_buffer_handle| with size
791 // |input_buffer_size|. The input buffer is associated with |input_buffer_id|
792 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will
793 // be put onto shared memory associated with |output_video_frame_handle|
794 // with size limit |output_buffer_size|.
795 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode,
796 AcceleratedJpegDecoderMsg_Decode_Params)
798 // Send destroy request to the decoder.
799 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy)
801 //------------------------------------------------------------------------------
802 // Accelerated JPEG Decoder Host Messages
803 // These messages are sent from the GPU process to Browser process.
805 // Report decode status.
806 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_DecodeAck,
807 int32, /* bitstream_buffer_id */
808 media::JpegDecodeAccelerator::Error /* error */)