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_allocation.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_rendering_stats.h"
17 #include "content/common/gpu/surface_capturer.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/command_buffer.h"
21 #include "gpu/command_buffer/common/constants.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/native_widget_types.h"
32 #include "ui/gfx/size.h"
33 #include "ui/gl/gpu_preference.h"
35 #if defined(OS_ANDROID)
36 #include "content/common/android/surface_texture_peer.h"
39 #define IPC_MESSAGE_START GpuMsgStart
41 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig
)
42 IPC_STRUCT_MEMBER(int32
, share_group_id
)
43 IPC_STRUCT_MEMBER(std::vector
<int>, attribs
)
44 IPC_STRUCT_MEMBER(GURL
, active_url
)
45 IPC_STRUCT_MEMBER(gfx::GpuPreference
, gpu_preference
)
48 #undef IPC_MESSAGE_EXPORT
49 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
50 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
51 IPC_STRUCT_MEMBER(int32
, surface_id
)
52 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
53 IPC_STRUCT_MEMBER(int32
, route_id
)
54 IPC_STRUCT_MEMBER(std::string
, mailbox_name
)
55 IPC_STRUCT_MEMBER(gfx::Size
, size
)
56 IPC_STRUCT_MEMBER(float, scale_factor
)
57 IPC_STRUCT_MEMBER(ui::LatencyInfo
, latency_info
)
60 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
)
61 IPC_STRUCT_MEMBER(int32
, surface_id
)
62 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
63 IPC_STRUCT_MEMBER(int32
, route_id
)
64 IPC_STRUCT_MEMBER(int, x
)
65 IPC_STRUCT_MEMBER(int, y
)
66 IPC_STRUCT_MEMBER(int, width
)
67 IPC_STRUCT_MEMBER(int, height
)
68 IPC_STRUCT_MEMBER(std::string
, mailbox_name
)
69 IPC_STRUCT_MEMBER(gfx::Size
, surface_size
)
70 IPC_STRUCT_MEMBER(float, surface_scale_factor
)
71 IPC_STRUCT_MEMBER(ui::LatencyInfo
, latency_info
)
73 #undef IPC_MESSAGE_EXPORT
74 #define IPC_MESSAGE_EXPORT
76 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params
)
77 IPC_STRUCT_MEMBER(int32
, surface_id
)
78 IPC_STRUCT_MEMBER(int32
, route_id
)
81 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params
)
82 IPC_STRUCT_MEMBER(std::string
, mailbox_name
)
83 IPC_STRUCT_MEMBER(uint32
, sync_point
)
84 #if defined(OS_MACOSX)
85 IPC_STRUCT_MEMBER(int32
, renderer_id
)
88 IPC_STRUCT_MEMBER(base::TimeTicks
, vsync_timebase
)
89 IPC_STRUCT_MEMBER(base::TimeDelta
, vsync_interval
)
93 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage
)
94 IPC_STRUCT_MEMBER(int32
, id
)
95 IPC_STRUCT_MEMBER(std::string
, message
)
98 #if defined(OS_ANDROID)
99 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params
)
100 IPC_STRUCT_MEMBER(float, m00
)
101 IPC_STRUCT_MEMBER(float, m01
)
102 IPC_STRUCT_MEMBER(float, m02
)
103 IPC_STRUCT_MEMBER(float, m03
)
104 IPC_STRUCT_MEMBER(float, m10
)
105 IPC_STRUCT_MEMBER(float, m11
)
106 IPC_STRUCT_MEMBER(float, m12
)
107 IPC_STRUCT_MEMBER(float, m13
)
108 IPC_STRUCT_MEMBER(float, m20
)
109 IPC_STRUCT_MEMBER(float, m21
)
110 IPC_STRUCT_MEMBER(float, m22
)
111 IPC_STRUCT_MEMBER(float, m23
)
112 IPC_STRUCT_MEMBER(float, m30
)
113 IPC_STRUCT_MEMBER(float, m31
)
114 IPC_STRUCT_MEMBER(float, m32
)
115 IPC_STRUCT_MEMBER(float, m33
)
119 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode
)
120 IPC_STRUCT_TRAITS_MEMBER(values
)
121 IPC_STRUCT_TRAITS_MEMBER(children
)
122 IPC_STRUCT_TRAITS_END()
124 IPC_STRUCT_TRAITS_BEGIN(gpu::GpuPerformanceStats
)
125 IPC_STRUCT_TRAITS_MEMBER(graphics
)
126 IPC_STRUCT_TRAITS_MEMBER(gaming
)
127 IPC_STRUCT_TRAITS_MEMBER(overall
)
128 IPC_STRUCT_TRAITS_END()
130 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice
)
131 IPC_STRUCT_TRAITS_MEMBER(vendor_id
)
132 IPC_STRUCT_TRAITS_MEMBER(device_id
)
133 IPC_STRUCT_TRAITS_MEMBER(vendor_string
)
134 IPC_STRUCT_TRAITS_MEMBER(device_string
)
135 IPC_STRUCT_TRAITS_END()
137 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo
)
138 IPC_STRUCT_TRAITS_MEMBER(finalized
)
139 IPC_STRUCT_TRAITS_MEMBER(initialization_time
)
140 IPC_STRUCT_TRAITS_MEMBER(optimus
)
141 IPC_STRUCT_TRAITS_MEMBER(amd_switchable
)
142 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute
)
143 IPC_STRUCT_TRAITS_MEMBER(gpu
)
144 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus
)
145 IPC_STRUCT_TRAITS_MEMBER(adapter_luid
)
146 IPC_STRUCT_TRAITS_MEMBER(driver_vendor
)
147 IPC_STRUCT_TRAITS_MEMBER(driver_version
)
148 IPC_STRUCT_TRAITS_MEMBER(driver_date
)
149 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version
)
150 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version
)
151 IPC_STRUCT_TRAITS_MEMBER(machine_model
)
152 IPC_STRUCT_TRAITS_MEMBER(gl_version
)
153 IPC_STRUCT_TRAITS_MEMBER(gl_version_string
)
154 IPC_STRUCT_TRAITS_MEMBER(gl_vendor
)
155 IPC_STRUCT_TRAITS_MEMBER(gl_renderer
)
156 IPC_STRUCT_TRAITS_MEMBER(gl_extensions
)
157 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor
)
158 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version
)
159 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions
)
160 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy
)
161 IPC_STRUCT_TRAITS_MEMBER(can_lose_context
)
162 IPC_STRUCT_TRAITS_MEMBER(performance_stats
)
163 IPC_STRUCT_TRAITS_MEMBER(software_rendering
)
164 IPC_STRUCT_TRAITS_MEMBER(sandboxed
)
166 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics
)
168 IPC_STRUCT_TRAITS_END()
170 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats
)
171 IPC_STRUCT_TRAITS_MEMBER(video_memory
)
172 IPC_STRUCT_TRAITS_MEMBER(has_duplicates
)
173 IPC_STRUCT_TRAITS_END()
175 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats
)
176 IPC_STRUCT_TRAITS_MEMBER(process_map
)
177 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
178 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max
)
179 IPC_STRUCT_TRAITS_END()
181 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats
)
182 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current
)
183 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max
)
184 IPC_STRUCT_TRAITS_MEMBER(bytes_limit
)
185 IPC_STRUCT_TRAITS_END()
187 IPC_STRUCT_TRAITS_BEGIN(content::GpuMemoryAllocationForRenderer
)
188 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible
)
189 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible
)
190 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_not_visible
)
191 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_not_visible
)
192 IPC_STRUCT_TRAITS_MEMBER(have_backbuffer_when_not_visible
)
193 IPC_STRUCT_TRAITS_END()
194 IPC_ENUM_TRAITS(content::GpuMemoryAllocationForRenderer::PriorityCutoff
)
196 IPC_STRUCT_TRAITS_BEGIN(content::GpuManagedMemoryStats
)
197 IPC_STRUCT_TRAITS_MEMBER(bytes_required
)
198 IPC_STRUCT_TRAITS_MEMBER(bytes_nice_to_have
)
199 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
200 IPC_STRUCT_TRAITS_MEMBER(backbuffer_requested
)
201 IPC_STRUCT_TRAITS_END()
203 IPC_ENUM_TRAITS(gfx::SurfaceType
)
204 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle
)
205 IPC_STRUCT_TRAITS_MEMBER(handle
)
206 IPC_STRUCT_TRAITS_MEMBER(transport_type
)
207 IPC_STRUCT_TRAITS_MEMBER(parent_gpu_process_id
)
208 IPC_STRUCT_TRAITS_MEMBER(parent_client_id
)
209 IPC_STRUCT_TRAITS_END()
211 IPC_ENUM_TRAITS(content::CauseForGpuLaunch
)
212 IPC_ENUM_TRAITS(gfx::GpuPreference
)
213 IPC_ENUM_TRAITS(gpu::error::ContextLostReason
)
215 IPC_ENUM_TRAITS(media::VideoCodecProfile
)
217 IPC_STRUCT_TRAITS_BEGIN(content::GpuRenderingStats
)
218 IPC_STRUCT_TRAITS_MEMBER(global_texture_upload_count
)
219 IPC_STRUCT_TRAITS_MEMBER(global_total_texture_upload_time
)
220 IPC_STRUCT_TRAITS_MEMBER(texture_upload_count
)
221 IPC_STRUCT_TRAITS_MEMBER(total_texture_upload_time
)
222 IPC_STRUCT_TRAITS_MEMBER(global_total_processing_commands_time
)
223 IPC_STRUCT_TRAITS_MEMBER(total_processing_commands_time
)
224 IPC_STRUCT_TRAITS_END()
226 IPC_ENUM_TRAITS(media::VideoFrame::Format
)
228 IPC_ENUM_TRAITS(media::VideoEncodeAccelerator::Error
)
230 IPC_ENUM_TRAITS(content::SurfaceCapturer::Error
)
232 //------------------------------------------------------------------------------
234 // These are messages from the browser to the GPU process.
236 // Tells the GPU process to initialize itself. The browser explicitly
237 // requests this be done so that we are guaranteed that the channel is set
238 // up between the browser and GPU process before doing any work that might
239 // potentially crash the GPU process. Detection of the child process
240 // exiting abruptly is predicated on having the IPC channel set up.
241 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize
)
243 // Tells the GPU process to create a new channel for communication with a
244 // given client. The channel name is returned in a
245 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
246 // the GPU process reuses an existing channel to that process if it exists.
247 // This ID is a unique opaque identifier generated by the browser process.
248 IPC_MESSAGE_CONTROL2(GpuMsg_EstablishChannel
,
250 bool /* share_context */)
252 // Tells the GPU process to close the channel identified by IPC channel
253 // handle. If no channel can be identified, do nothing.
254 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel
,
255 IPC::ChannelHandle
/* channel_handle */)
257 // Tells the GPU process to create a new command buffer that renders directly
258 // to a native view. A corresponding GpuCommandBufferStub is created.
259 IPC_MESSAGE_CONTROL4(GpuMsg_CreateViewCommandBuffer
,
260 gfx::GLSurfaceHandle
, /* compositing_surface */
261 int32
, /* surface_id */
262 int32
, /* client_id */
263 GPUCreateCommandBufferConfig
/* init_params */)
265 // Tells the GPU process to create a new image from a window. Images
266 // can be bound to textures using CHROMIUM_texture_from_image.
267 IPC_MESSAGE_CONTROL3(GpuMsg_CreateImage
,
268 gfx::PluginWindowHandle
, /* window */
269 int32
, /* client_id */
270 int32
/* image_id */)
272 // Tells the GPU process to delete image.
273 IPC_MESSAGE_CONTROL3(GpuMsg_DeleteImage
,
274 int32
, /* client_id */
275 int32
, /* image_id */
276 int32
/* sync_point */)
278 // Tells the GPU process to create a context for collecting graphics card
280 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo
)
282 // Tells the GPU process to report video_memory information for the task manager
283 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats
)
285 // Tells the GPU process that the browser process has finished resizing the
287 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_ResizeViewACK
)
289 // Tells the GPU process that the browser process has handled the swap
290 // buffers or post sub-buffer request. A non-zero sync point means
291 // that we should wait for the sync point. The surface_handle identifies
292 // that buffer that has finished presented, i.e. the buffer being returned.
293 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented
,
294 AcceleratedSurfaceMsg_BufferPresented_Params
)
296 // Tells the GPU process to remove all contexts.
297 IPC_MESSAGE_CONTROL0(GpuMsg_Clean
)
299 // Tells the GPU process to crash.
300 IPC_MESSAGE_CONTROL0(GpuMsg_Crash
)
302 // Tells the GPU process to hang.
303 IPC_MESSAGE_CONTROL0(GpuMsg_Hang
)
305 // Tells the GPU process to disable the watchdog thread.
306 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog
)
308 //------------------------------------------------------------------------------
310 // These are messages to the browser.
312 // A renderer sends this when it wants to create a connection to the GPU
313 // process. The browser will create the GPU process if necessary, and will
314 // return a handle to the channel via a GpuChannelEstablished message.
315 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel
,
316 content::CauseForGpuLaunch
,
318 IPC::ChannelHandle
/* handle to channel */,
319 gpu::GPUInfo
/* stats about GPU process*/)
321 // A renderer sends this to the browser process when it wants to
322 // create a GL context associated with the given view_id.
323 IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateViewCommandBuffer
,
324 int32
, /* surface_id */
325 GPUCreateCommandBufferConfig
, /* init_params */
326 int32
/* route_id */)
328 // Response from GPU to a GputMsg_Initialize message.
329 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized
,
331 ::gpu::GPUInfo
/* gpu_info */)
333 // Response from GPU to a GpuHostMsg_EstablishChannel message.
334 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished
,
335 IPC::ChannelHandle
/* channel_handle */)
337 // Message from GPU to notify to destroy the channel.
338 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel
,
339 int32
/* client_id */)
341 // Message to cache the given shader information.
342 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader
,
343 int32
/* client_id */,
344 std::string
/* key */,
345 std::string
/* shader */)
347 // Message to the GPU that a shader was loaded from disk.
348 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader
,
349 std::string
/* encoded shader */)
351 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
352 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated
,
353 int32
/* route_id */)
355 // Request from GPU to free the browser resources associated with the
357 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer
,
358 int32
/* surface_id */)
360 // Response from GPU to a GpuMsg_CreateImage message.
361 IPC_MESSAGE_CONTROL1(GpuHostMsg_ImageCreated
,
362 gfx::Size
/* size */)
364 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
365 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected
,
366 gpu::GPUInfo
/* GPU logging stats */)
368 // Response from GPU to a GpuMsg_GetVideoMemory.
369 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats
,
370 content::GPUVideoMemoryUsageStats
/* GPU memory stats */)
372 // Message from GPU to add a GPU log message to the about:gpu page.
373 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage
,
375 std::string
/* header */,
376 std::string
/* message */)
378 // Resize the window that is being drawn into. It's important that this
379 // resize be synchronized with the swapping of the front and back buffers.
380 IPC_MESSAGE_CONTROL3(GpuHostMsg_ResizeView
,
381 int32
/* surface_id */,
382 int32
/* route_id */,
383 gfx::Size
/* size */)
385 // Tells the browser that a frame with the specific latency info was drawn to
387 IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn
,
388 ui::LatencyInfo
/* latency_info */)
390 // Same as above with a rect of the part of the surface that changed.
391 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped
,
392 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
394 // This message notifies the browser process that the renderer
395 // swapped a portion of the buffers associated with the given "window", which
396 // should cause the browser to redraw the compositor's contents.
397 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfacePostSubBuffer
,
398 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
)
400 // Tells the browser to release whatever resources are associated with
401 // the given surface. The browser must send an ACK once this operation
403 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceRelease
,
404 GpuHostMsg_AcceleratedSurfaceRelease_Params
)
406 // Tells the browser to release resources for the given surface until the next
407 // time swap buffers or post sub buffer is sent.
408 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSuspend
,
409 int32
/* surface_id */)
411 // Tells the browser about updated parameters for vsync alignment.
412 IPC_MESSAGE_CONTROL3(GpuHostMsg_UpdateVSyncParameters
,
413 int32
/* surface_id */,
414 base::TimeTicks
/* timebase */,
415 base::TimeDelta
/* interval */)
417 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext
,
420 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext
,
421 bool /* offscreen */,
422 gpu::error::ContextLostReason
/* reason */,
425 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext
,
428 // Tells the browser about GPU memory usage statistics for UMA logging.
429 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats
,
430 content::GPUMemoryUmaStats
/* GPU memory UMA stats */)
432 //------------------------------------------------------------------------------
433 // GPU Channel Messages
434 // These are messages from a renderer process to the GPU process.
436 // Tells the GPU process to create a new command buffer that renders to an
437 // offscreen frame buffer.
438 IPC_SYNC_MESSAGE_CONTROL2_1(GpuChannelMsg_CreateOffscreenCommandBuffer
,
439 gfx::Size
, /* size */
440 GPUCreateCommandBufferConfig
, /* init_params */
441 int32
/* route_id */)
443 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
444 // destructor, so that the stub deletes the actual CommandBufferService
445 // object that it's hosting.
446 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer
,
447 int32
/* instance_id */)
449 // Generates n new unique mailbox names synchronously.
450 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_GenerateMailboxNames
,
452 std::vector
<gpu::Mailbox
> /* mailbox_names */)
454 // Generates n new unique mailbox names asynchronously.
455 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesAsync
,
458 // Reply to GpuChannelMsg_GenerateMailboxNamesAsync.
459 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesReply
,
460 std::vector
<gpu::Mailbox
> /* mailbox_names */)
462 // Create a new GPU-accelerated video encoder.
463 IPC_SYNC_MESSAGE_CONTROL0_1(GpuChannelMsg_CreateVideoEncoder
,
464 int32
/* route_id */)
466 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroyVideoEncoder
, int32
/* route_id */)
468 #if defined(OS_ANDROID)
469 // Register the StreamTextureProxy class with the GPU process, so that
470 // the renderer process will get notified whenever a frame becomes available.
471 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_RegisterStreamTextureProxy
,
472 int32
, /* stream_id */
475 // Tells the GPU process create and send the java surface texture object to
476 // the renderer process through the binder thread.
477 IPC_MESSAGE_CONTROL3(GpuChannelMsg_EstablishStreamTexture
,
478 int32
, /* stream_id */
479 int32
, /* primary_id */
480 int32
/* secondary_id */)
482 // Tells the GPU process to set the size of StreamTexture from the given
484 IPC_MESSAGE_CONTROL2(GpuChannelMsg_SetStreamTextureSize
,
485 int32
, /* stream_id */
486 gfx::Size
/* size */)
489 // Tells the GPU process to collect rendering stats.
490 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CollectRenderingStatsForSurface
,
491 int32
/* surface_id */,
492 content::GpuRenderingStats
/* stats */)
494 #if defined(OS_ANDROID)
495 //------------------------------------------------------------------------------
496 // Stream Texture Messages
497 // Inform the renderer that a new frame is available.
498 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable
)
500 // Inform the renderer process that the transform matrix has changed.
501 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged
,
502 GpuStreamTextureMsg_MatrixChanged_Params
/* params */)
505 //------------------------------------------------------------------------------
506 // GPU Command Buffer Messages
507 // These are messages between a renderer process to the GPU process relating to
508 // a single OpenGL context.
509 // Initialize a command buffer with the given number of command entries.
510 // Returns the shared memory handle for the command buffer mapped to the
512 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Initialize
,
513 base::SharedMemoryHandle
/* shared_state */,
516 // Sets the shared memory buffer used for commands.
517 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer
,
520 // Produces the front buffer into a mailbox. This allows another context to draw
521 // the output of this context.
522 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer
,
523 gpu::Mailbox
/* mailbox */)
525 // Get the current state of the command buffer.
526 IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_GetState
,
527 gpu::CommandBuffer::State
/* state */)
529 // Get the current state of the command buffer, as fast as possible.
530 IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_GetStateFast
,
531 gpu::CommandBuffer::State
/* state */)
533 // Asynchronously synchronize the put and get offsets of both processes.
534 // Caller passes its current put offset. Current state (including get offset)
535 // is returned in shared memory.
536 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_AsyncFlush
,
537 int32
/* put_offset */,
538 uint32
/* flush_count */)
540 // Sends information about the latency of the current frame to the GPU
542 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetLatencyInfo
,
543 ui::LatencyInfo
/* latency_info */)
545 // Asynchronously process any commands known to the GPU process. This is only
546 // used in the event that a channel is unscheduled and needs to be flushed
547 // again to process any commands issued subsequent to unscheduling. The GPU
548 // process actually sends it (deferred) to itself.
549 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled
)
551 // Sent by the GPU process to display messages in the console.
552 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg
,
553 GPUCommandBufferConsoleMessage
/* msg */)
555 // Register an existing shared memory transfer buffer. Returns an id that can be
556 // used to identify the transfer buffer from a command buffer.
557 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer
,
559 base::SharedMemoryHandle
/* transfer_buffer */,
562 // Destroy a previously created transfer buffer.
563 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer
,
566 // Get the shared memory handle for a transfer buffer mapped to the callers
568 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_GetTransferBuffer
,
570 base::SharedMemoryHandle
/* transfer_buffer */,
573 // Create and initialize a hardware video decoder, returning its new route_id.
574 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
576 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_CreateVideoDecoder
,
577 media::VideoCodecProfile
/* profile */,
580 // Create and initialize a surface capturer, returning its new route_id.
581 // Created capturers should be freed with SurfaceCapturerMsg_Destroy when no
583 IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_CreateSurfaceCapturer
,
586 // Tells the proxy that there was an error and the command buffer had to be
587 // destroyed for some reason.
588 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed
,
589 gpu::error::ContextLostReason
/* reason */)
591 // Request that the GPU process reply with the given message. Reply may be
593 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Echo
,
594 IPC::Message
/* reply */)
596 // Response to a GpuChannelMsg_Echo message.
597 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck
)
599 // Send to stub on surface visibility change.
600 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible
, bool /* visible */)
602 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_DiscardBackbuffer
)
603 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EnsureBackbuffer
)
605 // Sent to proxy when the gpu memory manager changes its memory allocation.
606 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation
,
607 content::GpuMemoryAllocationForRenderer
/* allocation */)
609 // Sent to stub from the proxy with statistics on managed memory usage and
612 GpuCommandBufferMsg_SendClientManagedMemoryStats
,
613 content::GpuManagedMemoryStats
/* stats */)
615 // Sent to stub when proxy is assigned a memory allocation changed callback.
617 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback
,
618 bool /* has_callback */)
620 // Inserts a sync point into the channel. This is handled on the IO thread, so
621 // can be expected to be reasonably fast, but the sync point is actually
622 // retired in order with respect to the other calls. The sync point is shared
624 IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_InsertSyncPoint
,
625 uint32
/* sync_point */)
627 // Retires the sync point. Note: this message is not sent explicitly by the
628 // renderer, but is synthesized by the GPU process.
629 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint
,
630 uint32
/* sync_point */)
632 // Makes this command buffer signal when a sync point is reached, by sending
633 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
635 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint
,
636 uint32
/* sync_point */,
637 uint32
/* signal_id */)
639 // Response to GpuCommandBufferMsg_SignalSyncPoint.
640 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck
,
641 uint32
/* signal_id */)
643 // Makes this command buffer signal when a query is reached, by sending
644 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
646 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery
,
648 uint32
/* signal_id */)
650 //------------------------------------------------------------------------------
651 // Accelerated Video Decoder Messages
652 // These messages are sent from Renderer process to GPU process.
654 // Send input buffer for decoding.
655 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode
,
656 base::SharedMemoryHandle
, /* input_buffer_handle */
657 int32
, /* bitstream_buffer_id */
660 // Sent from Renderer process to the GPU process to give the texture IDs for
661 // the textures the decoder will use for output.
662 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_AssignPictureBuffers
,
663 std::vector
<int32
>, /* Picture buffer ID */
664 std::vector
<uint32
>, /* Texture ID */
665 std::vector
<gfx::Size
>) /* Size */
667 // Send from Renderer process to the GPU process to recycle the given picture
668 // buffer for further decoding.
669 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer
,
670 int32
) /* Picture buffer ID */
672 // Send flush request to the decoder.
673 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush
)
675 // Send reset request to the decoder.
676 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset
)
678 // Send destroy request to the decoder.
679 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy
)
681 //------------------------------------------------------------------------------
682 // Accelerated Video Decoder Host Messages
683 // These messages are sent from GPU process to Renderer process.
684 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
687 // Accelerated video decoder has consumed input buffer from transfer buffer.
688 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed
,
689 int32
) /* Processed buffer ID */
691 // Allocate video frames for output of the hardware video decoder.
693 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers
,
694 int32
, /* Number of video frames to generate */
695 gfx::Size
, /* Requested size of buffer */
696 uint32
) /* Texture target */
698 // Decoder reports that a picture is ready and buffer does not need to be passed
699 // back to the decoder.
700 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer
,
701 int32
) /* Picture buffer ID */
703 // Decoder reports that a picture is ready.
704 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderHostMsg_PictureReady
,
705 int32
, /* Picture buffer ID */
706 int32
) /* Bitstream buffer ID */
708 // Confirm decoder has been flushed.
709 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone
)
711 // Confirm decoder has been reset.
712 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone
)
714 // Video decoder has encountered an error.
715 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification
,
716 uint32
) /* Error ID */
718 //------------------------------------------------------------------------------
719 // Accelerated Video Encoder Messages
720 // These messages are sent from the Renderer process to GPU process.
722 // Initialize the accelerated encoder.
723 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Initialize
,
724 media::VideoFrame::Format
/* input_format */,
725 gfx::Size
/* input_visible_size */,
726 media::VideoCodecProfile
/* output_profile */,
727 uint32
/* initial_bitrate */)
729 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
730 // AcceleratedVideoEncoderHostMsg_NotifyEncodeDone.
731 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Encode
,
732 int32
/* frame_id */,
733 base::SharedMemoryHandle
/* buffer_handle */,
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 of the completion of initialization.
754 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderHostMsg_NotifyInitializeDone
)
756 // Notify renderer of the input/output buffer requirements of the encoder.
757 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers
,
758 uint32
/* input_count */,
759 gfx::Size
/* input_coded_size */,
760 uint32
/* output_buffer_size */)
762 // Notify the renderer that the encoder has finished using an input buffer.
763 // There is no congruent entry point in the media::VideoEncodeAccelerator
764 // interface, in VEA this same done condition is indicated by dropping the
765 // reference to the media::VideoFrame passed to VEA::Encode().
766 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone
,
767 int32
/* frame_id */)
769 // Notify the renderer that an output buffer has been filled with encoded data.
770 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady
,
771 int32
/* bitstream_buffer_id */,
772 uint32
/* payload_size */,
773 bool /* key_frame */)
775 // Report error condition.
776 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError
,
777 media::VideoEncodeAccelerator::Error
/* error */)
779 //------------------------------------------------------------------------------
780 // Gpu Surface Capturer Messages
781 // These messages are sent from the Browser process to the GPU process.
783 // Initialize the capturer.
784 IPC_MESSAGE_ROUTED1(SurfaceCapturerMsg_Initialize
,
785 media::VideoFrame::Format
/* format */)
787 // Attempt to start a capture.
788 IPC_MESSAGE_ROUTED0(SurfaceCapturerMsg_TryCapture
)
790 // Copy captured contents to a video frame.
791 IPC_MESSAGE_ROUTED3(SurfaceCapturerMsg_CopyCaptureToVideoFrame
,
792 int32
/* buffer_id */,
793 base::SharedMemoryHandle
/* buffer_shm */,
794 uint32
/* buffer_size */)
796 // Destroy the capturer.
797 IPC_MESSAGE_ROUTED0(SurfaceCapturerMsg_Destroy
)
799 //------------------------------------------------------------------------------
800 // Gpu Surface Capturer Host Messages
801 // These messages are sent from GPU process to Browser process.
803 // Report the capture output parameters to the Browser process.
804 IPC_MESSAGE_ROUTED2(SurfaceCapturerHostMsg_NotifyCaptureParameters
,
805 gfx::Size
/* buffer_size */,
806 gfx::Rect
/* visible_rect */)
808 // Report successful copy of a capture of a surface.
809 IPC_MESSAGE_ROUTED1(SurfaceCapturerHostMsg_NotifyCopyCaptureDone
,
810 int32
/* frame_id */)
813 IPC_MESSAGE_ROUTED1(SurfaceCapturerHostMsg_NotifyError
,
814 content::SurfaceCapturer::Error
/* error */)