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
)
65 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig
)
66 IPC_STRUCT_MEMBER(int32
, share_group_id
)
67 IPC_STRUCT_MEMBER(std::vector
<int>, attribs
)
68 IPC_STRUCT_MEMBER(GURL
, active_url
)
69 IPC_STRUCT_MEMBER(gfx::GpuPreference
, gpu_preference
)
72 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
73 IPC_STRUCT_MEMBER(int32
, surface_id
)
74 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
75 IPC_STRUCT_MEMBER(int32
, route_id
)
76 IPC_STRUCT_MEMBER(gpu::Mailbox
, mailbox
)
77 IPC_STRUCT_MEMBER(gfx::Size
, size
)
78 IPC_STRUCT_MEMBER(float, scale_factor
)
79 IPC_STRUCT_MEMBER(std::vector
<ui::LatencyInfo
>, latency_info
)
82 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
)
83 IPC_STRUCT_MEMBER(int32
, surface_id
)
84 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
85 IPC_STRUCT_MEMBER(int32
, route_id
)
86 IPC_STRUCT_MEMBER(int, x
)
87 IPC_STRUCT_MEMBER(int, y
)
88 IPC_STRUCT_MEMBER(int, width
)
89 IPC_STRUCT_MEMBER(int, height
)
90 IPC_STRUCT_MEMBER(gpu::Mailbox
, mailbox
)
91 IPC_STRUCT_MEMBER(gfx::Size
, surface_size
)
92 IPC_STRUCT_MEMBER(float, surface_scale_factor
)
93 IPC_STRUCT_MEMBER(std::vector
<ui::LatencyInfo
>, latency_info
)
96 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params
)
97 IPC_STRUCT_MEMBER(int32
, surface_id
)
100 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params
)
101 IPC_STRUCT_MEMBER(gpu::Mailbox
, mailbox
)
102 IPC_STRUCT_MEMBER(uint32
, sync_point
)
103 #if defined(OS_MACOSX)
104 IPC_STRUCT_MEMBER(int32
, renderer_id
)
107 IPC_STRUCT_MEMBER(base::TimeTicks
, vsync_timebase
)
108 IPC_STRUCT_MEMBER(base::TimeDelta
, vsync_interval
)
112 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage
)
113 IPC_STRUCT_MEMBER(int32
, id
)
114 IPC_STRUCT_MEMBER(std::string
, message
)
117 #if defined(OS_ANDROID)
118 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params
)
119 IPC_STRUCT_MEMBER(float, m00
)
120 IPC_STRUCT_MEMBER(float, m01
)
121 IPC_STRUCT_MEMBER(float, m02
)
122 IPC_STRUCT_MEMBER(float, m03
)
123 IPC_STRUCT_MEMBER(float, m10
)
124 IPC_STRUCT_MEMBER(float, m11
)
125 IPC_STRUCT_MEMBER(float, m12
)
126 IPC_STRUCT_MEMBER(float, m13
)
127 IPC_STRUCT_MEMBER(float, m20
)
128 IPC_STRUCT_MEMBER(float, m21
)
129 IPC_STRUCT_MEMBER(float, m22
)
130 IPC_STRUCT_MEMBER(float, m23
)
131 IPC_STRUCT_MEMBER(float, m30
)
132 IPC_STRUCT_MEMBER(float, m31
)
133 IPC_STRUCT_MEMBER(float, m32
)
134 IPC_STRUCT_MEMBER(float, m33
)
138 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode
)
139 IPC_STRUCT_TRAITS_MEMBER(values
)
140 IPC_STRUCT_TRAITS_MEMBER(children
)
141 IPC_STRUCT_TRAITS_END()
143 IPC_STRUCT_TRAITS_BEGIN(gpu::GpuPerformanceStats
)
144 IPC_STRUCT_TRAITS_MEMBER(graphics
)
145 IPC_STRUCT_TRAITS_MEMBER(gaming
)
146 IPC_STRUCT_TRAITS_MEMBER(overall
)
147 IPC_STRUCT_TRAITS_END()
149 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice
)
150 IPC_STRUCT_TRAITS_MEMBER(vendor_id
)
151 IPC_STRUCT_TRAITS_MEMBER(device_id
)
152 IPC_STRUCT_TRAITS_MEMBER(active
)
153 IPC_STRUCT_TRAITS_MEMBER(vendor_string
)
154 IPC_STRUCT_TRAITS_MEMBER(device_string
)
155 IPC_STRUCT_TRAITS_END()
157 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo
)
158 IPC_STRUCT_TRAITS_MEMBER(finalized
)
159 IPC_STRUCT_TRAITS_MEMBER(initialization_time
)
160 IPC_STRUCT_TRAITS_MEMBER(optimus
)
161 IPC_STRUCT_TRAITS_MEMBER(amd_switchable
)
162 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute
)
163 IPC_STRUCT_TRAITS_MEMBER(gpu
)
164 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus
)
165 IPC_STRUCT_TRAITS_MEMBER(adapter_luid
)
166 IPC_STRUCT_TRAITS_MEMBER(driver_vendor
)
167 IPC_STRUCT_TRAITS_MEMBER(driver_version
)
168 IPC_STRUCT_TRAITS_MEMBER(driver_date
)
169 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version
)
170 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version
)
171 IPC_STRUCT_TRAITS_MEMBER(machine_model_name
)
172 IPC_STRUCT_TRAITS_MEMBER(machine_model_version
)
173 IPC_STRUCT_TRAITS_MEMBER(gl_version
)
174 IPC_STRUCT_TRAITS_MEMBER(gl_vendor
)
175 IPC_STRUCT_TRAITS_MEMBER(gl_renderer
)
176 IPC_STRUCT_TRAITS_MEMBER(gl_extensions
)
177 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor
)
178 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version
)
179 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions
)
180 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy
)
181 IPC_STRUCT_TRAITS_MEMBER(can_lose_context
)
182 IPC_STRUCT_TRAITS_MEMBER(performance_stats
)
183 IPC_STRUCT_TRAITS_MEMBER(software_rendering
)
184 IPC_STRUCT_TRAITS_MEMBER(direct_rendering
)
185 IPC_STRUCT_TRAITS_MEMBER(sandboxed
)
186 IPC_STRUCT_TRAITS_MEMBER(process_crash_count
)
188 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics
)
190 IPC_STRUCT_TRAITS_END()
192 IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities
)
193 IPC_STRUCT_TRAITS_MEMBER(post_sub_buffer
)
194 IPC_STRUCT_TRAITS_MEMBER(egl_image_external
)
195 IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888
)
196 IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1
)
197 IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1_npot
)
198 IPC_STRUCT_TRAITS_MEMBER(texture_rectangle
)
199 IPC_STRUCT_TRAITS_MEMBER(iosurface
)
200 IPC_STRUCT_TRAITS_MEMBER(texture_usage
)
201 IPC_STRUCT_TRAITS_MEMBER(texture_storage
)
202 IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer
)
203 IPC_STRUCT_TRAITS_MEMBER(sync_query
)
204 IPC_STRUCT_TRAITS_MEMBER(map_image
)
205 IPC_STRUCT_TRAITS_END()
207 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats
)
208 IPC_STRUCT_TRAITS_MEMBER(video_memory
)
209 IPC_STRUCT_TRAITS_MEMBER(has_duplicates
)
210 IPC_STRUCT_TRAITS_END()
212 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats
)
213 IPC_STRUCT_TRAITS_MEMBER(process_map
)
214 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
215 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max
)
216 IPC_STRUCT_TRAITS_END()
218 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats
)
219 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current
)
220 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max
)
221 IPC_STRUCT_TRAITS_MEMBER(bytes_limit
)
222 IPC_STRUCT_TRAITS_END()
224 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation
)
225 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible
)
226 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible
)
227 IPC_STRUCT_TRAITS_END()
229 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle
)
230 IPC_STRUCT_TRAITS_MEMBER(handle
)
231 IPC_STRUCT_TRAITS_MEMBER(transport_type
)
232 IPC_STRUCT_TRAITS_MEMBER(parent_client_id
)
233 IPC_STRUCT_TRAITS_END()
235 //------------------------------------------------------------------------------
237 // These are messages from the browser to the GPU process.
239 // Tells the GPU process to initialize itself. The browser explicitly
240 // requests this be done so that we are guaranteed that the channel is set
241 // up between the browser and GPU process before doing any work that might
242 // potentially crash the GPU process. Detection of the child process
243 // exiting abruptly is predicated on having the IPC channel set up.
244 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize
)
246 // Tells the GPU process to create a new channel for communication with a
247 // given client. The channel name is returned in a
248 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
249 // the GPU process reuses an existing channel to that process if it exists.
250 // This ID is a unique opaque identifier generated by the browser process.
251 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel
,
253 bool /* share_context */,
254 bool /* allow_future_sync_points */)
256 // Tells the GPU process to close the channel identified by IPC channel
257 // handle. If no channel can be identified, do nothing.
258 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel
,
259 IPC::ChannelHandle
/* channel_handle */)
261 // Tells the GPU process to create a new command buffer that renders directly
262 // to a native view. A corresponding GpuCommandBufferStub is created.
263 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer
,
264 gfx::GLSurfaceHandle
, /* compositing_surface */
265 int32
, /* surface_id */
266 int32
, /* client_id */
267 GPUCreateCommandBufferConfig
, /* init_params */
268 int32
/* route_id */)
270 // Tells the GPU process to create a new gpu memory buffer for |handle|.
271 IPC_MESSAGE_CONTROL4(GpuMsg_CreateGpuMemoryBuffer
,
272 gfx::GpuMemoryBufferHandle
, /* handle */
273 gfx::Size
, /* size */
274 unsigned, /* internalformat */
275 unsigned /* usage */)
277 // Tells the GPU process to destroy buffer.
278 IPC_MESSAGE_CONTROL2(GpuMsg_DestroyGpuMemoryBuffer
,
279 gfx::GpuMemoryBufferHandle
, /* handle */
280 int32
/* sync_point */)
282 // Tells the GPU process to create a context for collecting graphics card
284 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo
)
286 // Tells the GPU process to report video_memory information for the task manager
287 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats
)
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 wake up the GPU because we're about to draw.
297 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu
)
299 // Tells the GPU process to remove all contexts.
300 IPC_MESSAGE_CONTROL0(GpuMsg_Clean
)
302 // Tells the GPU process to crash.
303 IPC_MESSAGE_CONTROL0(GpuMsg_Crash
)
305 // Tells the GPU process to hang.
306 IPC_MESSAGE_CONTROL0(GpuMsg_Hang
)
308 // Tells the GPU process to disable the watchdog thread.
309 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog
)
311 //------------------------------------------------------------------------------
313 // These are messages to the browser.
315 // A renderer sends this when it wants to create a connection to the GPU
316 // process. The browser will create the GPU process if necessary, and will
317 // return a handle to the channel via a GpuChannelEstablished message.
318 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel
,
319 content::CauseForGpuLaunch
,
321 IPC::ChannelHandle
/* handle to channel */,
322 gpu::GPUInfo
/* stats about GPU process*/)
324 // A renderer sends this to the browser process when it wants to
325 // create a GL context associated with the given view_id.
326 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer
,
327 int32
, /* surface_id */
328 GPUCreateCommandBufferConfig
, /* init_params */
329 int32
, /* route_id */
330 content::CreateCommandBufferResult
/* result */)
332 // Response from GPU to a GputMsg_Initialize message.
333 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized
,
335 ::gpu::GPUInfo
/* gpu_info */)
337 // Response from GPU to a GpuHostMsg_EstablishChannel message.
338 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished
,
339 IPC::ChannelHandle
/* channel_handle */)
341 // Message from GPU to notify to destroy the channel.
342 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel
,
343 int32
/* client_id */)
345 // Message to cache the given shader information.
346 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader
,
347 int32
/* client_id */,
348 std::string
/* key */,
349 std::string
/* shader */)
351 // Message to the GPU that a shader was loaded from disk.
352 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader
,
353 std::string
/* encoded shader */)
355 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
356 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated
,
357 content::CreateCommandBufferResult
/* result */)
359 // Request from GPU to free the browser resources associated with the
361 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer
,
362 int32
/* surface_id */)
364 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
365 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated
,
366 gfx::GpuMemoryBufferHandle
/* handle */)
368 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
369 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected
,
370 gpu::GPUInfo
/* GPU logging stats */)
372 // Response from GPU to a GpuMsg_GetVideoMemory.
373 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats
,
374 content::GPUVideoMemoryUsageStats
/* GPU memory stats */)
376 // Message from GPU to add a GPU log message to the about:gpu page.
377 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage
,
379 std::string
/* header */,
380 std::string
/* message */)
382 // Tells the browser that a new accelerated surface was initialized.
383 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized
,
384 int32
/* surface_id */,
385 int32
/* route_id */)
387 // Tells the browser that a frame with the specific latency info was drawn to
389 IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn
,
390 std::vector
<ui::LatencyInfo
> /* latency_info */)
392 // Same as above with a rect of the part of the surface that changed.
393 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped
,
394 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
396 // This message notifies the browser process that the renderer
397 // swapped a portion of the buffers associated with the given "window", which
398 // should cause the browser to redraw the compositor's contents.
399 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfacePostSubBuffer
,
400 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
)
402 // Tells the browser to release whatever resources are associated with
403 // the given surface. The browser must send an ACK once this operation
405 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceRelease
,
406 GpuHostMsg_AcceleratedSurfaceRelease_Params
)
408 // Tells the browser to release resources for the given surface until the next
409 // time swap buffers or post sub buffer is sent.
410 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSuspend
,
411 int32
/* surface_id */)
413 // Tells the browser about updated parameters for vsync alignment.
414 IPC_MESSAGE_CONTROL3(GpuHostMsg_UpdateVSyncParameters
,
415 int32
/* surface_id */,
416 base::TimeTicks
/* timebase */,
417 base::TimeDelta
/* interval */)
419 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext
,
422 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext
,
423 bool /* offscreen */,
424 gpu::error::ContextLostReason
/* reason */,
427 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext
,
430 // Tells the browser about GPU memory usage statistics for UMA logging.
431 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats
,
432 content::GPUMemoryUmaStats
/* GPU memory UMA stats */)
434 //------------------------------------------------------------------------------
435 // GPU Channel Messages
436 // These are messages from a renderer process to the GPU process.
438 // Tells the GPU process to create a new command buffer that renders to an
439 // offscreen frame buffer.
440 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer
,
441 gfx::Size
, /* size */
442 GPUCreateCommandBufferConfig
, /* init_params */
443 int32
, /* route_id */
444 bool /* succeeded */)
446 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
447 // destructor, so that the stub deletes the actual CommandBufferService
448 // object that it's hosting.
449 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer
,
450 int32
/* instance_id */)
452 // Sent by DevTools agent in the inspected renderer process to initiate GPU
453 // instrumentation events recording.
454 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_DevToolsStartEventsRecording
,
455 int32
, /* route_id */
456 bool /* succeeded */)
458 // The message is sent when DevTools want to stop events recording.
459 IPC_MESSAGE_CONTROL0(GpuChannelMsg_DevToolsStopEventsRecording
)
461 #if defined(OS_ANDROID)
462 //------------------------------------------------------------------------------
463 // Stream Texture Messages
464 // Tells the GPU process create and send the java surface texture object to
465 // the renderer process through the binder thread.
466 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer
,
467 int32
, /* primary_id */
468 int32
/* secondary_id */)
470 // Tells the GPU process to set the size of StreamTexture from the given
472 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize
,
473 gfx::Size
/* size */)
475 // Tells the service-side instance to start sending frame available
477 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening
)
479 // Inform the renderer that a new frame is available.
480 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable
)
482 // Inform the renderer process that the transform matrix has changed.
483 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged
,
484 GpuStreamTextureMsg_MatrixChanged_Params
/* params */)
487 //------------------------------------------------------------------------------
488 // GPU Command Buffer Messages
489 // These are messages between a renderer process to the GPU process relating to
490 // a single OpenGL context.
491 // Initialize a command buffer with the given number of command entries.
492 // Returns the shared memory handle for the command buffer mapped to the
494 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize
,
495 base::SharedMemoryHandle
/* shared_state */,
497 gpu::Capabilities
/* capabilities */)
499 // Sets the shared memory buffer used for commands.
500 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer
,
503 // Produces the front buffer into a mailbox. This allows another context to draw
504 // the output of this context.
505 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer
,
506 gpu::Mailbox
/* mailbox */)
508 // Wait until the token is in a specific range, inclusive.
509 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange
,
512 gpu::CommandBuffer::State
/* state */)
514 // Wait until the get offset is in a specific range, inclusive.
515 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange
,
518 gpu::CommandBuffer::State
/* state */)
520 // Asynchronously synchronize the put and get offsets of both processes.
521 // Caller passes its current put offset. Current state (including get offset)
522 // is returned in shared memory.
523 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_AsyncFlush
,
524 int32
/* put_offset */,
525 uint32
/* flush_count */)
527 // Sends information about the latency of the current frame to the GPU
529 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetLatencyInfo
,
530 std::vector
<ui::LatencyInfo
> /* latency_info */)
532 // Asynchronously process any commands known to the GPU process. This is only
533 // used in the event that a channel is unscheduled and needs to be flushed
534 // again to process any commands issued subsequent to unscheduling. The GPU
535 // process actually sends it (deferred) to itself.
536 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled
)
538 // Sent by the GPU process to display messages in the console.
539 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg
,
540 GPUCommandBufferConsoleMessage
/* msg */)
542 // Register an existing shared memory transfer buffer. The id that can be
543 // used to identify the transfer buffer from a command buffer.
544 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer
,
546 base::SharedMemoryHandle
/* transfer_buffer */,
549 // Destroy a previously created transfer buffer.
550 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer
,
553 // Create and initialize a hardware video decoder using the specified route_id.
554 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
556 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder
,
557 media::VideoCodecProfile
/* profile */,
558 int32
, /* route_id */
559 bool /* succeeded */)
561 // Create and initialize a hardware video encoder using the specified route_id.
562 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
564 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder
,
565 media::VideoFrame::Format
/* input_format */,
566 gfx::Size
/* input_visible_size */,
567 media::VideoCodecProfile
/* output_profile */,
568 uint32
/* initial_bitrate */,
569 int32
, /* route_id */
570 bool /* succeeded */)
572 // Tells the proxy that there was an error and the command buffer had to be
573 // destroyed for some reason.
574 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed
,
575 gpu::error::ContextLostReason
/* reason */)
577 // Request that the GPU process reply with the given message. Reply may be
579 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Echo
,
580 IPC::Message
/* reply */)
582 // Response to a GpuChannelMsg_Echo message.
583 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck
)
585 // Send to stub on surface visibility change.
586 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible
, bool /* visible */)
588 // Sent to proxy when the gpu memory manager changes its memory allocation.
589 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation
,
590 gpu::MemoryAllocation
/* allocation */)
592 // Sent to stub when proxy is assigned a memory allocation changed callback.
594 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback
,
595 bool /* has_callback */)
597 // Inserts a sync point into the channel. This is handled on the IO thread, so
598 // can be expected to be reasonably fast, but the sync point is actually
599 // retired in order with respect to the other calls. The sync point is shared
601 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint
,
603 uint32
/* sync_point */)
605 // Retires the sync point. Note: this message is not sent explicitly by the
606 // renderer, but is synthesized by the GPU process.
607 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint
,
608 uint32
/* sync_point */)
610 // Makes this command buffer signal when a sync point is reached, by sending
611 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
613 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint
,
614 uint32
/* sync_point */,
615 uint32
/* signal_id */)
617 // Response to GpuCommandBufferMsg_SignalSyncPoint.
618 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck
,
619 uint32
/* signal_id */)
621 // Makes this command buffer signal when a query is reached, by sending
622 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
624 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery
,
626 uint32
/* signal_id */)
628 // Register an existing gpu memory buffer. The id that can be
629 // used to identify the gpu memory buffer from a command buffer.
630 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_RegisterGpuMemoryBuffer
,
632 gfx::GpuMemoryBufferHandle
/* gpu_memory_buffer */,
635 uint32
/* internalformat */)
637 // Unregister a previously registered gpu memory buffer.
638 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UnregisterGpuMemoryBuffer
,
641 // Attaches an external image stream to the client texture.
642 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture
,
643 uint32
, /* client_texture_id */
644 int32
, /* stream_id */
645 bool /* succeeded */)
647 //------------------------------------------------------------------------------
648 // Accelerated Video Decoder Messages
649 // These messages are sent from Renderer process to GPU process.
651 // Send input buffer for decoding.
652 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode
,
653 base::SharedMemoryHandle
, /* input_buffer_handle */
654 int32
, /* bitstream_buffer_id */
657 // Sent from Renderer process to the GPU process to give the texture IDs for
658 // the textures the decoder will use for output.
659 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers
,
660 std::vector
<int32
>, /* Picture buffer ID */
661 std::vector
<uint32
>) /* Texture ID */
663 // Send from Renderer process to the GPU process to recycle the given picture
664 // buffer for further decoding.
665 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer
,
666 int32
) /* Picture buffer ID */
668 // Send flush request to the decoder.
669 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush
)
671 // Send reset request to the decoder.
672 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset
)
674 // Send destroy request to the decoder.
675 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy
)
677 //------------------------------------------------------------------------------
678 // Accelerated Video Decoder Host Messages
679 // These messages are sent from GPU process to Renderer process.
680 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
683 // Accelerated video decoder has consumed input buffer from transfer buffer.
684 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed
,
685 int32
) /* Processed buffer ID */
687 // Allocate video frames for output of the hardware video decoder.
689 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers
,
690 int32
, /* Number of video frames to generate */
691 gfx::Size
, /* Requested size of buffer */
692 uint32
) /* Texture target */
694 // Decoder reports that a picture is ready and buffer does not need to be passed
695 // back to the decoder.
696 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer
,
697 int32
) /* Picture buffer ID */
699 // Decoder reports that a picture is ready.
700 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_PictureReady
,
701 int32
, /* Picture buffer ID */
702 int32
, /* Bitstream buffer ID */
703 gfx::Rect
) /* Visible rectangle */
705 // Confirm decoder has been flushed.
706 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone
)
708 // Confirm decoder has been reset.
709 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone
)
711 // Video decoder has encountered an error.
712 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification
,
713 uint32
) /* Error ID */
715 //------------------------------------------------------------------------------
716 // Accelerated Video Encoder Messages
717 // These messages are sent from the Renderer process to GPU process.
719 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
720 // AcceleratedVideoEncoderHostMsg_NotifyEncodeDone.
721 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Encode
,
722 int32
/* frame_id */,
723 base::SharedMemoryHandle
/* buffer_handle */,
724 uint32
/* buffer_size */,
725 bool /* force_keyframe */)
727 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
728 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
729 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer
,
730 int32
/* buffer_id */,
731 base::SharedMemoryHandle
/* buffer_handle */,
732 uint32
/* buffer_size */)
734 // Request a runtime encoding parameter change.
735 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange
,
736 uint32
/* bitrate */,
737 uint32
/* framerate */)
739 //------------------------------------------------------------------------------
740 // Accelerated Video Encoder Host Messages
741 // These messages are sent from GPU process to Renderer process.
743 // Notify renderer of the input/output buffer requirements of the encoder.
744 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers
,
745 uint32
/* input_count */,
746 gfx::Size
/* input_coded_size */,
747 uint32
/* output_buffer_size */)
749 // Notify the renderer that the encoder has finished using an input buffer.
750 // There is no congruent entry point in the media::VideoEncodeAccelerator
751 // interface, in VEA this same done condition is indicated by dropping the
752 // reference to the media::VideoFrame passed to VEA::Encode().
753 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone
,
754 int32
/* frame_id */)
756 // Notify the renderer that an output buffer has been filled with encoded data.
757 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady
,
758 int32
/* bitstream_buffer_id */,
759 uint32
/* payload_size */,
760 bool /* key_frame */)
762 // Report error condition.
763 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError
,
764 media::VideoEncodeAccelerator::Error
/* error */)
766 // Send destroy request to the encoder.
767 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy
)