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(basic_info_state
)
214 IPC_STRUCT_TRAITS_MEMBER(context_info_state
)
216 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state
)
217 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics
)
219 IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_supported_profiles
)
220 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles
)
221 IPC_STRUCT_TRAITS_END()
223 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats
)
224 IPC_STRUCT_TRAITS_MEMBER(video_memory
)
225 IPC_STRUCT_TRAITS_MEMBER(has_duplicates
)
226 IPC_STRUCT_TRAITS_END()
228 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats
)
229 IPC_STRUCT_TRAITS_MEMBER(process_map
)
230 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated
)
231 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max
)
232 IPC_STRUCT_TRAITS_END()
234 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats
)
235 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current
)
236 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max
)
237 IPC_STRUCT_TRAITS_MEMBER(bytes_limit
)
238 IPC_STRUCT_TRAITS_END()
240 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation
)
241 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible
)
242 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible
)
243 IPC_STRUCT_TRAITS_END()
245 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle
)
246 IPC_STRUCT_TRAITS_MEMBER(handle
)
247 IPC_STRUCT_TRAITS_MEMBER(transport_type
)
248 IPC_STRUCT_TRAITS_MEMBER(parent_client_id
)
249 IPC_STRUCT_TRAITS_END()
251 //------------------------------------------------------------------------------
253 // These are messages from the browser to the GPU process.
255 // Tells the GPU process to initialize itself. The browser explicitly
256 // requests this be done so that we are guaranteed that the channel is set
257 // up between the browser and GPU process before doing any work that might
258 // potentially crash the GPU process. Detection of the child process
259 // exiting abruptly is predicated on having the IPC channel set up.
260 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize
)
262 // Tells the GPU process to create a new channel for communication with a
263 // given client. The channel name is returned in a
264 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
265 // the GPU process reuses an existing channel to that process if it exists.
266 // This ID is a unique opaque identifier generated by the browser process.
267 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel
,
269 bool /* share_context */,
270 bool /* allow_future_sync_points */)
272 // Tells the GPU process to close the channel identified by IPC channel
273 // handle. If no channel can be identified, do nothing.
274 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel
,
275 IPC::ChannelHandle
/* channel_handle */)
277 // Tells the GPU process to create a new command buffer that renders directly
278 // to a native view. A corresponding GpuCommandBufferStub is created.
279 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer
,
280 gfx::GLSurfaceHandle
, /* compositing_surface */
281 int32
, /* surface_id */
282 int32
, /* client_id */
283 GPUCreateCommandBufferConfig
, /* init_params */
284 int32
/* route_id */)
286 // Tells the GPU process to create a new gpu memory buffer.
287 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer
,
288 GpuMsg_CreateGpuMemoryBuffer_Params
)
290 // Tells the GPU process to destroy buffer.
291 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer
,
292 gfx::GpuMemoryBufferId
, /* id */
293 int32
, /* client_id */
294 int32
/* sync_point */)
296 // Create and initialize a hardware jpeg decoder using the specified route_id.
297 // Created decoders should be freed with AcceleratedJpegDecoderMsg_Destroy when
299 IPC_SYNC_MESSAGE_CONTROL1_1(GpuMsg_CreateJpegDecoder
,
300 int32
/* route_id */,
301 bool /* succeeded */)
303 // Tells the GPU process to create a context for collecting graphics card
305 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo
)
307 // Tells the GPU process to report video_memory information for the task manager
308 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats
)
310 #if defined(OS_MACOSX)
311 // Tells the GPU process that the browser process has handled the swap
312 // buffers or post sub-buffer request.
313 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented
,
314 AcceleratedSurfaceMsg_BufferPresented_Params
)
317 // Tells the GPU process to wake up the GPU because we're about to draw.
318 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu
)
320 // Tells the GPU process to remove all contexts.
321 IPC_MESSAGE_CONTROL0(GpuMsg_Clean
)
323 // Tells the GPU process to crash.
324 IPC_MESSAGE_CONTROL0(GpuMsg_Crash
)
326 // Tells the GPU process to hang.
327 IPC_MESSAGE_CONTROL0(GpuMsg_Hang
)
329 // Tells the GPU process to disable the watchdog thread.
330 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog
)
332 // Tells the GPU process that the browser has seen a GPU switch.
333 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched
)
335 // Tells the GPU process to delete the default_offscreen surface. It will also
336 // close the display and any other resources when the last GL surface is
337 // deleted. GPU process will respond with GphHosMsg_ResourcesRelinquished.
338 IPC_MESSAGE_CONTROL0(GpuMsg_RelinquishResources
)
340 // Sends an input event to the gpu service.
341 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState
,
343 unsigned int, /* target */
344 gpu::ValueState
/* valuestate */)
346 //------------------------------------------------------------------------------
348 // These are messages to the browser.
350 // A renderer sends this when it wants to create a connection to the GPU
351 // process. The browser will create the GPU process if necessary, and will
352 // return a handle to the channel via a GpuChannelEstablished message.
353 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel
,
354 content::CauseForGpuLaunch
,
356 IPC::ChannelHandle
/* handle to channel */,
357 gpu::GPUInfo
/* stats about GPU process*/)
359 // A renderer sends this to the browser process when it wants to
360 // create a GL context associated with the given view_id.
361 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer
,
362 int32
, /* surface_id */
363 GPUCreateCommandBufferConfig
, /* init_params */
364 int32
, /* route_id */
365 content::CreateCommandBufferResult
/* result */)
367 // Response from GPU to a GputMsg_Initialize message.
368 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized
,
370 ::gpu::GPUInfo
/* gpu_info */)
372 // Response from GPU to a GpuHostMsg_EstablishChannel message.
373 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished
,
374 IPC::ChannelHandle
/* channel_handle */)
376 // Message from GPU to notify to destroy the channel.
377 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel
,
378 int32
/* client_id */)
380 // Message to cache the given shader information.
381 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader
,
382 int32
/* client_id */,
383 std::string
/* key */,
384 std::string
/* shader */)
386 // Message to the GPU that a shader was loaded from disk.
387 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader
,
388 std::string
/* encoded shader */)
390 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
391 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated
,
392 content::CreateCommandBufferResult
/* result */)
394 // Request from GPU to free the browser resources associated with the
396 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer
,
397 int32
/* surface_id */)
399 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
400 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated
,
401 gfx::GpuMemoryBufferHandle
/* handle */)
403 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
404 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected
,
405 gpu::GPUInfo
/* GPU logging stats */)
407 // Response from GPU to a GpuMsg_GetVideoMemory.
408 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats
,
409 content::GPUVideoMemoryUsageStats
/* GPU memory stats */)
411 // Message from GPU to add a GPU log message to the about:gpu page.
412 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage
,
414 std::string
/* header */,
415 std::string
/* message */)
417 // Tells the browser that a new accelerated surface was initialized.
418 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized
,
419 int32
/* surface_id */,
420 int32
/* route_id */)
423 #if defined(OS_MACOSX)
424 // Tells the browser that an accelerated surface has swapped.
425 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped
,
426 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
)
429 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext
,
432 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext
,
433 bool /* offscreen */,
434 gpu::error::ContextLostReason
/* reason */,
437 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext
,
440 // Tells the browser about GPU memory usage statistics for UMA logging.
441 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats
,
442 content::GPUMemoryUmaStats
/* GPU memory UMA stats */)
444 // Response to GpuMsg_RelinquishResources.
445 IPC_MESSAGE_CONTROL0(GpuHostMsg_ResourcesRelinquished
)
447 // Tells the browser that a context has subscribed to a new target and
448 // the browser should start sending the corresponding information
449 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription
,
450 int32
/* client_id */,
451 unsigned int /* target */)
453 // Tells the browser that no contexts are subscribed to the target anymore
454 // so the browser should stop sending the corresponding information
455 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription
,
456 int32
/* client_id */,
457 unsigned int /* target */)
459 //------------------------------------------------------------------------------
460 // GPU Channel Messages
461 // These are messages from a renderer process to the GPU process.
463 // Tells the GPU process to create a new command buffer that renders to an
464 // offscreen frame buffer.
465 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer
,
466 gfx::Size
, /* size */
467 GPUCreateCommandBufferConfig
, /* init_params */
468 int32
, /* route_id */
469 bool /* succeeded */)
471 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
472 // destructor, so that the stub deletes the actual CommandBufferService
473 // object that it's hosting.
474 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer
,
475 int32
/* instance_id */)
477 #if defined(OS_ANDROID)
478 //------------------------------------------------------------------------------
479 // Stream Texture Messages
480 // Tells the GPU process create and send the java surface texture object to
481 // the renderer process through the binder thread.
482 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer
,
483 int32
, /* primary_id */
484 int32
/* secondary_id */)
486 // Tells the GPU process to set the size of StreamTexture from the given
488 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize
,
489 gfx::Size
/* size */)
491 // Tells the service-side instance to start sending frame available
493 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening
)
495 // Inform the renderer that a new frame is available.
496 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable
)
498 // Inform the renderer process that the transform matrix has changed.
499 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged
,
500 GpuStreamTextureMsg_MatrixChanged_Params
/* params */)
503 //------------------------------------------------------------------------------
504 // GPU Command Buffer Messages
505 // These are messages between a renderer process to the GPU process relating to
506 // a single OpenGL context.
507 // Initialize a command buffer with the given number of command entries.
508 // Returns the shared memory handle for the command buffer mapped to the
510 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize
,
511 base::SharedMemoryHandle
/* shared_state */,
513 gpu::Capabilities
/* capabilities */)
515 // Sets the shared memory buffer used for commands.
516 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer
,
519 // Produces the front buffer into a mailbox. This allows another context to draw
520 // the output of this context.
521 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer
,
522 gpu::Mailbox
/* mailbox */)
524 // Wait until the token is in a specific range, inclusive.
525 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange
,
528 gpu::CommandBuffer::State
/* state */)
530 // Wait until the get offset is in a specific range, inclusive.
531 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange
,
534 gpu::CommandBuffer::State
/* state */)
536 // Asynchronously synchronize the put and get offsets of both processes.
537 // Caller passes its current put offset. Current state (including get offset)
538 // is returned in shared memory. The input latency info for the current
539 // frame is also sent to the GPU process.
540 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush
,
541 int32
/* put_offset */,
542 uint32
/* flush_count */,
543 std::vector
<ui::LatencyInfo
> /* latency_info */)
545 // Asynchronously process any commands known to the GPU process. This is only
546 // used in the event that a channel is unscheduled and needs to be flushed
547 // again to process any commands issued subsequent to unscheduling. The GPU
548 // process actually sends it (deferred) to itself.
549 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled
)
551 // Sent by the GPU process to display messages in the console.
552 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg
,
553 GPUCommandBufferConsoleMessage
/* msg */)
555 // Register an existing shared memory transfer buffer. The id that can be
556 // used to identify the transfer buffer from a command buffer.
557 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer
,
559 base::SharedMemoryHandle
/* transfer_buffer */,
562 // Destroy a previously created transfer buffer.
563 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer
,
566 // Create and initialize a hardware video decoder using the specified route_id.
567 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
569 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder
,
570 media::VideoCodecProfile
/* profile */,
571 int32
, /* route_id */
572 bool /* succeeded */)
574 // Create and initialize a hardware video encoder using the specified route_id.
575 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
577 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder
,
578 media::VideoPixelFormat
/* input_format */,
579 gfx::Size
/* input_visible_size */,
580 media::VideoCodecProfile
/* output_profile */,
581 uint32
/* initial_bitrate */,
582 int32
, /* route_id */
583 bool /* succeeded */)
585 // Tells the proxy that there was an error and the command buffer had to be
586 // destroyed for some reason.
587 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed
,
588 gpu::error::ContextLostReason
, /* reason */
589 gpu::error::Error
/* error */)
591 // Tells the browser that SwapBuffers returned and passes latency info
592 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted
,
593 std::vector
<ui::LatencyInfo
> /* latency_info */,
594 gfx::SwapResult
/* result */)
596 // Tells the browser about updated parameters for vsync alignment.
597 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters
,
598 base::TimeTicks
/* timebase */,
599 base::TimeDelta
/* interval */)
601 // Send to stub on surface visibility change.
602 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible
, bool /* visible */)
604 // Sent to proxy when the gpu memory manager changes its memory allocation.
605 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation
,
606 gpu::MemoryAllocation
/* allocation */)
608 // Sent to stub when proxy is assigned a memory allocation changed callback.
610 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback
,
611 bool /* has_callback */)
613 // Inserts a sync point into the channel. This is handled on the IO thread, so
614 // can be expected to be reasonably fast, but the sync point is actually
615 // retired in order with respect to the other calls. The sync point is shared
617 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint
,
619 uint32
/* sync_point */)
621 // Retires the sync point. Note: this message is not sent explicitly by the
622 // renderer, but is synthesized by the GPU process.
623 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint
,
624 uint32
/* sync_point */)
626 // Makes this command buffer signal when a sync point is reached, by sending
627 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
629 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint
,
630 uint32
/* sync_point */,
631 uint32
/* signal_id */)
633 // Response to GpuCommandBufferMsg_SignalSyncPoint.
634 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck
,
635 uint32
/* signal_id */)
637 // Makes this command buffer signal when a query is reached, by sending
638 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
640 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery
,
642 uint32
/* signal_id */)
644 // Create an image from an existing gpu memory buffer. The id that can be
645 // used to identify the image from a command buffer.
646 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage
,
648 gfx::GpuMemoryBufferHandle
/* gpu_memory_buffer */,
649 gfx::Size
/* size */,
650 gfx::GpuMemoryBuffer::Format
/* format */,
651 uint32
/* internalformat */)
653 // Destroy a previously created image.
654 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage
,
657 // Attaches an external image stream to the client texture.
658 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture
,
659 uint32
, /* client_texture_id */
660 int32
, /* stream_id */
661 bool /* succeeded */)
663 //------------------------------------------------------------------------------
664 // Accelerated Video Decoder Messages
665 // These messages are sent from Renderer process to GPU process.
667 // Send input buffer for decoding.
668 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode
,
669 base::SharedMemoryHandle
, /* input_buffer_handle */
670 int32
, /* bitstream_buffer_id */
673 // Sent from Renderer process to the GPU process to give the texture IDs for
674 // the textures the decoder will use for output.
675 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers
,
676 std::vector
<int32
>, /* Picture buffer ID */
677 std::vector
<uint32
>) /* Texture ID */
679 // Send from Renderer process to the GPU process to recycle the given picture
680 // buffer for further decoding.
681 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer
,
682 int32
) /* Picture buffer ID */
684 // Send flush request to the decoder.
685 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush
)
687 // Send reset request to the decoder.
688 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset
)
690 // Send destroy request to the decoder.
691 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy
)
693 //------------------------------------------------------------------------------
694 // Accelerated Video Decoder Host Messages
695 // These messages are sent from GPU process to Renderer process.
696 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
699 // Accelerated video decoder has consumed input buffer from transfer buffer.
700 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed
,
701 int32
) /* Processed buffer ID */
703 // Allocate video frames for output of the hardware video decoder.
705 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers
,
706 int32
, /* Number of video frames to generate */
707 gfx::Size
, /* Requested size of buffer */
708 uint32
) /* Texture target */
710 // Decoder reports that a picture is ready and buffer does not need to be passed
711 // back to the decoder.
712 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer
,
713 int32
) /* Picture buffer ID */
715 // Decoder reports that a picture is ready.
716 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady
,
717 int32
, /* Picture buffer ID */
718 int32
, /* Bitstream buffer ID */
719 gfx::Rect
, /* Visible rectangle */
720 bool) /* Buffer is HW overlay capable */
722 // Confirm decoder has been flushed.
723 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone
)
725 // Confirm decoder has been reset.
726 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone
)
728 // Video decoder has encountered an error.
729 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification
,
730 uint32
) /* Error ID */
732 //------------------------------------------------------------------------------
733 // Accelerated Video Encoder Messages
734 // These messages are sent from the Renderer process to GPU process.
736 // Queue a video frame to the encoder to encode. |frame_id| will be returned
737 // by AcceleratedVideoEncoderHostMsg_NotifyInputDone.
738 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderMsg_Encode
,
739 AcceleratedVideoEncoderMsg_Encode_Params
)
741 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
742 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
743 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer
,
744 int32
/* buffer_id */,
745 base::SharedMemoryHandle
/* buffer_handle */,
746 uint32
/* buffer_size */)
748 // Request a runtime encoding parameter change.
749 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange
,
750 uint32
/* bitrate */,
751 uint32
/* framerate */)
753 //------------------------------------------------------------------------------
754 // Accelerated Video Encoder Host Messages
755 // These messages are sent from GPU process to Renderer process.
757 // Notify renderer of the input/output buffer requirements of the encoder.
758 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers
,
759 uint32
/* input_count */,
760 gfx::Size
/* input_coded_size */,
761 uint32
/* output_buffer_size */)
763 // Notify the renderer that the encoder has finished using an input buffer.
764 // There is no congruent entry point in the media::VideoEncodeAccelerator
765 // interface, in VEA this same done condition is indicated by dropping the
766 // reference to the media::VideoFrame passed to VEA::Encode().
767 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone
,
768 int32
/* frame_id */)
770 // Notify the renderer that an output buffer has been filled with encoded data.
771 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady
,
772 int32
/* bitstream_buffer_id */,
773 uint32
/* payload_size */,
774 bool /* key_frame */)
776 // Report error condition.
777 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError
,
778 media::VideoEncodeAccelerator::Error
/* error */)
780 // Send destroy request to the encoder.
781 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy
)
783 //------------------------------------------------------------------------------
784 // Accelerated JPEG Decoder Messages
785 // These messages are sent from the Browser process to GPU process.
787 // Decode one JPEG image from shared memory |input_buffer_handle| with size
788 // |input_buffer_size|. The input buffer is associated with |input_buffer_id|
789 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will
790 // be put onto shared memory associated with |output_video_frame_handle|
791 // with size limit |output_buffer_size|.
792 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode
,
793 AcceleratedJpegDecoderMsg_Decode_Params
)
795 // Send destroy request to the decoder.
796 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy
)
798 //------------------------------------------------------------------------------
799 // Accelerated JPEG Decoder Host Messages
800 // These messages are sent from the GPU process to Browser process.
802 // Report decode status.
803 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_DecodeAck
,
804 int32
, /* bitstream_buffer_id */
805 media::JpegDecodeAccelerator::Error
/* error */)