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 02:20:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_BUFFERCLIENT_H
|
|
|
|
#define MOZILLA_GFX_BUFFERCLIENT_H
|
|
|
|
|
|
|
|
#include "mozilla/layers/PCompositableChild.h"
|
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
class CompositableChild;
|
|
|
|
class CompositableClient;
|
|
|
|
class TextureClient;
|
|
|
|
class ImageBridgeChild;
|
|
|
|
class ShadowableLayer;
|
|
|
|
class CompositableForwarder;
|
|
|
|
class CompositableChild;
|
2013-06-05 15:14:51 -07:00
|
|
|
class SurfaceDescriptor;
|
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 02:20:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CompositableClient manages the texture-specific logic for composite layers,
|
2013-07-08 21:21:06 -07:00
|
|
|
* independently of the layer. It is the content side of a CompositableClient/
|
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 02:20:52 -07:00
|
|
|
* CompositableHost pair.
|
|
|
|
*
|
|
|
|
* CompositableClient's purpose is to send texture data to the compositor side
|
|
|
|
* along with any extra information about how the texture is to be composited.
|
|
|
|
* Things like opacity or transformation belong to layer and not compositable.
|
|
|
|
*
|
|
|
|
* Since Compositables are independent of layers it is possible to create one,
|
|
|
|
* connect it to the compositor side, and start sending images to it. This alone
|
|
|
|
* is arguably not very useful, but it means that as long as a shadow layer can
|
|
|
|
* do the proper magic to find a reference to the right CompositableHost on the
|
|
|
|
* Compositor side, a Compositable client can be used outside of the main
|
|
|
|
* shadow layer forwarder machinery that is used on the main thread.
|
|
|
|
*
|
|
|
|
* The first step is to create a Compositable client and call Connect().
|
|
|
|
* Connect() creates the underlying IPDL actor (see CompositableChild) and the
|
|
|
|
* corresponding CompositableHost on the other side.
|
|
|
|
*
|
|
|
|
* To do in-transaction texture transfer (the default), call
|
|
|
|
* ShadowLayerForwarder::Attach(CompositableClient*, ShadowableLayer*). This
|
2013-04-25 15:25:33 -07:00
|
|
|
* will let the LayerComposite on the compositor side know which CompositableHost
|
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 02:20:52 -07:00
|
|
|
* to use for compositing.
|
|
|
|
*
|
|
|
|
* To do async texture transfer (like async-video), the CompositableClient
|
|
|
|
* should be created with a different CompositableForwarder (like
|
|
|
|
* ImageBridgeChild) and attachment is done with
|
|
|
|
* CompositableForwarder::AttachAsyncCompositable that takes an identifier
|
|
|
|
* instead of a CompositableChild, since the CompositableClient is not managed
|
|
|
|
* by this layer forwarder (the matching uses a global map on the compositor side,
|
|
|
|
* see CompositableMap in ImageBridgeParent.cpp)
|
|
|
|
*
|
|
|
|
* Subclasses: Thebes layers use ContentClients, ImageLayers use ImageClients,
|
|
|
|
* Canvas layers use CanvasClients (but ImageHosts). We have a different subclass
|
|
|
|
* where we have a different way of interfacing with the textures - in terms of
|
|
|
|
* drawing into the compositable and/or passing its contents to the compostior.
|
|
|
|
*/
|
|
|
|
class CompositableClient : public RefCounted<CompositableClient>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CompositableClient(CompositableForwarder* aForwarder)
|
|
|
|
: mCompositableChild(nullptr), mForwarder(aForwarder)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableClient);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~CompositableClient();
|
|
|
|
|
2013-04-12 00:28:55 -07:00
|
|
|
virtual TextureInfo GetTextureInfo() const
|
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 02:20:52 -07:00
|
|
|
{
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("This method should be overridden");
|
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 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
LayersBackend GetCompositorBackendType() const;
|
|
|
|
|
|
|
|
TemporaryRef<TextureClient>
|
2013-04-12 00:28:55 -07:00
|
|
|
CreateTextureClient(TextureClientType aTextureClientType);
|
|
|
|
|
|
|
|
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
|
|
|
|
const SurfaceDescriptor& aDescriptor)
|
|
|
|
{
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("If you want to call this, you should have implemented it");
|
2013-04-12 00:28:55 -07: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 02:20:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Establishes the connection with compositor side through IPDL
|
|
|
|
*/
|
|
|
|
virtual bool Connect();
|
|
|
|
|
|
|
|
void Destroy();
|
|
|
|
|
|
|
|
CompositableChild* GetIPDLActor() const;
|
|
|
|
|
|
|
|
// should only be called by a CompositableForwarder
|
|
|
|
void SetIPDLActor(CompositableChild* aChild);
|
|
|
|
|
|
|
|
CompositableForwarder* GetForwarder() const
|
|
|
|
{
|
|
|
|
return mForwarder;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This identifier is what lets us attach async compositables with a shadow
|
|
|
|
* layer. It is not used if the compositable is used with the regulat shadow
|
|
|
|
* layer forwarder.
|
|
|
|
*/
|
|
|
|
uint64_t GetAsyncID() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CompositableChild* mCompositableChild;
|
|
|
|
CompositableForwarder* mForwarder;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IPDL actor used by CompositableClient to match with its corresponding
|
|
|
|
* CompositableHost on the compositor side.
|
|
|
|
*
|
|
|
|
* CompositableChild is owned by a CompositableClient.
|
|
|
|
*/
|
|
|
|
class CompositableChild : public PCompositableChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CompositableChild()
|
|
|
|
: mCompositableClient(nullptr), mID(0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(CompositableChild);
|
|
|
|
}
|
|
|
|
~CompositableChild()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(CompositableChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Destroy();
|
|
|
|
|
|
|
|
void SetClient(CompositableClient* aClient)
|
|
|
|
{
|
|
|
|
mCompositableClient = aClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositableClient* GetCompositableClient() const
|
|
|
|
{
|
|
|
|
return mCompositableClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetAsyncID(uint64_t aID) { mID = aID; }
|
|
|
|
uint64_t GetAsyncID() const
|
|
|
|
{
|
|
|
|
return mID;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
CompositableClient* mCompositableClient;
|
|
|
|
uint64_t mID;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|