2012-01-19 18:45:37 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2012-10-04 11:05:24 +04:00
|
|
|
include LayersSurfaces;
|
2015-01-29 22:41:55 +03:00
|
|
|
include LayersMessages;
|
2016-07-01 11:15:16 +03:00
|
|
|
include PlatformWidgetTypes;
|
2019-11-08 01:35:04 +03:00
|
|
|
include PCompositorBridgeTypes;
|
2016-08-02 09:59:00 +03:00
|
|
|
include protocol PAPZ;
|
2016-08-16 23:59:13 +03:00
|
|
|
include protocol PAPZCTreeManager;
|
2016-01-08 22:17:39 +03:00
|
|
|
include protocol PBrowser;
|
2018-12-02 17:19:11 +03:00
|
|
|
include protocol PCanvas;
|
2017-06-14 18:40:00 +03:00
|
|
|
include protocol PCompositorManager;
|
2016-07-01 11:15:16 +03:00
|
|
|
include protocol PCompositorWidget;
|
2016-04-13 00:04:50 +03:00
|
|
|
include protocol PTexture;
|
2016-11-16 16:54:51 +03:00
|
|
|
include protocol PWebRenderBridge;
|
2019-11-14 07:59:56 +03:00
|
|
|
include protocol PWebGPU;
|
2013-07-26 23:28:31 +04:00
|
|
|
include "mozilla/GfxMessageUtils.h";
|
2017-06-09 07:32:13 +03:00
|
|
|
include "mozilla/layers/LayersMessageUtils.h";
|
2017-04-20 04:24:13 +03:00
|
|
|
include "mozilla/layers/WebRenderMessageUtils.h";
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2020-11-23 19:05:20 +03:00
|
|
|
using struct mozilla::null_t from "mozilla/ipc/IPCCore.h";
|
2018-03-25 02:06:01 +03:00
|
|
|
using struct mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
|
2013-10-01 23:25:07 +04:00
|
|
|
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
2018-11-01 23:15:46 +03:00
|
|
|
using struct mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
|
|
|
|
using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h";
|
2020-12-18 12:27:19 +03:00
|
|
|
using mozilla::layers::WindowKind from "mozilla/layers/LayersTypes.h";
|
2013-10-01 23:25:07 +04:00
|
|
|
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
2016-03-19 04:38:57 +03:00
|
|
|
using mozilla::CSSIntRegion from "Units.h";
|
2015-12-03 01:32:55 +03:00
|
|
|
using mozilla::LayoutDeviceIntPoint from "Units.h";
|
|
|
|
using mozilla::LayoutDeviceIntRegion from "Units.h";
|
2017-03-07 02:46:30 +03:00
|
|
|
using mozilla::LayoutDeviceIntSize from "Units.h";
|
2014-02-12 08:41:57 +04:00
|
|
|
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
2016-04-13 00:04:50 +03:00
|
|
|
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
|
2017-01-13 01:29:41 +03:00
|
|
|
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
|
2017-01-17 23:13:41 +03:00
|
|
|
using mozilla::wr::PipelineId from "mozilla/webrender/WebRenderTypes.h";
|
2017-07-31 23:31:10 +03:00
|
|
|
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
|
2021-10-05 15:54:39 +03:00
|
|
|
using mozilla::wr::RenderReasons from "mozilla/webrender/webrender_ffi.h";
|
2017-04-04 01:13:37 +03:00
|
|
|
using base::ProcessId from "base/process.h";
|
2017-04-20 04:24:13 +03:00
|
|
|
using mozilla::wr::MaybeExternalImageId from "mozilla/webrender/WebRenderTypes.h";
|
2018-07-30 16:24:50 +03:00
|
|
|
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
|
2018-04-20 22:13:06 +03:00
|
|
|
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
|
2020-01-09 01:19:14 +03:00
|
|
|
|
2012-01-19 18:45:37 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2018-11-16 05:13:56 +03:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2012-01-19 18:45:37 +04:00
|
|
|
/**
|
2017-01-16 18:51:43 +03:00
|
|
|
* 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.
|
2019-03-05 04:36:43 +03:00
|
|
|
* - There is also a ContentCompositorBridgeParent/CompositorBridgeChild
|
|
|
|
* pair created for each content process. The ContentCompositorBridgeParent
|
2017-01-16 18:51:43 +03:00
|
|
|
* 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
|
2019-04-10 01:39:01 +03:00
|
|
|
* by BrowserChild instances), that are attached to different windows, and therefore
|
2017-01-16 18:51:43 +03:00
|
|
|
* rendered by different compositors. This means that when a browser instance
|
|
|
|
* sends messages via its CompositorBridgeChild, the corresponding
|
2019-03-05 04:36:43 +03:00
|
|
|
* ContentCompositorBridgeParent has to use the layers id in the message
|
2017-01-16 18:51:43 +03:00
|
|
|
* 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.
|
2012-01-19 18:45:37 +04:00
|
|
|
*/
|
2021-07-22 05:24:43 +03:00
|
|
|
[RefCounted] sync protocol PCompositorBridge
|
2012-01-19 18:45:37 +04:00
|
|
|
{
|
2017-06-14 18:40:00 +03:00
|
|
|
manager PCompositorManager;
|
|
|
|
|
2016-08-02 09:59:00 +03:00
|
|
|
manages PAPZ;
|
2016-08-16 23:59:13 +03:00
|
|
|
manages PAPZCTreeManager;
|
2013-04-24 22:42:40 +04:00
|
|
|
// A Compositor manages a single Layer Manager (PLayerTransaction)
|
2016-04-13 00:04:50 +03:00
|
|
|
manages PTexture;
|
2016-07-01 11:15:16 +03:00
|
|
|
manages PCompositorWidget;
|
2016-11-16 16:54:51 +03:00
|
|
|
manages PWebRenderBridge;
|
2019-11-14 07:59:56 +03:00
|
|
|
manages PWebGPU;
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2013-11-22 02:07:56 +04:00
|
|
|
child:
|
2016-02-29 09:53:12 +03:00
|
|
|
// The child should invalidate retained layers. This is used for local
|
|
|
|
// compositor device resets, such as in CompositorD3D9, and ensures that
|
|
|
|
// TextureSources are recreated.
|
2018-03-25 02:06:01 +03:00
|
|
|
async InvalidateLayers(LayersId layersId);
|
2013-11-22 02:07:56 +04:00
|
|
|
|
2014-03-07 07:24:32 +04:00
|
|
|
// 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).
|
2015-07-06 06:02:26 +03:00
|
|
|
// transactionId is the id of the transaction before this composite, or 0
|
|
|
|
// if there was no transaction since the last composite.
|
2021-05-21 18:46:46 +03:00
|
|
|
[Priority=control] async DidComposite(LayersId id,
|
|
|
|
TransactionId[] transactionId,
|
|
|
|
TimeStamp compositeStart,
|
|
|
|
TimeStamp compositeEnd);
|
2014-03-07 07:24:32 +04:00
|
|
|
|
2018-11-16 05:13:56 +03:00
|
|
|
async NotifyFrameStats(FrameStats[] aFrameStats);
|
|
|
|
|
2016-06-15 14:28:10 +03:00
|
|
|
async ParentAsyncMessages(AsyncParentMessageData[] aMessages);
|
|
|
|
|
2018-07-30 16:24:50 +03:00
|
|
|
async ObserveLayersUpdate(LayersId aLayersId, LayersObserverEpoch aEpoch, bool aActive);
|
2016-09-24 04:12:45 +03:00
|
|
|
|
2019-11-19 02:13:55 +03:00
|
|
|
async CompositorOptionsChanged(LayersId id, CompositorOptions newOptions);
|
|
|
|
|
2020-07-05 14:45:01 +03:00
|
|
|
async NotifyJankedAnimations(LayersId id, uint64_t[] aJankedAnimations);
|
|
|
|
|
2015-01-29 22:41:55 +03:00
|
|
|
parent:
|
2017-06-14 18:40:00 +03:00
|
|
|
async __delete__();
|
|
|
|
|
2016-07-18 07:24:28 +03:00
|
|
|
// Must be called before Initialize().
|
2016-07-01 11:15:16 +03:00
|
|
|
async PCompositorWidget(CompositorWidgetInitData aInitData);
|
|
|
|
|
2016-07-18 07:24:28 +03:00
|
|
|
// When out-of-process, this must be called to finish initialization.
|
2018-03-25 02:06:01 +03:00
|
|
|
sync Initialize(LayersId rootLayerTreeId);
|
2016-07-18 07:24:28 +03:00
|
|
|
|
2016-08-16 23:59:13 +03:00
|
|
|
// Must be called after Initialize(), and only succeeds if AsyncPanZoomEnabled() is true.
|
2018-03-25 02:06:01 +03:00
|
|
|
async PAPZ(LayersId layersId);
|
|
|
|
async PAPZCTreeManager(LayersId layersId);
|
2016-08-16 23:59:13 +03:00
|
|
|
|
2019-11-14 07:59:56 +03:00
|
|
|
// Constructor for WebGPU IPDL
|
|
|
|
// Must be called before Initialize().
|
|
|
|
async PWebGPU();
|
|
|
|
|
2012-03-30 23:43:11 +04:00
|
|
|
// The child is about to be destroyed, so perform any necessary cleanup.
|
2015-11-24 04:50:51 +03:00
|
|
|
sync WillClose();
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2012-03-29 02:00:10 +04:00
|
|
|
// 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();
|
2019-07-16 04:28:32 +03:00
|
|
|
async ResumeAsync();
|
2012-03-29 02:00:10 +04:00
|
|
|
|
2016-11-29 01:32:20 +03:00
|
|
|
// See bug 1316632 comment #33 for why this has to be sync. Otherwise,
|
|
|
|
// there are ordering issues with SendPLayerTransactionConstructor.
|
2018-03-25 02:06:01 +03:00
|
|
|
sync NotifyChildCreated(LayersId id)
|
2017-04-10 00:30:27 +03:00
|
|
|
returns (CompositorOptions compositorOptions);
|
2016-11-29 01:32:20 +03:00
|
|
|
|
2017-04-04 01:13:37 +03:00
|
|
|
// 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.
|
2018-03-25 02:06:01 +03:00
|
|
|
sync MapAndNotifyChildCreated(LayersId id, ProcessId owner)
|
2017-04-10 00:30:27 +03:00
|
|
|
returns (CompositorOptions compositorOptions);
|
2017-04-04 01:13:37 +03:00
|
|
|
|
2018-03-25 02:06:01 +03:00
|
|
|
async AdoptChild(LayersId id);
|
2013-07-12 06:32:09 +04:00
|
|
|
|
2016-09-20 11:19:32 +03:00
|
|
|
// 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.
|
2018-03-25 02:06:01 +03:00
|
|
|
sync NotifyChildRecreated(LayersId id)
|
2017-04-10 00:30:27 +03:00
|
|
|
returns (CompositorOptions compositorOptions);
|
2016-09-20 11:19:32 +03:00
|
|
|
|
2013-06-18 11:58:43 +04:00
|
|
|
// Make sure any pending composites are started immediately and
|
|
|
|
// block until they are completed.
|
2021-10-05 15:54:39 +03:00
|
|
|
sync FlushRendering(RenderReasons aReasons);
|
2013-06-18 11:58:43 +04:00
|
|
|
|
2017-05-05 11:10:48 +03:00
|
|
|
// Same as FlushRendering, but asynchronous, since not all platforms require
|
|
|
|
// synchronous repaints on resize.
|
2021-10-05 15:54:39 +03:00
|
|
|
async FlushRenderingAsync(RenderReasons aReasons);
|
2017-05-05 11:10:48 +03:00
|
|
|
|
2017-05-15 20:03:32 +03:00
|
|
|
// Make sure any pending composites have been received.
|
|
|
|
sync WaitOnTransactionProcessed();
|
|
|
|
|
2016-02-24 06:50:09 +03:00
|
|
|
// Force an additional frame presentation to be executed. This is used to
|
|
|
|
// work around a windows presentation bug (See Bug 1232042)
|
2021-10-05 15:54:39 +03:00
|
|
|
async ForcePresent(RenderReasons aReasons);
|
2016-02-24 06:50:09 +03:00
|
|
|
|
2013-11-27 11:32:19 +04:00
|
|
|
sync StartFrameTimeRecording(int32_t bufferSize)
|
|
|
|
returns (uint32_t startIndex);
|
|
|
|
|
|
|
|
sync StopFrameTimeRecording(uint32_t startIndex)
|
|
|
|
returns (float[] intervals);
|
|
|
|
|
2018-03-25 02:06:01 +03:00
|
|
|
async PTexture(SurfaceDescriptor aSharedData, ReadLockDescriptor aReadLock, LayersBackend aBackend, TextureFlags aTextureFlags, LayersId id, uint64_t aSerial, MaybeExternalImageId aExternalImageId);
|
2016-04-13 00:04:50 +03:00
|
|
|
|
2018-12-02 17:19:11 +03:00
|
|
|
async InitPCanvasParent(Endpoint<PCanvasParent> aEndpoint);
|
2019-09-17 03:15:59 +03:00
|
|
|
async ReleasePCanvasParent();
|
2018-12-02 17:19:11 +03:00
|
|
|
|
2016-09-27 06:22:20 +03:00
|
|
|
sync SyncWithCompositor();
|
|
|
|
|
2016-11-16 16:54:51 +03:00
|
|
|
// The pipelineId is the same as the layersId
|
2020-12-18 12:27:19 +03:00
|
|
|
async PWebRenderBridge(PipelineId pipelineId, LayoutDeviceIntSize aSize, WindowKind aKind);
|
2016-11-16 16:54:51 +03:00
|
|
|
|
2017-07-19 06:09:00 +03:00
|
|
|
sync CheckContentOnlyTDR(uint32_t sequenceNum)
|
|
|
|
returns (bool isContentOnlyTDR);
|
|
|
|
|
2019-07-31 23:21:03 +03:00
|
|
|
async BeginRecording(TimeStamp aRecordingStart)
|
|
|
|
returns (bool success);
|
|
|
|
|
2019-11-08 01:35:04 +03:00
|
|
|
async EndRecordingToDisk()
|
2019-07-31 23:21:03 +03:00
|
|
|
returns (bool success);
|
2019-03-12 18:06:48 +03:00
|
|
|
|
2019-11-08 01:35:04 +03:00
|
|
|
async EndRecordingToMemory()
|
|
|
|
returns (CollectedFramesParams? frames);
|
|
|
|
|
2019-11-08 01:34:25 +03:00
|
|
|
// To set up sharing the composited output to Firefox Reality on Desktop
|
2019-09-04 22:58:51 +03:00
|
|
|
async RequestFxrOutput();
|
2012-01-19 18:45:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // layers
|
|
|
|
} // mozilla
|