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.
11 #include "base/memory/shared_memory.h"
12 #include "content/common/content_export.h"
13 #include "content/common/gpu/gpu_memory_uma_stats.h"
14 #include "content/common/gpu/gpu_process_launch_causes.h"
15 #include "content/common/gpu/gpu_result_codes.h"
16 #include "content/public/common/common_param_traits.h"
17 #include "content/public/common/gpu_memory_stats.h"
18 #include "gpu/command_buffer/common/capabilities.h"
19 #include "gpu/command_buffer/common/command_buffer.h"
20 #include "gpu/command_buffer/common/constants.h"
21 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
22 #include "gpu/command_buffer/common/mailbox.h"
23 #include "gpu/config/gpu_info.h"
24 #include "gpu/ipc/gpu_command_buffer_traits.h"
25 #include "ipc/ipc_channel_handle.h"
26 #include "ipc/ipc_message_macros.h"
27 #include "media/base/video_frame.h"
28 #include "media/video/video_decode_accelerator.h"
29 #include "media/video/video_encode_accelerator.h"
30 #include "ui/events/latency_info.h"
31 #include "ui/gfx/gpu_memory_buffer.h"
32 #include "ui/gfx/native_widget_types.h"
33 #include "ui/gfx/size.h"
34 #include "ui/gl/gpu_preference.h"
36 #if defined(OS_ANDROID)
37 #include "content/common/android/surface_texture_peer.h"
40 #undef IPC_MESSAGE_EXPORT
41 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
43 #define IPC_MESSAGE_START GpuMsgStart
45 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
46 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
47 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult,
48 content::CREATE_COMMAND_BUFFER_RESULT_LAST)
49 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
50 gfx::GpuPreferenceLast)
51 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
52 gfx::SURFACE_TYPE_LAST)
53 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
54 gpu::MemoryAllocation::CUTOFF_LAST)
55 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
56 gpu::error::kContextLostReasonLast)
57 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
58 media::VideoEncodeAccelerator::kErrorMax)
59 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format,
60 media::VideoFrame::FORMAT_MAX)
61 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
62 media::VIDEO_CODEC_PROFILE_MIN,
63 media::VIDEO_CODEC_PROFILE_MAX)
64 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
65 gpu::kCollectInfoNone,
66 gpu::kCollectInfoFatalFailure)
67 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
68 gpu::VIDEO_CODEC_PROFILE_MIN,
69 gpu::VIDEO_CODEC_PROFILE_MAX)
71 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
72 IPC_STRUCT_MEMBER(int32, share_group_id)
73 IPC_STRUCT_MEMBER(std::vector<int>, attribs)
74 IPC_STRUCT_MEMBER(GURL, active_url)
75 IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference)
78 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params)
79 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferType, type)
80 IPC_STRUCT_MEMBER(int32, id)
81 IPC_STRUCT_MEMBER(gfx::Size, size)
82 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Format, format)
83 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Usage, usage)
84 IPC_STRUCT_MEMBER(int32, client_id)
87 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
88 IPC_STRUCT_MEMBER(int32, surface_id)
89 IPC_STRUCT_MEMBER(uint64, surface_handle)
90 IPC_STRUCT_MEMBER(int32, route_id)
91 IPC_STRUCT_MEMBER(gfx::Size, size)
92 IPC_STRUCT_MEMBER(float, scale_factor)
93 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
96 #if defined(OS_MACOSX)
97 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
98 // If the browser needs framerate throttling based on GPU back-pressure to be
99 // disabled (e.g, because the NSView isn't visible but tab capture is active),
100 // then this is set to true.
101 IPC_STRUCT_MEMBER(bool, disable_throttling)
102 // If the browser is drawing to the screen, this is the CGL renderer ID of
103 // the GL context that the brower is using.
104 IPC_STRUCT_MEMBER(int32, renderer_id)
108 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
109 IPC_STRUCT_MEMBER(int32, id)
110 IPC_STRUCT_MEMBER(std::string, message)
113 #if defined(OS_ANDROID)
114 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params)
115 IPC_STRUCT_MEMBER(float, m00)
116 IPC_STRUCT_MEMBER(float, m01)
117 IPC_STRUCT_MEMBER(float, m02)
118 IPC_STRUCT_MEMBER(float, m03)
119 IPC_STRUCT_MEMBER(float, m10)
120 IPC_STRUCT_MEMBER(float, m11)
121 IPC_STRUCT_MEMBER(float, m12)
122 IPC_STRUCT_MEMBER(float, m13)
123 IPC_STRUCT_MEMBER(float, m20)
124 IPC_STRUCT_MEMBER(float, m21)
125 IPC_STRUCT_MEMBER(float, m22)
126 IPC_STRUCT_MEMBER(float, m23)
127 IPC_STRUCT_MEMBER(float, m30)
128 IPC_STRUCT_MEMBER(float, m31)
129 IPC_STRUCT_MEMBER(float, m32)
130 IPC_STRUCT_MEMBER(float, m33)
134 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
135 IPC_STRUCT_TRAITS_MEMBER(values)
136 IPC_STRUCT_TRAITS_MEMBER(children)
137 IPC_STRUCT_TRAITS_END()
139 IPC_STRUCT_TRAITS_BEGIN(gpu::GpuPerformanceStats)
140 IPC_STRUCT_TRAITS_MEMBER(graphics)
141 IPC_STRUCT_TRAITS_MEMBER(gaming)
142 IPC_STRUCT_TRAITS_MEMBER(overall)
143 IPC_STRUCT_TRAITS_END()
145 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
146 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
147 IPC_STRUCT_TRAITS_MEMBER(device_id)
148 IPC_STRUCT_TRAITS_MEMBER(active)
149 IPC_STRUCT_TRAITS_MEMBER(vendor_string)
150 IPC_STRUCT_TRAITS_MEMBER(device_string)
151 IPC_STRUCT_TRAITS_END()
153 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
154 IPC_STRUCT_TRAITS_MEMBER(profile)
155 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
156 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
157 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator)
158 IPC_STRUCT_TRAITS_END()
160 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
161 IPC_STRUCT_TRAITS_MEMBER(initialization_time)
162 IPC_STRUCT_TRAITS_MEMBER(optimus)
163 IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
164 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
165 IPC_STRUCT_TRAITS_MEMBER(gpu)
166 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
167 IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
168 IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
169 IPC_STRUCT_TRAITS_MEMBER(driver_version)
170 IPC_STRUCT_TRAITS_MEMBER(driver_date)
171 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
172 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
173 IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
174 IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
175 IPC_STRUCT_TRAITS_MEMBER(gl_version)
176 IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
177 IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
178 IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
179 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
180 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
181 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
182 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
183 IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
184 IPC_STRUCT_TRAITS_MEMBER(performance_stats)
185 IPC_STRUCT_TRAITS_MEMBER(software_rendering)
186 IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
187 IPC_STRUCT_TRAITS_MEMBER(sandboxed)
188 IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
189 IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
190 IPC_STRUCT_TRAITS_MEMBER(context_info_state)
192 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
193 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
195 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles)
196 IPC_STRUCT_TRAITS_END()
198 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats)
199 IPC_STRUCT_TRAITS_MEMBER(video_memory)
200 IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
201 IPC_STRUCT_TRAITS_END()
203 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats)
204 IPC_STRUCT_TRAITS_MEMBER(process_map)
205 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
206 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
207 IPC_STRUCT_TRAITS_END()
209 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
210 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
211 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
212 IPC_STRUCT_TRAITS_MEMBER(bytes_limit)
213 IPC_STRUCT_TRAITS_END()
215 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
216 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
217 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
218 IPC_STRUCT_TRAITS_END()
220 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle)
221 IPC_STRUCT_TRAITS_MEMBER(handle)
222 IPC_STRUCT_TRAITS_MEMBER(transport_type)
223 IPC_STRUCT_TRAITS_MEMBER(parent_client_id)
224 IPC_STRUCT_TRAITS_END()
226 //------------------------------------------------------------------------------
228 // These are messages from the browser to the GPU process.
230 // Tells the GPU process to initialize itself. The browser explicitly
231 // requests this be done so that we are guaranteed that the channel is set
232 // up between the browser and GPU process before doing any work that might
233 // potentially crash the GPU process. Detection of the child process
234 // exiting abruptly is predicated on having the IPC channel set up.
235 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
237 // Tells the GPU process to create a new channel for communication with a
238 // given client. The channel name is returned in a
239 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
240 // the GPU process reuses an existing channel to that process if it exists.
241 // This ID is a unique opaque identifier generated by the browser process.
242 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel,
244 bool /* share_context */,
245 bool /* allow_future_sync_points */)
247 // Tells the GPU process to close the channel identified by IPC channel
248 // handle. If no channel can be identified, do nothing.
249 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
250 IPC::ChannelHandle /* channel_handle */)
252 // Tells the GPU process to create a new command buffer that renders directly
253 // to a native view. A corresponding GpuCommandBufferStub is created.
254 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer,
255 gfx::GLSurfaceHandle, /* compositing_surface */
256 int32, /* surface_id */
257 int32, /* client_id */
258 GPUCreateCommandBufferConfig, /* init_params */
259 int32 /* route_id */)
261 // Tells the GPU process to create a new gpu memory buffer.
262 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
263 GpuMsg_CreateGpuMemoryBuffer_Params)
265 // Tells the GPU process to destroy buffer.
266 IPC_MESSAGE_CONTROL4(GpuMsg_DestroyGpuMemoryBuffer,
267 gfx::GpuMemoryBufferType, /* type */
268 gfx::GpuMemoryBufferId, /* id */
269 int32, /* client_id */
270 int32 /* sync_point */)
272 // Tells the GPU process to create a context for collecting graphics card
274 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
276 // Tells the GPU process to report video_memory information for the task manager
277 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
279 #if defined(OS_MACOSX)
280 // Tells the GPU process that the browser process has handled the swap
281 // buffers or post sub-buffer request.
282 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented,
283 AcceleratedSurfaceMsg_BufferPresented_Params)
286 // Tells the GPU process to wake up the GPU because we're about to draw.
287 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu)
289 // Tells the GPU process to remove all contexts.
290 IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
292 // Tells the GPU process to crash.
293 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
295 // Tells the GPU process to hang.
296 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
298 // Tells the GPU process to disable the watchdog thread.
299 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
301 // Tells the GPU process that the browser has seen a GPU switch.
302 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched)
304 //------------------------------------------------------------------------------
306 // These are messages to the browser.
308 // A renderer sends this when it wants to create a connection to the GPU
309 // process. The browser will create the GPU process if necessary, and will
310 // return a handle to the channel via a GpuChannelEstablished message.
311 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
312 content::CauseForGpuLaunch,
314 IPC::ChannelHandle /* handle to channel */,
315 gpu::GPUInfo /* stats about GPU process*/)
317 // A renderer sends this to the browser process when it wants to
318 // create a GL context associated with the given view_id.
319 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer,
320 int32, /* surface_id */
321 GPUCreateCommandBufferConfig, /* init_params */
322 int32, /* route_id */
323 content::CreateCommandBufferResult /* result */)
325 // Response from GPU to a GputMsg_Initialize message.
326 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
328 ::gpu::GPUInfo /* gpu_info */)
330 // Response from GPU to a GpuHostMsg_EstablishChannel message.
331 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
332 IPC::ChannelHandle /* channel_handle */)
334 // Message from GPU to notify to destroy the channel.
335 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel,
336 int32 /* client_id */)
338 // Message to cache the given shader information.
339 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
340 int32 /* client_id */,
341 std::string /* key */,
342 std::string /* shader */)
344 // Message to the GPU that a shader was loaded from disk.
345 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader,
346 std::string /* encoded shader */)
348 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
349 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
350 content::CreateCommandBufferResult /* result */)
352 // Request from GPU to free the browser resources associated with the
354 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer,
355 int32 /* surface_id */)
357 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
358 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
359 gfx::GpuMemoryBufferHandle /* handle */)
361 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
362 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
363 gpu::GPUInfo /* GPU logging stats */)
365 // Response from GPU to a GpuMsg_GetVideoMemory.
366 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
367 content::GPUVideoMemoryUsageStats /* GPU memory stats */)
369 // Message from GPU to add a GPU log message to the about:gpu page.
370 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
372 std::string /* header */,
373 std::string /* message */)
375 // Tells the browser that a new accelerated surface was initialized.
376 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized,
377 int32 /* surface_id */,
378 int32 /* route_id */)
380 // Same as above with a rect of the part of the surface that changed.
381 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
382 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
384 // Tells the browser about updated parameters for vsync alignment.
385 IPC_MESSAGE_CONTROL3(GpuHostMsg_UpdateVSyncParameters,
386 int32 /* surface_id */,
387 base::TimeTicks /* timebase */,
388 base::TimeDelta /* interval */)
390 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext,
393 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
394 bool /* offscreen */,
395 gpu::error::ContextLostReason /* reason */,
398 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext,
401 // Tells the browser about GPU memory usage statistics for UMA logging.
402 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
403 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
405 //------------------------------------------------------------------------------
406 // GPU Channel Messages
407 // These are messages from a renderer process to the GPU process.
409 // Tells the GPU process to create a new command buffer that renders to an
410 // offscreen frame buffer.
411 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
412 gfx::Size, /* size */
413 GPUCreateCommandBufferConfig, /* init_params */
414 int32, /* route_id */
415 bool /* succeeded */)
417 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
418 // destructor, so that the stub deletes the actual CommandBufferService
419 // object that it's hosting.
420 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
421 int32 /* instance_id */)
423 // Sent by DevTools agent in the inspected renderer process to initiate GPU
424 // instrumentation events recording.
425 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_DevToolsStartEventsRecording,
426 int32, /* route_id */
427 bool /* succeeded */)
429 // The message is sent when DevTools want to stop events recording.
430 IPC_MESSAGE_CONTROL0(GpuChannelMsg_DevToolsStopEventsRecording)
432 #if defined(OS_ANDROID)
433 //------------------------------------------------------------------------------
434 // Stream Texture Messages
435 // Tells the GPU process create and send the java surface texture object to
436 // the renderer process through the binder thread.
437 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer,
438 int32, /* primary_id */
439 int32 /* secondary_id */)
441 // Tells the GPU process to set the size of StreamTexture from the given
443 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize,
444 gfx::Size /* size */)
446 // Tells the service-side instance to start sending frame available
448 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening)
450 // Inform the renderer that a new frame is available.
451 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable)
453 // Inform the renderer process that the transform matrix has changed.
454 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged,
455 GpuStreamTextureMsg_MatrixChanged_Params /* params */)
458 //------------------------------------------------------------------------------
459 // GPU Command Buffer Messages
460 // These are messages between a renderer process to the GPU process relating to
461 // a single OpenGL context.
462 // Initialize a command buffer with the given number of command entries.
463 // Returns the shared memory handle for the command buffer mapped to the
465 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize,
466 base::SharedMemoryHandle /* shared_state */,
468 gpu::Capabilities /* capabilities */)
470 // Sets the shared memory buffer used for commands.
471 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer,
474 // Produces the front buffer into a mailbox. This allows another context to draw
475 // the output of this context.
476 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer,
477 gpu::Mailbox /* mailbox */)
479 // Wait until the token is in a specific range, inclusive.
480 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange,
483 gpu::CommandBuffer::State /* state */)
485 // Wait until the get offset is in a specific range, inclusive.
486 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange,
489 gpu::CommandBuffer::State /* state */)
491 // Asynchronously synchronize the put and get offsets of both processes.
492 // Caller passes its current put offset. Current state (including get offset)
493 // is returned in shared memory. The input latency info for the current
494 // frame is also sent to the GPU process.
495 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush,
496 int32 /* put_offset */,
497 uint32 /* flush_count */,
498 std::vector<ui::LatencyInfo> /* latency_info */)
500 // Asynchronously process any commands known to the GPU process. This is only
501 // used in the event that a channel is unscheduled and needs to be flushed
502 // again to process any commands issued subsequent to unscheduling. The GPU
503 // process actually sends it (deferred) to itself.
504 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled)
506 // Sent by the GPU process to display messages in the console.
507 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg,
508 GPUCommandBufferConsoleMessage /* msg */)
510 // Register an existing shared memory transfer buffer. The id that can be
511 // used to identify the transfer buffer from a command buffer.
512 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer,
514 base::SharedMemoryHandle /* transfer_buffer */,
517 // Destroy a previously created transfer buffer.
518 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer,
521 // Create and initialize a hardware video decoder using the specified route_id.
522 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
524 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder,
525 media::VideoCodecProfile /* profile */,
526 int32, /* route_id */
527 bool /* succeeded */)
529 // Create and initialize a hardware video encoder using the specified route_id.
530 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
532 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder,
533 media::VideoFrame::Format /* input_format */,
534 gfx::Size /* input_visible_size */,
535 media::VideoCodecProfile /* output_profile */,
536 uint32 /* initial_bitrate */,
537 int32, /* route_id */
538 bool /* succeeded */)
540 // Tells the proxy that there was an error and the command buffer had to be
541 // destroyed for some reason.
542 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed,
543 gpu::error::ContextLostReason /* reason */)
545 // Tells the browser that SwapBuffers returned and passes latency info
546 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted,
547 std::vector<ui::LatencyInfo> /* latency_info */)
549 // Send to stub on surface visibility change.
550 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */)
552 // Sent to proxy when the gpu memory manager changes its memory allocation.
553 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation,
554 gpu::MemoryAllocation /* allocation */)
556 // Sent to stub when proxy is assigned a memory allocation changed callback.
558 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
559 bool /* has_callback */)
561 // Inserts a sync point into the channel. This is handled on the IO thread, so
562 // can be expected to be reasonably fast, but the sync point is actually
563 // retired in order with respect to the other calls. The sync point is shared
565 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint,
567 uint32 /* sync_point */)
569 // Retires the sync point. Note: this message is not sent explicitly by the
570 // renderer, but is synthesized by the GPU process.
571 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint,
572 uint32 /* sync_point */)
574 // Makes this command buffer signal when a sync point is reached, by sending
575 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
577 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint,
578 uint32 /* sync_point */,
579 uint32 /* signal_id */)
581 // Response to GpuCommandBufferMsg_SignalSyncPoint.
582 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck,
583 uint32 /* signal_id */)
585 // Makes this command buffer signal when a query is reached, by sending
586 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
588 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery,
590 uint32 /* signal_id */)
592 // Create an image from an existing gpu memory buffer. The id that can be
593 // used to identify the image from a command buffer.
594 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage,
596 gfx::GpuMemoryBufferHandle /* gpu_memory_buffer */,
597 gfx::Size /* size */,
598 gfx::GpuMemoryBuffer::Format /* format */,
599 uint32 /* internalformat */)
601 // Destroy a previously created image.
602 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage,
605 // Attaches an external image stream to the client texture.
606 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture,
607 uint32, /* client_texture_id */
608 int32, /* stream_id */
609 bool /* succeeded */)
611 //------------------------------------------------------------------------------
612 // Accelerated Video Decoder Messages
613 // These messages are sent from Renderer process to GPU process.
615 // Send input buffer for decoding.
616 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode,
617 base::SharedMemoryHandle, /* input_buffer_handle */
618 int32, /* bitstream_buffer_id */
621 // Sent from Renderer process to the GPU process to give the texture IDs for
622 // the textures the decoder will use for output.
623 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers,
624 std::vector<int32>, /* Picture buffer ID */
625 std::vector<uint32>) /* Texture ID */
627 // Send from Renderer process to the GPU process to recycle the given picture
628 // buffer for further decoding.
629 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
630 int32) /* Picture buffer ID */
632 // Send flush request to the decoder.
633 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush)
635 // Send reset request to the decoder.
636 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset)
638 // Send destroy request to the decoder.
639 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy)
641 //------------------------------------------------------------------------------
642 // Accelerated Video Decoder Host Messages
643 // These messages are sent from GPU process to Renderer process.
644 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
647 // Accelerated video decoder has consumed input buffer from transfer buffer.
648 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
649 int32) /* Processed buffer ID */
651 // Allocate video frames for output of the hardware video decoder.
653 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
654 int32, /* Number of video frames to generate */
655 gfx::Size, /* Requested size of buffer */
656 uint32 ) /* Texture target */
658 // Decoder reports that a picture is ready and buffer does not need to be passed
659 // back to the decoder.
660 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
661 int32) /* Picture buffer ID */
663 // Decoder reports that a picture is ready.
664 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_PictureReady,
665 int32, /* Picture buffer ID */
666 int32, /* Bitstream buffer ID */
667 gfx::Rect) /* Visible rectangle */
669 // Confirm decoder has been flushed.
670 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone)
672 // Confirm decoder has been reset.
673 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone)
675 // Video decoder has encountered an error.
676 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
677 uint32) /* Error ID */
679 //------------------------------------------------------------------------------
680 // Accelerated Video Encoder Messages
681 // These messages are sent from the Renderer process to GPU process.
683 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
684 // AcceleratedVideoEncoderHostMsg_NotifyEncodeDone.
685 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Encode,
686 int32 /* frame_id */,
687 base::SharedMemoryHandle /* buffer_handle */,
688 uint32 /* buffer_size */,
689 bool /* force_keyframe */)
691 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
692 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
693 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer,
694 int32 /* buffer_id */,
695 base::SharedMemoryHandle /* buffer_handle */,
696 uint32 /* buffer_size */)
698 // Request a runtime encoding parameter change.
699 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange,
700 uint32 /* bitrate */,
701 uint32 /* framerate */)
703 //------------------------------------------------------------------------------
704 // Accelerated Video Encoder Host Messages
705 // These messages are sent from GPU process to Renderer process.
707 // Notify renderer of the input/output buffer requirements of the encoder.
708 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers,
709 uint32 /* input_count */,
710 gfx::Size /* input_coded_size */,
711 uint32 /* output_buffer_size */)
713 // Notify the renderer that the encoder has finished using an input buffer.
714 // There is no congruent entry point in the media::VideoEncodeAccelerator
715 // interface, in VEA this same done condition is indicated by dropping the
716 // reference to the media::VideoFrame passed to VEA::Encode().
717 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone,
718 int32 /* frame_id */)
720 // Notify the renderer that an output buffer has been filled with encoded data.
721 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady,
722 int32 /* bitstream_buffer_id */,
723 uint32 /* payload_size */,
724 bool /* key_frame */)
726 // Report error condition.
727 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
728 media::VideoEncodeAccelerator::Error /* error */)
730 // Send destroy request to the encoder.
731 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)