mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 862064; use PCompositable for tiled layers and add TiledContentClient. r=nical
--HG-- extra : rebase_source : b0055e13b661f78bc0e7168c0df8c6082cfdb34e
This commit is contained in:
parent
89e6b263d4
commit
35cf82d17b
@ -74,7 +74,7 @@ enum TextureHostFlags
|
||||
{
|
||||
TEXTURE_HOST_DEFAULT = 0, // The default texture host for the given
|
||||
// SurfaceDescriptor
|
||||
TEXTURE_HOST_TILED = 1 << 0, // A texture host that supports tiling
|
||||
TEXTURE_HOST_TILED = 1 << 0 // A texture host that supports tiling
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -15,11 +15,9 @@ namespace layers {
|
||||
|
||||
BasicTiledThebesLayer::BasicTiledThebesLayer(BasicShadowLayerManager* const aManager)
|
||||
: ThebesLayer(aManager, static_cast<BasicImplData*>(this))
|
||||
, mTiledBuffer(this, aManager)
|
||||
, mLowPrecisionTiledBuffer(this, aManager)
|
||||
, mContentClient()
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicTiledThebesLayer);
|
||||
mLowPrecisionTiledBuffer.SetResolution(gfxPlatform::GetLowPrecisionResolution());
|
||||
mPaintData.mLastScrollOffset = gfx::Point(0, 0);
|
||||
mPaintData.mFirstPaint = true;
|
||||
}
|
||||
@ -126,7 +124,15 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mTiledBuffer.HasFormatChanged()) {
|
||||
if (!mContentClient) {
|
||||
mContentClient = new TiledContentClient(this, BasicManager());
|
||||
|
||||
mContentClient->Connect();
|
||||
BasicManager()->Attach(mContentClient, this);
|
||||
MOZ_ASSERT(mContentClient->GetForwarder());
|
||||
}
|
||||
|
||||
if (mContentClient->mTiledBuffer.HasFormatChanged()) {
|
||||
mValidRegion = nsIntRegion();
|
||||
}
|
||||
|
||||
@ -151,9 +157,11 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
|
||||
NS_ASSERTION(!BasicManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
|
||||
|
||||
mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, aCallback, aCallbackData);
|
||||
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
|
||||
aCallback, aCallbackData);
|
||||
|
||||
mTiledBuffer.LockCopyAndWrite();
|
||||
BasicManager()->Hold(this);
|
||||
mContentClient->LockCopyAndWrite(TiledContentClient::TILED_BUFFER);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -199,33 +207,35 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
// Only draw progressively when the resolution is unchanged.
|
||||
if (gfxPlatform::UseProgressiveTilePainting() &&
|
||||
!BasicManager()->HasShadowTarget() &&
|
||||
mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
|
||||
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
|
||||
// Store the old valid region, then clear it before painting.
|
||||
// We clip the old valid region to the visible region, as it only gets
|
||||
// used to decide stale content (currently valid and previously visible)
|
||||
nsIntRegion oldValidRegion = mTiledBuffer.GetValidRegion();
|
||||
nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion();
|
||||
oldValidRegion.And(oldValidRegion, mVisibleRegion);
|
||||
if (!mPaintData.mLayerCriticalDisplayPort.IsEmpty()) {
|
||||
oldValidRegion.And(oldValidRegion, mPaintData.mLayerCriticalDisplayPort);
|
||||
}
|
||||
|
||||
updatedBuffer =
|
||||
mTiledBuffer.ProgressiveUpdate(mValidRegion, invalidRegion,
|
||||
oldValidRegion, &mPaintData, aCallback,
|
||||
aCallbackData);
|
||||
mContentClient->mTiledBuffer.ProgressiveUpdate(mValidRegion, invalidRegion,
|
||||
oldValidRegion, &mPaintData,
|
||||
aCallback, aCallbackData);
|
||||
} else {
|
||||
updatedBuffer = true;
|
||||
mValidRegion = mVisibleRegion;
|
||||
if (!mPaintData.mLayerCriticalDisplayPort.IsEmpty()) {
|
||||
mValidRegion.And(mValidRegion, mPaintData.mLayerCriticalDisplayPort);
|
||||
}
|
||||
mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
||||
mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, aCallback, aCallbackData);
|
||||
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
||||
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
|
||||
aCallback, aCallbackData);
|
||||
}
|
||||
|
||||
if (updatedBuffer) {
|
||||
mPaintData.mFirstPaint = false;
|
||||
mTiledBuffer.LockCopyAndWrite();
|
||||
BasicManager()->Hold(this);
|
||||
mContentClient->LockCopyAndWrite(TiledContentClient::TILED_BUFFER);
|
||||
|
||||
// If there are low precision updates, mark the paint as unfinished and
|
||||
// request a repeat transaction.
|
||||
@ -247,18 +257,19 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
bool updatedLowPrecision = false;
|
||||
if (!lowPrecisionInvalidRegion.IsEmpty() &&
|
||||
!nsIntRegion(mPaintData.mLayerCriticalDisplayPort).Contains(mVisibleRegion)) {
|
||||
nsIntRegion oldValidRegion = mLowPrecisionTiledBuffer.GetValidRegion();
|
||||
nsIntRegion oldValidRegion =
|
||||
mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
|
||||
oldValidRegion.And(oldValidRegion, mVisibleRegion);
|
||||
|
||||
// If the frame resolution or format have changed, invalidate the buffer
|
||||
if (mLowPrecisionTiledBuffer.GetFrameResolution() != mPaintData.mResolution ||
|
||||
mLowPrecisionTiledBuffer.HasFormatChanged()) {
|
||||
if (mContentClient->mLowPrecisionTiledBuffer.GetFrameResolution() != mPaintData.mResolution ||
|
||||
mContentClient->mLowPrecisionTiledBuffer.HasFormatChanged()) {
|
||||
if (!mLowPrecisionValidRegion.IsEmpty()) {
|
||||
updatedLowPrecision = true;
|
||||
}
|
||||
oldValidRegion.SetEmpty();
|
||||
mLowPrecisionValidRegion.SetEmpty();
|
||||
mLowPrecisionTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
||||
mContentClient->mLowPrecisionTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
||||
lowPrecisionInvalidRegion = mVisibleRegion;
|
||||
}
|
||||
|
||||
@ -273,25 +284,27 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext,
|
||||
lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
|
||||
|
||||
if (!lowPrecisionInvalidRegion.IsEmpty()) {
|
||||
updatedLowPrecision =
|
||||
mLowPrecisionTiledBuffer.ProgressiveUpdate(mLowPrecisionValidRegion,
|
||||
lowPrecisionInvalidRegion, oldValidRegion,
|
||||
&mPaintData, aCallback, aCallbackData);
|
||||
updatedLowPrecision = mContentClient->mLowPrecisionTiledBuffer
|
||||
.ProgressiveUpdate(mLowPrecisionValidRegion,
|
||||
lowPrecisionInvalidRegion,
|
||||
oldValidRegion, &mPaintData,
|
||||
aCallback, aCallbackData);
|
||||
}
|
||||
} else if (!mLowPrecisionValidRegion.IsEmpty()) {
|
||||
// Clear the low precision tiled buffer
|
||||
updatedLowPrecision = true;
|
||||
mLowPrecisionValidRegion.SetEmpty();
|
||||
mLowPrecisionTiledBuffer.PaintThebes(mLowPrecisionValidRegion,
|
||||
mLowPrecisionValidRegion, aCallback,
|
||||
aCallbackData);
|
||||
mContentClient->mLowPrecisionTiledBuffer.PaintThebes(mLowPrecisionValidRegion,
|
||||
mLowPrecisionValidRegion,
|
||||
aCallback, aCallbackData);
|
||||
}
|
||||
|
||||
// We send a Painted callback if we clear the valid region of the low
|
||||
// precision buffer, so that the shadow buffer's valid region can be updated
|
||||
// and the associated resources can be freed.
|
||||
if (updatedLowPrecision) {
|
||||
mLowPrecisionTiledBuffer.LockCopyAndWrite();
|
||||
BasicManager()->Hold(this);
|
||||
mContentClient->LockCopyAndWrite(TiledContentClient::LOW_PRECISION_TILED_BUFFER);
|
||||
}
|
||||
|
||||
EndPaint(false);
|
||||
|
@ -94,8 +94,7 @@ private:
|
||||
*/
|
||||
void EndPaint(bool aFinish);
|
||||
|
||||
BasicTiledLayerBuffer mTiledBuffer;
|
||||
BasicTiledLayerBuffer mLowPrecisionTiledBuffer;
|
||||
RefPtr<TiledContentClient> mContentClient;
|
||||
nsIntRegion mLowPrecisionValidRegion;
|
||||
BasicTiledLayerPaintData mPaintData;
|
||||
};
|
||||
|
@ -58,6 +58,43 @@ using namespace gfx;
|
||||
|
||||
namespace layers {
|
||||
|
||||
|
||||
TiledContentClient::TiledContentClient(BasicTiledThebesLayer* aThebesLayer,
|
||||
BasicShadowLayerManager* aManager)
|
||||
: CompositableClient(aManager->AsShadowForwarder())
|
||||
, mTiledBuffer(aThebesLayer, aManager)
|
||||
, mLowPrecisionTiledBuffer(aThebesLayer, aManager)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TiledContentClient);
|
||||
|
||||
mLowPrecisionTiledBuffer.SetResolution(gfxPlatform::GetLowPrecisionResolution());
|
||||
}
|
||||
|
||||
void
|
||||
TiledContentClient::LockCopyAndWrite(TiledBufferType aType)
|
||||
{
|
||||
// Create a heap copy owned and released by the compositor. This is needed
|
||||
// since we're sending this over an async message and content needs to be
|
||||
// be able to modify the tiled buffer in the next transaction.
|
||||
// TODO: Remove me once Bug 747811 lands.
|
||||
BasicTiledLayerBuffer* buffer = aType == LOW_PRECISION_TILED_BUFFER
|
||||
? &mLowPrecisionTiledBuffer
|
||||
: &mTiledBuffer;
|
||||
|
||||
BasicTiledLayerBuffer* heapCopy = new BasicTiledLayerBuffer(buffer->DeepCopy());
|
||||
buffer->ReadLock();
|
||||
mForwarder->PaintedTiledLayerBuffer(this, heapCopy);
|
||||
buffer->ClearPaintedRegion();
|
||||
}
|
||||
|
||||
BasicTiledLayerBuffer::BasicTiledLayerBuffer(BasicTiledThebesLayer* aThebesLayer,
|
||||
BasicShadowLayerManager* aManager)
|
||||
: mThebesLayer(aThebesLayer)
|
||||
, mManager(aManager)
|
||||
, mLastPaintOpaque(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
BasicTiledLayerBuffer::HasFormatChanged() const
|
||||
{
|
||||
@ -75,18 +112,6 @@ BasicTiledLayerBuffer::GetContentType() const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BasicTiledLayerBuffer::LockCopyAndWrite()
|
||||
{
|
||||
// Create a heap copy owned and released by the compositor. This is needed
|
||||
// since we're sending this over an async message and content needs to be
|
||||
// be able to modify the tiled buffer in the next transaction.
|
||||
// TODO: Remove me once Bug 747811 lands.
|
||||
BasicTiledLayerBuffer *heapCopy = new BasicTiledLayerBuffer(this->DeepCopy());
|
||||
ReadLock();
|
||||
mManager->PaintedTiledLayerBuffer(mManager->Hold(mThebesLayer), heapCopy);
|
||||
ClearPaintedRegion();
|
||||
}
|
||||
|
||||
void
|
||||
BasicTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
|
||||
|
@ -100,16 +100,12 @@ class BasicTiledLayerBuffer
|
||||
|
||||
public:
|
||||
BasicTiledLayerBuffer(BasicTiledThebesLayer* aThebesLayer,
|
||||
BasicShadowLayerManager* aManager)
|
||||
: mThebesLayer(aThebesLayer)
|
||||
, mManager(aManager)
|
||||
, mLastPaintOpaque(false)
|
||||
{}
|
||||
BasicTiledLayerBuffer()
|
||||
BasicShadowLayerManager* aManager);
|
||||
BasicTiledLayerBuffer()
|
||||
: mThebesLayer(nullptr)
|
||||
, mManager(nullptr)
|
||||
, mLastPaintOpaque(false)
|
||||
{}
|
||||
{}
|
||||
|
||||
void PaintThebes(const nsIntRegion& aNewValidRegion,
|
||||
const nsIntRegion& aPaintRegion,
|
||||
@ -135,8 +131,6 @@ public:
|
||||
|
||||
bool HasFormatChanged() const;
|
||||
|
||||
void LockCopyAndWrite();
|
||||
|
||||
/**
|
||||
* Performs a progressive update of a given tiled buffer.
|
||||
* See ComputeProgressiveUpdateRegion above for parameter documentation.
|
||||
@ -175,6 +169,7 @@ protected:
|
||||
}
|
||||
|
||||
BasicTiledLayerTile GetPlaceholderTile() const { return BasicTiledLayerTile(); }
|
||||
|
||||
private:
|
||||
gfxASurface::gfxContentType GetContentType() const;
|
||||
BasicTiledThebesLayer* mThebesLayer;
|
||||
@ -189,8 +184,8 @@ private:
|
||||
nsIntPoint mSinglePaintBufferOffset;
|
||||
|
||||
BasicTiledLayerTile ValidateTileInternal(BasicTiledLayerTile aTile,
|
||||
const nsIntPoint& aTileOrigin,
|
||||
const nsIntRect& aDirtyRect);
|
||||
const nsIntPoint& aTileOrigin,
|
||||
const nsIntRect& aDirtyRect);
|
||||
|
||||
/**
|
||||
* Calculates the region to update in a single progressive update transaction.
|
||||
@ -220,6 +215,39 @@ private:
|
||||
bool aIsRepeated);
|
||||
};
|
||||
|
||||
class TiledContentClient : public CompositableClient
|
||||
{
|
||||
// XXX: for now the layer which owns us interacts directly with our buffers.
|
||||
// We should have a content client for each tiled buffer which manages its
|
||||
// own valid region, resolution, etc. Then we could have a much cleaner
|
||||
// interface and tidy up BasicTiledThebesLayer::PaintThebes (bug 862547).
|
||||
friend class BasicTiledThebesLayer;
|
||||
|
||||
public:
|
||||
TiledContentClient(BasicTiledThebesLayer* aThebesLayer,
|
||||
BasicShadowLayerManager* aManager);
|
||||
|
||||
~TiledContentClient()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TiledContentClient);
|
||||
}
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return TextureInfo(BUFFER_TILED);
|
||||
}
|
||||
|
||||
enum TiledBufferType {
|
||||
TILED_BUFFER,
|
||||
LOW_PRECISION_TILED_BUFFER
|
||||
};
|
||||
void LockCopyAndWrite(TiledBufferType aType);
|
||||
|
||||
private:
|
||||
BasicTiledLayerBuffer mTiledBuffer;
|
||||
BasicTiledLayerBuffer mLowPrecisionTiledBuffer;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,24 +43,24 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
|
||||
}
|
||||
|
||||
/* static */ TemporaryRef<CompositableHost>
|
||||
CompositableHost::Create(const TextureInfo& aTextureInfo, Compositor* aCompositor)
|
||||
CompositableHost::Create(const TextureInfo& aTextureInfo)
|
||||
{
|
||||
RefPtr<CompositableHost> result;
|
||||
switch (aTextureInfo.mCompositableType) {
|
||||
case BUFFER_IMAGE_BUFFERED:
|
||||
result = new ImageHostBuffered(aTextureInfo, aCompositor);
|
||||
result = new ImageHostBuffered(aTextureInfo);
|
||||
return result;
|
||||
case BUFFER_IMAGE_SINGLE:
|
||||
result = new ImageHostSingle(aTextureInfo, aCompositor);
|
||||
result = new ImageHostSingle(aTextureInfo);
|
||||
return result;
|
||||
case BUFFER_TILED:
|
||||
result = new TiledContentHost(aTextureInfo, aCompositor);
|
||||
result = new TiledContentHost(aTextureInfo);
|
||||
return result;
|
||||
case BUFFER_CONTENT:
|
||||
result = new ContentHostSingleBuffered(aTextureInfo, aCompositor);
|
||||
result = new ContentHostSingleBuffered(aTextureInfo);
|
||||
return result;
|
||||
case BUFFER_CONTENT_DIRECT:
|
||||
result = new ContentHostDoubleBuffered(aTextureInfo, aCompositor);
|
||||
result = new ContentHostDoubleBuffered(aTextureInfo);
|
||||
return result;
|
||||
default:
|
||||
MOZ_NOT_REACHED("Unknown CompositableType");
|
||||
|
@ -48,10 +48,9 @@ class SurfaceDescriptor;
|
||||
class CompositableHost : public RefCounted<CompositableHost>
|
||||
{
|
||||
public:
|
||||
CompositableHost(const TextureInfo& aTextureInfo,
|
||||
Compositor* aCompositor = nullptr)
|
||||
CompositableHost(const TextureInfo& aTextureInfo)
|
||||
: mTextureInfo(aTextureInfo)
|
||||
, mCompositor(aCompositor)
|
||||
, mCompositor(nullptr)
|
||||
, mLayer(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(CompositableHost);
|
||||
@ -62,8 +61,7 @@ public:
|
||||
MOZ_COUNT_DTOR(CompositableHost);
|
||||
}
|
||||
|
||||
static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo,
|
||||
Compositor* aCompositor = nullptr);
|
||||
static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo);
|
||||
|
||||
virtual CompositableType GetType() = 0;
|
||||
|
||||
@ -146,7 +144,9 @@ public:
|
||||
Layer* GetLayer() const { return mLayer; }
|
||||
void SetLayer(Layer* aLayer) { mLayer = aLayer; }
|
||||
|
||||
void Attach(Layer* aLayer, Compositor* aCompositor)
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() { return nullptr; }
|
||||
|
||||
virtual void Attach(Layer* aLayer, Compositor* aCompositor)
|
||||
{
|
||||
SetCompositor(aCompositor);
|
||||
SetLayer(aLayer);
|
||||
|
@ -11,9 +11,8 @@ namespace mozilla {
|
||||
using namespace gfx;
|
||||
namespace layers {
|
||||
|
||||
ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo,
|
||||
Compositor* aCompositor)
|
||||
: ContentHost(aTextureInfo, aCompositor)
|
||||
ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo)
|
||||
: ContentHost(aTextureInfo)
|
||||
, mPaintWillResample(false)
|
||||
, mInitialised(false)
|
||||
{}
|
||||
|
@ -39,8 +39,8 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
ContentHost(const TextureInfo& aTextureInfo, Compositor* aCompositor)
|
||||
: CompositableHost(aTextureInfo, aCompositor)
|
||||
ContentHost(const TextureInfo& aTextureInfo)
|
||||
: CompositableHost(aTextureInfo)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
typedef ThebesLayerBuffer::ContentType ContentType;
|
||||
typedef ThebesLayerBuffer::PaintState PaintState;
|
||||
|
||||
ContentHostBase(const TextureInfo& aTextureInfo, Compositor* aCompositor);
|
||||
ContentHostBase(const TextureInfo& aTextureInfo);
|
||||
~ContentHostBase();
|
||||
|
||||
virtual void Composite(EffectChain& aEffectChain,
|
||||
@ -135,9 +135,8 @@ protected:
|
||||
class ContentHostDoubleBuffered : public ContentHostBase
|
||||
{
|
||||
public:
|
||||
ContentHostDoubleBuffered(const TextureInfo& aTextureInfo,
|
||||
Compositor* aCompositor)
|
||||
: ContentHostBase(aTextureInfo, aCompositor)
|
||||
ContentHostDoubleBuffered(const TextureInfo& aTextureInfo)
|
||||
: ContentHostBase(aTextureInfo)
|
||||
{}
|
||||
|
||||
~ContentHostDoubleBuffered();
|
||||
@ -173,9 +172,8 @@ protected:
|
||||
class ContentHostSingleBuffered : public ContentHostBase
|
||||
{
|
||||
public:
|
||||
ContentHostSingleBuffered(const TextureInfo& aTextureInfo,
|
||||
Compositor* aCompositor)
|
||||
: ContentHostBase(aTextureInfo, aCompositor)
|
||||
ContentHostSingleBuffered(const TextureInfo& aTextureInfo)
|
||||
: ContentHostBase(aTextureInfo)
|
||||
{}
|
||||
virtual ~ContentHostSingleBuffered();
|
||||
|
||||
|
@ -24,8 +24,8 @@ public:
|
||||
TextureHost* GetTextureHost() MOZ_OVERRIDE { return nullptr; }
|
||||
|
||||
protected:
|
||||
ImageHost(const TextureInfo& aTextureInfo, Compositor* aCompositor)
|
||||
: CompositableHost(aTextureInfo, aCompositor)
|
||||
ImageHost(const TextureInfo& aTextureInfo)
|
||||
: CompositableHost(aTextureInfo)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ImageHost);
|
||||
}
|
||||
@ -40,8 +40,8 @@ protected:
|
||||
class ImageHostSingle : public ImageHost
|
||||
{
|
||||
public:
|
||||
ImageHostSingle(const TextureInfo& aTextureInfo, Compositor* aCompositor)
|
||||
: ImageHost(aTextureInfo, aCompositor)
|
||||
ImageHostSingle(const TextureInfo& aTextureInfo)
|
||||
: ImageHost(aTextureInfo)
|
||||
, mTextureHost(nullptr)
|
||||
, mHasPictureRect(false)
|
||||
{}
|
||||
@ -99,8 +99,8 @@ protected:
|
||||
class ImageHostBuffered : public ImageHostSingle
|
||||
{
|
||||
public:
|
||||
ImageHostBuffered(const TextureInfo& aTextureInfo, Compositor* aCompositor)
|
||||
: ImageHostSingle(aTextureInfo, aCompositor)
|
||||
ImageHostBuffered(const TextureInfo& aTextureInfo)
|
||||
: ImageHostSingle(aTextureInfo)
|
||||
{}
|
||||
|
||||
virtual bool Update(const SurfaceDescriptor& aImage,
|
||||
|
@ -389,7 +389,7 @@ LayerManagerComposite::ComputeRenderIntegrityInternal(Layer* aLayer,
|
||||
TiledLayerComposer* composer = nullptr;
|
||||
LayerComposite* shadow = aLayer->AsLayerComposite();
|
||||
if (shadow) {
|
||||
composer = shadow->AsTiledLayerComposer();
|
||||
composer = shadow->GetTiledLayerComposer();
|
||||
if (composer) {
|
||||
incompleteRegion.Sub(incompleteRegion, composer->GetValidLowPrecisionRegion());
|
||||
if (!incompleteRegion.IsEmpty()) {
|
||||
|
@ -287,12 +287,7 @@ public:
|
||||
|
||||
virtual void CleanupResources() = 0;
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() { return NULL; }
|
||||
|
||||
virtual void EnsureBuffer(CompositableType aType)
|
||||
{
|
||||
MOZ_ASSERT(false, "Should not be called unless overriden.");
|
||||
}
|
||||
virtual TiledLayerComposer* GetTiledLayerComposer() { return nullptr; }
|
||||
|
||||
protected:
|
||||
LayerManagerComposite* mCompositeManager;
|
||||
|
@ -47,21 +47,6 @@ ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
|
||||
mBuffer= static_cast<ContentHost*>(aHost);
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerComposite::EnsureBuffer(CompositableType aType)
|
||||
{
|
||||
MOZ_ASSERT(aType == BUFFER_TILED,
|
||||
"Should only be called for tiled layers.");
|
||||
if (!mBuffer ||
|
||||
mBuffer->GetType() != aType) {
|
||||
RefPtr<CompositableHost> bufferHost
|
||||
= CompositableHost::Create(TextureInfo(aType), mCompositeManager->GetCompositor());
|
||||
NS_ASSERTION(bufferHost->GetType() == BUFFER_TILED, "bad buffer type");
|
||||
mBuffer = static_cast<ContentHost*>(bufferHost.get());
|
||||
mRequiresTiledProperties = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerComposite::Disconnect()
|
||||
{
|
||||
@ -87,7 +72,7 @@ ThebesLayerComposite::GetLayer()
|
||||
}
|
||||
|
||||
TiledLayerComposer*
|
||||
ThebesLayerComposite::AsTiledLayerComposer()
|
||||
ThebesLayerComposite::GetTiledLayerComposer()
|
||||
{
|
||||
return mBuffer->AsTiledLayerComposer();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
|
||||
virtual Layer* GetLayer() MOZ_OVERRIDE;
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE;
|
||||
virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE;
|
||||
|
||||
virtual void RenderLayer(const nsIntPoint& aOffset,
|
||||
const nsIntRect& aClipRect) MOZ_OVERRIDE;
|
||||
@ -58,7 +58,7 @@ public:
|
||||
|
||||
virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual void EnsureBuffer(CompositableType aType) MOZ_OVERRIDE;
|
||||
void EnsureTiled() { mRequiresTiledProperties = true; }
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual const char* Name() const MOZ_OVERRIDE { return "ThebesLayerComposite"; }
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "TiledContentHost.h"
|
||||
#include "mozilla/layers/Effects.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "ThebesLayerComposite.h"
|
||||
|
||||
namespace mozilla {
|
||||
using namespace gfx;
|
||||
@ -59,6 +60,13 @@ TiledContentHost::~TiledContentHost()
|
||||
mLowPrecisionMainMemoryTiledBuffer.ReadUnlock();
|
||||
}
|
||||
|
||||
void
|
||||
TiledContentHost::Attach(Layer* aLayer, Compositor* aCompositor)
|
||||
{
|
||||
CompositableHost::Attach(aLayer, aCompositor);
|
||||
static_cast<ThebesLayerComposite*>(aLayer)->EnsureTiled();
|
||||
}
|
||||
|
||||
void
|
||||
TiledContentHost::PaintedTiledLayerBuffer(const BasicTiledLayerBuffer* mTiledBuffer)
|
||||
{
|
||||
|
@ -66,8 +66,8 @@ class TiledLayerBufferComposite
|
||||
friend class TiledLayerBuffer<TiledLayerBufferComposite, TiledTexture>;
|
||||
|
||||
public:
|
||||
TiledLayerBufferComposite(Compositor* aCompositor)
|
||||
: mCompositor(aCompositor)
|
||||
TiledLayerBufferComposite()
|
||||
: mCompositor(nullptr)
|
||||
{}
|
||||
|
||||
void Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
|
||||
@ -81,6 +81,11 @@ public:
|
||||
// by the sum of the resolutions of all parent layers' FrameMetrics.
|
||||
const gfxSize& GetFrameResolution() { return mFrameResolution; }
|
||||
|
||||
void SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
mCompositor = aCompositor;
|
||||
}
|
||||
|
||||
protected:
|
||||
TiledTexture ValidateTile(TiledTexture aTile,
|
||||
const nsIntPoint& aTileRect,
|
||||
@ -126,10 +131,8 @@ class TiledContentHost : public ContentHost,
|
||||
public TiledLayerComposer
|
||||
{
|
||||
public:
|
||||
TiledContentHost(const TextureInfo& aTextureInfo, Compositor* aCompositor)
|
||||
: ContentHost(aTextureInfo, aCompositor)
|
||||
, mVideoMemoryTiledBuffer(aCompositor)
|
||||
, mLowPrecisionVideoMemoryTiledBuffer(aCompositor)
|
||||
TiledContentHost(const TextureInfo& aTextureInfo)
|
||||
: ContentHost(aTextureInfo)
|
||||
, mPendingUpload(false)
|
||||
, mPendingLowPrecisionUpload(false)
|
||||
{}
|
||||
@ -179,7 +182,7 @@ public:
|
||||
|
||||
virtual CompositableType GetType() { return BUFFER_TILED; }
|
||||
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() { return this; }
|
||||
virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual bool EnsureTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
@ -190,6 +193,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE
|
||||
{
|
||||
CompositableHost::SetCompositor(aCompositor);
|
||||
mVideoMemoryTiledBuffer.SetCompositor(aCompositor);
|
||||
mLowPrecisionVideoMemoryTiledBuffer.SetCompositor(aCompositor);
|
||||
}
|
||||
|
||||
virtual void Attach(Layer* aLayer, Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_LAYERS_HAVE_LOG
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@ class TextureFactoryIdentifier;
|
||||
class SurfaceDescriptor;
|
||||
class ThebesBufferData;
|
||||
class TextureClient;
|
||||
class BasicTiledLayerBuffer;
|
||||
|
||||
/**
|
||||
* A transaction is a set of changes that happenned on the content side, that
|
||||
@ -69,6 +70,9 @@ public:
|
||||
*/
|
||||
virtual void DestroyThebesBuffer(CompositableClient* aCompositable) = 0;
|
||||
|
||||
virtual void PaintedTiledLayerBuffer(CompositableClient* aCompositable,
|
||||
BasicTiledLayerBuffer* aTiledLayerBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Communicate to the compositor that the texture identified by aCompositable
|
||||
* and aTextureId has been updated to aImage.
|
||||
|
@ -132,6 +132,20 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
compositable->SetPictureRect(op.picture());
|
||||
break;
|
||||
}
|
||||
case CompositableOperation::TOpPaintTiledLayerBuffer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
||||
const OpPaintTiledLayerBuffer& op = aEdit.get_OpPaintTiledLayerBuffer();
|
||||
CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
|
||||
CompositableHost* compositable =
|
||||
compositableParent->GetCompositableHost();
|
||||
|
||||
TiledLayerComposer* tileComposer = compositable->AsTiledLayerComposer();
|
||||
NS_ASSERTION(tileComposer, "compositable is not a tile composer");
|
||||
|
||||
BasicTiledLayerBuffer* p = reinterpret_cast<BasicTiledLayerBuffer*>(op.tiledLayerBuffer());
|
||||
tileComposer->PaintedTiledLayerBuffer(p);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
MOZ_ASSERT(false, "bad type");
|
||||
}
|
||||
|
@ -230,6 +230,12 @@ public:
|
||||
|
||||
virtual void Connect(CompositableClient* aCompositable) MOZ_OVERRIDE;
|
||||
|
||||
virtual void PaintedTiledLayerBuffer(CompositableClient* aCompositable,
|
||||
BasicTiledLayerBuffer* aTiledLayerBuffer) MOZ_OVERRIDE
|
||||
{
|
||||
NS_RUNTIMEABORT("should not be called");
|
||||
}
|
||||
|
||||
/**
|
||||
* Communicate to the compositor that the texture identified by aCompositable
|
||||
* and aTextureId has been updated to aDescriptor.
|
||||
|
@ -235,7 +235,7 @@ struct OpRaiseToTopChild { PLayer container; PLayer childLayer; };
|
||||
|
||||
// Paint (buffer update)
|
||||
struct OpPaintTiledLayerBuffer {
|
||||
PLayer layer;
|
||||
PCompositable compositable;
|
||||
// Bug 747811
|
||||
// FIXME: We need to support sharing tile across process.
|
||||
uintptr_t tiledLayerBuffer;
|
||||
@ -277,6 +277,8 @@ union CompositableOperation {
|
||||
|
||||
OpPaintTexture;
|
||||
OpPaintTextureRegion;
|
||||
|
||||
OpPaintTiledLayerBuffer;
|
||||
};
|
||||
|
||||
// A unit of a changeset; a set of these comprise a changeset
|
||||
@ -300,7 +302,6 @@ union Edit {
|
||||
OpAttachCompositable;
|
||||
OpAttachAsyncCompositable;
|
||||
|
||||
OpPaintTiledLayerBuffer;
|
||||
CompositableOperation;
|
||||
};
|
||||
|
||||
|
@ -290,12 +290,12 @@ ShadowLayerForwarder::RepositionChild(ShadowableLayer* aContainer,
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerForwarder::PaintedTiledLayerBuffer(ShadowableLayer* aLayer,
|
||||
ShadowLayerForwarder::PaintedTiledLayerBuffer(CompositableClient* aCompositable,
|
||||
BasicTiledLayerBuffer* aTiledLayerBuffer)
|
||||
{
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default)
|
||||
NS_RUNTIMEABORT("PaintedTiledLayerBuffer must be made IPC safe (not share pointers)");
|
||||
mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
|
||||
mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(NULL, aCompositable->GetIPDLActor(),
|
||||
uintptr_t(aTiledLayerBuffer)));
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ class TiledLayerComposer;
|
||||
class Transaction;
|
||||
class SurfaceDescriptor;
|
||||
class CanvasSurface;
|
||||
class BasicTiledLayerBuffer;
|
||||
class TextureClientShmem;
|
||||
class ContentClientRemote;
|
||||
class CompositableChild;
|
||||
@ -258,8 +257,8 @@ public:
|
||||
* and is free to choose it's own internal representation (double buffering,
|
||||
* copy on write, tiling).
|
||||
*/
|
||||
void PaintedTiledLayerBuffer(ShadowableLayer* aThebes,
|
||||
BasicTiledLayerBuffer* aTiledLayerBuffer);
|
||||
virtual void PaintedTiledLayerBuffer(CompositableClient* aCompositable,
|
||||
BasicTiledLayerBuffer* aTiledLayerBuffer) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Notify the compositor that a compositable will be updated asynchronously
|
||||
|
@ -389,21 +389,6 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
compositableParent->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
|
||||
break;
|
||||
}
|
||||
case Edit::TOpPaintTiledLayerBuffer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
||||
const OpPaintTiledLayerBuffer& op = edit.get_OpPaintTiledLayerBuffer();
|
||||
ShadowLayerParent* shadow = AsShadowLayer(op);
|
||||
|
||||
LayerComposite* compositeLayer = shadow->AsLayer()->AsLayerComposite();
|
||||
compositeLayer->EnsureBuffer(BUFFER_TILED);
|
||||
TiledLayerComposer* tileComposer = compositeLayer->AsTiledLayerComposer();
|
||||
|
||||
NS_ASSERTION(tileComposer, "compositeLayer is not a tile composer");
|
||||
|
||||
BasicTiledLayerBuffer* p = reinterpret_cast<BasicTiledLayerBuffer*>(op.tiledLayerBuffer());
|
||||
tileComposer->PaintedTiledLayerBuffer(p);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_RUNTIMEABORT("not reached");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user