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/public/common/common_param_traits.h"
16 #include "content/public/common/gpu_memory_stats.h"
17 #include "gpu/command_buffer/common/capabilities.h"
18 #include "gpu/command_buffer/common/command_buffer.h"
19 #include "gpu/command_buffer/common/constants.h"
20 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
21 #include "gpu/command_buffer/common/mailbox.h"
22 #include "gpu/config/gpu_info.h"
23 #include "gpu/ipc/gpu_command_buffer_traits.h"
24 #include "ipc/ipc_channel_handle.h"
25 #include "ipc/ipc_message_macros.h"
26 #include "media/base/video_frame.h"
27 #include "media/video/video_decode_accelerator.h"
28 #include "media/video/video_encode_accelerator.h"
29 #include "ui/events/latency_info.h"
30 #include "ui/gfx/gpu_memory_buffer.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 #undef IPC_MESSAGE_EXPORT
40 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
42 #define IPC_MESSAGE_START GpuMsgStart
44 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch
,
45 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM
- 1)
46 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference
,
47 gfx::GpuPreferenceLast
)
48 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType
,
49 gfx::SURFACE_TYPE_LAST
)
50 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff
,
51 gpu::MemoryAllocation::CUTOFF_LAST
)
52 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason
,
53 gpu::error::kContextLostReasonLast
)
54 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error
,
55 media::VideoEncodeAccelerator::kErrorMax
)
56 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format
,
57 media::VideoFrame::FORMAT_MAX
)
58 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile
,
59 media::VIDEO_CODEC_PROFILE_MIN
,
60 media::VIDEO_CODEC_PROFILE_MAX
)
62 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig
)
63 IPC_STRUCT_MEMBER(int32
, share_group_id
)
64 IPC_STRUCT_MEMBER(std::vector
<int>, attribs
)
65 IPC_STRUCT_MEMBER(GURL
, active_url
)
66 IPC_STRUCT_MEMBER(gfx::GpuPreference
, gpu_preference
)
69 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
70 IPC_STRUCT_MEMBER(int32
, surface_id
)
71 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
72 IPC_STRUCT_MEMBER(int32
, route_id
)
73 IPC_STRUCT_MEMBER(gpu::Mailbox
, mailbox
)
74 IPC_STRUCT_MEMBER(gfx::Size
, size
)
75 IPC_STRUCT_MEMBER(float, scale_factor
)
76 IPC_STRUCT_MEMBER(std::vector
<ui::LatencyInfo
>, latency_info
)
79 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
)
80 IPC_STRUCT_MEMBER(int32
, surface_id
)
81 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
82 IPC_STRUCT_MEMBER(int32
, route_id
)
83 IPC_STRUCT_MEMBER(int, x
)
84 IPC_STRUCT_MEMBER(int, y
)
85 IPC_STRUCT_MEMBER(int, width
)
86 IPC_STRUCT_MEMBER(int, height
)
87 IPC_STRUCT_MEMBER(gpu::Mailbox
, mailbox
)
88 IPC_STRUCT_MEMBER(gfx::Size
, surface_size
)
89 IPC_STRUCT_MEMBER(float, surface_scale_factor
)
90 IPC_STRUCT_MEMBER(std::vector
<ui::LatencyInfo
>, latency_info
)
93 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params
)
94 IPC_STRUCT_MEMBER(int32
, surface_id
)
97 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params
)
98 IPC_STRUCT_MEMBER(gpu::Mailbox
, mailbox
)
99 IPC_STRUCT_MEMBER(uint32
, sync_point
)
100 #if defined(OS_MACOSX)
101 IPC_STRUCT_MEMBER(int32
, renderer_id
)
104 IPC_STRUCT_MEMBER(base::TimeTicks
, vsync_timebase
)
105 IPC_STRUCT_MEMBER(base::TimeDelta
, vsync_interval
)
109 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage
)
110 IPC_STRUCT_MEMBER(int32
, id
)
111 IPC_STRUCT_MEMBER(std::string
, message
)
114 #if defined(OS_ANDROID)
115 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params
)
116 IPC_STRUCT_MEMBER(float, m00
)
117 IPC_STRUCT_MEMBER(float, m01
)
118 IPC_STRUCT_MEMBER(float, m02
)
119 IPC_STRUCT_MEMBER(float, m03
)
120 IPC_STRUCT_MEMBER(float, m10
)
121 IPC_STRUCT_MEMBER(float, m11
)
122 IPC_STRUCT_MEMBER(float, m12
)
123 IPC_STRUCT_MEMBER(float, m13
)
124 IPC_STRUCT_MEMBER(float, m20
)
125 IPC_STRUCT_MEMBER(float, m21
)
126 IPC_STRUCT_MEMBER(float, m22
)
127 IPC_STRUCT_MEMBER(float, m23
)
128 IPC_STRUCT_MEMBER(float, m30
)
129 IPC_STRUCT_MEMBER(float, m31
)
130 IPC_STRUCT_MEMBER(float, m32
)
131 IPC_STRUCT_MEMBER(float, m33
)
135 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode
)
136 IPC_STRUCT_TRAITS_MEMBER(values
)
137 IPC_STRUCT_TRAITS_MEMBER(children
)
138 IPC_STRUCT_TRAITS_END()
140 IPC_STRUCT_TRAITS_BEGIN(gpu::GpuPerformanceStats
)
141 IPC_STRUCT_TRAITS_MEMBER(graphics
)
142 IPC_STRUCT_TRAITS_MEMBER(gaming
)
143 IPC_STRUCT_TRAITS_MEMBER(overall
)
144 IPC_STRUCT_TRAITS_END()
146 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice
)
147 IPC_STRUCT_TRAITS_MEMBER(vendor_id
)
148 IPC_STRUCT_TRAITS_MEMBER(device_id
)
149 IPC_STRUCT_TRAITS_MEMBER(active
)
150 IPC_STRUCT_TRAITS_MEMBER(vendor_string
)
151 IPC_STRUCT_TRAITS_MEMBER(device_string
)
152 IPC_STRUCT_TRAITS_END()
154 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo
)
155 IPC_STRUCT_TRAITS_MEMBER(finalized
)
156 IPC_STRUCT_TRAITS_MEMBER(initialization_time
)
157 IPC_STRUCT_TRAITS_MEMBER(optimus
)
158 IPC_STRUCT_TRAITS_MEMBER(amd_switchable
)
159 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute
)
160 IPC_STRUCT_TRAITS_MEMBER(gpu
)
161 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus
)
162 IPC_STRUCT_TRAITS_MEMBER(adapter_luid
)
163 IPC_STRUCT_TRAITS_MEMBER(driver_vendor
)
164 IPC_STRUCT_TRAITS_MEMBER(driver_version
)
165 IPC_STRUCT_TRAITS_MEMBER(driver_date
)
166 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version
)
167 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version
)
168 IPC_STRUCT_TRAITS_MEMBER(machine_model_name
)
169 IPC_STRUCT_TRAITS_MEMBER(machine_model_version
)
170 IPC_STRUCT_TRAITS_MEMBER(gl_version
)
171 IPC_STRUCT_TRAITS_MEMBER(gl_version_string
)
172 IPC_STRUCT_TRAITS_MEMBER(gl_vendor
)
173 IPC_STRUCT_TRAITS_MEMBER(gl_renderer
)
174 IPC_STRUCT_TRAITS_MEMBER(gl_extensions
)
175 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor
)
176 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version
)
177 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions
)
178 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy
)
179 IPC_STRUCT_TRAITS_MEMBER(can_lose_context
)
180 IPC_STRUCT_TRAITS_MEMBER(performance_stats
)
181 IPC_STRUCT_TRAITS_MEMBER(software_rendering
)
182 IPC_STRUCT_TRAITS_MEMBER(direct_rendering
)
183 IPC_STRUCT_TRAITS_MEMBER(sandboxed
)
185 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics
)
187 IPC_STRUCT_TRAITS_END()
189 IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities
)
190 IPC_STRUCT_TRAITS_MEMBER(post_sub_buffer
)
191 IPC_STRUCT_TRAITS_MEMBER(fast_npot_mo8_textures
)
192 IPC_STRUCT_TRAITS_MEMBER(egl_image_external
)
193 IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888
)
194 IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1
)
195 IPC_STRUCT_TRAITS_MEMBER(texture_rectangle
)
196 IPC_STRUCT_TRAITS_MEMBER(iosurface
)
197 IPC_STRUCT_TRAITS_MEMBER(texture_usage
)
198 IPC_STRUCT_TRAITS_MEMBER(texture_storage
)
199 IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer
)
200 IPC_STRUCT_TRAITS_MEMBER(sync_query
)
201 IPC_STRUCT_TRAITS_MEMBER(map_image
)
202 IPC_STRUCT_TRAITS_END()
204 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats
)
205 IPC_STRUCT_TRAITS_MEMBER(video_memory
)
206 IPC_STRUCT_TRAITS_MEMBER(has_duplicates
)
207 IPC_STRUCT_TRAITS_END()
209 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats
)
210 IPC_STRUCT_TRAITS_MEMBER(process_map
)
211 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
212 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max
)
213 IPC_STRUCT_TRAITS_END()
215 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats
)
216 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current
)
217 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max
)
218 IPC_STRUCT_TRAITS_MEMBER(bytes_limit
)
219 IPC_STRUCT_TRAITS_END()
221 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation
)
222 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible
)
223 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible
)
224 IPC_STRUCT_TRAITS_END()
226 IPC_STRUCT_TRAITS_BEGIN(gpu::ManagedMemoryStats
)
227 IPC_STRUCT_TRAITS_MEMBER(bytes_required
)
228 IPC_STRUCT_TRAITS_MEMBER(bytes_nice_to_have
)
229 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
230 IPC_STRUCT_TRAITS_MEMBER(backbuffer_requested
)
231 IPC_STRUCT_TRAITS_END()
233 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle
)
234 IPC_STRUCT_TRAITS_MEMBER(handle
)
235 IPC_STRUCT_TRAITS_MEMBER(transport_type
)
236 IPC_STRUCT_TRAITS_MEMBER(parent_client_id
)
237 IPC_STRUCT_TRAITS_END()
239 //------------------------------------------------------------------------------
241 // These are messages from the browser to the GPU process.
243 // Tells the GPU process to initialize itself. The browser explicitly
244 // requests this be done so that we are guaranteed that the channel is set
245 // up between the browser and GPU process before doing any work that might
246 // potentially crash the GPU process. Detection of the child process
247 // exiting abruptly is predicated on having the IPC channel set up.
248 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize
)
250 // Tells the GPU process to create a new channel for communication with a
251 // given client. The channel name is returned in a
252 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
253 // the GPU process reuses an existing channel to that process if it exists.
254 // This ID is a unique opaque identifier generated by the browser process.
255 IPC_MESSAGE_CONTROL2(GpuMsg_EstablishChannel
,
257 bool /* share_context */)
259 // Tells the GPU process to close the channel identified by IPC channel
260 // handle. If no channel can be identified, do nothing.
261 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel
,
262 IPC::ChannelHandle
/* channel_handle */)
264 // Tells the GPU process to create a new command buffer that renders directly
265 // to a native view. A corresponding GpuCommandBufferStub is created.
266 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer
,
267 gfx::GLSurfaceHandle
, /* compositing_surface */
268 int32
, /* surface_id */
269 int32
, /* client_id */
270 GPUCreateCommandBufferConfig
, /* init_params */
271 int32
/* route_id */)
273 // Tells the GPU process to create a new image from a window. Images
274 // can be bound to textures using CHROMIUM_texture_from_image.
275 IPC_MESSAGE_CONTROL3(GpuMsg_CreateImage
,
276 gfx::PluginWindowHandle
, /* window */
277 int32
, /* client_id */
278 int32
/* image_id */)
280 // Tells the GPU process to delete image.
281 IPC_MESSAGE_CONTROL3(GpuMsg_DeleteImage
,
282 int32
, /* client_id */
283 int32
, /* image_id */
284 int32
/* sync_point */)
286 // Tells the GPU process to create a context for collecting graphics card
288 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo
)
290 // Tells the GPU process to report video_memory information for the task manager
291 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats
)
293 // Tells the GPU process that the browser process has handled the swap
294 // buffers or post sub-buffer request. A non-zero sync point means
295 // that we should wait for the sync point. The surface_handle identifies
296 // that buffer that has finished presented, i.e. the buffer being returned.
297 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented
,
298 AcceleratedSurfaceMsg_BufferPresented_Params
)
300 // Tells the GPU process to wake up the GPU because we're about to draw.
301 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu
)
303 // Tells the GPU process to remove all contexts.
304 IPC_MESSAGE_CONTROL0(GpuMsg_Clean
)
306 // Tells the GPU process to crash.
307 IPC_MESSAGE_CONTROL0(GpuMsg_Crash
)
309 // Tells the GPU process to hang.
310 IPC_MESSAGE_CONTROL0(GpuMsg_Hang
)
312 // Tells the GPU process to disable the watchdog thread.
313 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog
)
315 //------------------------------------------------------------------------------
317 // These are messages to the browser.
319 // A renderer sends this when it wants to create a connection to the GPU
320 // process. The browser will create the GPU process if necessary, and will
321 // return a handle to the channel via a GpuChannelEstablished message.
322 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel
,
323 content::CauseForGpuLaunch
,
325 IPC::ChannelHandle
/* handle to channel */,
326 gpu::GPUInfo
/* stats about GPU process*/)
328 // A renderer sends this to the browser process when it wants to
329 // create a GL context associated with the given view_id.
330 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer
,
331 int32
, /* surface_id */
332 GPUCreateCommandBufferConfig
, /* init_params */
333 int32
, /* route_id */
334 bool /* succeeded */)
336 // Response from GPU to a GputMsg_Initialize message.
337 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized
,
339 ::gpu::GPUInfo
/* gpu_info */)
341 // Response from GPU to a GpuHostMsg_EstablishChannel message.
342 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished
,
343 IPC::ChannelHandle
/* channel_handle */)
345 // Message from GPU to notify to destroy the channel.
346 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel
,
347 int32
/* client_id */)
349 // Message to cache the given shader information.
350 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader
,
351 int32
/* client_id */,
352 std::string
/* key */,
353 std::string
/* shader */)
355 // Message to the GPU that a shader was loaded from disk.
356 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader
,
357 std::string
/* encoded shader */)
359 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
360 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated
,
361 bool /* succeeded */)
363 // Request from GPU to free the browser resources associated with the
365 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer
,
366 int32
/* surface_id */)
368 // Response from GPU to a GpuMsg_CreateImage message.
369 IPC_MESSAGE_CONTROL1(GpuHostMsg_ImageCreated
,
370 gfx::Size
/* size */)
372 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
373 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected
,
374 gpu::GPUInfo
/* GPU logging stats */)
376 // Response from GPU to a GpuMsg_GetVideoMemory.
377 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats
,
378 content::GPUVideoMemoryUsageStats
/* GPU memory stats */)
380 // Message from GPU to add a GPU log message to the about:gpu page.
381 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage
,
383 std::string
/* header */,
384 std::string
/* message */)
386 // Tells the browser that a new accelerated surface was initialized.
387 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized
,
388 int32
/* surface_id */,
389 int32
/* route_id */)
391 // Tells the browser that a frame with the specific latency info was drawn to
393 IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn
,
394 std::vector
<ui::LatencyInfo
> /* latency_info */)
396 // Same as above with a rect of the part of the surface that changed.
397 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped
,
398 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
400 // This message notifies the browser process that the renderer
401 // swapped a portion of the buffers associated with the given "window", which
402 // should cause the browser to redraw the compositor's contents.
403 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfacePostSubBuffer
,
404 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
)
406 // Tells the browser to release whatever resources are associated with
407 // the given surface. The browser must send an ACK once this operation
409 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceRelease
,
410 GpuHostMsg_AcceleratedSurfaceRelease_Params
)
412 // Tells the browser to release resources for the given surface until the next
413 // time swap buffers or post sub buffer is sent.
414 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSuspend
,
415 int32
/* surface_id */)
417 // Tells the browser about updated parameters for vsync alignment.
418 IPC_MESSAGE_CONTROL3(GpuHostMsg_UpdateVSyncParameters
,
419 int32
/* surface_id */,
420 base::TimeTicks
/* timebase */,
421 base::TimeDelta
/* interval */)
423 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext
,
426 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext
,
427 bool /* offscreen */,
428 gpu::error::ContextLostReason
/* reason */,
431 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext
,
434 // Tells the browser about GPU memory usage statistics for UMA logging.
435 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats
,
436 content::GPUMemoryUmaStats
/* GPU memory UMA stats */)
438 //------------------------------------------------------------------------------
439 // GPU Channel Messages
440 // These are messages from a renderer process to the GPU process.
442 // Tells the GPU process to create a new command buffer that renders to an
443 // offscreen frame buffer.
444 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer
,
445 gfx::Size
, /* size */
446 GPUCreateCommandBufferConfig
, /* init_params */
447 int32
, /* route_id */
448 bool /* succeeded */)
450 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
451 // destructor, so that the stub deletes the actual CommandBufferService
452 // object that it's hosting.
453 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer
,
454 int32
/* instance_id */)
456 // Sent by DevTools agent in the inspected renderer process to initiate GPU
457 // instrumentation events recording.
458 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_DevToolsStartEventsRecording
,
459 int32
, /* route_id */
460 bool /* succeeded */)
462 // The message is sent when DevTools want to stop events recording.
463 IPC_MESSAGE_CONTROL0(GpuChannelMsg_DevToolsStopEventsRecording
)
465 #if defined(OS_ANDROID)
466 //------------------------------------------------------------------------------
467 // Stream Texture Messages
468 // Tells the GPU process create and send the java surface texture object to
469 // the renderer process through the binder thread.
470 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer
,
471 int32
, /* primary_id */
472 int32
/* secondary_id */)
474 // Tells the GPU process to set the size of StreamTexture from the given
476 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize
,
477 gfx::Size
/* size */)
479 // Tells the service-side instance to start sending frame available
481 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening
)
483 // Inform the renderer that a new frame is available.
484 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable
)
486 // Inform the renderer process that the transform matrix has changed.
487 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged
,
488 GpuStreamTextureMsg_MatrixChanged_Params
/* params */)
491 //------------------------------------------------------------------------------
492 // GPU Command Buffer Messages
493 // These are messages between a renderer process to the GPU process relating to
494 // a single OpenGL context.
495 // Initialize a command buffer with the given number of command entries.
496 // Returns the shared memory handle for the command buffer mapped to the
498 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize
,
499 base::SharedMemoryHandle
/* shared_state */,
501 gpu::Capabilities
/* capabilities */)
503 // Sets the shared memory buffer used for commands.
504 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer
,
507 // Produces the front buffer into a mailbox. This allows another context to draw
508 // the output of this context.
509 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer
,
510 gpu::Mailbox
/* mailbox */)
512 // Wait until the token is in a specific range, inclusive.
513 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange
,
516 gpu::CommandBuffer::State
/* state */)
518 // Wait until the get offset is in a specific range, inclusive.
519 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange
,
522 gpu::CommandBuffer::State
/* state */)
524 // Asynchronously synchronize the put and get offsets of both processes.
525 // Caller passes its current put offset. Current state (including get offset)
526 // is returned in shared memory.
527 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_AsyncFlush
,
528 int32
/* put_offset */,
529 uint32
/* flush_count */)
531 // Sends information about the latency of the current frame to the GPU
533 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetLatencyInfo
,
534 std::vector
<ui::LatencyInfo
> /* latency_info */)
536 // Asynchronously process any commands known to the GPU process. This is only
537 // used in the event that a channel is unscheduled and needs to be flushed
538 // again to process any commands issued subsequent to unscheduling. The GPU
539 // process actually sends it (deferred) to itself.
540 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled
)
542 // Sent by the GPU process to display messages in the console.
543 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg
,
544 GPUCommandBufferConsoleMessage
/* msg */)
546 // Register an existing shared memory transfer buffer. The id that can be
547 // used to identify the transfer buffer from a command buffer.
548 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer
,
550 base::SharedMemoryHandle
/* transfer_buffer */,
553 // Destroy a previously created transfer buffer.
554 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer
,
557 // Create and initialize a hardware video decoder using the specified route_id.
558 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
560 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder
,
561 media::VideoCodecProfile
/* profile */,
562 int32
, /* route_id */
563 bool /* succeeded */)
565 // Create and initialize a hardware video encoder using the specified route_id.
566 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
568 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder
,
569 media::VideoFrame::Format
/* input_format */,
570 gfx::Size
/* input_visible_size */,
571 media::VideoCodecProfile
/* output_profile */,
572 uint32
/* initial_bitrate */,
573 int32
, /* route_id */
574 bool /* succeeded */)
576 // Tells the proxy that there was an error and the command buffer had to be
577 // destroyed for some reason.
578 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed
,
579 gpu::error::ContextLostReason
/* reason */)
581 // Request that the GPU process reply with the given message. Reply may be
583 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Echo
,
584 IPC::Message
/* reply */)
586 // Response to a GpuChannelMsg_Echo message.
587 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck
)
589 // Send to stub on surface visibility change.
590 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible
, bool /* visible */)
592 // Sent to proxy when the gpu memory manager changes its memory allocation.
593 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation
,
594 gpu::MemoryAllocation
/* allocation */)
596 // Sent to stub from the proxy with statistics on managed memory usage and
598 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SendClientManagedMemoryStats
,
599 gpu::ManagedMemoryStats
/* stats */)
601 // Sent to stub when proxy is assigned a memory allocation changed callback.
603 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback
,
604 bool /* has_callback */)
606 // Inserts a sync point into the channel. This is handled on the IO thread, so
607 // can be expected to be reasonably fast, but the sync point is actually
608 // retired in order with respect to the other calls. The sync point is shared
610 IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_InsertSyncPoint
,
611 uint32
/* sync_point */)
613 // Retires the sync point. Note: this message is not sent explicitly by the
614 // renderer, but is synthesized by the GPU process.
615 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint
,
616 uint32
/* sync_point */)
618 // Makes this command buffer signal when a sync point is reached, by sending
619 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
621 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint
,
622 uint32
/* sync_point */,
623 uint32
/* signal_id */)
625 // Response to GpuCommandBufferMsg_SignalSyncPoint.
626 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck
,
627 uint32
/* signal_id */)
629 // Makes this command buffer signal when a query is reached, by sending
630 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
632 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery
,
634 uint32
/* signal_id */)
636 // Register an existing gpu memory buffer. The id that can be
637 // used to identify the gpu memory buffer from a command buffer.
638 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_RegisterGpuMemoryBuffer
,
640 gfx::GpuMemoryBufferHandle
/* gpu_memory_buffer */,
643 uint32
/* internalformat */)
645 // Destroy a previously created gpu memory buffer.
646 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyGpuMemoryBuffer
,
649 // Attaches an external image stream to the client texture.
650 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture
,
651 uint32
, /* client_texture_id */
652 int32
, /* stream_id */
653 bool /* succeeded */)
655 //------------------------------------------------------------------------------
656 // Accelerated Video Decoder Messages
657 // These messages are sent from Renderer process to GPU process.
659 // Send input buffer for decoding.
660 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode
,
661 base::SharedMemoryHandle
, /* input_buffer_handle */
662 int32
, /* bitstream_buffer_id */
665 // Sent from Renderer process to the GPU process to give the texture IDs for
666 // the textures the decoder will use for output.
667 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers
,
668 std::vector
<int32
>, /* Picture buffer ID */
669 std::vector
<uint32
>) /* Texture ID */
671 // Send from Renderer process to the GPU process to recycle the given picture
672 // buffer for further decoding.
673 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer
,
674 int32
) /* Picture buffer ID */
676 // Send flush request to the decoder.
677 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush
)
679 // Send reset request to the decoder.
680 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset
)
682 // Send destroy request to the decoder.
683 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy
)
685 //------------------------------------------------------------------------------
686 // Accelerated Video Decoder Host Messages
687 // These messages are sent from GPU process to Renderer process.
688 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
691 // Accelerated video decoder has consumed input buffer from transfer buffer.
692 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed
,
693 int32
) /* Processed buffer ID */
695 // Allocate video frames for output of the hardware video decoder.
697 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers
,
698 int32
, /* Number of video frames to generate */
699 gfx::Size
, /* Requested size of buffer */
700 uint32
) /* Texture target */
702 // Decoder reports that a picture is ready and buffer does not need to be passed
703 // back to the decoder.
704 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer
,
705 int32
) /* Picture buffer ID */
707 // Decoder reports that a picture is ready.
708 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderHostMsg_PictureReady
,
709 int32
, /* Picture buffer ID */
710 int32
) /* Bitstream buffer ID */
712 // Confirm decoder has been flushed.
713 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone
)
715 // Confirm decoder has been reset.
716 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone
)
718 // Video decoder has encountered an error.
719 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification
,
720 uint32
) /* Error ID */
722 //------------------------------------------------------------------------------
723 // Accelerated Video Encoder Messages
724 // These messages are sent from the Renderer process to GPU process.
726 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
727 // AcceleratedVideoEncoderHostMsg_NotifyEncodeDone.
728 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Encode
,
729 int32
/* frame_id */,
730 base::SharedMemoryHandle
/* buffer_handle */,
731 uint32
/* buffer_size */,
732 bool /* force_keyframe */)
734 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
735 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
736 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer
,
737 int32
/* buffer_id */,
738 base::SharedMemoryHandle
/* buffer_handle */,
739 uint32
/* buffer_size */)
741 // Request a runtime encoding parameter change.
742 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange
,
743 uint32
/* bitrate */,
744 uint32
/* framerate */)
746 //------------------------------------------------------------------------------
747 // Accelerated Video Encoder Host Messages
748 // These messages are sent from GPU process to Renderer process.
750 // Notify renderer of the input/output buffer requirements of the encoder.
751 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers
,
752 uint32
/* input_count */,
753 gfx::Size
/* input_coded_size */,
754 uint32
/* output_buffer_size */)
756 // Notify the renderer that the encoder has finished using an input buffer.
757 // There is no congruent entry point in the media::VideoEncodeAccelerator
758 // interface, in VEA this same done condition is indicated by dropping the
759 // reference to the media::VideoFrame passed to VEA::Encode().
760 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone
,
761 int32
/* frame_id */)
763 // Notify the renderer that an output buffer has been filled with encoded data.
764 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady
,
765 int32
/* bitstream_buffer_id */,
766 uint32
/* payload_size */,
767 bool /* key_frame */)
769 // Report error condition.
770 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError
,
771 media::VideoEncodeAccelerator::Error
/* error */)
773 // Send destroy request to the encoder.
774 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy
)