Files
palemoon27/gfx/layers/ipc/CompositableForwarder.h
T
roytam1 c34e72358b import changes from `dev' branch of rmottola/Arctic-Fox:
- nsTArray*: fully sync with AF, and use ActualAlloc::Successful (adaf2f742)
- Bug 1182808 - Part 2: Remove AlignedFallibleTArray. r=padenot (e0f112fb4)
- Bug 1182808 - Part 3: Rename AlignedTArray_Impl to AlignedTArray and remove existing AlignedTArray. r=padenot (ff2beea1e)
- Bug 1148582 - Include the rounded clip of the async scrolled scroll frame in its mAncestorClip. (1633f8cb2)
- Bug 1148582 - Support multiple mask layers per layer in LayerManagerComposite. (d292070f8)
- Bug 1143575. #include nsDebug.h in YCbCrImageDataSerializer.cpp for NS_WARN_IF. r=nical (c9a7fe42c)
- Bug 1143575. Remove ImageClientBridge::Updated. r=nical (095f1f806)
- Bug 1143575. Pass a picture rect with OpUseOverlaySource and OpUseTexture, and eliminate OpUpdatePictureRect. r=nical (c134913c2)
- Bug 1143575. Extend IPDL OpUseTexture to support multiple timestamped images. r=nical (54d018cd1)
- Bug 1143575. Replace ImageClientSingle::UpdateImage's use of Image serial numbers with ImageContainer state generation counters, and switch it to use ImageContainer::GetCurrentImages. r=nical (e2e096ad2)
- Bug 1143575. ImageClient::UpdateImage should not return false when there's no image, because recreating the ImageClient won't help. r=nical (4be2ed5ed)
- Bug 1143575. Make ImageClientSingle handle multiple textures. r=nical (8889f2639)
- Bug 1143575. Store composition time in Compositor. r=nical (1501cc5d0)
- Bug 1143575. Implement ImageHost support for multiple timed images. r=nical (99a440556)
- Bug 1168456 - Remove NotifyWaitingForResourcesStatusChanged() call from MediaCodecReader r=bholley,bwu (efabdbeed)
- Bug 1163871: Use DebugOnly to suppress opt build warning in gonk nsAppShell.cpp. r=mwu (fc77b0322)
- Bug 1165161 - stop bootAnim with "browser-ui-startup-complete" event.  r=mwu (a2a9bbfdd)
- Bug 949036 - Make ID3v2 tag detection more careful - not every bit of data containing ID3 is a tag. r=eflores (ac590bbd1)
- bug 1137076 handle null mDecoder during Reader shutdown r=edwin (1507b0627)
- Bug 1150322 - Fix duration parsing in MediaOmxReader - r=sotaro (93577cfea)
- Bug 1112219 - Implement platform independent MediaResourceManager r=cpearce,bwu,nical (cc722ccf3)
- Bug 1091037 - Raise ImageBridge thread priority r=gsvelto,nical (d66ecdd06)
- Bug 1143575. Route ImageCompositeNotifications to ImageContainers. r=nical (fe5d3da61)
- bug 1184801 process AnalyserNode input only when required r=padenot (8079b66f5)
- Bug 1157768 - FFTBlock Changes for using libav fft; r=padenot (3238d710c)
- bug 914392 move mSharedBuffers ownership to engine r=padenot (4444d8352)
2021-03-23 10:01:13 +08:00

205 lines
6.8 KiB
C++

/* -*- 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
* 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_LAYERS_COMPOSITABLEFORWARDER
#define MOZILLA_LAYERS_COMPOSITABLEFORWARDER
#include <stdint.h> // for int32_t, uint64_t
#include "gfxTypes.h"
#include "mozilla/Attributes.h" // for override
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
class CompositableClient;
class AsyncTransactionTracker;
class ImageContainer;
struct TextureFactoryIdentifier;
class SurfaceDescriptor;
class SurfaceDescriptorTiles;
class ThebesBufferData;
class PTextureChild;
/**
* A transaction is a set of changes that happenned on the content side, that
* should be sent to the compositor side.
* CompositableForwarder is an interface to manage a transaction of
* compositable objetcs.
*
* ShadowLayerForwarder is an example of a CompositableForwarder (that can
* additionally forward modifications of the Layer tree).
* ImageBridgeChild is another CompositableForwarder.
*/
class CompositableForwarder : public ISurfaceAllocator
{
public:
CompositableForwarder()
: mSerial(++sSerialCounter)
{}
/**
* Setup the IPDL actor for aCompositable to be part of layers
* transactions.
*/
virtual void Connect(CompositableClient* aCompositable,
ImageContainer* aImageContainer = nullptr) = 0;
/**
* Tell the CompositableHost on the compositor side what TiledLayerBuffer to
* use for the next composition.
*/
virtual void UseTiledLayerBuffer(CompositableClient* aCompositable,
const SurfaceDescriptorTiles& aTiledDescriptor) = 0;
/**
* Create a TextureChild/Parent pair as as well as the TextureHost on the parent side.
*/
virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData, TextureFlags aFlags) = 0;
/**
* Communicate to the compositor that aRegion in the texture identified by
* aCompositable and aIdentifier has been updated to aThebesBuffer.
*/
virtual void UpdateTextureRegion(CompositableClient* aCompositable,
const ThebesBufferData& aThebesBufferData,
const nsIntRegion& aUpdatedRegion) = 0;
#ifdef MOZ_WIDGET_GONK
virtual void UseOverlaySource(CompositableClient* aCompositabl,
const OverlaySource& aOverlay,
const gfx::IntRect& aPictureRect) = 0;
#endif
/**
* Tell the CompositableHost on the compositor side to remove the texture
* from the CompositableHost.
* This function does not delete the TextureHost corresponding to the
* TextureClient passed in parameter.
* When the TextureClient has TEXTURE_DEALLOCATE_CLIENT flag,
* the transaction becomes synchronous.
*/
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) = 0;
/**
* Tell the CompositableHost on the compositor side to remove the texture
* from the CompositableHost. The compositor side sends back transaction
* complete message.
* This function does not delete the TextureHost corresponding to the
* TextureClient passed in parameter.
* It is used when the TextureClient recycled.
* Only ImageBridge implements it.
*/
virtual void RemoveTextureFromCompositableAsync(AsyncTransactionTracker* aAsyncTransactionTracker,
CompositableClient* aCompositable,
TextureClient* aTexture) {}
/**
* Tell the compositor side to delete the TextureHost corresponding to the
* TextureClient passed in parameter.
*/
virtual void RemoveTexture(TextureClient* aTexture) = 0;
/**
* Holds a reference to a TextureClient until after the next
* compositor transaction, and then drops it.
*/
virtual void HoldUntilTransaction(TextureClient* aClient)
{
if (aClient) {
mTexturesToRemove.AppendElement(aClient);
}
}
/**
* Forcibly remove texture data from TextureClient
* This function needs to be called after a tansaction with Compositor.
*/
virtual void RemoveTexturesIfNecessary()
{
mTexturesToRemove.Clear();
}
struct TimedTextureClient {
TimedTextureClient()
: mTextureClient(nullptr), mFrameID(0), mProducerID(0) {}
TextureClient* mTextureClient;
TimeStamp mTimeStamp;
nsIntRect mPictureRect;
int32_t mFrameID;
int32_t mProducerID;
};
/**
* Tell the CompositableHost on the compositor side what textures to use for
* the next composition.
*/
virtual void UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures) = 0;
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) = 0;
virtual void SendPendingAsyncMessges() = 0;
void IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier);
virtual int32_t GetMaxTextureSize() const override
{
return mTextureFactoryIdentifier.mMaxTextureSize;
}
bool IsOnCompositorSide() const override { return false; }
/**
* Returns the type of backend that is used off the main thread.
* We only don't allow changing the backend type at runtime so this value can
* be queried once and will not change until Gecko is restarted.
*/
virtual LayersBackend GetCompositorBackendType() const override
{
return mTextureFactoryIdentifier.mParentBackend;
}
bool SupportsTextureBlitting() const
{
return mTextureFactoryIdentifier.mSupportsTextureBlitting;
}
bool SupportsPartialUploads() const
{
return mTextureFactoryIdentifier.mSupportsPartialUploads;
}
const TextureFactoryIdentifier& GetTextureFactoryIdentifier() const
{
return mTextureFactoryIdentifier;
}
int32_t GetSerial() { return mSerial; }
SyncObject* GetSyncObject() { return mSyncObject; }
protected:
TextureFactoryIdentifier mTextureFactoryIdentifier;
nsTArray<RefPtr<TextureClient> > mTexturesToRemove;
RefPtr<SyncObject> mSyncObject;
const int32_t mSerial;
static mozilla::Atomic<int32_t> sSerialCounter;
};
} // namespace layers
} // namespace mozilla
#endif