[NaCl SDK]: use standard __BEGIN_DECLS macros in sys/select.h
[chromium-blink-merge.git] / content / common / gpu / gpu_messages.h
blob193544e8505ffc473e93b65f01e105e684e946f3
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/gpu/gpu_memory_uma_stats.h"
14 #include "content/common/gpu/gpu_process_launch_causes.h"
15 #include "content/common/gpu/gpu_result_codes.h"
16 #include "content/public/common/common_param_traits.h"
17 #include "content/public/common/gpu_memory_stats.h"
18 #include "gpu/command_buffer/common/capabilities.h"
19 #include "gpu/command_buffer/common/command_buffer.h"
20 #include "gpu/command_buffer/common/constants.h"
21 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
22 #include "gpu/command_buffer/common/mailbox.h"
23 #include "gpu/config/gpu_info.h"
24 #include "gpu/ipc/gpu_command_buffer_traits.h"
25 #include "ipc/ipc_channel_handle.h"
26 #include "ipc/ipc_message_macros.h"
27 #include "media/base/video_frame.h"
28 #include "media/video/video_decode_accelerator.h"
29 #include "media/video/video_encode_accelerator.h"
30 #include "ui/events/latency_info.h"
31 #include "ui/gfx/gpu_memory_buffer.h"
32 #include "ui/gfx/native_widget_types.h"
33 #include "ui/gfx/size.h"
34 #include "ui/gl/gpu_preference.h"
36 #if defined(OS_ANDROID)
37 #include "content/common/android/surface_texture_peer.h"
38 #endif
40 #undef IPC_MESSAGE_EXPORT
41 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
43 #define IPC_MESSAGE_START GpuMsgStart
45 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
46 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
47 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult,
48 content::CREATE_COMMAND_BUFFER_RESULT_LAST)
49 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
50 gfx::GpuPreferenceLast)
51 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
52 gfx::SURFACE_TYPE_LAST)
53 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
54 gpu::MemoryAllocation::CUTOFF_LAST)
55 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
56 gpu::error::kContextLostReasonLast)
57 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
58 media::VideoEncodeAccelerator::kErrorMax)
59 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format,
60 media::VideoFrame::FORMAT_MAX)
61 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
62 media::VIDEO_CODEC_PROFILE_MIN,
63 media::VIDEO_CODEC_PROFILE_MAX)
64 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
65 gpu::kCollectInfoNone,
66 gpu::kCollectInfoFatalFailure)
68 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
69 IPC_STRUCT_MEMBER(int32, share_group_id)
70 IPC_STRUCT_MEMBER(std::vector<int>, attribs)
71 IPC_STRUCT_MEMBER(GURL, active_url)
72 IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference)
73 IPC_STRUCT_END()
75 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
76 IPC_STRUCT_MEMBER(int32, surface_id)
77 IPC_STRUCT_MEMBER(uint64, surface_handle)
78 IPC_STRUCT_MEMBER(int32, route_id)
79 IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox)
80 IPC_STRUCT_MEMBER(gfx::Size, size)
81 IPC_STRUCT_MEMBER(float, scale_factor)
82 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
83 IPC_STRUCT_END()
85 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params)
86 IPC_STRUCT_MEMBER(int32, surface_id)
87 IPC_STRUCT_MEMBER(uint64, surface_handle)
88 IPC_STRUCT_MEMBER(int32, route_id)
89 IPC_STRUCT_MEMBER(int, x)
90 IPC_STRUCT_MEMBER(int, y)
91 IPC_STRUCT_MEMBER(int, width)
92 IPC_STRUCT_MEMBER(int, height)
93 IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox)
94 IPC_STRUCT_MEMBER(gfx::Size, surface_size)
95 IPC_STRUCT_MEMBER(float, surface_scale_factor)
96 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
97 IPC_STRUCT_END()
99 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params)
100 IPC_STRUCT_MEMBER(int32, surface_id)
101 IPC_STRUCT_END()
103 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
104 IPC_STRUCT_MEMBER(gpu::Mailbox, mailbox)
105 IPC_STRUCT_MEMBER(uint32, sync_point)
106 #if defined(OS_MACOSX)
107 IPC_STRUCT_MEMBER(int32, renderer_id)
108 #endif
109 #if defined(OS_WIN)
110 IPC_STRUCT_MEMBER(base::TimeTicks, vsync_timebase)
111 IPC_STRUCT_MEMBER(base::TimeDelta, vsync_interval)
112 #endif
113 IPC_STRUCT_END()
115 IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
116 IPC_STRUCT_MEMBER(int32, id)
117 IPC_STRUCT_MEMBER(std::string, message)
118 IPC_STRUCT_END()
120 #if defined(OS_ANDROID)
121 IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params)
122 IPC_STRUCT_MEMBER(float, m00)
123 IPC_STRUCT_MEMBER(float, m01)
124 IPC_STRUCT_MEMBER(float, m02)
125 IPC_STRUCT_MEMBER(float, m03)
126 IPC_STRUCT_MEMBER(float, m10)
127 IPC_STRUCT_MEMBER(float, m11)
128 IPC_STRUCT_MEMBER(float, m12)
129 IPC_STRUCT_MEMBER(float, m13)
130 IPC_STRUCT_MEMBER(float, m20)
131 IPC_STRUCT_MEMBER(float, m21)
132 IPC_STRUCT_MEMBER(float, m22)
133 IPC_STRUCT_MEMBER(float, m23)
134 IPC_STRUCT_MEMBER(float, m30)
135 IPC_STRUCT_MEMBER(float, m31)
136 IPC_STRUCT_MEMBER(float, m32)
137 IPC_STRUCT_MEMBER(float, m33)
138 IPC_STRUCT_END()
139 #endif
141 IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
142 IPC_STRUCT_TRAITS_MEMBER(values)
143 IPC_STRUCT_TRAITS_MEMBER(children)
144 IPC_STRUCT_TRAITS_END()
146 IPC_STRUCT_TRAITS_BEGIN(gpu::GpuPerformanceStats)
147 IPC_STRUCT_TRAITS_MEMBER(graphics)
148 IPC_STRUCT_TRAITS_MEMBER(gaming)
149 IPC_STRUCT_TRAITS_MEMBER(overall)
150 IPC_STRUCT_TRAITS_END()
152 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
153 IPC_STRUCT_TRAITS_MEMBER(vendor_id)
154 IPC_STRUCT_TRAITS_MEMBER(device_id)
155 IPC_STRUCT_TRAITS_MEMBER(active)
156 IPC_STRUCT_TRAITS_MEMBER(vendor_string)
157 IPC_STRUCT_TRAITS_MEMBER(device_string)
158 IPC_STRUCT_TRAITS_END()
160 IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
161 IPC_STRUCT_TRAITS_MEMBER(initialization_time)
162 IPC_STRUCT_TRAITS_MEMBER(optimus)
163 IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
164 IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
165 IPC_STRUCT_TRAITS_MEMBER(gpu)
166 IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
167 IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
168 IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
169 IPC_STRUCT_TRAITS_MEMBER(driver_version)
170 IPC_STRUCT_TRAITS_MEMBER(driver_date)
171 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
172 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
173 IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
174 IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
175 IPC_STRUCT_TRAITS_MEMBER(gl_version)
176 IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
177 IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
178 IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
179 IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
180 IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
181 IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
182 IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
183 IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
184 IPC_STRUCT_TRAITS_MEMBER(performance_stats)
185 IPC_STRUCT_TRAITS_MEMBER(software_rendering)
186 IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
187 IPC_STRUCT_TRAITS_MEMBER(sandboxed)
188 IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
189 IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
190 IPC_STRUCT_TRAITS_MEMBER(context_info_state)
191 #if defined(OS_WIN)
192 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
193 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
194 #endif
195 IPC_STRUCT_TRAITS_END()
197 IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities)
198 IPC_STRUCT_TRAITS_MEMBER(post_sub_buffer)
199 IPC_STRUCT_TRAITS_MEMBER(egl_image_external)
200 IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888)
201 IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1)
202 IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1_npot)
203 IPC_STRUCT_TRAITS_MEMBER(texture_rectangle)
204 IPC_STRUCT_TRAITS_MEMBER(iosurface)
205 IPC_STRUCT_TRAITS_MEMBER(texture_usage)
206 IPC_STRUCT_TRAITS_MEMBER(texture_storage)
207 IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer)
208 IPC_STRUCT_TRAITS_MEMBER(sync_query)
209 IPC_STRUCT_TRAITS_MEMBER(map_image)
210 IPC_STRUCT_TRAITS_END()
212 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats)
213 IPC_STRUCT_TRAITS_MEMBER(video_memory)
214 IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
215 IPC_STRUCT_TRAITS_END()
217 IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats)
218 IPC_STRUCT_TRAITS_MEMBER(process_map)
219 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
220 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
221 IPC_STRUCT_TRAITS_END()
223 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
224 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
225 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
226 IPC_STRUCT_TRAITS_MEMBER(bytes_limit)
227 IPC_STRUCT_TRAITS_END()
229 IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
230 IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
231 IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
232 IPC_STRUCT_TRAITS_END()
234 IPC_STRUCT_TRAITS_BEGIN(gfx::GLSurfaceHandle)
235 IPC_STRUCT_TRAITS_MEMBER(handle)
236 IPC_STRUCT_TRAITS_MEMBER(transport_type)
237 IPC_STRUCT_TRAITS_MEMBER(parent_client_id)
238 IPC_STRUCT_TRAITS_END()
240 //------------------------------------------------------------------------------
241 // GPU Messages
242 // These are messages from the browser to the GPU process.
244 // Tells the GPU process to initialize itself. The browser explicitly
245 // requests this be done so that we are guaranteed that the channel is set
246 // up between the browser and GPU process before doing any work that might
247 // potentially crash the GPU process. Detection of the child process
248 // exiting abruptly is predicated on having the IPC channel set up.
249 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
251 // Tells the GPU process to create a new channel for communication with a
252 // given client. The channel name is returned in a
253 // GpuHostMsg_ChannelEstablished message. The client ID is passed so that
254 // the GPU process reuses an existing channel to that process if it exists.
255 // This ID is a unique opaque identifier generated by the browser process.
256 IPC_MESSAGE_CONTROL3(GpuMsg_EstablishChannel,
257 int /* client_id */,
258 bool /* share_context */,
259 bool /* allow_future_sync_points */)
261 // Tells the GPU process to close the channel identified by IPC channel
262 // handle. If no channel can be identified, do nothing.
263 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
264 IPC::ChannelHandle /* channel_handle */)
266 // Tells the GPU process to create a new command buffer that renders directly
267 // to a native view. A corresponding GpuCommandBufferStub is created.
268 IPC_MESSAGE_CONTROL5(GpuMsg_CreateViewCommandBuffer,
269 gfx::GLSurfaceHandle, /* compositing_surface */
270 int32, /* surface_id */
271 int32, /* client_id */
272 GPUCreateCommandBufferConfig, /* init_params */
273 int32 /* route_id */)
275 // Tells the GPU process to create a new gpu memory buffer for |handle|.
276 IPC_MESSAGE_CONTROL4(GpuMsg_CreateGpuMemoryBuffer,
277 gfx::GpuMemoryBufferHandle, /* handle */
278 gfx::Size, /* size */
279 unsigned, /* internalformat */
280 unsigned /* usage */)
282 // Tells the GPU process to destroy buffer.
283 IPC_MESSAGE_CONTROL2(GpuMsg_DestroyGpuMemoryBuffer,
284 gfx::GpuMemoryBufferHandle, /* handle */
285 int32 /* sync_point */)
287 // Tells the GPU process to create a context for collecting graphics card
288 // information.
289 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
291 // Tells the GPU process to report video_memory information for the task manager
292 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
294 // Tells the GPU process that the browser process has handled the swap
295 // buffers or post sub-buffer request. A non-zero sync point means
296 // that we should wait for the sync point. The surface_handle identifies
297 // that buffer that has finished presented, i.e. the buffer being returned.
298 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented,
299 AcceleratedSurfaceMsg_BufferPresented_Params)
301 // Tells the GPU process to wake up the GPU because we're about to draw.
302 IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu)
304 // Tells the GPU process to remove all contexts.
305 IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
307 // Tells the GPU process to crash.
308 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
310 // Tells the GPU process to hang.
311 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
313 // Tells the GPU process to disable the watchdog thread.
314 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
316 //------------------------------------------------------------------------------
317 // GPU Host Messages
318 // These are messages to the browser.
320 // A renderer sends this when it wants to create a connection to the GPU
321 // process. The browser will create the GPU process if necessary, and will
322 // return a handle to the channel via a GpuChannelEstablished message.
323 IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
324 content::CauseForGpuLaunch,
325 int /* client id */,
326 IPC::ChannelHandle /* handle to channel */,
327 gpu::GPUInfo /* stats about GPU process*/)
329 // A renderer sends this to the browser process when it wants to
330 // create a GL context associated with the given view_id.
331 IPC_SYNC_MESSAGE_CONTROL3_1(GpuHostMsg_CreateViewCommandBuffer,
332 int32, /* surface_id */
333 GPUCreateCommandBufferConfig, /* init_params */
334 int32, /* route_id */
335 content::CreateCommandBufferResult /* result */)
337 // Response from GPU to a GputMsg_Initialize message.
338 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
339 bool /* result */,
340 ::gpu::GPUInfo /* gpu_info */)
342 // Response from GPU to a GpuHostMsg_EstablishChannel message.
343 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
344 IPC::ChannelHandle /* channel_handle */)
346 // Message from GPU to notify to destroy the channel.
347 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel,
348 int32 /* client_id */)
350 // Message to cache the given shader information.
351 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
352 int32 /* client_id */,
353 std::string /* key */,
354 std::string /* shader */)
356 // Message to the GPU that a shader was loaded from disk.
357 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader,
358 std::string /* encoded shader */)
360 // Respond from GPU to a GpuMsg_CreateViewCommandBuffer message.
361 IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated,
362 content::CreateCommandBufferResult /* result */)
364 // Request from GPU to free the browser resources associated with the
365 // command buffer.
366 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyCommandBuffer,
367 int32 /* surface_id */)
369 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
370 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
371 gfx::GpuMemoryBufferHandle /* handle */)
373 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
374 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
375 gpu::GPUInfo /* GPU logging stats */)
377 // Response from GPU to a GpuMsg_GetVideoMemory.
378 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
379 content::GPUVideoMemoryUsageStats /* GPU memory stats */)
381 // Message from GPU to add a GPU log message to the about:gpu page.
382 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
383 int /*severity*/,
384 std::string /* header */,
385 std::string /* message */)
387 // Tells the browser that a new accelerated surface was initialized.
388 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceInitialized,
389 int32 /* surface_id */,
390 int32 /* route_id */)
392 // Tells the browser that a frame with the specific latency info was drawn to
393 // the screen
394 IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn,
395 std::vector<ui::LatencyInfo> /* latency_info */)
397 // Same as above with a rect of the part of the surface that changed.
398 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
399 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
401 // This message notifies the browser process that the renderer
402 // swapped a portion of the buffers associated with the given "window", which
403 // should cause the browser to redraw the compositor's contents.
404 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfacePostSubBuffer,
405 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params)
407 // Tells the browser to release whatever resources are associated with
408 // the given surface. The browser must send an ACK once this operation
409 // is complete.
410 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceRelease,
411 GpuHostMsg_AcceleratedSurfaceRelease_Params)
413 // Tells the browser to release resources for the given surface until the next
414 // time swap buffers or post sub buffer is sent.
415 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSuspend,
416 int32 /* surface_id */)
418 // Tells the browser about updated parameters for vsync alignment.
419 IPC_MESSAGE_CONTROL3(GpuHostMsg_UpdateVSyncParameters,
420 int32 /* surface_id */,
421 base::TimeTicks /* timebase */,
422 base::TimeDelta /* interval */)
424 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext,
425 GURL /* url */)
427 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
428 bool /* offscreen */,
429 gpu::error::ContextLostReason /* reason */,
430 GURL /* url */)
432 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext,
433 GURL /* url */)
435 // Tells the browser about GPU memory usage statistics for UMA logging.
436 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
437 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
439 //------------------------------------------------------------------------------
440 // GPU Channel Messages
441 // These are messages from a renderer process to the GPU process.
443 // Tells the GPU process to create a new command buffer that renders to an
444 // offscreen frame buffer.
445 IPC_SYNC_MESSAGE_CONTROL3_1(GpuChannelMsg_CreateOffscreenCommandBuffer,
446 gfx::Size, /* size */
447 GPUCreateCommandBufferConfig, /* init_params */
448 int32, /* route_id */
449 bool /* succeeded */)
451 // The CommandBufferProxy sends this to the GpuCommandBufferStub in its
452 // destructor, so that the stub deletes the actual CommandBufferService
453 // object that it's hosting.
454 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer,
455 int32 /* instance_id */)
457 // Sent by DevTools agent in the inspected renderer process to initiate GPU
458 // instrumentation events recording.
459 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_DevToolsStartEventsRecording,
460 int32, /* route_id */
461 bool /* succeeded */)
463 // The message is sent when DevTools want to stop events recording.
464 IPC_MESSAGE_CONTROL0(GpuChannelMsg_DevToolsStopEventsRecording)
466 #if defined(OS_ANDROID)
467 //------------------------------------------------------------------------------
468 // Stream Texture Messages
469 // Tells the GPU process create and send the java surface texture object to
470 // the renderer process through the binder thread.
471 IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer,
472 int32, /* primary_id */
473 int32 /* secondary_id */)
475 // Tells the GPU process to set the size of StreamTexture from the given
476 // stream Id.
477 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize,
478 gfx::Size /* size */)
480 // Tells the service-side instance to start sending frame available
481 // notifications.
482 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening)
484 // Inform the renderer that a new frame is available.
485 IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable)
487 // Inform the renderer process that the transform matrix has changed.
488 IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged,
489 GpuStreamTextureMsg_MatrixChanged_Params /* params */)
490 #endif
492 //------------------------------------------------------------------------------
493 // GPU Command Buffer Messages
494 // These are messages between a renderer process to the GPU process relating to
495 // a single OpenGL context.
496 // Initialize a command buffer with the given number of command entries.
497 // Returns the shared memory handle for the command buffer mapped to the
498 // calling process.
499 IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize,
500 base::SharedMemoryHandle /* shared_state */,
501 bool /* result */,
502 gpu::Capabilities /* capabilities */)
504 // Sets the shared memory buffer used for commands.
505 IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer,
506 int32 /* shm_id */)
508 // Produces the front buffer into a mailbox. This allows another context to draw
509 // the output of this context.
510 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer,
511 gpu::Mailbox /* mailbox */)
513 // Wait until the token is in a specific range, inclusive.
514 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange,
515 int32 /* start */,
516 int32 /* end */,
517 gpu::CommandBuffer::State /* state */)
519 // Wait until the get offset is in a specific range, inclusive.
520 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange,
521 int32 /* start */,
522 int32 /* end */,
523 gpu::CommandBuffer::State /* state */)
525 // Asynchronously synchronize the put and get offsets of both processes.
526 // Caller passes its current put offset. Current state (including get offset)
527 // is returned in shared memory.
528 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_AsyncFlush,
529 int32 /* put_offset */,
530 uint32 /* flush_count */)
532 // Sends information about the latency of the current frame to the GPU
533 // process.
534 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetLatencyInfo,
535 std::vector<ui::LatencyInfo> /* latency_info */)
537 // Asynchronously process any commands known to the GPU process. This is only
538 // used in the event that a channel is unscheduled and needs to be flushed
539 // again to process any commands issued subsequent to unscheduling. The GPU
540 // process actually sends it (deferred) to itself.
541 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_Rescheduled)
543 // Sent by the GPU process to display messages in the console.
544 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg,
545 GPUCommandBufferConsoleMessage /* msg */)
547 // Register an existing shared memory transfer buffer. The id that can be
548 // used to identify the transfer buffer from a command buffer.
549 IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer,
550 int32 /* id */,
551 base::SharedMemoryHandle /* transfer_buffer */,
552 uint32 /* size */)
554 // Destroy a previously created transfer buffer.
555 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer,
556 int32 /* id */)
558 // Create and initialize a hardware video decoder using the specified route_id.
559 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when
560 // no longer needed.
561 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder,
562 media::VideoCodecProfile /* profile */,
563 int32, /* route_id */
564 bool /* succeeded */)
566 // Create and initialize a hardware video encoder using the specified route_id.
567 // Created encoders should be freed with AcceleratedVideoEncoderMsg_Destroy when
568 // no longer needed.
569 IPC_SYNC_MESSAGE_ROUTED5_1(GpuCommandBufferMsg_CreateVideoEncoder,
570 media::VideoFrame::Format /* input_format */,
571 gfx::Size /* input_visible_size */,
572 media::VideoCodecProfile /* output_profile */,
573 uint32 /* initial_bitrate */,
574 int32, /* route_id */
575 bool /* succeeded */)
577 // Tells the proxy that there was an error and the command buffer had to be
578 // destroyed for some reason.
579 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed,
580 gpu::error::ContextLostReason /* reason */)
582 // Request that the GPU process reply with the given message. Reply may be
583 // delayed.
584 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Echo,
585 IPC::Message /* reply */)
587 // Response to a GpuChannelMsg_Echo message.
588 IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_EchoAck)
590 // Send to stub on surface visibility change.
591 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */)
593 // Sent to proxy when the gpu memory manager changes its memory allocation.
594 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetMemoryAllocation,
595 gpu::MemoryAllocation /* allocation */)
597 // Sent to stub when proxy is assigned a memory allocation changed callback.
598 IPC_MESSAGE_ROUTED1(
599 GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback,
600 bool /* has_callback */)
602 // Inserts a sync point into the channel. This is handled on the IO thread, so
603 // can be expected to be reasonably fast, but the sync point is actually
604 // retired in order with respect to the other calls. The sync point is shared
605 // across channels.
606 IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_InsertSyncPoint,
607 bool /* retire */,
608 uint32 /* sync_point */)
610 // Retires the sync point. Note: this message is not sent explicitly by the
611 // renderer, but is synthesized by the GPU process.
612 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_RetireSyncPoint,
613 uint32 /* sync_point */)
615 // Makes this command buffer signal when a sync point is reached, by sending
616 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
617 // signal_id.
618 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncPoint,
619 uint32 /* sync_point */,
620 uint32 /* signal_id */)
622 // Response to GpuCommandBufferMsg_SignalSyncPoint.
623 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalSyncPointAck,
624 uint32 /* signal_id */)
626 // Makes this command buffer signal when a query is reached, by sending
627 // back a GpuCommandBufferMsg_SignalSyncPointAck message with the same
628 // signal_id.
629 IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery,
630 uint32 /* query */,
631 uint32 /* signal_id */)
633 // Register an existing gpu memory buffer. The id that can be
634 // used to identify the gpu memory buffer from a command buffer.
635 IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_RegisterGpuMemoryBuffer,
636 int32 /* id */,
637 gfx::GpuMemoryBufferHandle /* gpu_memory_buffer */,
638 uint32 /* width */,
639 uint32 /* height */,
640 uint32 /* internalformat */)
642 // Unregister a previously registered gpu memory buffer.
643 IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UnregisterGpuMemoryBuffer,
644 int32 /* id */)
646 // Attaches an external image stream to the client texture.
647 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture,
648 uint32, /* client_texture_id */
649 int32, /* stream_id */
650 bool /* succeeded */)
652 //------------------------------------------------------------------------------
653 // Accelerated Video Decoder Messages
654 // These messages are sent from Renderer process to GPU process.
656 // Send input buffer for decoding.
657 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode,
658 base::SharedMemoryHandle, /* input_buffer_handle */
659 int32, /* bitstream_buffer_id */
660 uint32) /* size */
662 // Sent from Renderer process to the GPU process to give the texture IDs for
663 // the textures the decoder will use for output.
664 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_AssignPictureBuffers,
665 std::vector<int32>, /* Picture buffer ID */
666 std::vector<uint32>) /* Texture ID */
668 // Send from Renderer process to the GPU process to recycle the given picture
669 // buffer for further decoding.
670 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
671 int32) /* Picture buffer ID */
673 // Send flush request to the decoder.
674 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush)
676 // Send reset request to the decoder.
677 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset)
679 // Send destroy request to the decoder.
680 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy)
682 //------------------------------------------------------------------------------
683 // Accelerated Video Decoder Host Messages
684 // These messages are sent from GPU process to Renderer process.
685 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
686 // created.
688 // Accelerated video decoder has consumed input buffer from transfer buffer.
689 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
690 int32) /* Processed buffer ID */
692 // Allocate video frames for output of the hardware video decoder.
693 IPC_MESSAGE_ROUTED3(
694 AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
695 int32, /* Number of video frames to generate */
696 gfx::Size, /* Requested size of buffer */
697 uint32 ) /* Texture target */
699 // Decoder reports that a picture is ready and buffer does not need to be passed
700 // back to the decoder.
701 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
702 int32) /* Picture buffer ID */
704 // Decoder reports that a picture is ready.
705 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_PictureReady,
706 int32, /* Picture buffer ID */
707 int32, /* Bitstream buffer ID */
708 gfx::Rect) /* Visible rectangle */
710 // Confirm decoder has been flushed.
711 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone)
713 // Confirm decoder has been reset.
714 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone)
716 // Video decoder has encountered an error.
717 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
718 uint32) /* Error ID */
720 //------------------------------------------------------------------------------
721 // Accelerated Video Encoder Messages
722 // These messages are sent from the Renderer process to GPU process.
724 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by
725 // AcceleratedVideoEncoderHostMsg_NotifyEncodeDone.
726 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Encode,
727 int32 /* frame_id */,
728 base::SharedMemoryHandle /* buffer_handle */,
729 uint32 /* buffer_size */,
730 bool /* force_keyframe */)
732 // Queue a buffer to the encoder for use in returning output. |buffer_id| will
733 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady.
734 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer,
735 int32 /* buffer_id */,
736 base::SharedMemoryHandle /* buffer_handle */,
737 uint32 /* buffer_size */)
739 // Request a runtime encoding parameter change.
740 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange,
741 uint32 /* bitrate */,
742 uint32 /* framerate */)
744 //------------------------------------------------------------------------------
745 // Accelerated Video Encoder Host Messages
746 // These messages are sent from GPU process to Renderer process.
748 // Notify renderer of the input/output buffer requirements of the encoder.
749 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers,
750 uint32 /* input_count */,
751 gfx::Size /* input_coded_size */,
752 uint32 /* output_buffer_size */)
754 // Notify the renderer that the encoder has finished using an input buffer.
755 // There is no congruent entry point in the media::VideoEncodeAccelerator
756 // interface, in VEA this same done condition is indicated by dropping the
757 // reference to the media::VideoFrame passed to VEA::Encode().
758 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone,
759 int32 /* frame_id */)
761 // Notify the renderer that an output buffer has been filled with encoded data.
762 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady,
763 int32 /* bitstream_buffer_id */,
764 uint32 /* payload_size */,
765 bool /* key_frame */)
767 // Report error condition.
768 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
769 media::VideoEncodeAccelerator::Error /* error */)
771 // Send destroy request to the encoder.
772 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)