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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
include LayersMessages;
include PlatformWidgetTypes;
include PCompositorBridgeTypes;
include protocol PAPZ;
include protocol PAPZCTreeManager;
include protocol PBrowser;
include protocol PCanvas;
include protocol PCompositorManager;
include protocol PCompositorWidget;
include protocol PLayerTransaction;
include protocol PTexture;
include protocol PWebGL;
include protocol PWebRenderBridge;
include protocol PWebGPU;
include "mozilla/GfxMessageUtils.h";
include "mozilla/layers/LayersMessageUtils.h";
include "mozilla/layers/WebRenderMessageUtils.h";
using struct mozilla::null_t from "mozilla/ipc/IPCCore.h";
using struct mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using struct mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h";
using mozilla::layers::MaybeZoomConstraints from "mozilla/layers/ZoomConstraints.h";
using mozilla::layers::WindowKind from "mozilla/layers/LayersTypes.h";
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
using mozilla::CSSIntRegion from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::LayoutDeviceIntRegion from "Units.h";
using mozilla::LayoutDeviceIntSize from "Units.h";
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
using base::ProcessId from "base/process.h";
using mozilla::wr::MaybeExternalImageId from "mozilla/webrender/WebRenderTypes.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
using struct DxgiAdapterDesc from "mozilla/D3DMessageUtils.h";
namespace mozilla {
namespace layers {
struct FrameStats {
TransactionId id;
TimeStamp compositeStart;
TimeStamp renderStart;
TimeStamp compositeEnd;
int32_t contentFrameTime;
double resourceUploadTime;
double gpuCacheUploadTime;
TimeStamp transactionStart;
TimeStamp refreshStart;
TimeStamp fwdTime;
TimeStamp sceneBuiltTime;
uint32_t skippedComposites;
nsCString url;
};
/**
* The PCompositorBridge protocol is a top-level protocol for the compositor.
* There is an instance of the protocol for each compositor, plus one for each
* content process. In other words:
* - There is a CompositorBridgeParent/CompositorBridgeChild pair created
* for each "top level browser window", which has its own compositor. The
* CompositorBridgeChild instance lives in the UI process, and the
* CompositorBridgeParent lives in the GPU process (if there is one) or the
* UI process otherwise.
* - There is also a ContentCompositorBridgeParent/CompositorBridgeChild
* pair created for each content process. The ContentCompositorBridgeParent
* lives in the GPU process (if there is one) or the UI process otherwise. The
* CompositorBridgeChild is a singleton in the content process. Note that
* a given content process may have multiple browser instances (represented
* by BrowserChild instances), that are attached to different windows, and therefore
* rendered by different compositors. This means that when a browser instance
* sends messages via its CompositorBridgeChild, the corresponding
* ContentCompositorBridgeParent has to use the layers id in the message
* to find the correct compositor or CompositorBridgeParent to pass the message
* on to.
*
* One of the main goals of this protocol is to manage the PLayerTransaction sub-
* protocol, which is per-browser. A lot of the functions in the protocol are
* basically multiplexing/demultiplexing stuff in PLayerTransaction.
*/
sync refcounted protocol PCompositorBridge
{
manager PCompositorManager;
manages PAPZ;
manages PAPZCTreeManager;
// A Compositor manages a single Layer Manager (PLayerTransaction)
manages PLayerTransaction;
manages PTexture;
manages PCompositorWidget;
manages PWebRenderBridge;
manages PWebGL;
manages PWebGPU;
child:
// The child should invalidate retained layers. This is used for local
// compositor device resets, such as in CompositorD3D9, and ensures that
// TextureSources are recreated.
async InvalidateLayers(LayersId layersId);
// The compositor completed a layers transaction. id is the layers id
// of the child layer tree that was composited (or 0 when notifying
// the root layer tree).
// transactionId is the id of the transaction before this composite, or 0
// if there was no transaction since the last composite.
prio(mediumhigh) async DidComposite(LayersId id, TransactionId transactionId,
TimeStamp compositeStart,
TimeStamp compositeEnd);
async NotifyFrameStats(FrameStats[] aFrameStats);
/**
* Parent informs the child that the graphics objects are ready for
* compositing. This usually means that the graphics objects (textures
* and the like) are available on the GPU. This is used for chrome UI.
* @see RequestNotifyAfterRemotePaint
* @see PBrowser
*/
async RemotePaintIsReady();
/**
* Bounce plugin widget configurations over to the main thread for
* application on the widgets. Used on Windows and Linux in managing
* plugin widgets.
*/
async UpdatePluginConfigurations(LayoutDeviceIntPoint aContentOffset,
LayoutDeviceIntRegion aVisibleRegion,
PluginWindowData[] aPlugins);
/**
* Captures an image for all visible child plugins of a given widget for use
* during scrolling.
* @param aParentWidget parent of widgets to be captured
*/
async CaptureAllPlugins(uintptr_t aParentWidget);
/**
* Hides all registered plugin widgets associated with a particular chrome
* widget.
*/
async HideAllPlugins(uintptr_t aParentWidget);
async ParentAsyncMessages(AsyncParentMessageData[] aMessages);
async ObserveLayersUpdate(LayersId aLayersId, LayersObserverEpoch aEpoch, bool aActive);
async CompositorOptionsChanged(LayersId id, CompositorOptions newOptions);
async NotifyJankedAnimations(LayersId id, uint64_t[] aJankedAnimations);
parent:
async __delete__();
// Must be called before Initialize().
async PCompositorWidget(CompositorWidgetInitData aInitData);
// When out-of-process, this must be called to finish initialization.
sync Initialize(LayersId rootLayerTreeId);
// Must be called after Initialize(), and only succeeds if AsyncPanZoomEnabled() is true.
async PAPZ(LayersId layersId);
async PAPZCTreeManager(LayersId layersId);
// Constructor for WebGPU IPDL
// Must be called before Initialize().
async PWebGPU();
/**
* Confirmation callback for UpdatePluginConfigurations and HideAllPlugins.
*/
async RemotePluginsReady();
// The child is about to be destroyed, so perform any necessary cleanup.
sync WillClose();
// Pause/resume the compositor. These are intended to be used on mobile, when
// the compositor needs to pause/resume in lockstep with the application.
sync Pause();
sync Resume();
async ResumeAsync();
// See bug 1316632 comment #33 for why this has to be sync. Otherwise,
// there are ordering issues with SendPLayerTransactionConstructor.
sync NotifyChildCreated(LayersId id)
returns (CompositorOptions compositorOptions);
// This version of NotifyChildCreated also performs a layer tree mapping.
//
// See bug 1316632 comment #33 for why this has to be sync. Otherwise,
// there are ordering issues with SendPLayerTransactionConstructor.
sync MapAndNotifyChildCreated(LayersId id, ProcessId owner)
returns (CompositorOptions compositorOptions);
async AdoptChild(LayersId id);
// Same as NotifyChildCreated, but used when child processes need to
// reassociate layers. This must be synchronous to ensure that the
// association happens before PLayerTransactions are sent over the
// cross-process bridge.
sync NotifyChildRecreated(LayersId id)
returns (CompositorOptions compositorOptions);
// Make a snapshot of the content that would have been drawn to our
// render target at the time this message is received. If the size
// or format of |inSnapshot| doesn't match our render target,
// results are undefined.
//
// NB: this message will result in animations, transforms, effects,
// and so forth being interpolated. That's what we want to happen.
sync MakeSnapshot(SurfaceDescriptor inSnapshot, IntRect dirtyRect);
// Make sure any pending composites are started immediately and
// block until they are completed.
sync FlushRendering();
// Same as FlushRendering, but asynchronous, since not all platforms require
// synchronous repaints on resize.
async FlushRenderingAsync();
// Make sure any pending composites have been received.
sync WaitOnTransactionProcessed();
// Force an additional frame presentation to be executed. This is used to
// work around a windows presentation bug (See Bug 1232042)
async ForcePresent();
sync StartFrameTimeRecording(int32_t bufferSize)
returns (uint32_t startIndex);
sync StopFrameTimeRecording(uint32_t startIndex)
returns (float[] intervals);
// layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored.
async PLayerTransaction(LayersBackend[] layersBackendHints, LayersId id);
// Notify the compositor that a region of the screen has been invalidated.
async NotifyRegionInvalidated(nsIntRegion region);
/**
* The child (content/chrome thread) requests that the parent inform it when
* the graphics objects are ready to display.
* @see PBrowser
* @see RemotePaintIsReady
*/
async RequestNotifyAfterRemotePaint();
/**
* Sent when the child has finished CaptureAllPlugins.
*/
async AllPluginsCaptured();
async PTexture(SurfaceDescriptor aSharedData, ReadLockDescriptor aReadLock, LayersBackend aBackend, TextureFlags aTextureFlags, LayersId id, uint64_t aSerial, MaybeExternalImageId aExternalImageId);
async InitPCanvasParent(Endpoint<PCanvasParent> aEndpoint);
async ReleasePCanvasParent();
sync SyncWithCompositor();
// The pipelineId is the same as the layersId
async PWebRenderBridge(PipelineId pipelineId, LayoutDeviceIntSize aSize, WindowKind aKind);
sync CheckContentOnlyTDR(uint32_t sequenceNum)
returns (bool isContentOnlyTDR);
async BeginRecording(TimeStamp aRecordingStart)
returns (bool success);
async EndRecordingToDisk()
returns (bool success);
async EndRecordingToMemory()
returns (CollectedFramesParams? frames);
sync SupportsAsyncDXGISurface()
returns (bool value);
sync PreferredDXGIAdapter()
returns (DxgiAdapterDesc desc);
// To set up sharing the composited output to Firefox Reality on Desktop
async RequestFxrOutput();
// Actor that represents one WebGL context.
async PWebGL();
child:
// Send back Compositor Frame Metrics from APZCs so tiled layers can
// update progressively.
async SharedCompositorFrameMetrics(Handle metrics, CrossProcessMutexHandle mutex, LayersId aLayersId, uint32_t aAPZCId);
async ReleaseSharedCompositorFrameMetrics(ViewID aId, uint32_t aAPZCId);
};
} // layers
} // mozilla
|