2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2017-10-28 01:55:37 +03:00
|
|
|
* 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/. */
|
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
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_COMPOSITOR_H
|
|
|
|
#define MOZILLA_GFX_COMPOSITOR_H
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "Units.h" // for ScreenPoint
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted
|
2016-03-14 18:39:12 +03:00
|
|
|
#include "mozilla/gfx/2D.h" // for DrawTarget
|
2017-07-05 18:18:48 +03:00
|
|
|
#include "mozilla/gfx/MatrixFwd.h" // for Matrix, Matrix4x4
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize, Point
|
2016-12-04 19:49:32 +03:00
|
|
|
#include "mozilla/gfx/Polygon.h" // for Polygon
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/gfx/Rect.h" // for Rect, IntRect
|
|
|
|
#include "mozilla/gfx/Types.h" // for Float
|
2016-10-07 20:58:13 +03:00
|
|
|
#include "mozilla/gfx/Triangle.h" // for Triangle, TexturedTriangle
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticTypes, etc
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
Bug 1592044 - Reduce the frequency of IOSurface and framebuffer creation and destruction with the help of a surface pool. r=jgilbert
There are multiple SurfacePools: Main thread painting and the non-WebRender compositors create a new pool per window, and WebRender creates one shared pool across all windows. The non-WebRender users set the pool size limit to zero, i.e. no recycling across paints. This preserves the pre-existing behavior.
WebRender's pool size is configurable with the gfx.webrender.compositor.surface-pool-size pref.
Every window holds on to a SurfacePoolHandle. A SurfacePoolHandle has an owning reference to the pool, via a surface pool wrapper. Once all handles are gone, the surface pool goes away, too.
The SurfacePool holds on to IOSurfaces and MozFramebuffers. Both are created on demand, independently, but are associated with each other.
A given NativeLayer uses only one surface pool handle during its lifetime. The native layer no longer influences which GLContext its framebuffers are created for; the GL context is now managed by the surface pool handle.
As a result, a NativeLayer can no longer change which GLContext its framebuffers are created by.
So in the future, if we ever need to migrate a window frome one GLContext to another, we will need to recreate the NativeLayers inside it. I think that's ok.
Differential Revision: https://phabricator.services.mozilla.com/D54859
--HG--
extra : moz-landing-system : lando
2019-12-19 00:01:51 +03:00
|
|
|
#include "mozilla/layers/SurfacePool.h" // for SurfacePoolHandle
|
2017-03-22 06:32:53 +03:00
|
|
|
#include "mozilla/layers/TextureSourceProvider.h"
|
2016-07-01 11:15:16 +03:00
|
|
|
#include "mozilla/widget/CompositorWidget.h"
|
2014-02-27 01:36:35 +04:00
|
|
|
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
2013-11-21 23:25:16 +04:00
|
|
|
#include "nsRegion.h"
|
2013-12-02 00:54:46 +04:00
|
|
|
#include <vector>
|
2014-03-12 02:19:01 +04:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Different elements of a web pages are rendered into separate "layers" before
|
|
|
|
* they are flattened into the final image that is brought to the screen.
|
|
|
|
* See Layers.h for more informations about layers and why we use retained
|
|
|
|
* structures.
|
|
|
|
* Most of the documentation for layers is directly in the source code in the
|
|
|
|
* form of doc comments. An overview can also be found in the the wiki:
|
|
|
|
* https://wiki.mozilla.org/Gecko:Overview#Graphics
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* # Main interfaces and abstractions
|
|
|
|
*
|
|
|
|
* - CompositableClient and CompositableHost
|
|
|
|
* (client/CompositableClient.h composite/CompositableHost.h)
|
|
|
|
* - TextureClient and TextureHost
|
|
|
|
* (client/TextureClient.h composite/TextureHost.h)
|
|
|
|
* - TextureSource
|
|
|
|
* (composite/TextureHost.h)
|
|
|
|
* - Forwarders
|
|
|
|
* (ipc/CompositableForwarder.h ipc/ShadowLayers.h)
|
|
|
|
* - Compositor
|
|
|
|
* (this file)
|
|
|
|
* - IPDL protocols
|
|
|
|
* (.ipdl files under the gfx/layers/ipc directory)
|
|
|
|
*
|
|
|
|
* The *Client and Shadowable* classes are always used on the content thread.
|
|
|
|
* Forwarders are always used on the content thread.
|
|
|
|
* The *Host and Shadow* classes are always used on the compositor thread.
|
|
|
|
* Compositors, TextureSource, and Effects are always used on the compositor
|
|
|
|
* thread.
|
|
|
|
* Most enums and constants are declared in LayersTypes.h and CompositorTypes.h.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* # Texture transfer
|
|
|
|
*
|
|
|
|
* Most layer classes own a Compositable plus some extra information like
|
|
|
|
* transforms and clip rects. They are platform independent.
|
|
|
|
* Compositable classes manipulate Texture objects and are reponsible for
|
|
|
|
* things like tiling, buffer rotation or double buffering. Compositables
|
|
|
|
* are also platform-independent. Examples of compositable classes are:
|
|
|
|
* - ImageClient
|
|
|
|
* - CanvasClient
|
|
|
|
* - etc.
|
|
|
|
* Texture classes (TextureClient and TextureHost) are thin abstractions over
|
|
|
|
* platform-dependent texture memory. They are maniplulated by compositables
|
|
|
|
* and don't know about buffer rotations and such. The purposes of TextureClient
|
|
|
|
* and TextureHost are to synchronize, serialize and deserialize texture data.
|
|
|
|
* TextureHosts provide access to TextureSources that are views on the
|
|
|
|
* Texture data providing the necessary api for Compositor backend to composite
|
|
|
|
* them.
|
|
|
|
*
|
|
|
|
* Compositable and Texture clients and hosts are created using factory methods.
|
|
|
|
* They should only be created by using their constructor in exceptional
|
|
|
|
* circumstances. The factory methods are located:
|
|
|
|
* TextureClient - CompositableClient::CreateTextureClient
|
|
|
|
* TextureHost - TextureHost::CreateTextureHost, which calls a
|
|
|
|
* platform-specific function, e.g.,
|
|
|
|
* CreateTextureHostOGL CompositableClient - in the appropriate subclass, e.g.,
|
|
|
|
* CanvasClient::CreateCanvasClient
|
|
|
|
* CompositableHost - CompositableHost::Create
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* # IPDL
|
|
|
|
*
|
|
|
|
* If off-main-thread compositing (OMTC) is enabled, compositing is performed
|
|
|
|
* in a dedicated thread. In some setups compositing happens in a dedicated
|
|
|
|
* process. Documentation may refer to either the compositor thread or the
|
|
|
|
* compositor process.
|
|
|
|
* See explanations in ShadowLayers.h.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* # Backend implementations
|
|
|
|
*
|
|
|
|
* Compositor backends like OpenGL or flavours of D3D live in their own
|
|
|
|
* directory under gfx/layers/. To add a new backend, implement at least the
|
|
|
|
* following interfaces:
|
|
|
|
* - Compositor (ex. CompositorOGL)
|
2014-09-17 17:13:29 +04:00
|
|
|
* - TextureHost (ex. SurfaceTextureHost)
|
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
|
|
|
* Depending on the type of data that needs to be serialized, you may need to
|
|
|
|
* add specific TextureClient implementations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nsIWidget;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
2013-09-27 04:37:19 +04:00
|
|
|
class DrawTarget;
|
2016-02-25 16:15:52 +03:00
|
|
|
class DataSourceSurface;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
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
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
struct Effect;
|
|
|
|
struct EffectChain;
|
|
|
|
class Image;
|
2014-03-18 05:36:56 +04:00
|
|
|
class Layer;
|
2014-10-07 17:58:59 +04:00
|
|
|
class TextureSource;
|
2013-07-30 13:59:51 +04:00
|
|
|
class DataTextureSource;
|
|
|
|
class CompositingRenderTarget;
|
2016-03-22 21:08:38 +03:00
|
|
|
class CompositorBridgeParent;
|
2019-08-25 20:43:42 +03:00
|
|
|
class NativeLayer;
|
2016-04-14 13:38:38 +03:00
|
|
|
class CompositorOGL;
|
|
|
|
class CompositorD3D11;
|
2016-06-02 12:00:21 +03:00
|
|
|
class TextureReadLock;
|
2017-04-11 05:44:46 +03:00
|
|
|
struct GPUStats;
|
2018-03-28 22:46:38 +03:00
|
|
|
class AsyncReadbackBuffer;
|
2019-04-18 00:31:37 +03:00
|
|
|
class RecordedFrame;
|
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
|
|
|
|
|
|
|
enum SurfaceInitMode { INIT_MODE_NONE, INIT_MODE_CLEAR };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Common interface for compositor backends.
|
|
|
|
*
|
|
|
|
* Compositor provides a cross-platform interface to a set of operations for
|
|
|
|
* compositing quads. Compositor knows nothing about the layer tree. It must be
|
|
|
|
* told everything about each composited quad - contents, location, transform,
|
|
|
|
* opacity, etc.
|
|
|
|
*
|
|
|
|
* In theory it should be possible for different widgets to use the same
|
|
|
|
* compositor. In practice, we use one compositor per window.
|
|
|
|
*
|
|
|
|
* # Usage
|
|
|
|
*
|
|
|
|
* For an example of a user of Compositor, see LayerManagerComposite.
|
|
|
|
*
|
|
|
|
* Initialization: create a Compositor object, call Initialize().
|
|
|
|
*
|
|
|
|
* Destruction: destroy any resources associated with the compositor, call
|
|
|
|
* Destroy(), delete the Compositor object.
|
|
|
|
*
|
|
|
|
* Composition:
|
|
|
|
* call BeginFrame,
|
|
|
|
* for each quad to be composited:
|
|
|
|
* call MakeCurrent if necessary (not necessary if no other context has been
|
|
|
|
* made current),
|
|
|
|
* take care of any texture upload required to composite the quad, this step
|
|
|
|
* is backend-dependent,
|
|
|
|
* construct an EffectChain for the quad,
|
|
|
|
* call DrawQuad,
|
|
|
|
* call EndFrame.
|
|
|
|
*
|
2019-08-30 22:51:59 +03:00
|
|
|
* By default, the compositor will render to the screen if BeginFrameForWindow
|
|
|
|
* is called. To render to a target, call BeginFrameForTarget or
|
|
|
|
* or SetRenderTarget, the latter with a target created
|
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
|
|
|
* by CreateRenderTarget or CreateRenderTargetFromSource.
|
|
|
|
*
|
|
|
|
* The target and viewport methods can be called before any DrawQuad call and
|
|
|
|
* affect any subsequent DrawQuad calls.
|
|
|
|
*/
|
2017-03-22 06:32:53 +03:00
|
|
|
class Compositor : public TextureSourceProvider {
|
2014-04-14 23:04:24 +04:00
|
|
|
protected:
|
2016-06-02 12:00:21 +03:00
|
|
|
virtual ~Compositor();
|
2014-04-14 23:04:24 +04:00
|
|
|
|
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
|
|
|
public:
|
2021-09-22 08:27:20 +03:00
|
|
|
explicit Compositor(widget::CompositorWidget* aWidget);
|
|
|
|
|
|
|
|
bool IsValid() const override { return true; }
|
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
|
|
|
|
2016-07-05 22:41:21 +03:00
|
|
|
virtual bool Initialize(nsCString* const out_failureReason) = 0;
|
2019-04-11 15:36:51 +03:00
|
|
|
void Destroy() override;
|
2016-06-15 14:28:10 +03:00
|
|
|
bool IsDestroyed() const { return mIsDestroyed; }
|
2016-04-30 02:20:40 +03:00
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Creates a Surface that can be used as a rendering target by this
|
|
|
|
* compositor.
|
|
|
|
*/
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<CompositingRenderTarget> CreateRenderTarget(
|
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
|
|
|
const gfx::IntRect& aRect, SurfaceInitMode aInit) = 0;
|
|
|
|
|
2018-03-28 22:46:38 +03:00
|
|
|
/**
|
|
|
|
* Grab a snapshot of aSource and store it in aDest, so that the pixels can
|
|
|
|
* be read on the CPU by mapping aDest at some point in the future.
|
|
|
|
* aSource and aDest must have the same size.
|
|
|
|
* If this is a GPU compositor, this call must not block on the GPU.
|
|
|
|
* Returns whether the operation was successful.
|
|
|
|
*/
|
|
|
|
virtual bool ReadbackRenderTarget(CompositingRenderTarget* aSource,
|
2021-09-22 08:27:20 +03:00
|
|
|
AsyncReadbackBuffer* aDest) = 0;
|
2018-03-28 22:46:38 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an AsyncReadbackBuffer of the specified size. Can return null.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<AsyncReadbackBuffer> CreateAsyncReadbackBuffer(
|
2021-09-22 08:27:20 +03:00
|
|
|
const gfx::IntSize& aSize) = 0;
|
2018-03-28 22:46:38 +03:00
|
|
|
|
2018-04-12 22:28:26 +03:00
|
|
|
/**
|
|
|
|
* Draw a part of aSource into the current render target.
|
|
|
|
* Scaling is done with linear filtering.
|
|
|
|
* Returns whether the operation was successful.
|
|
|
|
*/
|
|
|
|
virtual bool BlitRenderTarget(CompositingRenderTarget* aSource,
|
|
|
|
const gfx::IntSize& aSourceSize,
|
2021-09-22 08:27:20 +03:00
|
|
|
const gfx::IntSize& aDestSize) = 0;
|
2018-04-12 22:28:26 +03:00
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Sets the given surface as the target for subsequent calls to DrawQuad.
|
|
|
|
* Passing null as aSurface sets the screen as the target.
|
|
|
|
*/
|
|
|
|
virtual void SetRenderTarget(CompositingRenderTarget* aSurface) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current target for rendering. Will return null if we are
|
|
|
|
* rendering to the screen.
|
|
|
|
*/
|
2019-02-12 21:53:10 +03:00
|
|
|
virtual already_AddRefed<CompositingRenderTarget> GetCurrentRenderTarget()
|
|
|
|
const = 0;
|
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
|
|
|
|
2018-03-28 21:44:17 +03:00
|
|
|
/**
|
|
|
|
* Returns a render target which contains the entire window's drawing.
|
|
|
|
* On platforms where no such render target is used during compositing (e.g.
|
|
|
|
* with buffered BasicCompositor, where only the invalid area is drawn to a
|
|
|
|
* render target), this will return null.
|
|
|
|
*/
|
2019-02-12 21:53:10 +03:00
|
|
|
virtual already_AddRefed<CompositingRenderTarget> GetWindowRenderTarget()
|
2021-09-22 08:27:20 +03:00
|
|
|
const = 0;
|
2018-03-28 21:44:17 +03:00
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Mostly the compositor will pull the size from a widget and this method will
|
|
|
|
* be ignored, but compositor implementations are free to use it if they like.
|
|
|
|
*/
|
|
|
|
virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) = 0;
|
|
|
|
|
|
|
|
/**
|
2013-12-02 00:54:46 +04:00
|
|
|
* Tell the compositor to draw a quad. What to do draw and how it is
|
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
|
|
|
* drawn is specified by aEffectChain. aRect is the quad to draw, in user
|
2013-11-07 13:53:08 +04:00
|
|
|
* space. aTransform transforms from user space to screen space. If texture
|
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
|
|
|
* coords are required, these will be in the primary effect in the effect
|
2014-12-18 03:28:45 +03:00
|
|
|
* chain. aVisibleRect is used to determine which edges should be antialiased,
|
|
|
|
* without applying the effect to the inner edges of a tiled layer.
|
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
|
|
|
*/
|
2016-05-13 23:15:17 +03:00
|
|
|
virtual void DrawQuad(const gfx::Rect& aRect, const gfx::IntRect& aClipRect,
|
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
|
|
|
const EffectChain& aEffectChain, gfx::Float aOpacity,
|
2014-12-18 03:28:45 +03:00
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
const gfx::Rect& aVisibleRect) = 0;
|
|
|
|
|
2020-03-09 17:16:17 +03:00
|
|
|
void SetClearColor(const gfx::DeviceColor& aColor) { mClearColor = aColor; }
|
2016-09-01 19:24:39 +03:00
|
|
|
|
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
|
|
|
/**
|
2019-08-30 22:51:59 +03:00
|
|
|
* Start a new frame for rendering to the window.
|
2019-08-31 00:37:55 +03:00
|
|
|
* Needs to be paired with a call to EndFrame() if the return value is not
|
|
|
|
* Nothing().
|
2013-11-21 23:25:16 +04:00
|
|
|
*
|
2019-08-30 22:51:59 +03:00
|
|
|
* aInvalidRegion is the invalid region of the window.
|
|
|
|
* aClipRect is the clip rect for all drawing (optional).
|
|
|
|
* aRenderBounds is the bounding rect for rendering.
|
2019-08-26 03:58:43 +03:00
|
|
|
* aOpaqueRegion is the area that contains opaque content.
|
2019-08-30 22:51:59 +03:00
|
|
|
* All coordinates are in window space.
|
2013-11-21 23:25:16 +04:00
|
|
|
*
|
2019-08-26 03:58:45 +03:00
|
|
|
* Returns the non-empty render bounds actually used by the compositor in
|
|
|
|
* window space, or Nothing() if composition should be aborted.
|
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
|
|
|
*/
|
2019-08-30 22:51:55 +03:00
|
|
|
virtual Maybe<gfx::IntRect> BeginFrameForWindow(
|
|
|
|
const nsIntRegion& aInvalidRegion, const Maybe<gfx::IntRect>& aClipRect,
|
2019-08-31 00:37:55 +03:00
|
|
|
const gfx::IntRect& aRenderBounds, const nsIntRegion& aOpaqueRegion) = 0;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Flush the current frame to the screen and tidy up.
|
2016-06-02 12:00:21 +03:00
|
|
|
*
|
|
|
|
* Derived class overriding this should call Compositor::EndFrame.
|
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
|
|
|
*/
|
2016-06-02 12:00:21 +03:00
|
|
|
virtual void EndFrame();
|
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
|
|
|
|
2021-11-22 12:49:59 +03:00
|
|
|
virtual void CancelFrame(bool aNeedFlush = true) {}
|
2016-10-11 15:10:22 +03:00
|
|
|
|
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
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
|
|
|
virtual const char* Name() const = 0;
|
|
|
|
#endif // MOZ_DUMP_PAINTING
|
|
|
|
|
2016-04-14 13:38:38 +03:00
|
|
|
virtual CompositorD3D11* AsCompositorD3D11() { return nullptr; }
|
|
|
|
|
2019-04-11 15:36:51 +03:00
|
|
|
Compositor* AsCompositor() override { return this; }
|
2017-03-22 06:32:53 +03:00
|
|
|
|
|
|
|
TimeStamp GetLastCompositionEndTime() const override {
|
|
|
|
return mLastCompositionEndTime;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Notify the compositor that composition is being paused. This allows the
|
|
|
|
* compositor to temporarily release any resources.
|
|
|
|
* Between calling Pause and Resume, compositing may fail.
|
|
|
|
*/
|
|
|
|
virtual void Pause() {}
|
|
|
|
/**
|
|
|
|
* Notify the compositor that composition is being resumed. The compositor
|
|
|
|
* regain any resources it requires for compositing.
|
|
|
|
* Returns true if succeeded.
|
|
|
|
*/
|
|
|
|
virtual bool Resume() { return true; }
|
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
widget::CompositorWidget* GetWidget() const { return mWidget; }
|
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
|
|
|
|
2019-04-18 00:29:19 +03:00
|
|
|
/**
|
2019-05-02 20:33:38 +03:00
|
|
|
* Request the compositor to allow recording its frames.
|
2019-04-18 00:29:19 +03:00
|
|
|
*
|
2019-05-02 20:33:38 +03:00
|
|
|
* This is a noop on |CompositorOGL|.
|
2019-04-18 00:29:19 +03:00
|
|
|
*/
|
2019-08-30 22:52:15 +03:00
|
|
|
virtual void RequestAllowFrameRecording(bool aWillRecord) {
|
|
|
|
mRecordFrames = aWillRecord;
|
|
|
|
}
|
2019-04-18 00:29:19 +03:00
|
|
|
|
2019-04-18 00:31:37 +03:00
|
|
|
/**
|
|
|
|
* Record the current frame for readback by the |CompositionRecorder|.
|
|
|
|
*
|
|
|
|
* If this compositor does not support this feature, a null pointer is
|
|
|
|
* returned instead.
|
|
|
|
*/
|
2019-04-18 00:29:19 +03:00
|
|
|
already_AddRefed<RecordedFrame> RecordFrame(const TimeStamp& aTimeStamp);
|
2019-04-18 00:31:37 +03:00
|
|
|
|
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
|
|
|
protected:
|
2019-08-30 22:52:15 +03:00
|
|
|
/**
|
|
|
|
* Whether or not the compositor should be prepared to record frames. While
|
|
|
|
* this returns true, compositors are expected to maintain a full window
|
|
|
|
* render target that they return from GetWindowRenderTarget() between
|
|
|
|
* NormalDrawingDone() and EndFrame().
|
|
|
|
*
|
|
|
|
* This will be true when either we are recording a profile with screenshots
|
|
|
|
* enabled or the |LayerManagerComposite| has requested us to record frames
|
|
|
|
* for the |CompositionRecorder|.
|
|
|
|
*/
|
|
|
|
bool ShouldRecordFrames() const;
|
|
|
|
|
2016-07-19 15:38:35 +03:00
|
|
|
/**
|
|
|
|
* Last Composition end time.
|
|
|
|
*/
|
|
|
|
TimeStamp mLastCompositionEndTime;
|
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
widget::CompositorWidget* mWidget;
|
2016-04-30 02:20:40 +03:00
|
|
|
|
2016-06-15 14:28:10 +03:00
|
|
|
bool mIsDestroyed;
|
|
|
|
|
2020-03-09 17:16:17 +03:00
|
|
|
gfx::DeviceColor mClearColor;
|
2016-08-18 02:35:25 +03:00
|
|
|
|
2019-08-30 22:52:15 +03:00
|
|
|
bool mRecordFrames = false;
|
|
|
|
|
2014-02-13 20:53:50 +04:00
|
|
|
private:
|
|
|
|
static LayersBackend sBackend;
|
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
|
|
|
};
|
|
|
|
|
2014-10-24 04:08:06 +04:00
|
|
|
// Returns the number of rects. (Up to 4)
|
|
|
|
typedef gfx::Rect decomposedRectArrayT[4];
|
|
|
|
size_t DecomposeIntoNoRepeatRects(const gfx::Rect& aRect,
|
|
|
|
const gfx::Rect& aTexCoordRect,
|
|
|
|
decomposedRectArrayT* aLayerRects,
|
|
|
|
decomposedRectArrayT* aTextureRects);
|
|
|
|
|
2016-01-19 09:24:19 +03:00
|
|
|
static inline bool BlendOpIsMixBlendMode(gfx::CompositionOp aOp) {
|
|
|
|
switch (aOp) {
|
|
|
|
case gfx::CompositionOp::OP_MULTIPLY:
|
|
|
|
case gfx::CompositionOp::OP_SCREEN:
|
|
|
|
case gfx::CompositionOp::OP_OVERLAY:
|
|
|
|
case gfx::CompositionOp::OP_DARKEN:
|
|
|
|
case gfx::CompositionOp::OP_LIGHTEN:
|
|
|
|
case gfx::CompositionOp::OP_COLOR_DODGE:
|
|
|
|
case gfx::CompositionOp::OP_COLOR_BURN:
|
|
|
|
case gfx::CompositionOp::OP_HARD_LIGHT:
|
|
|
|
case gfx::CompositionOp::OP_SOFT_LIGHT:
|
|
|
|
case gfx::CompositionOp::OP_DIFFERENCE:
|
|
|
|
case gfx::CompositionOp::OP_EXCLUSION:
|
|
|
|
case gfx::CompositionOp::OP_HUE:
|
|
|
|
case gfx::CompositionOp::OP_SATURATION:
|
|
|
|
case gfx::CompositionOp::OP_COLOR:
|
|
|
|
case gfx::CompositionOp::OP_LUMINOSITY:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-28 22:46:38 +03:00
|
|
|
class AsyncReadbackBuffer {
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(AsyncReadbackBuffer)
|
|
|
|
|
|
|
|
gfx::IntSize GetSize() const { return mSize; }
|
|
|
|
virtual bool MapAndCopyInto(gfx::DataSourceSurface* aSurface,
|
|
|
|
const gfx::IntSize& aReadSize) const = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit AsyncReadbackBuffer(const gfx::IntSize& aSize) : mSize(aSize) {}
|
2019-04-11 15:36:51 +03:00
|
|
|
virtual ~AsyncReadbackBuffer() = default;
|
2018-03-28 22:46:38 +03:00
|
|
|
|
|
|
|
gfx::IntSize mSize;
|
|
|
|
};
|
|
|
|
|
2017-03-27 20:59:15 +03:00
|
|
|
struct TexturedVertex {
|
|
|
|
float position[2];
|
|
|
|
float texCoords[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
nsTArray<TexturedVertex> TexturedTrianglesToVertexArray(
|
|
|
|
const nsTArray<gfx::TexturedTriangle>& aTriangles);
|
|
|
|
|
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
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* MOZILLA_GFX_COMPOSITOR_H */
|