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

Side by Side Diff: content/common/gpu/gpu_browser_messages.h

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

Powered by Google App Engine
This is Rietveld 408576698