1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Multiply-included message file, hence no include guard here, but see below
// for a much smaller-than-usual include guard section.
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/common/content_param_traits.h"
#include "content/common/gpu/establish_channel_params.h"
#include "content/common/gpu/gpu_memory_uma_stats.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/public/common/common_param_traits.h"
#include "content/public/common/gpu_memory_stats.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/command_buffer/common/value_state.h"
#include "gpu/config/gpu_info.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_start.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
#if defined(OS_MACOSX)
#include "content/common/gpu/accelerated_surface_buffers_swapped_params_mac.h"
#include "content/common/gpu/buffer_presented_params_mac.h"
#include "ui/base/cocoa/remote_layer_api.h"
#include "ui/gfx/mac/io_surface.h"
#endif
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
#define IPC_MESSAGE_START GpuMsgStart
IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats)
IPC_STRUCT_TRAITS_MEMBER(process_map)
IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats)
IPC_STRUCT_TRAITS_MEMBER(video_memory)
IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params)
IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id)
IPC_STRUCT_MEMBER(gfx::Size, size)
IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
IPC_STRUCT_MEMBER(gfx::BufferUsage, usage)
IPC_STRUCT_MEMBER(int32_t, client_id)
IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, surface_handle)
IPC_STRUCT_END()
IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBufferFromHandle_Params)
IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, handle)
IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id)
IPC_STRUCT_MEMBER(gfx::Size, size)
IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
IPC_STRUCT_MEMBER(int32_t, client_id)
IPC_STRUCT_END()
IPC_STRUCT_TRAITS_BEGIN(content::EstablishChannelParams)
IPC_STRUCT_TRAITS_MEMBER(client_id)
IPC_STRUCT_TRAITS_MEMBER(client_tracing_id)
IPC_STRUCT_TRAITS_MEMBER(preempts)
IPC_STRUCT_TRAITS_MEMBER(allow_view_command_buffers)
IPC_STRUCT_TRAITS_MEMBER(allow_real_time_streams)
IPC_STRUCT_TRAITS_END()
#if defined(OS_MACOSX)
IPC_STRUCT_TRAITS_BEGIN(content::AcceleratedSurfaceBuffersSwappedParams)
IPC_STRUCT_TRAITS_MEMBER(surface_id)
// Only one of ca_context_id or io_surface may be non-0.
IPC_STRUCT_TRAITS_MEMBER(ca_context_id)
IPC_STRUCT_TRAITS_MEMBER(io_surface)
IPC_STRUCT_TRAITS_MEMBER(size)
IPC_STRUCT_TRAITS_MEMBER(scale_factor)
IPC_STRUCT_TRAITS_MEMBER(latency_info)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::BufferPresentedParams)
// The vsync parameters, to synchronize presentation with the display.
IPC_STRUCT_TRAITS_MEMBER(surface_id)
IPC_STRUCT_TRAITS_MEMBER(vsync_timebase)
IPC_STRUCT_TRAITS_MEMBER(vsync_interval)
IPC_STRUCT_TRAITS_END()
#endif
//------------------------------------------------------------------------------
// GPU Messages
// These are messages from the browser to the GPU process.
// Tells the GPU process to initialize itself. The browser explicitly
// requests this be done so that we are guaranteed that the channel is set
// up between the browser and GPU process before doing any work that might
// potentially crash the GPU process. Detection of the child process
// exiting abruptly is predicated on having the IPC channel set up.
IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
// Tells the GPU process to shutdown itself.
IPC_MESSAGE_CONTROL0(GpuMsg_Finalize)
// Tells the GPU process to create a new channel for communication with a
// given client. The channel name is returned in a
// GpuHostMsg_ChannelEstablished message. The client ID is passed so
// that
// the GPU process reuses an existing channel to that process if it exists.
// This ID is a unique opaque identifier generated by the browser process.
// The client_tracing_id is a unique ID used for the purposes of tracing.
IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel,
content::EstablishChannelParams /* params */)
// Tells the GPU process to close the channel identified by IPC channel
// handle. If no channel can be identified, do nothing.
IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
IPC::ChannelHandle /* channel_handle */)
// Tells the GPU process to create a new gpu memory buffer.
IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
GpuMsg_CreateGpuMemoryBuffer_Params)
// Tells the GPU process to create a new gpu memory buffer from an existing
// handle.
IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBufferFromHandle,
GpuMsg_CreateGpuMemoryBufferFromHandle_Params)
// Tells the GPU process to destroy buffer.
IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
gfx::GpuMemoryBufferId, /* id */
int32_t, /* client_id */
gpu::SyncToken /* sync_token */)
// Tells the GPU process to create a context for collecting graphics card
// information.
IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
// Tells the GPU process to report video_memory information for the task manager
IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
#if defined(OS_MACOSX)
// Tells the GPU process that the browser process has handled the swap
// buffers or post sub-buffer request.
IPC_MESSAGE_CONTROL1(AcceleratedSurfaceMsg_BufferPresented,
content::BufferPresentedParams)
#endif
#if defined(OS_ANDROID)
// Tells the GPU process to wake up the GPU because we're about to draw.
IPC_MESSAGE_CONTROL0(GpuMsg_WakeUpGpu)
#endif
// Tells the GPU process to remove all contexts.
IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
// Tells the GPU process to crash.
IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
// Tells the GPU process to hang.
IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
// Tells the GPU process to disable the watchdog thread.
IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
// Tells the GPU process that the browser has seen a GPU switch.
IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched)
// Sends an input event to the gpu service.
IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState,
int, /* client_id */
unsigned int, /* target */
gpu::ValueState /* valuestate */)
//------------------------------------------------------------------------------
// GPU Host Messages
// These are messages to the browser.
// A renderer sends this when it wants to create a connection to the GPU
// process. The browser will create the GPU process if necessary, and will
// return a handle to the channel via a GpuChannelEstablished message.
IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
content::CauseForGpuLaunch,
int /* client id */,
IPC::ChannelHandle /* handle to channel */,
gpu::GPUInfo /* stats about GPU process*/)
// A renderer sends this when it wants to know whether a gpu process exists.
IPC_SYNC_MESSAGE_CONTROL0_1(GpuHostMsg_HasGpuProcess, bool /* result */)
// Response from GPU to a GputMsg_Initialize message.
IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
bool /* result */,
::gpu::GPUInfo /* gpu_info */)
// Response from GPU to a GpuHostMsg_EstablishChannel message.
IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
IPC::ChannelHandle /* channel_handle */)
// Message from GPU to notify to destroy the channel.
IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel, int32_t /* client_id */)
// Message to cache the given shader information.
IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
int32_t /* client_id */,
std::string /* key */,
std::string /* shader */)
// Message to the GPU that a shader was loaded from disk.
IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader, std::string /* encoded shader */)
// Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
gfx::GpuMemoryBufferHandle /* handle */)
// Response from GPU to a GpuMsg_CollectGraphicsInfo.
IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
gpu::GPUInfo /* GPU logging stats */)
// Response from GPU to a GpuMsg_GetVideoMemory.
IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
content::GPUVideoMemoryUsageStats /* GPU memory stats */)
#if defined(OS_MACOSX)
// Tells the browser that an accelerated surface has swapped.
IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
content::AcceleratedSurfaceBuffersSwappedParams)
#endif
#if defined(OS_WIN)
IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow,
gfx::PluginWindowHandle /* parent_window */,
gfx::PluginWindowHandle /* child_window */)
#endif
IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext, GURL /* url */)
IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
bool /* offscreen */,
gpu::error::ContextLostReason /* reason */,
GURL /* url */)
IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext, GURL /* url */)
// Tells the browser about GPU memory usage statistics for UMA logging.
IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
content::GPUMemoryUmaStats /* GPU memory UMA stats */)
// Tells the browser that a context has subscribed to a new target and
// the browser should start sending the corresponding information
IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription,
int32_t /* client_id */,
unsigned int /* target */)
// Tells the browser that no contexts are subscribed to the target anymore
// so the browser should stop sending the corresponding information
IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription,
int32_t /* client_id */,
unsigned int /* target */)
// Message from GPU to add a GPU log message to the about:gpu page.
IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
int /*severity*/,
std::string /* header */,
std::string /* message */)
|