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_types.h"
30 #include "media/video/jpeg_decode_accelerator.h"
31 #include "media/video/video_decode_accelerator.h"
32 #include "media/video/video_encode_accelerator.h"
33 #include "ui/events/latency_info.h"
34 #include "ui/gfx/geometry/size.h"
35 #include "ui/gfx/gpu_memory_buffer.h"
36 #include "ui/gfx/native_widget_types.h"
37 #include "ui/gfx/swap_result.h"
38 #include "ui/gl/gpu_preference.h"
40 #if defined(OS_ANDROID)
41 #include "content/common/android/surface_texture_peer.h"
44 #undef IPC_MESSAGE_EXPORT
45 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
47 #define IPC_MESSAGE_START GpuMsgStart
49 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch
,
50 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM
- 1)
51 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult
,
52 content::CREATE_COMMAND_BUFFER_RESULT_LAST
)
53 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference
,
54 gfx::GpuPreferenceLast
)
55 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType
,
56 gfx::SURFACE_TYPE_LAST
)
57 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult
, gfx::SwapResult::SWAP_RESULT_LAST
)
58 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff
,
59 gpu::MemoryAllocation::CUTOFF_LAST
)
60 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error
, gpu::error::kErrorLast
)
61 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason
,
62 gpu::error::kContextLostReasonLast
)
63 IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error
,
64 media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM
)
65 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error
,
66 media::VideoEncodeAccelerator::kErrorMax
)
67 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile
,
68 media::VIDEO_CODEC_PROFILE_MIN
,
69 media::VIDEO_CODEC_PROFILE_MAX
)
70 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult
,
71 gpu::kCollectInfoNone
,
72 gpu::kCollectInfoFatalFailure
)
73 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile
,
74 gpu::VIDEO_CODEC_PROFILE_MIN
,
75 gpu::VIDEO_CODEC_PROFILE_MAX
)
77 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig
)
78 IPC_STRUCT_MEMBER(int32
, share_group_id
)
79 IPC_STRUCT_MEMBER(std::vector
<int>, attribs
)
80 IPC_STRUCT_MEMBER(GURL
, active_url
)
81 IPC_STRUCT_MEMBER(gfx::GpuPreference
, gpu_preference
)
84 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params
)
85 IPC_STRUCT_MEMBER(int32
, id
)
86 IPC_STRUCT_MEMBER(gfx::Size
, size
)
87 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Format
, format
)
88 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Usage
, usage
)
89 IPC_STRUCT_MEMBER(int32
, client_id
)
90 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle
, surface_handle
)
93 #if defined(OS_MACOSX)
94 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
95 IPC_STRUCT_MEMBER(int32
, surface_id
)
96 IPC_STRUCT_MEMBER(uint64
, surface_handle
)
97 IPC_STRUCT_MEMBER(int32
, route_id
)
98 IPC_STRUCT_MEMBER(gfx::Size
, size
)
99 IPC_STRUCT_MEMBER(gfx::Rect
, damage_rect
)
100 IPC_STRUCT_MEMBER(float, scale_factor
)
101 IPC_STRUCT_MEMBER(std::vector
<ui::LatencyInfo
>, latency_info
)
104 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params
)
105 // If the browser needs framerate throttling based on GPU back-pressure to be
106 // disabled (e.g, because the NSView isn't visible but tab capture is active),
107 // then this is set to true.
108 IPC_STRUCT_MEMBER(bool, disable_throttling
)
109 // If the browser is drawing to the screen, this is the CGL renderer ID of
110 // the GL context that the brower is using.
111 IPC_STRUCT_MEMBER(int32
, renderer_id
)
115 IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params
)
116 IPC_STRUCT_MEMBER(int32
, input_buffer_id
)
117 IPC_STRUCT_MEMBER(gfx::Size
, coded_size
)
118 IPC_STRUCT_MEMBER(base::SharedMemoryHandle
, input_buffer_handle
)
119 IPC_STRUCT_MEMBER(uint32
, input_buffer_size
)
120 IPC_STRUCT_MEMBER(base::SharedMemoryHandle
, output_video_frame_handle
)
121 IPC_STRUCT_MEMBER(uint32
, output_buffer_size
)
124 IPC_STRUCT_BEGIN(AcceleratedVideoEncoderMsg_Encode_Params
)
125 IPC_STRUCT_MEMBER(int32_t, frame_id
)
126 IPC_STRUCT_MEMBER(base::SharedMemoryHandle
, buffer_handle
)
127 IPC_STRUCT_MEMBER(uint32_t, buffer_offset
)
128 IPC_STRUCT_MEMBER(uint32_t, buffer_size
)
129 IPC_STRUCT_MEMBER(bool, force_keyframe
)
132 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage
)
133 IPC_STRUCT_MEMBER(int32
, id
)
134 IPC_STRUCT_MEMBER(std::string
, message
)
137 #if defined(OS_ANDROID)
138 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params
)
139 IPC_STRUCT_MEMBER(float, m00
)
140 IPC_STRUCT_MEMBER(float, m01
)
141 IPC_STRUCT_MEMBER(float, m02
)
142 IPC_STRUCT_MEMBER(float, m03
)
143 IPC_STRUCT_MEMBER(float, m10
)
144 IPC_STRUCT_MEMBER(float, m11
)
145 IPC_STRUCT_MEMBER(float, m12
)
146 IPC_STRUCT_MEMBER(float, m13
)
147 IPC_STRUCT_MEMBER(float, m20
)
148 IPC_STRUCT_MEMBER(float, m21
)
149 IPC_STRUCT_MEMBER(float, m22
)
150 IPC_STRUCT_MEMBER(float, m23
)
151 IPC_STRUCT_MEMBER(float, m30
)
152 IPC_STRUCT_MEMBER(float, m31
)
153 IPC_STRUCT_MEMBER(float, m32
)
154 IPC_STRUCT_MEMBER(float, m33
)
158 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode
)
159 IPC_STRUCT_TRAITS_MEMBER(values
)
160 IPC_STRUCT_TRAITS_MEMBER(children
)
161 IPC_STRUCT_TRAITS_END()
163 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice
)
164 IPC_STRUCT_TRAITS_MEMBER(vendor_id
)
165 IPC_STRUCT_TRAITS_MEMBER(device_id
)
166 IPC_STRUCT_TRAITS_MEMBER(active
)
167 IPC_STRUCT_TRAITS_MEMBER(vendor_string
)
168 IPC_STRUCT_TRAITS_MEMBER(device_string
)
169 IPC_STRUCT_TRAITS_END()
171 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile
)
172 IPC_STRUCT_TRAITS_MEMBER(profile
)
173 IPC_STRUCT_TRAITS_MEMBER(max_resolution
)
174 IPC_STRUCT_TRAITS_MEMBER(min_resolution
)
175 IPC_STRUCT_TRAITS_END()
177 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile
)
178 IPC_STRUCT_TRAITS_MEMBER(profile
)
179 IPC_STRUCT_TRAITS_MEMBER(max_resolution
)
180 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator
)
181 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator
)
182 IPC_STRUCT_TRAITS_END()
184 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo
)
185 IPC_STRUCT_TRAITS_MEMBER(initialization_time
)
186 IPC_STRUCT_TRAITS_MEMBER(optimus
)
187 IPC_STRUCT_TRAITS_MEMBER(amd_switchable
)
188 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute
)
189 IPC_STRUCT_TRAITS_MEMBER(gpu
)
190 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus
)
191 IPC_STRUCT_TRAITS_MEMBER(adapter_luid
)
192 IPC_STRUCT_TRAITS_MEMBER(driver_vendor
)
193 IPC_STRUCT_TRAITS_MEMBER(driver_version
)
194 IPC_STRUCT_TRAITS_MEMBER(driver_date
)
195 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version
)
196 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version
)
197 IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples
)
198 IPC_STRUCT_TRAITS_MEMBER(machine_model_name
)
199 IPC_STRUCT_TRAITS_MEMBER(machine_model_version
)
200 IPC_STRUCT_TRAITS_MEMBER(gl_version
)
201 IPC_STRUCT_TRAITS_MEMBER(gl_vendor
)
202 IPC_STRUCT_TRAITS_MEMBER(gl_renderer
)
203 IPC_STRUCT_TRAITS_MEMBER(gl_extensions
)
204 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor
)
205 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version
)
206 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions
)
207 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy
)
208 IPC_STRUCT_TRAITS_MEMBER(can_lose_context
)
209 IPC_STRUCT_TRAITS_MEMBER(software_rendering
)
210 IPC_STRUCT_TRAITS_MEMBER(direct_rendering
)
211 IPC_STRUCT_TRAITS_MEMBER(sandboxed
)
212 IPC_STRUCT_TRAITS_MEMBER(process_crash_count
)
213 IPC_STRUCT_TRAITS_MEMBER(in_process_gpu
)
214 IPC_STRUCT_TRAITS_MEMBER(basic_info_state
)
215 IPC_STRUCT_TRAITS_MEMBER(context_info_state
)
217 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state
)
218 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics
)
220 IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_supported_profiles
)
221 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles
)
222 IPC_STRUCT_TRAITS_MEMBER(jpeg_decode_accelerator_supported
)
223 IPC_STRUCT_TRAITS_END()
225 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats
)
226 IPC_STRUCT_TRAITS_MEMBER(video_memory
)
227 IPC_STRUCT_TRAITS_MEMBER(has_duplicates
)
228 IPC_STRUCT_TRAITS_END()
230 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats
)
231 IPC_STRUCT_TRAITS_MEMBER(process_map
)
232 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
233 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max
)
234 IPC_STRUCT_TRAITS_END()
236 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats
)
237 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current
)
238 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max
)
239 IPC_STRUCT_TRAITS_MEMBER(bytes_limit
)
240 IPC_STRUCT_TRAITS_END()
242 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation
)
243 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible
)
244 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible
)
245 IPC_STRUCT_TRAITS_END()
247 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle
)
248 IPC_STRUCT_TRAITS_MEMBER(handle
)
249 IPC_STRUCT_TRAITS_MEMBER(transport_type
)
250 IPC_STRUCT_TRAITS_MEMBER(parent_client_id
)
251 IPC_STRUCT_TRAITS_END()
253 //------------------------------------------------------------------------------
255 // These are messages from the browser to the GPU process.
257 // Tells the GPU process to initialize itself. The browser explicitly
258 // requests this be done so that we are guaranteed that the channel is set
259 // up between the browser and GPU process before doing any work that might
260 // potentially crash the GPU process. Detection of the child process
261 // exiting abruptly is predicated on having the IPC channel set up.
262 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize
)
264 // Tells the GPU process to create a new channel for communication with a
265 // given client. The channel name is returned in a
266 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
267 // the GPU process reuses an existing channel to that process if it exists.
268 // This ID is a unique opaque identifier generated by the browser process.
269 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel
,
271 bool /* share_context */,
272 bool /* allow_future_sync_points */)
274 // Tells the GPU process to close the channel identified by IPC channel
275 // handle. If no channel can be identified, do nothing.
276 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel
,
277 IPC::ChannelHandle
/* channel_handle */)
279 // Tells the GPU process to create a new command buffer that renders directly
280 // to a native view. A corresponding GpuCommandBufferStub is created.
281 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer
,
282 gfx::GLSurfaceHandle
, /* compositing_surface */
283 int32
, /* surface_id */
284 int32
, /* client_id */
285 GPUCreateCommandBufferConfig
, /* init_params */
286 int32
/* route_id */)
288 // Tells the GPU process to create a new gpu memory buffer.
289 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer
,
290 GpuMsg_CreateGpuMemoryBuffer_Params
)
292 // Tells the GPU process to destroy buffer.
293 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer
,
294 gfx::GpuMemoryBufferId
, /* id */
295 int32
, /* client_id */
296 int32
/* sync_point */)
298 // Create and initialize a hardware jpeg decoder using the specified route_id.
299 // Created decoders should be freed with AcceleratedJpegDecoderMsg_Destroy when
301 IPC_SYNC_MESSAGE_CONTROL1_1(GpuMsg_CreateJpegDecoder
,
302 int32
/* route_id */,
303 bool /* succeeded */)
305 // Tells the GPU process to create a context for collecting graphics card
307 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo
)
309 // Tells the GPU process to report video_memory information for the task manager
310 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats
)
312 #if defined(OS_MACOSX)
313 // Tells the GPU process that the browser process has handled the swap
314 // buffers or post sub-buffer request.
315 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented
,
316 AcceleratedSurfaceMsg_BufferPresented_Params
)
319 // Tells the GPU process to wake up the GPU because we're about to draw.
320 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu
)
322 // Tells the GPU process to remove all contexts.
323 IPC_MESSAGE_CONTROL0(GpuMsg_Clean
)
325 // Tells the GPU process to crash.
326 IPC_MESSAGE_CONTROL0(GpuMsg_Crash
)
328 // Tells the GPU process to hang.
329 IPC_MESSAGE_CONTROL0(GpuMsg_Hang
)
331 // Tells the GPU process to disable the watchdog thread.
332 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog
)
334 // Tells the GPU process that the browser has seen a GPU switch.
335 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched
)
337 // Tells the GPU process to delete the default_offscreen surface. It will also
338 // close the display and any other resources when the last GL surface is
339 // deleted. GPU process will respond with GphHosMsg_ResourcesRelinquished.
340 IPC_MESSAGE_CONTROL0(GpuMsg_RelinquishResources
)
342 // Sends an input event to the gpu service.
343 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState
,
345 unsigned int, /* target */
346 gpu::ValueState
/* valuestate */)
348 //------------------------------------------------------------------------------
350 // These are messages to the browser.
352 // A renderer sends this when it wants to create a connection to the GPU
353 // process. The browser will create the GPU process if necessary, and will
354 // return a handle to the channel via a GpuChannelEstablished message.
355 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel
,
356 content::CauseForGpuLaunch
,
358 IPC::ChannelHandle
/* handle to channel */,
359 gpu::GPUInfo
/* stats about GPU process*/)
361 // A renderer sends this to the browser process when it wants to
362 // create a GL context associated with the given view_id.
363 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer
,
364 int32
, /* surface_id */
365 GPUCreateCommandBufferConfig
, /* init_params */
366 int32
, /* route_id */
367 content::CreateCommandBufferResult
/* result */)
369 // Response from GPU to a GputMsg_Initialize message.
370 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized
,
372 ::gpu::GPUInfo
/* gpu_info */)
374 // Response from GPU to a GpuHostMsg_EstablishChannel message.
375 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished
,
376 IPC::ChannelHandle
/* channel_handle */)
378 // Message from GPU to notify to destroy the channel.
379 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel
,
380 int32
/* client_id */)
382 // Message to cache the given shader information.
383 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader
,
384 int32
/* client_id */,
385 std::string
/* key */,
386 std::string
/* shader */)
388 // Message to the GPU that a shader was loaded from disk.
389 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader
,
390 std::string
/* encoded shader */)
392 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
393 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated
,
394 content::CreateCommandBufferResult
/* result */)
396 // Request from GPU to free the browser resources associated with the
398 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer
,
399 int32
/* surface_id */)
401 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
402 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated
,
403 gfx::GpuMemoryBufferHandle
/* handle */)
405 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
406 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected
,
407 gpu::GPUInfo
/* GPU logging stats */)
409 // Response from GPU to a GpuMsg_GetVideoMemory.
410 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats
,
411 content::GPUVideoMemoryUsageStats
/* GPU memory stats */)
413 // Message from GPU to add a GPU log message to the about:gpu page.
414 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage
,
416 std::string
/* header */,
417 std::string
/* message */)
419 // Tells the browser that a new accelerated surface was initialized.
420 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized
,
421 int32
/* surface_id */,
422 int32
/* route_id */)
425 #if defined(OS_MACOSX)
426 // Tells the browser that an accelerated surface has swapped.
427 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped
,
428 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
431 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext
,
434 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext
,
435 bool /* offscreen */,
436 gpu::error::ContextLostReason
/* reason */,
439 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext
,
442 // Tells the browser about GPU memory usage statistics for UMA logging.
443 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats
,
444 content::GPUMemoryUmaStats
/* GPU memory UMA stats */)
446 // Response to GpuMsg_RelinquishResources.
447 IPC_MESSAGE_CONTROL0(GpuHostMsg_ResourcesRelinquished
)
449 // Tells the browser that a context has subscribed to a new target and
450 // the browser should start sending the corresponding information
451 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription
,
452 int32
/* client_id */,
453 unsigned int /* target */)
455 // Tells the browser that no contexts are subscribed to the target anymore
456 // so the browser should stop sending the corresponding information
457 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription
,
458 int32
/* client_id */,
459 unsigned int /* target */)
461 //------------------------------------------------------------------------------
462 // GPU Channel Messages
463 // These are messages from a renderer process to the GPU process.
465 // Tells the GPU process to create a new command buffer that renders to an
466 // offscreen frame buffer.
467 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer
,
468 gfx::Size
, /* size */
469 GPUCreateCommandBufferConfig
, /* init_params */
470 int32
, /* route_id */
471 bool /* succeeded */)
473 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
474 // destructor, so that the stub deletes the actual CommandBufferService
475 // object that it's hosting.
476 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer
,
477 int32
/* instance_id */)
479 #if defined(OS_ANDROID)
480 //------------------------------------------------------------------------------
481 // Stream Texture Messages
482 // Tells the GPU process create and send the java surface texture object to
483 // the renderer process through the binder thread.
484 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer
,
485 int32
, /* primary_id */
486 int32
/* secondary_id */)
488 // Tells the GPU process to set the size of StreamTexture from the given
490 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize
,
491 gfx::Size
/* size */)
493 // Tells the service-side instance to start sending frame available
495 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening
)
497 // Inform the renderer that a new frame is available.
498 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable
)
500 // Inform the renderer process that the transform matrix has changed.
501 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged
,
502 GpuStreamTextureMsg_MatrixChanged_Params
/* params */)
505 //------------------------------------------------------------------------------
506 // GPU Command Buffer Messages
507 // These are messages between a renderer process to the GPU process relating to
508 // a single OpenGL context.
509 // Initialize a command buffer with the given number of command entries.
510 // Returns the shared memory handle for the command buffer mapped to the
512 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize
,
513 base::SharedMemoryHandle
/* shared_state */,
515 gpu::Capabilities
/* capabilities */)
517 // Sets the shared memory buffer used for commands.
518 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer
,
521 // Produces the front buffer into a mailbox. This allows another context to draw
522 // the output of this context.
523 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer
,
524 gpu::Mailbox
/* mailbox */)
526 // Wait until the token is in a specific range, inclusive.
527 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange
,
530 gpu::CommandBuffer::State
/* state */)
532 // Wait until the get offset is in a specific range, inclusive.
533 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange
,
536 gpu::CommandBuffer::State
/* state */)
538 // Asynchronously synchronize the put and get offsets of both processes.
539 // Caller passes its current put offset. Current state (including get offset)
540 // is returned in shared memory. The input latency info for the current
541 // frame is also sent to the GPU process.
542 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush
,
543 int32
/* put_offset */,
544 uint32
/* flush_count */,
545 std::vector
<ui::LatencyInfo
> /* latency_info */)
547 // Asynchronously process any commands known to the GPU process. This is only
548 // used in the event that a channel is unscheduled and needs to be flushed
549 // again to process any commands issued subsequent to unscheduling. The GPU
550 // process actually sends it (deferred) to itself.
551 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled
)
553 // Sent by the GPU process to display messages in the console.
554 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg
,
555 GPUCommandBufferConsoleMessage
/* msg */)
557 // Register an existing shared memory transfer buffer. The id that can be
558 // used to identify the transfer buffer from a command buffer.
559 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer
,
561 base::SharedMemoryHandle
/* transfer_buffer */,
564 // Destroy a previously created transfer buffer.
565 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer
,
568 // Create and initialize a hardware video decoder using the specified route_id.
569 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
571 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder
,
572 media::VideoCodecProfile
/* profile */,
573 int32
, /* route_id */
574 bool /* succeeded */)
576 // Create and initialize a hardware video encoder using the specified route_id.
577 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
579 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder
,
580 media::VideoPixelFormat
/* input_format */,
581 gfx::Size
/* input_visible_size */,
582 media::VideoCodecProfile
/* output_profile */,
583 uint32
/* initial_bitrate */,
584 int32
, /* route_id */
585 bool /* succeeded */)
587 // Tells the proxy that there was an error and the command buffer had to be
588 // destroyed for some reason.
589 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed
,
590 gpu::error::ContextLostReason
, /* reason */
591 gpu::error::Error
/* error */)
593 // Tells the browser that SwapBuffers returned and passes latency info
594 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted
,
595 std::vector
<ui::LatencyInfo
> /* latency_info */,
596 gfx::SwapResult
/* result */)
598 // Tells the browser about updated parameters for vsync alignment.
599 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters
,
600 base::TimeTicks
/* timebase */,
601 base::TimeDelta
/* interval */)
603 // Send to stub on surface visibility change.
604 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible
, bool /* visible */)
606 // Sent to proxy when the gpu memory manager changes its memory allocation.
607 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation
,
608 gpu::MemoryAllocation
/* allocation */)
610 // Sent to stub when proxy is assigned a memory allocation changed callback.
612 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback
,
613 bool /* has_callback */)
615 // Inserts a sync point into the channel. This is handled on the IO thread, so
616 // can be expected to be reasonably fast, but the sync point is actually
617 // retired in order with respect to the other calls. The sync point is shared
619 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint
,
621 uint32
/* sync_point */)
623 // Retires the sync point. Note: this message is not sent explicitly by the
624 // renderer, but is synthesized by the GPU process.
625 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint
,
626 uint32
/* sync_point */)
628 // Makes this command buffer signal when a sync point is reached, by sending
629 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
631 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint
,
632 uint32
/* sync_point */,
633 uint32
/* signal_id */)
635 // Response to GpuCommandBufferMsg_SignalSyncPoint.
636 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck
,
637 uint32
/* signal_id */)
639 // Makes this command buffer signal when a query is reached, by sending
640 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
642 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery
,
644 uint32
/* signal_id */)
646 // Create an image from an existing gpu memory buffer. The id that can be
647 // used to identify the image from a command buffer.
648 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage
,
650 gfx::GpuMemoryBufferHandle
/* gpu_memory_buffer */,
651 gfx::Size
/* size */,
652 gfx::GpuMemoryBuffer::Format
/* format */,
653 uint32
/* internalformat */)
655 // Destroy a previously created image.
656 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage
,
659 // Attaches an external image stream to the client texture.
660 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture
,
661 uint32
, /* client_texture_id */
662 int32
, /* stream_id */
663 bool /* succeeded */)
665 //------------------------------------------------------------------------------
666 // Accelerated Video Decoder Messages
667 // These messages are sent from Renderer process to GPU process.
669 // Send input buffer for decoding.
670 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode
,
671 base::SharedMemoryHandle
, /* input_buffer_handle */
672 int32
, /* bitstream_buffer_id */
675 // Sent from Renderer process to the GPU process to give the texture IDs for
676 // the textures the decoder will use for output.
677 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers
,
678 std::vector
<int32
>, /* Picture buffer ID */
679 std::vector
<uint32
>) /* Texture ID */
681 // Send from Renderer process to the GPU process to recycle the given picture
682 // buffer for further decoding.
683 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer
,
684 int32
) /* Picture buffer ID */
686 // Send flush request to the decoder.
687 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush
)
689 // Send reset request to the decoder.
690 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset
)
692 // Send destroy request to the decoder.
693 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy
)
695 //------------------------------------------------------------------------------
696 // Accelerated Video Decoder Host Messages
697 // These messages are sent from GPU process to Renderer process.
698 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
701 // Accelerated video decoder has consumed input buffer from transfer buffer.
702 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed
,
703 int32
) /* Processed buffer ID */
705 // Allocate video frames for output of the hardware video decoder.
707 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers
,
708 int32
, /* Number of video frames to generate */
709 gfx::Size
, /* Requested size of buffer */
710 uint32
) /* Texture target */
712 // Decoder reports that a picture is ready and buffer does not need to be passed
713 // back to the decoder.
714 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer
,
715 int32
) /* Picture buffer ID */
717 // Decoder reports that a picture is ready.
718 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady
,
719 int32
, /* Picture buffer ID */
720 int32
, /* Bitstream buffer ID */
721 gfx::Rect
, /* Visible rectangle */
722 bool) /* Buffer is HW overlay capable */
724 // Confirm decoder has been flushed.
725 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone
)
727 // Confirm decoder has been reset.
728 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone
)
730 // Video decoder has encountered an error.
731 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification
,
732 uint32
) /* Error ID */
734 //------------------------------------------------------------------------------
735 // Accelerated Video Encoder Messages
736 // These messages are sent from the Renderer process to GPU process.
738 // Queue a video frame to the encoder to encode. |frame_id| will be returned
739 // by AcceleratedVideoEncoderHostMsg_NotifyInputDone.
740 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode
,
741 AcceleratedVideoEncoderMsg_Encode_Params
)
743 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
744 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
745 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer
,
746 int32
/* buffer_id */,
747 base::SharedMemoryHandle
/* buffer_handle */,
748 uint32
/* buffer_size */)
750 // Request a runtime encoding parameter change.
751 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange
,
752 uint32
/* bitrate */,
753 uint32
/* framerate */)
755 //------------------------------------------------------------------------------
756 // Accelerated Video Encoder Host Messages
757 // These messages are sent from GPU process to Renderer process.
759 // Notify renderer of the input/output buffer requirements of the encoder.
760 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers
,
761 uint32
/* input_count */,
762 gfx::Size
/* input_coded_size */,
763 uint32
/* output_buffer_size */)
765 // Notify the renderer that the encoder has finished using an input buffer.
766 // There is no congruent entry point in the media::VideoEncodeAccelerator
767 // interface, in VEA this same done condition is indicated by dropping the
768 // reference to the media::VideoFrame passed to VEA::Encode().
769 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone
,
770 int32
/* frame_id */)
772 // Notify the renderer that an output buffer has been filled with encoded data.
773 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady
,
774 int32
/* bitstream_buffer_id */,
775 uint32
/* payload_size */,
776 bool /* key_frame */)
778 // Report error condition.
779 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError
,
780 media::VideoEncodeAccelerator::Error
/* error */)
782 // Send destroy request to the encoder.
783 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy
)
785 //------------------------------------------------------------------------------
786 // Accelerated JPEG Decoder Messages
787 // These messages are sent from the Browser process to GPU process.
789 // Decode one JPEG image from shared memory |input_buffer_handle| with size
790 // |input_buffer_size|. The input buffer is associated with |input_buffer_id|
791 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will
792 // be put onto shared memory associated with |output_video_frame_handle|
793 // with size limit |output_buffer_size|.
794 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode
,
795 AcceleratedJpegDecoderMsg_Decode_Params
)
797 // Send destroy request to the decoder.
798 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy
)
800 //------------------------------------------------------------------------------
801 // Accelerated JPEG Decoder Host Messages
802 // These messages are sent from the GPU process to Browser process.
804 // Report decode status.
805 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_DecodeAck
,
806 int32
, /* bitstream_buffer_id */
807 media::JpegDecodeAccelerator::Error
/* error */)