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

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 sievers@'s comments 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.
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 GpuBrowserMsgStart
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(GpuBrowserMsg_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(GpuBrowserMsg_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 //------------------------------------------------------------------------------
77 // GPU Messages
78 // These are messages from the browser to the GPU process.
79
80 // Tells the GPU process to initialize itself. The browser explicitly
81 // requests this be done so that we are guaranteed that the channel is set
82 // up between the browser and GPU process before doing any work that might
83 // potentially crash the GPU process. Detection of the child process
84 // exiting abruptly is predicated on having the IPC channel set up.
85 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Initialize)
86
87 // Tells the GPU process to shutdown itself.
88 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Finalize)
89
90 // Tells the GPU process to create a new channel for communication with a
91 // given client. The channel name is returned in a
92 // GpuBrowserHostMsg_ChannelEstablished message. The client ID is passed so
93 // that
94 // the GPU process reuses an existing channel to that process if it exists.
95 // This ID is a unique opaque identifier generated by the browser process.
96 // The client_tracing_id is a unique ID used for the purposes of tracing.
97 IPC_MESSAGE_CONTROL1(GpuBrowserMsg_EstablishChannel,
98 content::EstablishChannelParams /* params */)
99
100 // Tells the GPU process to close the channel identified by IPC channel
101 // handle. If no channel can be identified, do nothing.
102 IPC_MESSAGE_CONTROL1(GpuBrowserMsg_CloseChannel,
103 IPC::ChannelHandle /* channel_handle */)
104
105 // Tells the GPU process to create a new gpu memory buffer.
106 IPC_MESSAGE_CONTROL1(GpuBrowserMsg_CreateGpuMemoryBuffer,
107 GpuBrowserMsg_CreateGpuMemoryBuffer_Params)
108
109 // Tells the GPU process to create a new gpu memory buffer from an existing
110 // handle.
111 IPC_MESSAGE_CONTROL1(GpuBrowserMsg_CreateGpuMemoryBufferFromHandle,
112 GpuBrowserMsg_CreateGpuMemoryBufferFromHandle_Params)
113
114 // Tells the GPU process to destroy buffer.
115 IPC_MESSAGE_CONTROL3(GpuBrowserMsg_DestroyGpuMemoryBuffer,
116 gfx::GpuMemoryBufferId, /* id */
117 int32_t, /* client_id */
118 gpu::SyncToken /* sync_token */)
119
120 // Tells the GPU process to create a context for collecting graphics card
121 // information.
122 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_CollectGraphicsInfo)
123
124 // Tells the GPU process to report video_memory information for the task manager
125 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_GetVideoMemoryUsageStats)
126
127 #if defined(OS_MACOSX)
128 // Tells the GPU process that the browser process has handled the swap
129 // buffers or post sub-buffer request.
130 IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented,
131 AcceleratedSurfaceMsg_BufferPresented_Params)
132 #endif
133
134 #if defined(OS_ANDROID)
135 // Tells the GPU process to wake up the GPU because we're about to draw.
136 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_WakeUpGpu)
137 #endif
138
139 // Tells the GPU process to remove all contexts.
140 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Clean)
141
142 // Tells the GPU process to crash.
143 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Crash)
144
145 // Tells the GPU process to hang.
146 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_Hang)
147
148 // Tells the GPU process to disable the watchdog thread.
149 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_DisableWatchdog)
150
151 // Tells the GPU process that the browser has seen a GPU switch.
152 IPC_MESSAGE_CONTROL0(GpuBrowserMsg_GpuSwitched)
153
154 // Sends an input event to the gpu service.
155 IPC_MESSAGE_CONTROL3(GpuBrowserMsg_UpdateValueState,
156 int, /* client_id */
157 unsigned int, /* target */
158 gpu::ValueState /* valuestate */)
159
160 //------------------------------------------------------------------------------
161 // GPU Host Messages
162 // These are messages to the browser.
163
164 // A renderer sends this when it wants to create a connection to the GPU
165 // process. The browser will create the GPU process if necessary, and will
166 // return a handle to the channel via a GpuChannelEstablished message.
167 IPC_SYNC_MESSAGE_CONTROL1_3(GpuBrowserHostMsg_EstablishGpuChannel,
168 content::CauseForGpuLaunch,
169 int /* client id */,
170 IPC::ChannelHandle /* handle to channel */,
171 gpu::GPUInfo /* stats about GPU process*/)
172
173 // A renderer sends this when it wants to know whether a gpu process exists.
174 IPC_SYNC_MESSAGE_CONTROL0_1(GpuBrowserHostMsg_HasGpuProcess, bool /* result */)
175
176 // Response from GPU to a GputMsg_Initialize message.
177 IPC_MESSAGE_CONTROL2(GpuBrowserHostMsg_Initialized,
178 bool /* result */,
179 ::gpu::GPUInfo /* gpu_info */)
180
181 // Response from GPU to a GpuBrowserHostMsg_EstablishChannel message.
182 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_ChannelEstablished,
183 IPC::ChannelHandle /* channel_handle */)
184
185 // Message from GPU to notify to destroy the channel.
186 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_DestroyChannel, int32_t /* client_id */)
187
188 // Message to cache the given shader information.
189 IPC_MESSAGE_CONTROL3(GpuBrowserHostMsg_CacheShader,
190 int32_t /* client_id */,
191 std::string /* key */,
192 std::string /* shader */)
193
194 // Message to the GPU that a shader was loaded from disk.
195 IPC_MESSAGE_CONTROL1(GpuBrowserMsg_LoadedShader,
196 std::string /* encoded shader */)
197
198 // Response from GPU to a GpuBrowserMsg_CreateGpuMemoryBuffer message.
199 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_GpuMemoryBufferCreated,
200 gfx::GpuMemoryBufferHandle /* handle */)
201
202 // Response from GPU to a GpuBrowserMsg_CollectGraphicsInfo.
203 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_GraphicsInfoCollected,
204 gpu::GPUInfo /* GPU logging stats */)
205
206 // Response from GPU to a GpuBrowserMsg_GetVideoMemory.
207 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_VideoMemoryUsageStats,
208 content::GPUVideoMemoryUsageStats /* GPU memory stats */)
209
210 #if defined(OS_MACOSX)
211 // Tells the browser that an accelerated surface has swapped.
212 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_AcceleratedSurfaceBuffersSwapped,
213 GpuBrowserHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
214 #endif
215
216 #if defined(OS_WIN)
217 IPC_MESSAGE_CONTROL2(GpuBrowserHostMsg_AcceleratedSurfaceCreatedChildWindow,
218 gfx::PluginWindowHandle /* parent_window */,
219 gfx::PluginWindowHandle /* child_window */)
220 #endif
221
222 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_DidCreateOffscreenContext,
223 GURL /* url */)
224
225 IPC_MESSAGE_CONTROL3(GpuBrowserHostMsg_DidLoseContext,
226 bool /* offscreen */,
227 gpu::error::ContextLostReason /* reason */,
228 GURL /* url */)
229
230 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_DidDestroyOffscreenContext,
231 GURL /* url */)
232
233 // Tells the browser about GPU memory usage statistics for UMA logging.
234 IPC_MESSAGE_CONTROL1(GpuBrowserHostMsg_GpuMemoryUmaStats,
235 content::GPUMemoryUmaStats /* GPU memory UMA stats */)
236
237 // Tells the browser that a context has subscribed to a new target and
238 // the browser should start sending the corresponding information
239 IPC_MESSAGE_CONTROL2(GpuBrowserHostMsg_AddSubscription,
240 int32_t /* client_id */,
241 unsigned int /* target */)
242
243 // Tells the browser that no contexts are subscribed to the target anymore
244 // so the browser should stop sending the corresponding information
245 IPC_MESSAGE_CONTROL2(GpuBrowserHostMsg_RemoveSubscription,
246 int32_t /* client_id */,
247 unsigned int /* target */)
248
249 // Message from GPU to add a GPU log message to the about:gpu page.
250 IPC_MESSAGE_CONTROL3(GpuBrowserHostMsg_OnLogMessage,
251 int /*severity*/,
252 std::string /* header */,
253 std::string /* message */)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698