[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / common / gpu / gpu_messages.h
blob7e507e4bf21fed4d52b46eb3262c85b4d04078e8
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.
8 #include <string>
9 #include <vector>
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/gfx/swap_result.h"
37 #include "ui/gl/gpu_preference.h"
39 #if defined(OS_ANDROID)
40 #include "content/common/android/surface_texture_peer.h"
41 #endif
43 #undef IPC_MESSAGE_EXPORT
44 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
46 #define IPC_MESSAGE_START GpuMsgStart
48 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
49 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
50 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult,
51 content::CREATE_COMMAND_BUFFER_RESULT_LAST)
52 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
53 gfx::GpuPreferenceLast)
54 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
55 gfx::SURFACE_TYPE_LAST)
56 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST)
57 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
58 gpu::MemoryAllocation::CUTOFF_LAST)
59 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error, gpu::error::kErrorLast)
60 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
61 gpu::error::kContextLostReasonLast)
62 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
63 media::VideoEncodeAccelerator::kErrorMax)
64 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format,
65 media::VideoFrame::FORMAT_MAX)
66 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
67 media::VIDEO_CODEC_PROFILE_MIN,
68 media::VIDEO_CODEC_PROFILE_MAX)
69 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
70 gpu::kCollectInfoNone,
71 gpu::kCollectInfoFatalFailure)
72 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
73 gpu::VIDEO_CODEC_PROFILE_MIN,
74 gpu::VIDEO_CODEC_PROFILE_MAX)
76 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
77 IPC_STRUCT_MEMBER(int32, share_group_id)
78 IPC_STRUCT_MEMBER(std::vector<int>, attribs)
79 IPC_STRUCT_MEMBER(GURL, active_url)
80 IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference)
81 IPC_STRUCT_END()
83 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params)
84 IPC_STRUCT_MEMBER(int32, id)
85 IPC_STRUCT_MEMBER(gfx::Size, size)
86 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Format, format)
87 IPC_STRUCT_MEMBER(gfx::GpuMemoryBuffer::Usage, usage)
88 IPC_STRUCT_MEMBER(int32, client_id)
89 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, surface_handle)
90 IPC_STRUCT_END()
92 #if defined(OS_MACOSX)
93 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
94 IPC_STRUCT_MEMBER(int32, surface_id)
95 IPC_STRUCT_MEMBER(uint64, surface_handle)
96 IPC_STRUCT_MEMBER(int32, route_id)
97 IPC_STRUCT_MEMBER(gfx::Size, size)
98 IPC_STRUCT_MEMBER(gfx::Rect, damage_rect)
99 IPC_STRUCT_MEMBER(float, scale_factor)
100 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
101 IPC_STRUCT_END()
103 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
104 // If the browser needs framerate throttling based on GPU back-pressure to be
105 // disabled (e.g, because the NSView isn't visible but tab capture is active),
106 // then this is set to true.
107 IPC_STRUCT_MEMBER(bool, disable_throttling)
108 // If the browser is drawing to the screen, this is the CGL renderer ID of
109 // the GL context that the brower is using.
110 IPC_STRUCT_MEMBER(int32, renderer_id)
111 IPC_STRUCT_END()
112 #endif
114 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
115 IPC_STRUCT_MEMBER(int32, id)
116 IPC_STRUCT_MEMBER(std::string, message)
117 IPC_STRUCT_END()
119 #if defined(OS_ANDROID)
120 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params)
121 IPC_STRUCT_MEMBER(float, m00)
122 IPC_STRUCT_MEMBER(float, m01)
123 IPC_STRUCT_MEMBER(float, m02)
124 IPC_STRUCT_MEMBER(float, m03)
125 IPC_STRUCT_MEMBER(float, m10)
126 IPC_STRUCT_MEMBER(float, m11)
127 IPC_STRUCT_MEMBER(float, m12)
128 IPC_STRUCT_MEMBER(float, m13)
129 IPC_STRUCT_MEMBER(float, m20)
130 IPC_STRUCT_MEMBER(float, m21)
131 IPC_STRUCT_MEMBER(float, m22)
132 IPC_STRUCT_MEMBER(float, m23)
133 IPC_STRUCT_MEMBER(float, m30)
134 IPC_STRUCT_MEMBER(float, m31)
135 IPC_STRUCT_MEMBER(float, m32)
136 IPC_STRUCT_MEMBER(float, m33)
137 IPC_STRUCT_END()
138 #endif
140 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
141 IPC_STRUCT_TRAITS_MEMBER(values)
142 IPC_STRUCT_TRAITS_MEMBER(children)
143 IPC_STRUCT_TRAITS_END()
145 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
146 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
147 IPC_STRUCT_TRAITS_MEMBER(device_id)
148 IPC_STRUCT_TRAITS_MEMBER(active)
149 IPC_STRUCT_TRAITS_MEMBER(vendor_string)
150 IPC_STRUCT_TRAITS_MEMBER(device_string)
151 IPC_STRUCT_TRAITS_END()
153 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile)
154 IPC_STRUCT_TRAITS_MEMBER(profile)
155 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
156 IPC_STRUCT_TRAITS_MEMBER(min_resolution)
157 IPC_STRUCT_TRAITS_END()
159 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
160 IPC_STRUCT_TRAITS_MEMBER(profile)
161 IPC_STRUCT_TRAITS_MEMBER(max_resolution)
162 IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
163 IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator)
164 IPC_STRUCT_TRAITS_END()
166 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
167 IPC_STRUCT_TRAITS_MEMBER(initialization_time)
168 IPC_STRUCT_TRAITS_MEMBER(optimus)
169 IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
170 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
171 IPC_STRUCT_TRAITS_MEMBER(gpu)
172 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
173 IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
174 IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
175 IPC_STRUCT_TRAITS_MEMBER(driver_version)
176 IPC_STRUCT_TRAITS_MEMBER(driver_date)
177 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
178 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
179 IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples)
180 IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
181 IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
182 IPC_STRUCT_TRAITS_MEMBER(gl_version)
183 IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
184 IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
185 IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
186 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
187 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
188 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
189 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
190 IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
191 IPC_STRUCT_TRAITS_MEMBER(software_rendering)
192 IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
193 IPC_STRUCT_TRAITS_MEMBER(sandboxed)
194 IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
195 IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
196 IPC_STRUCT_TRAITS_MEMBER(context_info_state)
197 #if defined(OS_WIN)
198 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
199 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
200 #endif
201 IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_supported_profiles)
202 IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles)
203 IPC_STRUCT_TRAITS_END()
205 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats)
206 IPC_STRUCT_TRAITS_MEMBER(video_memory)
207 IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
208 IPC_STRUCT_TRAITS_END()
210 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats)
211 IPC_STRUCT_TRAITS_MEMBER(process_map)
212 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
213 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
214 IPC_STRUCT_TRAITS_END()
216 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
217 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
218 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
219 IPC_STRUCT_TRAITS_MEMBER(bytes_limit)
220 IPC_STRUCT_TRAITS_END()
222 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
223 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
224 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
225 IPC_STRUCT_TRAITS_END()
227 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle)
228 IPC_STRUCT_TRAITS_MEMBER(handle)
229 IPC_STRUCT_TRAITS_MEMBER(transport_type)
230 IPC_STRUCT_TRAITS_MEMBER(parent_client_id)
231 IPC_STRUCT_TRAITS_END()
233 //------------------------------------------------------------------------------
234 // GPU Messages
235 // These are messages from the browser to the GPU process.
237 // Tells the GPU process to initialize itself. The browser explicitly
238 // requests this be done so that we are guaranteed that the channel is set
239 // up between the browser and GPU process before doing any work that might
240 // potentially crash the GPU process. Detection of the child process
241 // exiting abruptly is predicated on having the IPC channel set up.
242 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
244 // Tells the GPU process to create a new channel for communication with a
245 // given client. The channel name is returned in a
246 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
247 // the GPU process reuses an existing channel to that process if it exists.
248 // This ID is a unique opaque identifier generated by the browser process.
249 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel,
250 int /* client_id */,
251 bool /* share_context */,
252 bool /* allow_future_sync_points */)
254 // Tells the GPU process to close the channel identified by IPC channel
255 // handle. If no channel can be identified, do nothing.
256 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
257 IPC::ChannelHandle /* channel_handle */)
259 // Tells the GPU process to create a new command buffer that renders directly
260 // to a native view. A corresponding GpuCommandBufferStub is created.
261 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer,
262 gfx::GLSurfaceHandle, /* compositing_surface */
263 int32, /* surface_id */
264 int32, /* client_id */
265 GPUCreateCommandBufferConfig, /* init_params */
266 int32 /* route_id */)
268 // Tells the GPU process to create a new gpu memory buffer.
269 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
270 GpuMsg_CreateGpuMemoryBuffer_Params)
272 // Tells the GPU process to destroy buffer.
273 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
274 gfx::GpuMemoryBufferId, /* id */
275 int32, /* client_id */
276 int32 /* sync_point */)
278 // Tells the GPU process to create a context for collecting graphics card
279 // information.
280 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
282 // Tells the GPU process to report video_memory information for the task manager
283 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
285 #if defined(OS_MACOSX)
286 // Tells the GPU process that the browser process has handled the swap
287 // buffers or post sub-buffer request.
288 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented,
289 AcceleratedSurfaceMsg_BufferPresented_Params)
290 #endif
292 // Tells the GPU process to wake up the GPU because we're about to draw.
293 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu)
295 // Tells the GPU process to remove all contexts.
296 IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
298 // Tells the GPU process to crash.
299 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
301 // Tells the GPU process to hang.
302 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
304 // Tells the GPU process to disable the watchdog thread.
305 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
307 // Tells the GPU process that the browser has seen a GPU switch.
308 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched)
310 // Tells the GPU process to delete the default_offscreen surface. It will also
311 // close the display and any other resources when the last GL surface is
312 // deleted. GPU process will respond with GphHosMsg_ResourcesRelinquished.
313 IPC_MESSAGE_CONTROL0(GpuMsg_RelinquishResources)
315 // Sends an input event to the gpu service.
316 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState,
317 int, /* client_id */
318 unsigned int, /* target */
319 gpu::ValueState /* valuestate */)
321 //------------------------------------------------------------------------------
322 // GPU Host Messages
323 // These are messages to the browser.
325 // A renderer sends this when it wants to create a connection to the GPU
326 // process. The browser will create the GPU process if necessary, and will
327 // return a handle to the channel via a GpuChannelEstablished message.
328 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
329 content::CauseForGpuLaunch,
330 int /* client id */,
331 IPC::ChannelHandle /* handle to channel */,
332 gpu::GPUInfo /* stats about GPU process*/)
334 // A renderer sends this to the browser process when it wants to
335 // create a GL context associated with the given view_id.
336 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer,
337 int32, /* surface_id */
338 GPUCreateCommandBufferConfig, /* init_params */
339 int32, /* route_id */
340 content::CreateCommandBufferResult /* result */)
342 // Response from GPU to a GputMsg_Initialize message.
343 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
344 bool /* result */,
345 ::gpu::GPUInfo /* gpu_info */)
347 // Response from GPU to a GpuHostMsg_EstablishChannel message.
348 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
349 IPC::ChannelHandle /* channel_handle */)
351 // Message from GPU to notify to destroy the channel.
352 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel,
353 int32 /* client_id */)
355 // Message to cache the given shader information.
356 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
357 int32 /* client_id */,
358 std::string /* key */,
359 std::string /* shader */)
361 // Message to the GPU that a shader was loaded from disk.
362 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader,
363 std::string /* encoded shader */)
365 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
366 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
367 content::CreateCommandBufferResult /* result */)
369 // Request from GPU to free the browser resources associated with the
370 // command buffer.
371 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer,
372 int32 /* surface_id */)
374 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
375 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
376 gfx::GpuMemoryBufferHandle /* handle */)
378 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
379 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
380 gpu::GPUInfo /* GPU logging stats */)
382 // Response from GPU to a GpuMsg_GetVideoMemory.
383 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
384 content::GPUVideoMemoryUsageStats /* GPU memory stats */)
386 // Message from GPU to add a GPU log message to the about:gpu page.
387 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
388 int /*severity*/,
389 std::string /* header */,
390 std::string /* message */)
392 // Tells the browser that a new accelerated surface was initialized.
393 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized,
394 int32 /* surface_id */,
395 int32 /* route_id */)
398 #if defined(OS_MACOSX)
399 // Tells the browser that an accelerated surface has swapped.
400 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
401 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
402 #endif
404 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext,
405 GURL /* url */)
407 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
408 bool /* offscreen */,
409 gpu::error::ContextLostReason /* reason */,
410 GURL /* url */)
412 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext,
413 GURL /* url */)
415 // Tells the browser about GPU memory usage statistics for UMA logging.
416 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
417 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
419 // Response to GpuMsg_RelinquishResources.
420 IPC_MESSAGE_CONTROL0(GpuHostMsg_ResourcesRelinquished)
422 // Tells the browser that a context has subscribed to a new target and
423 // the browser should start sending the corresponding information
424 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription,
425 int32 /* client_id */,
426 unsigned int /* target */)
428 // Tells the browser that no contexts are subscribed to the target anymore
429 // so the browser should stop sending the corresponding information
430 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription,
431 int32 /* client_id */,
432 unsigned int /* target */)
434 //------------------------------------------------------------------------------
435 // GPU Channel Messages
436 // These are messages from a renderer process to the GPU process.
438 // Tells the GPU process to create a new command buffer that renders to an
439 // offscreen frame buffer.
440 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
441 gfx::Size, /* size */
442 GPUCreateCommandBufferConfig, /* init_params */
443 int32, /* route_id */
444 bool /* succeeded */)
446 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
447 // destructor, so that the stub deletes the actual CommandBufferService
448 // object that it's hosting.
449 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
450 int32 /* instance_id */)
452 #if defined(OS_ANDROID)
453 //------------------------------------------------------------------------------
454 // Stream Texture Messages
455 // Tells the GPU process create and send the java surface texture object to
456 // the renderer process through the binder thread.
457 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer,
458 int32, /* primary_id */
459 int32 /* secondary_id */)
461 // Tells the GPU process to set the size of StreamTexture from the given
462 // stream Id.
463 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize,
464 gfx::Size /* size */)
466 // Tells the service-side instance to start sending frame available
467 // notifications.
468 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening)
470 // Inform the renderer that a new frame is available.
471 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable)
473 // Inform the renderer process that the transform matrix has changed.
474 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged,
475 GpuStreamTextureMsg_MatrixChanged_Params /* params */)
476 #endif
478 //------------------------------------------------------------------------------
479 // GPU Command Buffer Messages
480 // These are messages between a renderer process to the GPU process relating to
481 // a single OpenGL context.
482 // Initialize a command buffer with the given number of command entries.
483 // Returns the shared memory handle for the command buffer mapped to the
484 // calling process.
485 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize,
486 base::SharedMemoryHandle /* shared_state */,
487 bool /* result */,
488 gpu::Capabilities /* capabilities */)
490 // Sets the shared memory buffer used for commands.
491 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer,
492 int32 /* shm_id */)
494 // Produces the front buffer into a mailbox. This allows another context to draw
495 // the output of this context.
496 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer,
497 gpu::Mailbox /* mailbox */)
499 // Wait until the token is in a specific range, inclusive.
500 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange,
501 int32 /* start */,
502 int32 /* end */,
503 gpu::CommandBuffer::State /* state */)
505 // Wait until the get offset is in a specific range, inclusive.
506 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange,
507 int32 /* start */,
508 int32 /* end */,
509 gpu::CommandBuffer::State /* state */)
511 // Asynchronously synchronize the put and get offsets of both processes.
512 // Caller passes its current put offset. Current state (including get offset)
513 // is returned in shared memory. The input latency info for the current
514 // frame is also sent to the GPU process.
515 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush,
516 int32 /* put_offset */,
517 uint32 /* flush_count */,
518 std::vector<ui::LatencyInfo> /* latency_info */)
520 // Asynchronously process any commands known to the GPU process. This is only
521 // used in the event that a channel is unscheduled and needs to be flushed
522 // again to process any commands issued subsequent to unscheduling. The GPU
523 // process actually sends it (deferred) to itself.
524 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled)
526 // Sent by the GPU process to display messages in the console.
527 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg,
528 GPUCommandBufferConsoleMessage /* msg */)
530 // Register an existing shared memory transfer buffer. The id that can be
531 // used to identify the transfer buffer from a command buffer.
532 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer,
533 int32 /* id */,
534 base::SharedMemoryHandle /* transfer_buffer */,
535 uint32 /* size */)
537 // Destroy a previously created transfer buffer.
538 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer,
539 int32 /* id */)
541 // Create and initialize a hardware video decoder using the specified route_id.
542 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
543 // no longer needed.
544 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder,
545 media::VideoCodecProfile /* profile */,
546 int32, /* route_id */
547 bool /* succeeded */)
549 // Create and initialize a hardware video encoder using the specified route_id.
550 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
551 // no longer needed.
552 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder,
553 media::VideoFrame::Format /* input_format */,
554 gfx::Size /* input_visible_size */,
555 media::VideoCodecProfile /* output_profile */,
556 uint32 /* initial_bitrate */,
557 int32, /* route_id */
558 bool /* succeeded */)
560 // Tells the proxy that there was an error and the command buffer had to be
561 // destroyed for some reason.
562 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed,
563 gpu::error::ContextLostReason, /* reason */
564 gpu::error::Error /* error */)
566 // Tells the browser that SwapBuffers returned and passes latency info
567 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted,
568 std::vector<ui::LatencyInfo> /* latency_info */,
569 gfx::SwapResult /* result */)
571 // Tells the browser about updated parameters for vsync alignment.
572 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters,
573 base::TimeTicks /* timebase */,
574 base::TimeDelta /* interval */)
576 // Send to stub on surface visibility change.
577 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */)
579 // Sent to proxy when the gpu memory manager changes its memory allocation.
580 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation,
581 gpu::MemoryAllocation /* allocation */)
583 // Sent to stub when proxy is assigned a memory allocation changed callback.
584 IPC_MESSAGE_ROUTED1(
585 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
586 bool /* has_callback */)
588 // Inserts a sync point into the channel. This is handled on the IO thread, so
589 // can be expected to be reasonably fast, but the sync point is actually
590 // retired in order with respect to the other calls. The sync point is shared
591 // across channels.
592 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint,
593 bool /* retire */,
594 uint32 /* sync_point */)
596 // Retires the sync point. Note: this message is not sent explicitly by the
597 // renderer, but is synthesized by the GPU process.
598 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint,
599 uint32 /* sync_point */)
601 // Makes this command buffer signal when a sync point is reached, by sending
602 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
603 // signal_id.
604 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint,
605 uint32 /* sync_point */,
606 uint32 /* signal_id */)
608 // Response to GpuCommandBufferMsg_SignalSyncPoint.
609 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck,
610 uint32 /* signal_id */)
612 // Makes this command buffer signal when a query is reached, by sending
613 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
614 // signal_id.
615 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery,
616 uint32 /* query */,
617 uint32 /* signal_id */)
619 // Create an image from an existing gpu memory buffer. The id that can be
620 // used to identify the image from a command buffer.
621 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage,
622 int32 /* id */,
623 gfx::GpuMemoryBufferHandle /* gpu_memory_buffer */,
624 gfx::Size /* size */,
625 gfx::GpuMemoryBuffer::Format /* format */,
626 uint32 /* internalformat */)
628 // Destroy a previously created image.
629 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage,
630 int32 /* id */)
632 // Attaches an external image stream to the client texture.
633 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture,
634 uint32, /* client_texture_id */
635 int32, /* stream_id */
636 bool /* succeeded */)
638 //------------------------------------------------------------------------------
639 // Accelerated Video Decoder Messages
640 // These messages are sent from Renderer process to GPU process.
642 // Send input buffer for decoding.
643 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode,
644 base::SharedMemoryHandle, /* input_buffer_handle */
645 int32, /* bitstream_buffer_id */
646 uint32) /* size */
648 // Sent from Renderer process to the GPU process to give the texture IDs for
649 // the textures the decoder will use for output.
650 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers,
651 std::vector<int32>, /* Picture buffer ID */
652 std::vector<uint32>) /* Texture ID */
654 // Send from Renderer process to the GPU process to recycle the given picture
655 // buffer for further decoding.
656 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
657 int32) /* Picture buffer ID */
659 // Send flush request to the decoder.
660 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush)
662 // Send reset request to the decoder.
663 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset)
665 // Send destroy request to the decoder.
666 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy)
668 //------------------------------------------------------------------------------
669 // Accelerated Video Decoder Host Messages
670 // These messages are sent from GPU process to Renderer process.
671 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
672 // created.
674 // Accelerated video decoder has consumed input buffer from transfer buffer.
675 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
676 int32) /* Processed buffer ID */
678 // Allocate video frames for output of the hardware video decoder.
679 IPC_MESSAGE_ROUTED3(
680 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
681 int32, /* Number of video frames to generate */
682 gfx::Size, /* Requested size of buffer */
683 uint32 ) /* Texture target */
685 // Decoder reports that a picture is ready and buffer does not need to be passed
686 // back to the decoder.
687 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
688 int32) /* Picture buffer ID */
690 // Decoder reports that a picture is ready.
691 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderHostMsg_PictureReady,
692 int32, /* Picture buffer ID */
693 int32, /* Bitstream buffer ID */
694 gfx::Rect, /* Visible rectangle */
695 bool) /* Buffer is HW overlay capable */
697 // Confirm decoder has been flushed.
698 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone)
700 // Confirm decoder has been reset.
701 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone)
703 // Video decoder has encountered an error.
704 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
705 uint32) /* Error ID */
707 //------------------------------------------------------------------------------
708 // Accelerated Video Encoder Messages
709 // These messages are sent from the Renderer process to GPU process.
711 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
712 // AcceleratedVideoEncoderHostMsg_NotifyInputDone.
713 IPC_MESSAGE_ROUTED5(AcceleratedVideoEncoderMsg_Encode,
714 int32 /* frame_id */,
715 base::SharedMemoryHandle /* buffer_handle */,
716 uint32 /* buffer_offset */,
717 uint32 /* buffer_size */,
718 bool /* force_keyframe */)
720 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
721 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
722 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer,
723 int32 /* buffer_id */,
724 base::SharedMemoryHandle /* buffer_handle */,
725 uint32 /* buffer_size */)
727 // Request a runtime encoding parameter change.
728 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange,
729 uint32 /* bitrate */,
730 uint32 /* framerate */)
732 //------------------------------------------------------------------------------
733 // Accelerated Video Encoder Host Messages
734 // These messages are sent from GPU process to Renderer process.
736 // Notify renderer of the input/output buffer requirements of the encoder.
737 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers,
738 uint32 /* input_count */,
739 gfx::Size /* input_coded_size */,
740 uint32 /* output_buffer_size */)
742 // Notify the renderer that the encoder has finished using an input buffer.
743 // There is no congruent entry point in the media::VideoEncodeAccelerator
744 // interface, in VEA this same done condition is indicated by dropping the
745 // reference to the media::VideoFrame passed to VEA::Encode().
746 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone,
747 int32 /* frame_id */)
749 // Notify the renderer that an output buffer has been filled with encoded data.
750 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady,
751 int32 /* bitstream_buffer_id */,
752 uint32 /* payload_size */,
753 bool /* key_frame */)
755 // Report error condition.
756 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
757 media::VideoEncodeAccelerator::Error /* error */)
759 // Send destroy request to the encoder.
760 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)