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