Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: content/gpu/gpu_host_messages.h

Issue 1820793005: gpu_host_messages => content/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 // Multiply-included message file, hence no include guard here, but see below
6 // for a much smaller-than-usual include guard section.
7
8 #include "build/build_config.h"
9 #include "content/common/content_export.h"
10 #include "content/common/gpu/gpu_memory_uma_stats.h"
11 #include "content/gpu/establish_channel_params.h"
12 #include "gpu/command_buffer/common/sync_token.h"
13 #include "gpu/command_buffer/common/value_state.h"
14 #include "gpu/command_buffer/service/gpu_preferences.h"
15 #include "gpu/config/gpu_info.h"
16 #include "gpu/ipc/common/gpu_command_buffer_traits.h"
17 #include "gpu/ipc/common/gpu_param_traits.h"
18 #include "gpu/ipc/common/memory_stats.h"
19 #include "gpu/ipc/common/surface_handle.h"
20 #include "ipc/ipc_channel_handle.h"
21 #include "ipc/ipc_message_macros.h"
22 #include "ipc/ipc_message_start.h"
23 #include "ui/events/ipc/latency_info_param_traits.h"
24 #include "ui/gfx/gpu_memory_buffer.h"
25 #include "ui/gfx/ipc/gfx_param_traits.h"
26 #include "url/gurl.h"
27 #include "url/ipc/url_param_traits.h"
28
29 #if defined(OS_MACOSX)
30 #include "content/common/gpu/accelerated_surface_buffers_swapped_params_mac.h"
31 #include "content/common/gpu/buffer_presented_params_mac.h"
32 #include "ui/base/cocoa/remote_layer_api.h"
33 #include "ui/gfx/mac/io_surface.h"
34 #endif
35
36 #undef IPC_MESSAGE_EXPORT
37 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
38
39 #define IPC_MESSAGE_START GpuMsgStart
40
41 IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
42 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
43 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
44 IPC_STRUCT_TRAITS_END()
45
46 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoMemoryUsageStats)
47 IPC_STRUCT_TRAITS_MEMBER(process_map)
48 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated)
49 IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_historical_max)
50 IPC_STRUCT_TRAITS_END()
51
52 IPC_STRUCT_TRAITS_BEGIN(gpu::VideoMemoryUsageStats::ProcessStats)
53 IPC_STRUCT_TRAITS_MEMBER(video_memory)
54 IPC_STRUCT_TRAITS_MEMBER(has_duplicates)
55 IPC_STRUCT_TRAITS_END()
56
57 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBuffer_Params)
58 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id)
59 IPC_STRUCT_MEMBER(gfx::Size, size)
60 IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
61 IPC_STRUCT_MEMBER(gfx::BufferUsage, usage)
62 IPC_STRUCT_MEMBER(int32_t, client_id)
63 IPC_STRUCT_MEMBER(gpu::SurfaceHandle, surface_handle)
64 IPC_STRUCT_END()
65
66 IPC_STRUCT_BEGIN(GpuMsg_CreateGpuMemoryBufferFromHandle_Params)
67 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, handle)
68 IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferId, id)
69 IPC_STRUCT_MEMBER(gfx::Size, size)
70 IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
71 IPC_STRUCT_MEMBER(int32_t, client_id)
72 IPC_STRUCT_END()
73
74 IPC_STRUCT_TRAITS_BEGIN(content::EstablishChannelParams)
75 IPC_STRUCT_TRAITS_MEMBER(client_id)
76 IPC_STRUCT_TRAITS_MEMBER(client_tracing_id)
77 IPC_STRUCT_TRAITS_MEMBER(preempts)
78 IPC_STRUCT_TRAITS_MEMBER(allow_view_command_buffers)
79 IPC_STRUCT_TRAITS_MEMBER(allow_real_time_streams)
80 IPC_STRUCT_TRAITS_END()
81
82 #if defined(OS_MACOSX)
83 IPC_STRUCT_TRAITS_BEGIN(content::AcceleratedSurfaceBuffersSwappedParams)
84 IPC_STRUCT_TRAITS_MEMBER(surface_id)
85 // Only one of ca_context_id or io_surface may be non-0.
86 IPC_STRUCT_TRAITS_MEMBER(ca_context_id)
87 IPC_STRUCT_TRAITS_MEMBER(io_surface)
88 IPC_STRUCT_TRAITS_MEMBER(size)
89 IPC_STRUCT_TRAITS_MEMBER(scale_factor)
90 IPC_STRUCT_TRAITS_MEMBER(latency_info)
91 IPC_STRUCT_TRAITS_END()
92
93 IPC_STRUCT_TRAITS_BEGIN(content::BufferPresentedParams)
94 // The vsync parameters, to synchronize presentation with the display.
95 IPC_STRUCT_TRAITS_MEMBER(surface_id)
96 IPC_STRUCT_TRAITS_MEMBER(vsync_timebase)
97 IPC_STRUCT_TRAITS_MEMBER(vsync_interval)
98 IPC_STRUCT_TRAITS_END()
99 #endif
100
101 IPC_STRUCT_TRAITS_BEGIN(gpu::GpuPreferences)
102 IPC_STRUCT_TRAITS_MEMBER(single_process)
103 IPC_STRUCT_TRAITS_MEMBER(in_process_gpu)
104 IPC_STRUCT_TRAITS_MEMBER(ui_prioritize_in_gpu_process)
105 IPC_STRUCT_TRAITS_MEMBER(disable_accelerated_video_decode)
106 #if defined(OS_CHROMEOS)
107 IPC_STRUCT_TRAITS_MEMBER(disable_vaapi_accelerated_video_encode)
108 #endif
109 #if defined(ENABLE_WEBRTC)
110 IPC_STRUCT_TRAITS_MEMBER(disable_web_rtc_hw_encoding)
111 #endif
112 #if defined(OS_WIN)
113 IPC_STRUCT_TRAITS_MEMBER(enable_accelerated_vpx_decode)
114 #endif
115 IPC_STRUCT_TRAITS_MEMBER(compile_shader_always_succeeds)
116 IPC_STRUCT_TRAITS_MEMBER(disable_gl_error_limit)
117 IPC_STRUCT_TRAITS_MEMBER(disable_glsl_translator)
118 IPC_STRUCT_TRAITS_MEMBER(disable_gpu_driver_bug_workarounds)
119 IPC_STRUCT_TRAITS_MEMBER(disable_shader_name_hashing)
120 IPC_STRUCT_TRAITS_MEMBER(enable_gpu_command_logging)
121 IPC_STRUCT_TRAITS_MEMBER(enable_gpu_debugging)
122 IPC_STRUCT_TRAITS_MEMBER(enable_gpu_service_logging_gpu)
123 IPC_STRUCT_TRAITS_MEMBER(disable_gpu_program_cache)
124 IPC_STRUCT_TRAITS_MEMBER(enforce_gl_minimums)
125 IPC_STRUCT_TRAITS_MEMBER(force_gpu_mem_available)
126 IPC_STRUCT_TRAITS_MEMBER(gpu_program_cache_size)
127 IPC_STRUCT_TRAITS_MEMBER(disable_gpu_shader_disk_cache)
128 IPC_STRUCT_TRAITS_MEMBER(enable_share_group_async_texture_upload)
129 IPC_STRUCT_TRAITS_MEMBER(enable_subscribe_uniform_extension)
130 IPC_STRUCT_TRAITS_MEMBER(enable_threaded_texture_mailboxes)
131 IPC_STRUCT_TRAITS_MEMBER(gl_shader_interm_output)
132 IPC_STRUCT_TRAITS_MEMBER(emulate_shader_precision)
133 IPC_STRUCT_TRAITS_MEMBER(enable_gpu_service_logging)
134 IPC_STRUCT_TRAITS_MEMBER(enable_gpu_service_tracing)
135 IPC_STRUCT_TRAITS_MEMBER(enable_unsafe_es3_apis)
136 IPC_STRUCT_TRAITS_END()
137
138 //------------------------------------------------------------------------------
139 // GPU Messages
140 // These are messages from the browser to the GPU process.
141
142 // Tells the GPU process to initialize itself. The browser explicitly
143 // requests this be done so that we are guaranteed that the channel is set
144 // up between the browser and GPU process before doing any work that might
145 // potentially crash the GPU process. Detection of the child process
146 // exiting abruptly is predicated on having the IPC channel set up.
147 IPC_MESSAGE_CONTROL1(GpuMsg_Initialize,
148 gpu::GpuPreferences /* gpu_prefernces */)
149
150 // Tells the GPU process to shutdown itself.
151 IPC_MESSAGE_CONTROL0(GpuMsg_Finalize)
152
153 // Tells the GPU process to create a new channel for communication with a
154 // given client. The channel name is returned in a
155 // GpuHostMsg_ChannelEstablished message. The client ID is passed so
156 // that the GPU process reuses an existing channel to that process if it exists.
157 // This ID is a unique opaque identifier generated by the browser process.
158 // The client_tracing_id is a unique ID used for the purposes of tracing.
159 IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel,
160 content::EstablishChannelParams /* params */)
161
162 // Tells the GPU process to close the channel identified by |client_id|.
163 // If no channel can be identified, do nothing.
164 IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, int32_t /* client_id */)
165
166 // Tells the GPU process to create a new gpu memory buffer.
167 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
168 GpuMsg_CreateGpuMemoryBuffer_Params)
169
170 // Tells the GPU process to create a new gpu memory buffer from an existing
171 // handle.
172 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBufferFromHandle,
173 GpuMsg_CreateGpuMemoryBufferFromHandle_Params)
174
175 // Tells the GPU process to destroy buffer.
176 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
177 gfx::GpuMemoryBufferId, /* id */
178 int32_t, /* client_id */
179 gpu::SyncToken /* sync_token */)
180
181 // Tells the GPU process to create a context for collecting graphics card
182 // information.
183 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
184
185 // Tells the GPU process to report video_memory information for the task manager
186 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
187
188 #if defined(OS_MACOSX)
189 // Tells the GPU process that the browser process has handled the swap
190 // buffers or post sub-buffer request.
191 IPC_MESSAGE_CONTROL1(AcceleratedSurfaceMsg_BufferPresented,
192 content::BufferPresentedParams)
193 #endif
194
195 #if defined(OS_ANDROID)
196 // Tells the GPU process to wake up the GPU because we're about to draw.
197 IPC_MESSAGE_CONTROL0(GpuMsg_WakeUpGpu)
198 #endif
199
200 // Tells the GPU process to remove all contexts.
201 IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
202
203 // Tells the GPU process to crash.
204 IPC_MESSAGE_CONTROL0(GpuMsg_Crash)
205
206 // Tells the GPU process to hang.
207 IPC_MESSAGE_CONTROL0(GpuMsg_Hang)
208
209 // Tells the GPU process to disable the watchdog thread.
210 IPC_MESSAGE_CONTROL0(GpuMsg_DisableWatchdog)
211
212 // Tells the GPU process that the browser has seen a GPU switch.
213 IPC_MESSAGE_CONTROL0(GpuMsg_GpuSwitched)
214
215 // Sends an input event to the gpu service.
216 IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState,
217 int, /* client_id */
218 unsigned int, /* target */
219 gpu::ValueState /* valuestate */)
220
221 //------------------------------------------------------------------------------
222 // GPU Host Messages
223 // These are messages to the browser.
224
225 // Response from GPU to a GputMsg_Initialize message.
226 IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
227 bool /* result */,
228 ::gpu::GPUInfo /* gpu_info */)
229
230 // Response from GPU to a GpuHostMsg_EstablishChannel message.
231 IPC_MESSAGE_CONTROL1(GpuHostMsg_ChannelEstablished,
232 IPC::ChannelHandle /* channel_handle */)
233
234 // Message from GPU to notify to destroy the channel.
235 IPC_MESSAGE_CONTROL1(GpuHostMsg_DestroyChannel, int32_t /* client_id */)
236
237 // Message to cache the given shader information.
238 IPC_MESSAGE_CONTROL3(GpuHostMsg_CacheShader,
239 int32_t /* client_id */,
240 std::string /* key */,
241 std::string /* shader */)
242
243 // Message to the GPU that a shader was loaded from disk.
244 IPC_MESSAGE_CONTROL1(GpuMsg_LoadedShader, std::string /* encoded shader */)
245
246 // Response from GPU to a GpuMsg_CreateGpuMemoryBuffer message.
247 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryBufferCreated,
248 gfx::GpuMemoryBufferHandle /* handle */)
249
250 // Response from GPU to a GpuMsg_CollectGraphicsInfo.
251 IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
252 gpu::GPUInfo /* GPU logging stats */)
253
254 // Response from GPU to a GpuMsg_GetVideoMemory.
255 IPC_MESSAGE_CONTROL1(GpuHostMsg_VideoMemoryUsageStats,
256 gpu::VideoMemoryUsageStats /* GPU memory stats */)
257
258 #if defined(OS_MACOSX)
259 // Tells the browser that an accelerated surface has swapped.
260 IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
261 content::AcceleratedSurfaceBuffersSwappedParams)
262 #endif
263
264 #if defined(OS_WIN)
265 IPC_MESSAGE_CONTROL2(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow,
266 gpu::SurfaceHandle /* parent_window */,
267 gpu::SurfaceHandle /* child_window */)
268 #endif
269
270 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidCreateOffscreenContext, GURL /* url */)
271
272 IPC_MESSAGE_CONTROL3(GpuHostMsg_DidLoseContext,
273 bool /* offscreen */,
274 gpu::error::ContextLostReason /* reason */,
275 GURL /* url */)
276
277 IPC_MESSAGE_CONTROL1(GpuHostMsg_DidDestroyOffscreenContext, GURL /* url */)
278
279 // Tells the browser about GPU memory usage statistics for UMA logging.
280 IPC_MESSAGE_CONTROL1(GpuHostMsg_GpuMemoryUmaStats,
281 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
282
283 // Tells the browser that a context has subscribed to a new target and
284 // the browser should start sending the corresponding information
285 IPC_MESSAGE_CONTROL2(GpuHostMsg_AddSubscription,
286 int32_t /* client_id */,
287 unsigned int /* target */)
288
289 // Tells the browser that no contexts are subscribed to the target anymore
290 // so the browser should stop sending the corresponding information
291 IPC_MESSAGE_CONTROL2(GpuHostMsg_RemoveSubscription,
292 int32_t /* client_id */,
293 unsigned int /* target */)
294
295 // Message from GPU to add a GPU log message to the about:gpu page.
296 IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
297 int /*severity*/,
298 std::string /* header */,
299 std::string /* message */)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698