зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1170189 - Remove the TiledLayerComposer interface. r=BenWa
This commit is contained in:
Родитель
c23b8a3c64
Коммит
820e9182e7
|
@ -60,11 +60,6 @@ static inline int floor_div(int a, int b)
|
|||
}
|
||||
}
|
||||
|
||||
// An abstract implementation of a tile buffer. This code covers the logic of
|
||||
// moving and reusing tiles and leaves the validation up to the implementor. To
|
||||
// avoid the overhead of virtual dispatch, we employ the curiously recurring
|
||||
// template pattern.
|
||||
//
|
||||
// Tiles are aligned to a grid with one of the grid points at (0,0) and other
|
||||
// grid points spaced evenly in the x- and y-directions by GetTileSize()
|
||||
// multiplied by mResolution. GetScaledTileSize() provides convenience for
|
||||
|
@ -82,30 +77,6 @@ static inline int floor_div(int a, int b)
|
|||
// the tile type should be a reference or some other type with an efficient
|
||||
// copy constructor.
|
||||
//
|
||||
// It is required that the derived class specify the base class as a friend. It
|
||||
// must also implement the following public method:
|
||||
//
|
||||
// Tile GetPlaceholderTile() const;
|
||||
//
|
||||
// Returns a temporary placeholder tile used as a marker. This placeholder tile
|
||||
// must never be returned by validateTile and must be == to every instance
|
||||
// of a placeholder tile.
|
||||
//
|
||||
// Additionally, it must implement the following protected methods:
|
||||
//
|
||||
// Tile ValidateTile(Tile aTile, const nsIntPoint& aTileOrigin,
|
||||
// const nsIntRegion& aDirtyRect);
|
||||
//
|
||||
// Validates the dirtyRect. The returned Tile will replace the tile.
|
||||
//
|
||||
// void ReleaseTile(Tile aTile);
|
||||
//
|
||||
// Destroys the given tile.
|
||||
//
|
||||
// void SwapTiles(Tile& aTileA, Tile& aTileB);
|
||||
//
|
||||
// Swaps two tiles.
|
||||
//
|
||||
// The contents of the tile buffer will be rendered at the resolution specified
|
||||
// in mResolution, which can be altered with SetResolution. The resolution
|
||||
// should always be a factor of the tile length, to avoid tiles covering
|
||||
|
@ -196,19 +167,6 @@ public:
|
|||
const nsIntRegion& GetPaintedRegion() const { return mPaintedRegion; }
|
||||
void ClearPaintedRegion() { mPaintedRegion.SetEmpty(); }
|
||||
|
||||
void ResetPaintedAndValidState() {
|
||||
mPaintedRegion.SetEmpty();
|
||||
mValidRegion.SetEmpty();
|
||||
mTiles.mSize.width = 0;
|
||||
mTiles.mSize.height = 0;
|
||||
for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
|
||||
if (!mRetainedTiles[i].IsPlaceholderTile()) {
|
||||
AsDerived().ReleaseTile(mRetainedTiles[i]);
|
||||
}
|
||||
}
|
||||
mRetainedTiles.Clear();
|
||||
}
|
||||
|
||||
// Get and set draw scaling. mResolution affects the resolution at which the
|
||||
// contents of the buffer are drawn. mResolution has no effect on the
|
||||
// coordinate space of the valid region, but does affect the size of an
|
||||
|
@ -217,18 +175,10 @@ public:
|
|||
float GetResolution() const { return mResolution; }
|
||||
bool IsLowPrecision() const { return mResolution < 1; }
|
||||
|
||||
typedef Tile* Iterator;
|
||||
Iterator TilesBegin() { return mRetainedTiles.Elements(); }
|
||||
Iterator TilesEnd() { return mRetainedTiles.Elements() + mRetainedTiles.Length(); }
|
||||
|
||||
void Dump(std::stringstream& aStream, const char* aPrefix, bool aDumpHtml);
|
||||
|
||||
protected:
|
||||
|
||||
// Return a reference to this tile in GetTile when the requested tile offset
|
||||
// does not exist.
|
||||
Tile mPlaceHolderTile;
|
||||
|
||||
nsIntRegion mValidRegion;
|
||||
nsIntRegion mPaintedRegion;
|
||||
|
||||
|
@ -244,41 +194,6 @@ protected:
|
|||
TilesPlacement mTiles;
|
||||
float mResolution;
|
||||
gfx::IntSize mTileSize;
|
||||
|
||||
private:
|
||||
const Derived& AsDerived() const { return *static_cast<const Derived*>(this); }
|
||||
Derived& AsDerived() { return *static_cast<Derived*>(this); }
|
||||
};
|
||||
|
||||
class ClientTiledLayerBuffer;
|
||||
class SurfaceDescriptorTiles;
|
||||
class ISurfaceAllocator;
|
||||
|
||||
// Shadow layers may implement this interface in order to be notified when a
|
||||
// tiled layer buffer is updated.
|
||||
class TiledLayerComposer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Update the current retained layer with the updated layer data.
|
||||
* It is expected that the tiles described by aTiledDescriptor are all in the
|
||||
* ReadLock state, so that the locks can be adopted when recreating a
|
||||
* ClientTiledLayerBuffer locally. This lock will be retained until the buffer
|
||||
* has completed uploading.
|
||||
*
|
||||
* Returns false if a deserialization error happened, in which case we will
|
||||
* have to kill the child process.
|
||||
*/
|
||||
virtual bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
|
||||
const SurfaceDescriptorTiles& aTiledDescriptor) = 0;
|
||||
|
||||
/**
|
||||
* If some part of the buffer is being rendered at a lower precision, this
|
||||
* returns that region. If it is not, an empty region will be returned.
|
||||
*/
|
||||
virtual const nsIntRegion& GetValidLowPrecisionRegion() const = 0;
|
||||
|
||||
virtual const nsIntRegion& GetValidRegion() const = 0;
|
||||
};
|
||||
|
||||
template<typename Derived, typename Tile> void
|
||||
|
|
|
@ -1155,13 +1155,12 @@ void ClientTiledLayerBuffer::Update(const nsIntRegion& newValidRegion,
|
|||
mRetainedTiles[i] = tile;
|
||||
}
|
||||
|
||||
mTiles = newTiles;
|
||||
|
||||
PostValidate(aPaintRegion);
|
||||
for (size_t i = 0; i < mRetainedTiles.Length(); ++i) {
|
||||
UnlockTile(mRetainedTiles[i]);
|
||||
}
|
||||
|
||||
mTiles = newTiles;
|
||||
mValidRegion = newValidRegion;
|
||||
mPaintedRegion.OrWith(aPaintRegion);
|
||||
}
|
||||
|
|
|
@ -455,6 +455,19 @@ public:
|
|||
mResolution = aResolution;
|
||||
}
|
||||
|
||||
void ResetPaintedAndValidState() {
|
||||
mPaintedRegion.SetEmpty();
|
||||
mValidRegion.SetEmpty();
|
||||
mTiles.mSize.width = 0;
|
||||
mTiles.mSize.height = 0;
|
||||
for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
|
||||
if (!mRetainedTiles[i].IsPlaceholderTile()) {
|
||||
mRetainedTiles[i].Release();
|
||||
}
|
||||
}
|
||||
mRetainedTiles.Clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
TileClient ValidateTile(TileClient aTile,
|
||||
const nsIntPoint& aTileRect,
|
||||
|
@ -464,10 +477,6 @@ protected:
|
|||
|
||||
void UnlockTile(TileClient aTile);
|
||||
|
||||
void ReleaseTile(TileClient aTile) { aTile.Release(); }
|
||||
|
||||
void SwapTiles(TileClient& aTileA, TileClient& aTileB) { std::swap(aTileA, aTileB); }
|
||||
|
||||
TileClient GetPlaceholderTile() const { return TileClient(); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace layers {
|
|||
class Layer;
|
||||
class Compositor;
|
||||
class ThebesBufferData;
|
||||
class TiledLayerComposer;
|
||||
class TiledContentHost;
|
||||
class CompositableParentManager;
|
||||
class PCompositableParent;
|
||||
struct EffectChain;
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
Layer* GetLayer() const { return mLayer; }
|
||||
void SetLayer(Layer* aLayer) { mLayer = aLayer; }
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() { return nullptr; }
|
||||
virtual TiledContentHost* AsTiledContentHost() { return nullptr; }
|
||||
|
||||
typedef uint32_t AttachFlags;
|
||||
static const AttachFlags NO_FLAGS = 0;
|
||||
|
|
|
@ -40,7 +40,6 @@ class Matrix4x4;
|
|||
namespace layers {
|
||||
class Compositor;
|
||||
class ThebesBufferData;
|
||||
class TiledLayerComposer;
|
||||
struct EffectChain;
|
||||
|
||||
struct TexturedEffect;
|
||||
|
@ -54,10 +53,6 @@ struct TexturedEffect;
|
|||
class ContentHost : public CompositableHost
|
||||
{
|
||||
public:
|
||||
// Subclasses should implement this method if they support being used as a
|
||||
// tiling.
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() { return nullptr; }
|
||||
|
||||
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aUpdated,
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "LayerScope.h" // for LayerScope Tool
|
||||
#include "protobuf/LayerScopePacket.pb.h" // for protobuf (LayerScope)
|
||||
#include "PaintedLayerComposite.h" // for PaintedLayerComposite
|
||||
#include "TiledLayerBuffer.h" // for TiledLayerComposer
|
||||
#include "TiledContentHost.h"
|
||||
#include "Units.h" // for ScreenIntRect
|
||||
#include "UnitTransforms.h" // for ViewAs
|
||||
#include "gfx2DGlue.h" // for ToMatrix4x4
|
||||
|
@ -1016,10 +1016,10 @@ LayerManagerComposite::ComputeRenderIntegrityInternal(Layer* aLayer,
|
|||
SubtractTransformedRegion(aScreenRegion, incompleteRegion, transformToScreen);
|
||||
|
||||
// See if there's any incomplete low-precision rendering
|
||||
TiledLayerComposer* composer = nullptr;
|
||||
TiledContentHost* composer = nullptr;
|
||||
LayerComposite* shadow = aLayer->AsLayerComposite();
|
||||
if (shadow) {
|
||||
composer = shadow->GetTiledLayerComposer();
|
||||
composer = shadow->GetCompositableHost()->AsTiledContentHost();
|
||||
if (composer) {
|
||||
incompleteRegion.Sub(incompleteRegion, composer->GetValidLowPrecisionRegion());
|
||||
if (!incompleteRegion.IsEmpty()) {
|
||||
|
@ -1338,7 +1338,8 @@ LayerManagerComposite::AsyncPanZoomEnabled() const
|
|||
|
||||
nsIntRegion
|
||||
LayerComposite::GetFullyRenderedRegion() {
|
||||
if (TiledLayerComposer* tiled = GetTiledLayerComposer()) {
|
||||
if (TiledContentHost* tiled = GetCompositableHost() ? GetCompositableHost()->AsTiledContentHost()
|
||||
: nullptr) {
|
||||
nsIntRegion shadowVisibleRegion = GetShadowVisibleRegion();
|
||||
// Discard the region which hasn't been drawn yet when doing
|
||||
// progressive drawing. Note that if the shadow visible region
|
||||
|
|
|
@ -56,7 +56,6 @@ class ImageLayerComposite;
|
|||
class LayerComposite;
|
||||
class RefLayerComposite;
|
||||
class PaintedLayerComposite;
|
||||
class TiledLayerComposer;
|
||||
class TextRenderer;
|
||||
class CompositingRenderTarget;
|
||||
struct FPSState;
|
||||
|
@ -379,8 +378,6 @@ public:
|
|||
|
||||
virtual void CleanupResources() = 0;
|
||||
|
||||
virtual TiledLayerComposer* GetTiledLayerComposer() { return nullptr; }
|
||||
|
||||
virtual void DestroyFrontBuffer() { }
|
||||
|
||||
void AddBlendModeEffect(EffectChain& aEffectChain);
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class TiledLayerComposer;
|
||||
|
||||
PaintedLayerComposite::PaintedLayerComposite(LayerManagerComposite *aManager)
|
||||
: PaintedLayer(aManager, nullptr)
|
||||
, LayerComposite(aManager)
|
||||
|
@ -91,16 +89,6 @@ PaintedLayerComposite::SetLayerManager(LayerManagerComposite* aManager)
|
|||
}
|
||||
}
|
||||
|
||||
TiledLayerComposer*
|
||||
PaintedLayerComposite::GetTiledLayerComposer()
|
||||
{
|
||||
if (!mBuffer) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(mBuffer->IsAttached());
|
||||
return mBuffer->AsTiledLayerComposer();
|
||||
}
|
||||
|
||||
LayerRenderState
|
||||
PaintedLayerComposite::GetRenderState()
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@ namespace layers {
|
|||
|
||||
class CompositableHost;
|
||||
class ContentHost;
|
||||
class TiledLayerComposer;
|
||||
|
||||
class PaintedLayerComposite : public PaintedLayer,
|
||||
public LayerComposite
|
||||
|
@ -52,8 +51,6 @@ public:
|
|||
|
||||
virtual void SetLayerManager(LayerManagerComposite* aManager) override;
|
||||
|
||||
virtual TiledLayerComposer* GetTiledLayerComposer() override;
|
||||
|
||||
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
|
||||
|
||||
virtual void CleanupResources() override;
|
||||
|
|
|
@ -167,8 +167,6 @@ public:
|
|||
static void RecycleCallback(TextureHost* textureHost, void* aClosure);
|
||||
|
||||
protected:
|
||||
void SwapTiles(TileHost& aTileA, TileHost& aTileB) { std::swap(aTileA, aTileB); }
|
||||
|
||||
CSSToParentLayerScale2D mFrameResolution;
|
||||
};
|
||||
|
||||
|
@ -192,8 +190,7 @@ protected:
|
|||
* buffer after compositing a new one. Rendering takes us to RenderTile which
|
||||
* is similar to Composite for non-tiled ContentHosts.
|
||||
*/
|
||||
class TiledContentHost : public ContentHost,
|
||||
public TiledLayerComposer
|
||||
class TiledContentHost : public ContentHost
|
||||
{
|
||||
public:
|
||||
explicit TiledContentHost(const TextureInfo& aTextureInfo);
|
||||
|
@ -217,12 +214,12 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
const nsIntRegion& GetValidLowPrecisionRegion() const override
|
||||
const nsIntRegion& GetValidLowPrecisionRegion() const
|
||||
{
|
||||
return mLowPrecisionTiledBuffer.GetValidRegion();
|
||||
}
|
||||
|
||||
const nsIntRegion& GetValidRegion() const override
|
||||
const nsIntRegion& GetValidRegion() const
|
||||
{
|
||||
return mTiledBuffer.GetValidRegion();
|
||||
}
|
||||
|
@ -235,8 +232,8 @@ public:
|
|||
mLowPrecisionTiledBuffer.SetCompositor(aCompositor);
|
||||
}
|
||||
|
||||
virtual bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
|
||||
const SurfaceDescriptorTiles& aTiledDescriptor) override;
|
||||
bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
|
||||
const SurfaceDescriptorTiles& aTiledDescriptor);
|
||||
|
||||
void Composite(EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
|
@ -247,7 +244,7 @@ public:
|
|||
|
||||
virtual CompositableType GetType() override { return CompositableType::CONTENT_TILED; }
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() override { return this; }
|
||||
virtual TiledContentHost* AsTiledContentHost() override { return this; }
|
||||
|
||||
virtual void Attach(Layer* aLayer,
|
||||
Compositor* aCompositor,
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "GLContext.h" // for GLContext
|
||||
#include "Layers.h" // for Layer
|
||||
#include "RenderTrace.h" // for RenderTraceInvalidateEnd, etc
|
||||
#include "TiledLayerBuffer.h" // for TiledLayerComposer
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/RefPtr.h" // for RefPtr
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
|
@ -23,6 +22,7 @@
|
|||
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
||||
#include "mozilla/layers/TextureHost.h" // for TextureHost
|
||||
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
|
||||
#include "mozilla/layers/TiledContentHost.h"
|
||||
#include "mozilla/layers/PaintedLayerComposite.h"
|
||||
#include "mozilla/mozalloc.h" // for operator delete
|
||||
#include "mozilla/unused.h"
|
||||
|
@ -112,13 +112,12 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
|||
case CompositableOperation::TOpUseTiledLayerBuffer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
||||
const OpUseTiledLayerBuffer& op = aEdit.get_OpUseTiledLayerBuffer();
|
||||
CompositableHost* compositable = AsCompositable(op);
|
||||
TiledContentHost* compositable = AsCompositable(op)->AsTiledContentHost();
|
||||
|
||||
TiledLayerComposer* tileComposer = compositable->AsTiledLayerComposer();
|
||||
NS_ASSERTION(tileComposer, "compositable is not a tile composer");
|
||||
NS_ASSERTION(compositable, "The compositable is not tiled");
|
||||
|
||||
const SurfaceDescriptorTiles& tileDesc = op.tileLayerDescriptor();
|
||||
bool success = tileComposer->UseTiledLayerBuffer(this, tileDesc);
|
||||
bool success = compositable->UseTiledLayerBuffer(this, tileDesc);
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,7 @@ EXPORTS.mozilla.layers += [
|
|||
'composite/LayerManagerComposite.h',
|
||||
'composite/PaintedLayerComposite.h',
|
||||
'composite/TextureHost.h',
|
||||
'composite/TiledContentHost.h',
|
||||
'Compositor.h',
|
||||
'CompositorTypes.h',
|
||||
'D3D11ShareHandleImage.h',
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "ScopedGLHelpers.h"
|
||||
#include "GLReadTexImageHelper.h"
|
||||
#include "GLBlitTextureImageHelper.h"
|
||||
#include "TiledLayerBuffer.h" // for TiledLayerComposer
|
||||
#include "HeapCopyOfStackArray.h"
|
||||
|
||||
#if MOZ_WIDGET_ANDROID
|
||||
|
|
Загрузка…
Ссылка в новой задаче