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;
|
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;
|
2017-06-14 18:40:00 +03:00
|
|
|
include protocol PCompositorManager;
|
2016-07-01 11:15:16 +03:00
|
|
|
include protocol PCompositorWidget;
|
2013-04-24 22:42:40 +04:00
|
|
|
include protocol PLayerTransaction;
|
2016-04-13 00:04:50 +03:00
|
|
|
include protocol PTexture;
|
2016-11-16 16:54:51 +03:00
|
|
|
include protocol PWebRenderBridge;
|
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
|
|
|
|
2013-10-01 23:25:07 +04:00
|
|
|
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
|
|
|
|
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
2013-12-20 00:19:25 +04:00
|
|
|
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
|
|
|
|
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
2016-01-08 22:17:39 +03:00
|
|
|
using mozilla::layers::MaybeZoomConstraints from "FrameMetrics.h";
|
2016-03-19 04:38:57 +03:00
|
|
|
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
|
2013-10-01 23:25:07 +04:00
|
|
|
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
2013-12-20 00:19:25 +04:00
|
|
|
using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
|
|
|
|
using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.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";
|
2015-06-08 19:53:41 +03:00
|
|
|
using class mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.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";
|
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";
|
2017-08-30 03:10:22 +03:00
|
|
|
using mozilla::wr::WebRenderError from "mozilla/webrender/WebRenderTypes.h";
|
2012-01-19 18:45:37 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
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.
|
|
|
|
* - There is also a CrossProcessCompositorBridgeParent/CompositorBridgeChild
|
|
|
|
* pair created for each content process. The CrossProcessCompositorBridgeParent
|
|
|
|
* 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 TabChild 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
|
|
|
|
* CrossProcessCompositorBridgeParent 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.
|
2012-01-19 18:45:37 +04:00
|
|
|
*/
|
2016-03-22 21:07:08 +03:00
|
|
|
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)
|
|
|
|
manages 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;
|
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.
|
|
|
|
async InvalidateLayers(uint64_t 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.
|
2015-08-25 08:51:58 +03:00
|
|
|
async DidComposite(uint64_t id, uint64_t transactionId,
|
|
|
|
TimeStamp compositeStart, TimeStamp compositeEnd);
|
2014-03-07 07:24:32 +04:00
|
|
|
|
2014-05-23 22:19:00 +04:00
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
|
2015-01-29 22:41:55 +03:00
|
|
|
/**
|
|
|
|
* Bounce plugin widget configurations over to the main thread for
|
|
|
|
* application on the widgets. Used on Windows and Linux in managing
|
|
|
|
* plugin widgets.
|
|
|
|
*/
|
2015-12-03 01:32:55 +03:00
|
|
|
async UpdatePluginConfigurations(LayoutDeviceIntPoint aContentOffset,
|
|
|
|
LayoutDeviceIntRegion aVisibleRegion,
|
2015-01-29 22:41:55 +03:00
|
|
|
PluginWindowData[] aPlugins);
|
2012-10-30 02:10:45 +04:00
|
|
|
|
2016-07-18 11:54:02 +03:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
2015-03-04 16:46:15 +03:00
|
|
|
/**
|
2015-09-03 18:01:33 +03:00
|
|
|
* Hides all registered plugin widgets associated with a particular chrome
|
|
|
|
* widget.
|
2015-03-04 16:46:15 +03:00
|
|
|
*/
|
2015-09-03 18:01:33 +03:00
|
|
|
async HideAllPlugins(uintptr_t aParentWidget);
|
2015-03-04 16:46:15 +03:00
|
|
|
|
2016-06-15 14:28:10 +03:00
|
|
|
async ParentAsyncMessages(AsyncParentMessageData[] aMessages);
|
|
|
|
|
2016-09-24 04:12:45 +03:00
|
|
|
async ObserveLayerUpdate(uint64_t aLayersId, uint64_t aEpoch, bool aActive);
|
|
|
|
|
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.
|
|
|
|
sync Initialize(uint64_t rootLayerTreeId);
|
|
|
|
|
2016-08-16 23:59:13 +03:00
|
|
|
// Must be called after Initialize(), and only succeeds if AsyncPanZoomEnabled() is true.
|
2016-08-02 09:59:00 +03:00
|
|
|
async PAPZ(uint64_t layersId);
|
2016-08-16 23:59:13 +03:00
|
|
|
async PAPZCTreeManager(uint64_t layersId);
|
|
|
|
|
2015-10-06 22:23:24 +03:00
|
|
|
/**
|
|
|
|
* Confirmation callback for UpdatePluginConfigurations and HideAllPlugins.
|
|
|
|
*/
|
|
|
|
async RemotePluginsReady();
|
|
|
|
|
2015-06-08 19:53:41 +03:00
|
|
|
// Child requests frame uniformity measurements
|
|
|
|
sync GetFrameUniformity() returns (FrameUniformityData data);
|
|
|
|
|
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();
|
2017-01-05 22:04:38 +03:00
|
|
|
async ForceIsFirstPaint();
|
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.
|
2017-04-10 00:30:27 +03:00
|
|
|
sync NotifyChildCreated(uint64_t id)
|
|
|
|
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.
|
2017-04-10 00:30:27 +03:00
|
|
|
sync MapAndNotifyChildCreated(uint64_t id, ProcessId owner)
|
|
|
|
returns (CompositorOptions compositorOptions);
|
2017-04-04 01:13:37 +03:00
|
|
|
|
2014-10-15 02:11:38 +04:00
|
|
|
async AdoptChild(uint64_t 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.
|
2017-04-10 00:30:27 +03:00
|
|
|
sync NotifyChildRecreated(uint64_t id)
|
|
|
|
returns (CompositorOptions compositorOptions);
|
2016-09-20 11:19:32 +03:00
|
|
|
|
2012-10-04 11:05:24 +04:00
|
|
|
// 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.
|
2015-04-21 18:04:57 +03:00
|
|
|
sync MakeSnapshot(SurfaceDescriptor inSnapshot, IntRect dirtyRect);
|
2012-10-04 11:05:24 +04:00
|
|
|
|
2013-06-18 11:58:43 +04:00
|
|
|
// Make sure any pending composites are started immediately and
|
|
|
|
// block until they are completed.
|
|
|
|
sync FlushRendering();
|
|
|
|
|
2017-05-05 11:10:48 +03:00
|
|
|
// Same as FlushRendering, but asynchronous, since not all platforms require
|
|
|
|
// synchronous repaints on resize.
|
|
|
|
async FlushRenderingAsync();
|
|
|
|
|
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)
|
|
|
|
async ForcePresent();
|
|
|
|
|
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);
|
|
|
|
|
2013-08-18 10:46:16 +04:00
|
|
|
// layersBackendHints is an ordered list of preffered backends where
|
2014-01-23 22:26:41 +04:00
|
|
|
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
|
2013-08-18 10:46:16 +04:00
|
|
|
// that hint is ignored.
|
2017-05-05 20:53:17 +03:00
|
|
|
async PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id);
|
2013-11-21 23:25:16 +04:00
|
|
|
|
|
|
|
// Notify the compositor that a region of the screen has been invalidated.
|
|
|
|
async NotifyRegionInvalidated(nsIntRegion region);
|
2013-12-20 00:19:25 +04:00
|
|
|
|
2014-05-23 22:19:00 +04:00
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
|
2016-07-18 11:54:02 +03:00
|
|
|
/**
|
|
|
|
* Sent when the child has finished CaptureAllPlugins.
|
|
|
|
*/
|
|
|
|
async AllPluginsCaptured();
|
|
|
|
|
2018-03-12 16:10:13 +03:00
|
|
|
async PTexture(SurfaceDescriptor aSharedData, ReadLockDescriptor aReadLock, LayersBackend aBackend, TextureFlags aTextureFlags, uint64_t id, uint64_t aSerial, MaybeExternalImageId aExternalImageId);
|
2016-04-13 00:04:50 +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
|
2017-03-07 02:46:30 +03:00
|
|
|
sync PWebRenderBridge(PipelineId pipelineId, LayoutDeviceIntSize aSize)
|
2017-07-31 23:31:10 +03:00
|
|
|
returns (TextureFactoryIdentifier textureFactoryIdentifier, IdNamespace idNamespace);
|
2016-11-16 16:54:51 +03:00
|
|
|
|
2017-07-19 06:09:00 +03:00
|
|
|
sync CheckContentOnlyTDR(uint32_t sequenceNum)
|
|
|
|
returns (bool isContentOnlyTDR);
|
|
|
|
|
2013-12-20 00:19:25 +04:00
|
|
|
child:
|
|
|
|
// Send back Compositor Frame Metrics from APZCs so tiled layers can
|
|
|
|
// update progressively.
|
2015-03-06 14:25:40 +03:00
|
|
|
async SharedCompositorFrameMetrics(Handle metrics, CrossProcessMutexHandle mutex, uint64_t aLayersId, uint32_t aAPZCId);
|
2013-12-20 00:19:25 +04:00
|
|
|
async ReleaseSharedCompositorFrameMetrics(ViewID aId, uint32_t aAPZCId);
|
2017-08-30 03:10:22 +03:00
|
|
|
async NotifyWebRenderError(WebRenderError error);
|
2012-01-19 18:45:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // layers
|
|
|
|
} // mozilla
|