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/content_param_traits.h"
14 #include "content/common/gpu/gpu_memory_uma_stats.h"
15 #include "content/common/gpu/gpu_process_launch_causes.h"
16 #include "content/common/gpu/gpu_result_codes.h"
17 #include "content/public/common/common_param_traits.h"
18 #include "content/public/common/gpu_memory_stats.h"
19 #include "gpu/command_buffer/common/capabilities.h"
20 #include "gpu/command_buffer/common/command_buffer.h"
21 #include "gpu/command_buffer/common/constants.h"
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
23 #include "gpu/command_buffer/common/mailbox.h"
24 #include "gpu/command_buffer/common/value_state.h"
25 #include "gpu/config/gpu_info.h"
26 #include "gpu/ipc/gpu_command_buffer_traits.h"
27 #include "ipc/ipc_channel_handle.h"
28 #include "ipc/ipc_message_macros.h"
29 #include "media/base/video_frame.h"
30 #include "media/video/video_decode_accelerator.h"
31 #include "media/video/video_encode_accelerator.h"
32 #include "ui/events/latency_info.h"
33 #include "ui/gfx/geometry/size.h"
34 #include "ui/gfx/gpu_memory_buffer.h"
35 #include "ui/gfx/native_widget_types.h"
36 #include "ui/gl/gpu_preference.h"
38 #if defined(OS_ANDROID)
39 #include "content/common/android/surface_texture_peer.h"
42 #undef IPC_MESSAGE_EXPORT
43 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
45 #define IPC_MESSAGE_START GpuMsgStart
47 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch
,
48 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM
- 1)
49 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult
,
50 content::CREATE_COMMAND_BUFFER_RESULT_LAST
)
51 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference
,
52 gfx::GpuPreferenceLast
)
53 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType
,
54 gfx::SURFACE_TYPE_LAST
)
55 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff
,
56 gpu::MemoryAllocation::CUTOFF_LAST
)
57 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error
, gpu::error::kErrorLast
)
58 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason
,
59 gpu::error::kContextLostReasonLast
)
60 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error
,
61 media::VideoEncodeAccelerator::kErrorMax
)
62 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format
,
63 media::VideoFrame::FORMAT_MAX
)
64 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile
,
65 media::VIDEO_CODEC_PROFILE_MIN
,
66 media::VIDEO_CODEC_PROFILE_MAX
)
67 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult
,
68 gpu::kCollectInfoNone
,
69 gpu::kCollectInfoFatalFailure
)
70 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile
,
71 gpu::VIDEO_CODEC_PROFILE_MIN
,
72 gpu::VIDEO_CODEC_PROFILE_MAX
)
74 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig
)
75 IPC_STRUCT_MEMBER(int32
, share_group_id
)
76 IPC_STRUCT_MEMBER(std::vector
<int>, attribs
)
77 IPC_STRUCT_MEMBER(GURL
, active_url
)
78 IPC_STRUCT_MEMBER(gfx::GpuPreference
, gpu_preference
)
81 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params
)
82 IPC_STRUCT_MEMBER(int32
, id
)
83 IPC_STRUCT_MEMBER(gfx::Size
, size
)
84 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Format
, format
)
85 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Usage
, usage
)
86 IPC_STRUCT_MEMBER(int32
, client_id
)
87 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle
, surface_handle
)
90 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
91 IPC_STRUCT_MEMBER(int32
, surface_id
)
92 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
93 IPC_STRUCT_MEMBER(int32
, route_id
)
94 IPC_STRUCT_MEMBER(gfx::Size
, size
)
95 IPC_STRUCT_MEMBER(float, scale_factor
)
96 IPC_STRUCT_MEMBER(std::vector
<ui::LatencyInfo
>, latency_info
)
99 #if defined(OS_MACOSX)
100 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params
)
101 // If the browser needs framerate throttling based on GPU back-pressure to be
102 // disabled (e.g, because the NSView isn't visible but tab capture is active),
103 // then this is set to true.
104 IPC_STRUCT_MEMBER(bool, disable_throttling
)
105 // If the browser is drawing to the screen, this is the CGL renderer ID of
106 // the GL context that the brower is using.
107 IPC_STRUCT_MEMBER(int32
, renderer_id
)
111 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage
)
112 IPC_STRUCT_MEMBER(int32
, id
)
113 IPC_STRUCT_MEMBER(std::string
, message
)
116 #if defined(OS_ANDROID)
117 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params
)
118 IPC_STRUCT_MEMBER(float, m00
)
119 IPC_STRUCT_MEMBER(float, m01
)
120 IPC_STRUCT_MEMBER(float, m02
)
121 IPC_STRUCT_MEMBER(float, m03
)
122 IPC_STRUCT_MEMBER(float, m10
)
123 IPC_STRUCT_MEMBER(float, m11
)
124 IPC_STRUCT_MEMBER(float, m12
)
125 IPC_STRUCT_MEMBER(float, m13
)
126 IPC_STRUCT_MEMBER(float, m20
)
127 IPC_STRUCT_MEMBER(float, m21
)
128 IPC_STRUCT_MEMBER(float, m22
)
129 IPC_STRUCT_MEMBER(float, m23
)
130 IPC_STRUCT_MEMBER(float, m30
)
131 IPC_STRUCT_MEMBER(float, m31
)
132 IPC_STRUCT_MEMBER(float, m32
)
133 IPC_STRUCT_MEMBER(float, m33
)
137 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode
)
138 IPC_STRUCT_TRAITS_MEMBER(values
)
139 IPC_STRUCT_TRAITS_MEMBER(children
)
140 IPC_STRUCT_TRAITS_END()
142 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice
)
143 IPC_STRUCT_TRAITS_MEMBER(vendor_id
)
144 IPC_STRUCT_TRAITS_MEMBER(device_id
)
145 IPC_STRUCT_TRAITS_MEMBER(active
)
146 IPC_STRUCT_TRAITS_MEMBER(vendor_string
)
147 IPC_STRUCT_TRAITS_MEMBER(device_string
)
148 IPC_STRUCT_TRAITS_END()
150 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile
)
151 IPC_STRUCT_TRAITS_MEMBER(profile
)
152 IPC_STRUCT_TRAITS_MEMBER(max_resolution
)
153 IPC_STRUCT_TRAITS_MEMBER(min_resolution
)
154 IPC_STRUCT_TRAITS_END()
156 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile
)
157 IPC_STRUCT_TRAITS_MEMBER(profile
)
158 IPC_STRUCT_TRAITS_MEMBER(max_resolution
)
159 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator
)
160 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator
)
161 IPC_STRUCT_TRAITS_END()
163 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo
)
164 IPC_STRUCT_TRAITS_MEMBER(initialization_time
)
165 IPC_STRUCT_TRAITS_MEMBER(optimus
)
166 IPC_STRUCT_TRAITS_MEMBER(amd_switchable
)
167 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute
)
168 IPC_STRUCT_TRAITS_MEMBER(gpu
)
169 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus
)
170 IPC_STRUCT_TRAITS_MEMBER(adapter_luid
)
171 IPC_STRUCT_TRAITS_MEMBER(driver_vendor
)
172 IPC_STRUCT_TRAITS_MEMBER(driver_version
)
173 IPC_STRUCT_TRAITS_MEMBER(driver_date
)
174 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version
)
175 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version
)
176 IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples
)
177 IPC_STRUCT_TRAITS_MEMBER(machine_model_name
)
178 IPC_STRUCT_TRAITS_MEMBER(machine_model_version
)
179 IPC_STRUCT_TRAITS_MEMBER(gl_version
)
180 IPC_STRUCT_TRAITS_MEMBER(gl_vendor
)
181 IPC_STRUCT_TRAITS_MEMBER(gl_renderer
)
182 IPC_STRUCT_TRAITS_MEMBER(gl_extensions
)
183 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor
)
184 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version
)
185 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions
)
186 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy
)
187 IPC_STRUCT_TRAITS_MEMBER(can_lose_context
)
188 IPC_STRUCT_TRAITS_MEMBER(software_rendering
)
189 IPC_STRUCT_TRAITS_MEMBER(direct_rendering
)
190 IPC_STRUCT_TRAITS_MEMBER(sandboxed
)
191 IPC_STRUCT_TRAITS_MEMBER(process_crash_count
)
192 IPC_STRUCT_TRAITS_MEMBER(basic_info_state
)
193 IPC_STRUCT_TRAITS_MEMBER(context_info_state
)
195 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state
)
196 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics
)
198 IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_supported_profiles
)
199 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles
)
200 IPC_STRUCT_TRAITS_END()
202 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats
)
203 IPC_STRUCT_TRAITS_MEMBER(video_memory
)
204 IPC_STRUCT_TRAITS_MEMBER(has_duplicates
)
205 IPC_STRUCT_TRAITS_END()
207 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats
)
208 IPC_STRUCT_TRAITS_MEMBER(process_map
)
209 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
210 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max
)
211 IPC_STRUCT_TRAITS_END()
213 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats
)
214 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current
)
215 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max
)
216 IPC_STRUCT_TRAITS_MEMBER(bytes_limit
)
217 IPC_STRUCT_TRAITS_END()
219 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation
)
220 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible
)
221 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible
)
222 IPC_STRUCT_TRAITS_END()
224 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle
)
225 IPC_STRUCT_TRAITS_MEMBER(handle
)
226 IPC_STRUCT_TRAITS_MEMBER(transport_type
)
227 IPC_STRUCT_TRAITS_MEMBER(parent_client_id
)
228 IPC_STRUCT_TRAITS_END()
230 //------------------------------------------------------------------------------
232 // These are messages from the browser to the GPU process.
234 // Tells the GPU process to initialize itself. The browser explicitly
235 // requests this be done so that we are guaranteed that the channel is set
236 // up between the browser and GPU process before doing any work that might
237 // potentially crash the GPU process. Detection of the child process
238 // exiting abruptly is predicated on having the IPC channel set up.
239 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize
)
241 // Tells the GPU process to create a new channel for communication with a
242 // given client. The channel name is returned in a
243 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
244 // the GPU process reuses an existing channel to that process if it exists.
245 // This ID is a unique opaque identifier generated by the browser process.
246 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel
,
248 bool /* share_context */,
249 bool /* allow_future_sync_points */)
251 // Tells the GPU process to close the channel identified by IPC channel
252 // handle. If no channel can be identified, do nothing.
253 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel
,
254 IPC::ChannelHandle
/* channel_handle */)
256 // Tells the GPU process to create a new command buffer that renders directly
257 // to a native view. A corresponding GpuCommandBufferStub is created.
258 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer
,
259 gfx::GLSurfaceHandle
, /* compositing_surface */
260 int32
, /* surface_id */
261 int32
, /* client_id */
262 GPUCreateCommandBufferConfig
, /* init_params */
263 int32
/* route_id */)
265 // Tells the GPU process to create a new gpu memory buffer.
266 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer
,
267 GpuMsg_CreateGpuMemoryBuffer_Params
)
269 // Tells the GPU process to destroy buffer.
270 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer
,
271 gfx::GpuMemoryBufferId
, /* id */
272 int32
, /* client_id */
273 int32
/* sync_point */)
275 // Tells the GPU process to create a context for collecting graphics card
277 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo
)
279 // Tells the GPU process to report video_memory information for the task manager
280 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats
)
282 #if defined(OS_MACOSX)
283 // Tells the GPU process that the browser process has handled the swap
284 // buffers or post sub-buffer request.
285 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented
,
286 AcceleratedSurfaceMsg_BufferPresented_Params
)
289 // Tells the GPU process to wake up the GPU because we're about to draw.
290 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu
)
292 // Tells the GPU process to remove all contexts.
293 IPC_MESSAGE_CONTROL0(GpuMsg_Clean
)
295 // Tells the GPU process to crash.
296 IPC_MESSAGE_CONTROL0(GpuMsg_Crash
)
298 // Tells the GPU process to hang.
299 IPC_MESSAGE_CONTROL0(GpuMsg_Hang
)
301 // Tells the GPU process to disable the watchdog thread.
302 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog
)
304 // Tells the GPU process that the browser has seen a GPU switch.
305 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched
)
307 // Tells the GPU process to delete the default_offscreen surface. It will also
308 // close the display and any other resources when the last GL surface is
309 // deleted. GPU process will respond with GphHosMsg_ResourcesRelinquished.
310 IPC_MESSAGE_CONTROL0(GpuMsg_RelinquishResources
)
312 // Sends an input event to the gpu service.
313 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState
,
315 unsigned int, /* target */
316 gpu::ValueState
/* valuestate */)
318 //------------------------------------------------------------------------------
320 // These are messages to the browser.
322 // A renderer sends this when it wants to create a connection to the GPU
323 // process. The browser will create the GPU process if necessary, and will
324 // return a handle to the channel via a GpuChannelEstablished message.
325 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel
,
326 content::CauseForGpuLaunch
,
328 IPC::ChannelHandle
/* handle to channel */,
329 gpu::GPUInfo
/* stats about GPU process*/)
331 // A renderer sends this to the browser process when it wants to
332 // create a GL context associated with the given view_id.
333 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer
,
334 int32
, /* surface_id */
335 GPUCreateCommandBufferConfig
, /* init_params */
336 int32
, /* route_id */
337 content::CreateCommandBufferResult
/* result */)
339 // Response from GPU to a GputMsg_Initialize message.
340 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized
,
342 ::gpu::GPUInfo
/* gpu_info */)
344 // Response from GPU to a GpuHostMsg_EstablishChannel message.
345 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished
,
346 IPC::ChannelHandle
/* channel_handle */)
348 // Message from GPU to notify to destroy the channel.
349 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel
,
350 int32
/* client_id */)
352 // Message to cache the given shader information.
353 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader
,
354 int32
/* client_id */,
355 std::string
/* key */,
356 std::string
/* shader */)
358 // Message to the GPU that a shader was loaded from disk.
359 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader
,
360 std::string
/* encoded shader */)
362 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
363 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated
,
364 content::CreateCommandBufferResult
/* result */)
366 // Request from GPU to free the browser resources associated with the
368 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer
,
369 int32
/* surface_id */)
371 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
372 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated
,
373 gfx::GpuMemoryBufferHandle
/* handle */)
375 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
376 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected
,
377 gpu::GPUInfo
/* GPU logging stats */)
379 // Response from GPU to a GpuMsg_GetVideoMemory.
380 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats
,
381 content::GPUVideoMemoryUsageStats
/* GPU memory stats */)
383 // Message from GPU to add a GPU log message to the about:gpu page.
384 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage
,
386 std::string
/* header */,
387 std::string
/* message */)
389 // Tells the browser that a new accelerated surface was initialized.
390 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized
,
391 int32
/* surface_id */,
392 int32
/* route_id */)
394 // Same as above with a rect of the part of the surface that changed.
395 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped
,
396 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
398 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext
,
401 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext
,
402 bool /* offscreen */,
403 gpu::error::ContextLostReason
/* reason */,
406 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext
,
409 // Tells the browser about GPU memory usage statistics for UMA logging.
410 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats
,
411 content::GPUMemoryUmaStats
/* GPU memory UMA stats */)
413 // Response to GpuMsg_RelinquishResources.
414 IPC_MESSAGE_CONTROL0(GpuHostMsg_ResourcesRelinquished
)
416 // Tells the browser that a context has subscribed to a new target and
417 // the browser should start sending the corresponding information
418 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription
,
419 int32
/* client_id */,
420 unsigned int /* target */)
422 // Tells the browser that no contexts are subscribed to the target anymore
423 // so the browser should stop sending the corresponding information
424 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription
,
425 int32
/* client_id */,
426 unsigned int /* target */)
428 //------------------------------------------------------------------------------
429 // GPU Channel Messages
430 // These are messages from a renderer process to the GPU process.
432 // Tells the GPU process to create a new command buffer that renders to an
433 // offscreen frame buffer.
434 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer
,
435 gfx::Size
, /* size */
436 GPUCreateCommandBufferConfig
, /* init_params */
437 int32
, /* route_id */
438 bool /* succeeded */)
440 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
441 // destructor, so that the stub deletes the actual CommandBufferService
442 // object that it's hosting.
443 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer
,
444 int32
/* instance_id */)
446 #if defined(OS_ANDROID)
447 //------------------------------------------------------------------------------
448 // Stream Texture Messages
449 // Tells the GPU process create and send the java surface texture object to
450 // the renderer process through the binder thread.
451 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer
,
452 int32
, /* primary_id */
453 int32
/* secondary_id */)
455 // Tells the GPU process to set the size of StreamTexture from the given
457 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize
,
458 gfx::Size
/* size */)
460 // Tells the service-side instance to start sending frame available
462 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening
)
464 // Inform the renderer that a new frame is available.
465 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable
)
467 // Inform the renderer process that the transform matrix has changed.
468 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged
,
469 GpuStreamTextureMsg_MatrixChanged_Params
/* params */)
472 //------------------------------------------------------------------------------
473 // GPU Command Buffer Messages
474 // These are messages between a renderer process to the GPU process relating to
475 // a single OpenGL context.
476 // Initialize a command buffer with the given number of command entries.
477 // Returns the shared memory handle for the command buffer mapped to the
479 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize
,
480 base::SharedMemoryHandle
/* shared_state */,
482 gpu::Capabilities
/* capabilities */)
484 // Sets the shared memory buffer used for commands.
485 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer
,
488 // Produces the front buffer into a mailbox. This allows another context to draw
489 // the output of this context.
490 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer
,
491 gpu::Mailbox
/* mailbox */)
493 // Wait until the token is in a specific range, inclusive.
494 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange
,
497 gpu::CommandBuffer::State
/* state */)
499 // Wait until the get offset is in a specific range, inclusive.
500 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange
,
503 gpu::CommandBuffer::State
/* state */)
505 // Asynchronously synchronize the put and get offsets of both processes.
506 // Caller passes its current put offset. Current state (including get offset)
507 // is returned in shared memory. The input latency info for the current
508 // frame is also sent to the GPU process.
509 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush
,
510 int32
/* put_offset */,
511 uint32
/* flush_count */,
512 std::vector
<ui::LatencyInfo
> /* latency_info */)
514 // Asynchronously process any commands known to the GPU process. This is only
515 // used in the event that a channel is unscheduled and needs to be flushed
516 // again to process any commands issued subsequent to unscheduling. The GPU
517 // process actually sends it (deferred) to itself.
518 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled
)
520 // Sent by the GPU process to display messages in the console.
521 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg
,
522 GPUCommandBufferConsoleMessage
/* msg */)
524 // Register an existing shared memory transfer buffer. The id that can be
525 // used to identify the transfer buffer from a command buffer.
526 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer
,
528 base::SharedMemoryHandle
/* transfer_buffer */,
531 // Destroy a previously created transfer buffer.
532 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer
,
535 // Create and initialize a hardware video decoder using the specified route_id.
536 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
538 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder
,
539 media::VideoCodecProfile
/* profile */,
540 int32
, /* route_id */
541 bool /* succeeded */)
543 // Create and initialize a hardware video encoder using the specified route_id.
544 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
546 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder
,
547 media::VideoFrame::Format
/* input_format */,
548 gfx::Size
/* input_visible_size */,
549 media::VideoCodecProfile
/* output_profile */,
550 uint32
/* initial_bitrate */,
551 int32
, /* route_id */
552 bool /* succeeded */)
554 // Tells the proxy that there was an error and the command buffer had to be
555 // destroyed for some reason.
556 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed
,
557 gpu::error::ContextLostReason
, /* reason */
558 gpu::error::Error
/* error */)
560 // Tells the browser that SwapBuffers returned and passes latency info
561 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted
,
562 std::vector
<ui::LatencyInfo
> /* latency_info */)
564 // Tells the browser about updated parameters for vsync alignment.
565 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters
,
566 base::TimeTicks
/* timebase */,
567 base::TimeDelta
/* interval */)
569 // Send to stub on surface visibility change.
570 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible
, bool /* visible */)
572 // Sent to proxy when the gpu memory manager changes its memory allocation.
573 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation
,
574 gpu::MemoryAllocation
/* allocation */)
576 // Sent to stub when proxy is assigned a memory allocation changed callback.
578 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback
,
579 bool /* has_callback */)
581 // Inserts a sync point into the channel. This is handled on the IO thread, so
582 // can be expected to be reasonably fast, but the sync point is actually
583 // retired in order with respect to the other calls. The sync point is shared
585 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint
,
587 uint32
/* sync_point */)
589 // Retires the sync point. Note: this message is not sent explicitly by the
590 // renderer, but is synthesized by the GPU process.
591 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint
,
592 uint32
/* sync_point */)
594 // Makes this command buffer signal when a sync point is reached, by sending
595 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
597 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint
,
598 uint32
/* sync_point */,
599 uint32
/* signal_id */)
601 // Response to GpuCommandBufferMsg_SignalSyncPoint.
602 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck
,
603 uint32
/* signal_id */)
605 // Makes this command buffer signal when a query is reached, by sending
606 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
608 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery
,
610 uint32
/* signal_id */)
612 // Create an image from an existing gpu memory buffer. The id that can be
613 // used to identify the image from a command buffer.
614 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage
,
616 gfx::GpuMemoryBufferHandle
/* gpu_memory_buffer */,
617 gfx::Size
/* size */,
618 gfx::GpuMemoryBuffer::Format
/* format */,
619 uint32
/* internalformat */)
621 // Destroy a previously created image.
622 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage
,
625 // Attaches an external image stream to the client texture.
626 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture
,
627 uint32
, /* client_texture_id */
628 int32
, /* stream_id */
629 bool /* succeeded */)
631 //------------------------------------------------------------------------------
632 // Accelerated Video Decoder Messages
633 // These messages are sent from Renderer process to GPU process.
635 // Send input buffer for decoding.
636 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode
,
637 base::SharedMemoryHandle
, /* input_buffer_handle */
638 int32
, /* bitstream_buffer_id */
641 // Sent from Renderer process to the GPU process to give the texture IDs for
642 // the textures the decoder will use for output.
643 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers
,
644 std::vector
<int32
>, /* Picture buffer ID */
645 std::vector
<uint32
>) /* Texture ID */
647 // Send from Renderer process to the GPU process to recycle the given picture
648 // buffer for further decoding.
649 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer
,
650 int32
) /* Picture buffer ID */
652 // Send flush request to the decoder.
653 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush
)
655 // Send reset request to the decoder.
656 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset
)
658 // Send destroy request to the decoder.
659 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy
)
661 //------------------------------------------------------------------------------
662 // Accelerated Video Decoder Host Messages
663 // These messages are sent from GPU process to Renderer process.
664 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
667 // Accelerated video decoder has consumed input buffer from transfer buffer.
668 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed
,
669 int32
) /* Processed buffer ID */
671 // Allocate video frames for output of the hardware video decoder.
673 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers
,
674 int32
, /* Number of video frames to generate */
675 gfx::Size
, /* Requested size of buffer */
676 uint32
) /* Texture target */
678 // Decoder reports that a picture is ready and buffer does not need to be passed
679 // back to the decoder.
680 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer
,
681 int32
) /* Picture buffer ID */
683 // Decoder reports that a picture is ready.
684 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady
,
685 int32
, /* Picture buffer ID */
686 int32
, /* Bitstream buffer ID */
687 gfx::Rect
, /* Visible rectangle */
688 bool) /* Buffer is HW overlay capable */
690 // Confirm decoder has been flushed.
691 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone
)
693 // Confirm decoder has been reset.
694 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone
)
696 // Video decoder has encountered an error.
697 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification
,
698 uint32
) /* Error ID */
700 //------------------------------------------------------------------------------
701 // Accelerated Video Encoder Messages
702 // These messages are sent from the Renderer process to GPU process.
704 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
705 // AcceleratedVideoEncoderHostMsg_NotifyInputDone.
706 IPC_MESSAGE_ROUTED5(AcceleratedVideoEncoderMsg_Encode
,
707 int32
/* frame_id */,
708 base::SharedMemoryHandle
/* buffer_handle */,
709 uint32
/* buffer_offset */,
710 uint32
/* buffer_size */,
711 bool /* force_keyframe */)
713 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
714 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
715 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer
,
716 int32
/* buffer_id */,
717 base::SharedMemoryHandle
/* buffer_handle */,
718 uint32
/* buffer_size */)
720 // Request a runtime encoding parameter change.
721 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange
,
722 uint32
/* bitrate */,
723 uint32
/* framerate */)
725 //------------------------------------------------------------------------------
726 // Accelerated Video Encoder Host Messages
727 // These messages are sent from GPU process to Renderer process.
729 // Notify renderer of the input/output buffer requirements of the encoder.
730 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers
,
731 uint32
/* input_count */,
732 gfx::Size
/* input_coded_size */,
733 uint32
/* output_buffer_size */)
735 // Notify the renderer that the encoder has finished using an input buffer.
736 // There is no congruent entry point in the media::VideoEncodeAccelerator
737 // interface, in VEA this same done condition is indicated by dropping the
738 // reference to the media::VideoFrame passed to VEA::Encode().
739 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone
,
740 int32
/* frame_id */)
742 // Notify the renderer that an output buffer has been filled with encoded data.
743 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady
,
744 int32
/* bitstream_buffer_id */,
745 uint32
/* payload_size */,
746 bool /* key_frame */)
748 // Report error condition.
749 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError
,
750 media::VideoEncodeAccelerator::Error
/* error */)
752 // Send destroy request to the encoder.
753 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy
)