зеркало из https://github.com/mozilla/gecko-dev.git
Bug 989883 - Remove deprecated ContentClient/Host. r=mattwoodrow
This commit is contained in:
Родитель
f1a6964fcb
Коммит
24e2f3dd3b
|
@ -165,8 +165,6 @@ enum CompositableType
|
|||
BUFFER_IMAGE_SINGLE, // image/canvas with a single texture, single buffered
|
||||
BUFFER_IMAGE_BUFFERED, // canvas, double buffered
|
||||
BUFFER_BRIDGE, // image bridge protocol
|
||||
BUFFER_CONTENT, // thebes layer interface, single buffering
|
||||
BUFFER_CONTENT_DIRECT, // thebes layer interface, double buffering
|
||||
BUFFER_CONTENT_INC, // thebes layer interface, only sends incremental
|
||||
// updates to a texture on the compositor side.
|
||||
// somewhere in the middle
|
||||
|
|
|
@ -151,8 +151,8 @@ ClientThebesLayer::PaintBuffer(gfxContext* aContext,
|
|||
mValidRegion.Or(mValidRegion, tmp);
|
||||
|
||||
// Hold(this) ensures this layer is kept alive through the current transaction
|
||||
// The ContentClient assumes this layer is kept alive (e.g., in CreateBuffer,
|
||||
// DestroyThebesBuffer), so deleting this Hold for whatever reason will break things.
|
||||
// The ContentClient assumes this layer is kept alive (e.g., in CreateBuffer),
|
||||
// so deleting this Hold for whatever reason will break things.
|
||||
ClientManager()->Hold(this);
|
||||
contentClientRemote->Updated(aRegionToDraw,
|
||||
mVisibleRegion,
|
||||
|
|
|
@ -66,13 +66,6 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
|
|||
}
|
||||
|
||||
bool useDoubleBuffering = false;
|
||||
bool useDeprecatedTextures = true;
|
||||
// XXX We need support for gralloc with non-deprecated textures content before
|
||||
// we can use them with FirefoxOS (bug 946720). We need the same locking for
|
||||
// Windows.
|
||||
#if !defined(XP_WIN)
|
||||
useDeprecatedTextures = gfxPlatform::GetPlatform()->UseDeprecatedTextures();
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (backend == LayersBackend::LAYERS_D3D11) {
|
||||
|
@ -86,22 +79,14 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
|
|||
}
|
||||
|
||||
if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
|
||||
if (useDeprecatedTextures) {
|
||||
return new DeprecatedContentClientDoubleBuffered(aForwarder);
|
||||
} else {
|
||||
return new ContentClientDoubleBuffered(aForwarder);
|
||||
}
|
||||
return new ContentClientDoubleBuffered(aForwarder);
|
||||
}
|
||||
#ifdef XP_MACOSX
|
||||
if (backend == LayersBackend::LAYERS_OPENGL) {
|
||||
return new ContentClientIncremental(aForwarder);
|
||||
}
|
||||
#endif
|
||||
if (useDeprecatedTextures) {
|
||||
return new DeprecatedContentClientSingleBuffered(aForwarder);
|
||||
} else {
|
||||
return new ContentClientSingleBuffered(aForwarder);
|
||||
}
|
||||
return new ContentClientSingleBuffered(aForwarder);
|
||||
}
|
||||
|
||||
// We pass a null pointer for the ContentClient Forwarder argument, which means
|
||||
|
@ -147,7 +132,7 @@ ContentClientRemoteBuffer::DestroyBuffers()
|
|||
void
|
||||
ContentClientRemoteBuffer::BeginPaint()
|
||||
{
|
||||
// XXX: So we might not have a DeprecatedTextureClient yet.. because it will
|
||||
// XXX: So we might not have a TextureClient yet.. because it will
|
||||
// only be created by CreateBuffer.. which will deliver a locked surface!.
|
||||
if (mTextureClient) {
|
||||
SetBufferProvider(mTextureClient);
|
||||
|
@ -333,190 +318,6 @@ ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
|||
mFrontAndBackBufferDiffer = true;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::DestroyBuffers()
|
||||
{
|
||||
if (!mDeprecatedTextureClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
mDeprecatedTextureClient = nullptr;
|
||||
mDeprecatedTextureClientOnWhite = nullptr;
|
||||
|
||||
DestroyFrontBuffer();
|
||||
|
||||
mForwarder->DestroyThebesBuffer(this);
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::BeginPaint()
|
||||
{
|
||||
// XXX: So we might not have a DeprecatedTextureClient yet.. because it will
|
||||
// only be created by CreateBuffer.. which will deliver a locked surface!.
|
||||
if (mDeprecatedTextureClient) {
|
||||
SetDeprecatedBufferProvider(mDeprecatedTextureClient);
|
||||
}
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
SetDeprecatedBufferProviderOnWhite(mDeprecatedTextureClientOnWhite);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::EndPaint()
|
||||
{
|
||||
// XXX: We might still not have a texture client if PaintThebes
|
||||
// decided we didn't need one yet because the region to draw was empty.
|
||||
SetDeprecatedBufferProvider(nullptr);
|
||||
SetDeprecatedBufferProviderOnWhite(nullptr);
|
||||
mOldTextures.Clear();
|
||||
|
||||
if (mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient->Unlock();
|
||||
}
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DeprecatedContentClientRemoteBuffer::CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient)
|
||||
{
|
||||
aClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT, mContentType);
|
||||
MOZ_ASSERT(aClient, "Failed to create texture client");
|
||||
|
||||
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
||||
aClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, mContentType);
|
||||
MOZ_ASSERT(aClient, "Failed to create texture client");
|
||||
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
||||
NS_WARNING("Could not allocate texture client");
|
||||
aClient->SetFlags(0);
|
||||
aClient = nullptr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(IsSurfaceDescriptorValid(*aClient->GetDescriptor()));
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!mIsNewBuffer,
|
||||
"Bad! Did we create a buffer twice without painting?");
|
||||
|
||||
if (mDeprecatedTextureClient) {
|
||||
mOldTextures.AppendElement(mDeprecatedTextureClient);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mOldTextures.AppendElement(mDeprecatedTextureClientOnWhite);
|
||||
}
|
||||
DestroyBuffers();
|
||||
}
|
||||
|
||||
mContentType = aType;
|
||||
mSize = gfx::IntSize(aRect.width, aRect.height);
|
||||
mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
|
||||
|
||||
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClient)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
||||
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClientOnWhite)) {
|
||||
mDeprecatedTextureClient->SetFlags(0);
|
||||
mDeprecatedTextureClient = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CreateFrontBufferAndNotify(aRect);
|
||||
mIsNewBuffer = true;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::CreateBuffer(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags,
|
||||
RefPtr<gfx::DrawTarget>* aBlackDT,
|
||||
RefPtr<gfx::DrawTarget>* aWhiteDT)
|
||||
{
|
||||
BuildDeprecatedTextureClients(aType, aRect, aFlags);
|
||||
if (!mDeprecatedTextureClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContentForType(
|
||||
mDeprecatedTextureClient->BackendType()));
|
||||
*aBlackDT = mDeprecatedTextureClient->LockDrawTarget();
|
||||
if (aFlags & BUFFER_COMPONENT_ALPHA) {
|
||||
*aWhiteDT = mDeprecatedTextureClientOnWhite->LockDrawTarget();
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRegion
|
||||
DeprecatedContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
bool aDidSelfCopy)
|
||||
{
|
||||
nsIntRegion updatedRegion;
|
||||
if (mIsNewBuffer || aDidSelfCopy) {
|
||||
// A buffer reallocation clears both buffers. The front buffer has all the
|
||||
// content by now, but the back buffer is still clear. Here, in effect, we
|
||||
// are saying to copy all of the pixels of the front buffer to the back.
|
||||
// Also when we self-copied in the buffer, the buffer space
|
||||
// changes and some changed buffer content isn't reflected in the
|
||||
// draw or invalidate region (on purpose!). When this happens, we
|
||||
// need to read back the entire buffer too.
|
||||
updatedRegion = aVisibleRegion;
|
||||
mIsNewBuffer = false;
|
||||
} else {
|
||||
updatedRegion = aRegionToDraw;
|
||||
}
|
||||
|
||||
NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
|
||||
"Update outside of buffer rect!");
|
||||
NS_ABORT_IF_FALSE(mDeprecatedTextureClient, "should have a back buffer by now");
|
||||
|
||||
return updatedRegion;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
bool aDidSelfCopy)
|
||||
{
|
||||
nsIntRegion updatedRegion = GetUpdatedRegion(aRegionToDraw,
|
||||
aVisibleRegion,
|
||||
aDidSelfCopy);
|
||||
|
||||
MOZ_ASSERT(mDeprecatedTextureClient);
|
||||
mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
}
|
||||
LockFrontBuffer();
|
||||
mForwarder->UpdateTextureRegion(this,
|
||||
ThebesBufferData(BufferRect(),
|
||||
BufferRotation()),
|
||||
updatedRegion);
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
||||
{
|
||||
MOZ_ASSERT(mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(!mDeprecatedTextureClientOnWhite || mDeprecatedTextureClientOnWhite->GetAccessMode() == DeprecatedTextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient);
|
||||
|
||||
mFrontAndBackBufferDiffer = true;
|
||||
mDeprecatedTextureClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
|
||||
{
|
||||
|
@ -720,245 +521,6 @@ ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
|||
}
|
||||
}
|
||||
|
||||
DeprecatedContentClientDoubleBuffered::~DeprecatedContentClientDoubleBuffered()
|
||||
{
|
||||
if (mDeprecatedTextureClient) {
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
|
||||
mFrontClient->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
MOZ_ASSERT(mFrontClientOnWhite);
|
||||
mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
mFrontClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
|
||||
{
|
||||
if (!CreateAndAllocateDeprecatedTextureClient(mFrontClient)) {
|
||||
mDeprecatedTextureClient->SetFlags(0);
|
||||
mDeprecatedTextureClient = nullptr;
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetFlags(0);
|
||||
mDeprecatedTextureClientOnWhite = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
|
||||
if (!CreateAndAllocateDeprecatedTextureClient(mFrontClientOnWhite)) {
|
||||
mDeprecatedTextureClient->SetFlags(0);
|
||||
mDeprecatedTextureClient = nullptr;
|
||||
mDeprecatedTextureClientOnWhite->SetFlags(0);
|
||||
mDeprecatedTextureClientOnWhite = nullptr;
|
||||
mFrontClient->SetFlags(0);
|
||||
mFrontClient = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mFrontBufferRect = aBufferRect;
|
||||
mFrontBufferRotation = nsIntPoint();
|
||||
|
||||
mForwarder->CreatedDoubleBuffer(this,
|
||||
*mFrontClient->LockSurfaceDescriptor(),
|
||||
*mDeprecatedTextureClient->LockSurfaceDescriptor(),
|
||||
mTextureInfo,
|
||||
mFrontClientOnWhite ? mFrontClientOnWhite->LockSurfaceDescriptor() : nullptr,
|
||||
mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->LockSurfaceDescriptor() : nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::DestroyFrontBuffer()
|
||||
{
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
MOZ_ASSERT(mFrontClient->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
||||
|
||||
mFrontClient = nullptr;
|
||||
mFrontClientOnWhite = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::LockFrontBuffer()
|
||||
{
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
if (mFrontClientOnWhite) {
|
||||
mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
||||
{
|
||||
mFrontUpdatedRegion = aFrontUpdatedRegion;
|
||||
|
||||
RefPtr<DeprecatedTextureClient> oldBack = mDeprecatedTextureClient;
|
||||
mDeprecatedTextureClient = mFrontClient;
|
||||
mFrontClient = oldBack;
|
||||
|
||||
oldBack = mDeprecatedTextureClientOnWhite;
|
||||
mDeprecatedTextureClientOnWhite = mFrontClientOnWhite;
|
||||
mFrontClientOnWhite = oldBack;
|
||||
|
||||
nsIntRect oldBufferRect = mBufferRect;
|
||||
mBufferRect = mFrontBufferRect;
|
||||
mFrontBufferRect = oldBufferRect;
|
||||
|
||||
nsIntPoint oldBufferRotation = mBufferRotation;
|
||||
mBufferRotation = mFrontBufferRotation;
|
||||
mFrontBufferRotation = oldBufferRotation;
|
||||
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
mFrontClient->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
|
||||
if (mFrontClientOnWhite) {
|
||||
mFrontClientOnWhite->SetAccessMode(DeprecatedTextureClient::ACCESS_READ_ONLY);
|
||||
}
|
||||
|
||||
DeprecatedContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
|
||||
}
|
||||
|
||||
struct AutoDeprecatedTextureClient {
|
||||
AutoDeprecatedTextureClient()
|
||||
: mTexture(nullptr)
|
||||
{}
|
||||
~AutoDeprecatedTextureClient()
|
||||
{
|
||||
if (mTexture) {
|
||||
mTexture->Unlock();
|
||||
}
|
||||
}
|
||||
DrawTarget* GetDrawTarget(DeprecatedTextureClient* aTexture)
|
||||
{
|
||||
MOZ_ASSERT(!mTexture);
|
||||
mTexture = aTexture;
|
||||
if (mTexture) {
|
||||
return mTexture->LockDrawTarget();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
private:
|
||||
DeprecatedTextureClient* mTexture;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::PrepareFrame()
|
||||
{
|
||||
mIsNewBuffer = false;
|
||||
|
||||
if (!mFrontAndBackBufferDiffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDidSelfCopy) {
|
||||
// We can't easily draw our front buffer into us, since we're going to be
|
||||
// copying stuff around anyway it's easiest if we just move our situation
|
||||
// to non-rotated while we're at it. If this situation occurs we'll have
|
||||
// hit a self-copy path in PaintThebes before as well anyway.
|
||||
mBufferRect.MoveTo(mFrontBufferRect.TopLeft());
|
||||
mBufferRotation = nsIntPoint();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mBufferRect = mFrontBufferRect;
|
||||
mBufferRotation = mFrontBufferRotation;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
|
||||
{
|
||||
if (!mFrontAndBackBufferDiffer) {
|
||||
return;
|
||||
}
|
||||
mFrontAndBackBufferDiffer = false;
|
||||
|
||||
MOZ_ASSERT(mFrontClient);
|
||||
MOZ_ASSERT(mFrontClient->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
||||
MOZ_ASSERT(!mFrontClientOnWhite ||
|
||||
mFrontClientOnWhite->GetAccessMode() != DeprecatedTextureClient::ACCESS_NONE);
|
||||
|
||||
MOZ_LAYERS_LOG(("BasicShadowableThebes(%p): reading back <x=%d,y=%d,w=%d,h=%d>",
|
||||
this,
|
||||
mFrontUpdatedRegion.GetBounds().x,
|
||||
mFrontUpdatedRegion.GetBounds().y,
|
||||
mFrontUpdatedRegion.GetBounds().width,
|
||||
mFrontUpdatedRegion.GetBounds().height));
|
||||
|
||||
nsIntRegion updateRegion = mFrontUpdatedRegion;
|
||||
if (mDidSelfCopy) {
|
||||
updateRegion = mBufferRect;
|
||||
mDidSelfCopy = false;
|
||||
}
|
||||
|
||||
// No point in sync'ing what we are going to draw over anyway. And if there is
|
||||
// nothing to sync at all, there is nothing to do and we can go home early.
|
||||
updateRegion.Sub(updateRegion, aRegionToDraw);
|
||||
if (updateRegion.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoDeprecatedTextureClient autoTextureFront;
|
||||
AutoDeprecatedTextureClient autoTextureFrontOnWhite;
|
||||
// We need to ensure that we lock these two buffers in the same
|
||||
// order as the compositor to prevent deadlocks.
|
||||
DrawTarget* dt = autoTextureFront.GetDrawTarget(mFrontClient);
|
||||
DrawTarget* dtOnWhite = autoTextureFrontOnWhite.GetDrawTarget(mFrontClientOnWhite);
|
||||
RotatedBuffer frontBuffer(dt,
|
||||
dtOnWhite,
|
||||
mFrontBufferRect,
|
||||
mFrontBufferRotation);
|
||||
UpdateDestinationFrom(frontBuffer, updateRegion);
|
||||
|
||||
// We need to flush our buffers before we unlock our front textures
|
||||
FlushBuffers();
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
|
||||
const nsIntRegion& aUpdateRegion)
|
||||
{
|
||||
DrawTarget* destDT =
|
||||
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
|
||||
if (!destDT) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool isClippingCheap = IsClippingCheap(destDT, aUpdateRegion);
|
||||
if (isClippingCheap) {
|
||||
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
|
||||
}
|
||||
|
||||
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
|
||||
if (isClippingCheap) {
|
||||
destDT->PopClip();
|
||||
}
|
||||
ReturnDrawTargetToBuffer(destDT);
|
||||
|
||||
if (aSource.HaveBufferOnWhite()) {
|
||||
MOZ_ASSERT(HaveBufferOnWhite());
|
||||
DrawTarget* destDT =
|
||||
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE);
|
||||
if (!destDT) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool isClippingCheap = IsClippingCheap(destDT, aUpdateRegion);
|
||||
if (isClippingCheap) {
|
||||
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
|
||||
}
|
||||
|
||||
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
|
||||
if (isClippingCheap) {
|
||||
destDT->PopClip();
|
||||
}
|
||||
ReturnDrawTargetToBuffer(destDT);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientSingleBuffered::PrepareFrame()
|
||||
{
|
||||
|
@ -999,61 +561,6 @@ ContentClientSingleBuffered::PrepareFrame()
|
|||
mFrontAndBackBufferDiffer = false;
|
||||
}
|
||||
|
||||
DeprecatedContentClientSingleBuffered::~DeprecatedContentClientSingleBuffered()
|
||||
{
|
||||
if (mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
if (mDeprecatedTextureClientOnWhite) {
|
||||
mDeprecatedTextureClientOnWhite->SetDescriptor(SurfaceDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientSingleBuffered::CreateFrontBufferAndNotify(const nsIntRect& aBufferRect)
|
||||
{
|
||||
mForwarder->CreatedSingleBuffer(this,
|
||||
*mDeprecatedTextureClient->LockSurfaceDescriptor(),
|
||||
mTextureInfo,
|
||||
mDeprecatedTextureClientOnWhite ? mDeprecatedTextureClientOnWhite->LockSurfaceDescriptor() : nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentClientSingleBuffered::PrepareFrame()
|
||||
{
|
||||
mIsNewBuffer = false;
|
||||
if (!mFrontAndBackBufferDiffer) {
|
||||
return;
|
||||
}
|
||||
mFrontAndBackBufferDiffer = false;
|
||||
|
||||
DrawTarget* backBuffer = GetDTBuffer();
|
||||
if (!backBuffer && mDeprecatedTextureClient) {
|
||||
backBuffer = mDeprecatedTextureClient->LockDrawTarget();
|
||||
}
|
||||
if (!backBuffer) {
|
||||
NS_WARNING("Could not lock texture client");
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> oldBuffer;
|
||||
oldBuffer = SetDTBuffer(backBuffer,
|
||||
mBufferRect,
|
||||
mBufferRotation);
|
||||
|
||||
backBuffer = GetDTBufferOnWhite();
|
||||
if (!backBuffer && mDeprecatedTextureClientOnWhite) {
|
||||
backBuffer = mDeprecatedTextureClientOnWhite->LockDrawTarget();
|
||||
}
|
||||
if (!backBuffer) {
|
||||
NS_WARN_IF_FALSE(!mDeprecatedTextureClientOnWhite,
|
||||
"Could not lock texture client (on white)");
|
||||
return;
|
||||
}
|
||||
|
||||
oldBuffer = SetDTBufferOnWhite(backBuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
|
||||
{
|
||||
|
|
|
@ -303,111 +303,6 @@ protected:
|
|||
gfx::SurfaceFormat mSurfaceFormat;
|
||||
};
|
||||
|
||||
class DeprecatedContentClientRemoteBuffer : public ContentClientRemote
|
||||
, protected RotatedContentBuffer
|
||||
{
|
||||
using RotatedContentBuffer::BufferRect;
|
||||
using RotatedContentBuffer::BufferRotation;
|
||||
public:
|
||||
DeprecatedContentClientRemoteBuffer(CompositableForwarder* aForwarder)
|
||||
: ContentClientRemote(aForwarder)
|
||||
, RotatedContentBuffer(ContainsVisibleBounds)
|
||||
, mDeprecatedTextureClient(nullptr)
|
||||
, mIsNewBuffer(false)
|
||||
, mFrontAndBackBufferDiffer(false)
|
||||
, mContentType(gfxContentType::COLOR_ALPHA)
|
||||
{}
|
||||
|
||||
typedef RotatedContentBuffer::PaintState PaintState;
|
||||
typedef RotatedContentBuffer::ContentType ContentType;
|
||||
|
||||
virtual void Clear() { RotatedContentBuffer::Clear(); }
|
||||
|
||||
virtual PaintState BeginPaintBuffer(ThebesLayer* aLayer,
|
||||
uint32_t aFlags) MOZ_OVERRIDE
|
||||
{
|
||||
return RotatedContentBuffer::BeginPaint(aLayer, aFlags);
|
||||
}
|
||||
virtual gfx::DrawTarget* BorrowDrawTargetForPainting(ThebesLayer* aLayer,
|
||||
const PaintState& aPaintState) MOZ_OVERRIDE
|
||||
{
|
||||
return RotatedContentBuffer::BorrowDrawTargetForPainting(aLayer, aPaintState);
|
||||
}
|
||||
virtual void ReturnDrawTargetToBuffer(gfx::DrawTarget*& aReturned) MOZ_OVERRIDE
|
||||
{
|
||||
BorrowDrawTarget::ReturnDrawTarget(aReturned);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin/End Paint map a gfxASurface from the texture client
|
||||
* into the buffer of RotatedContentBuffer. The surface is only
|
||||
* valid when the texture client is locked, so is mapped out
|
||||
* of RotatedContentBuffer when we are done painting.
|
||||
* None of the underlying buffer attributes (rect, rotation)
|
||||
* are affected by mapping/unmapping.
|
||||
*/
|
||||
virtual void BeginPaint() MOZ_OVERRIDE;
|
||||
virtual void EndPaint() MOZ_OVERRIDE;
|
||||
|
||||
virtual void Updated(const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
bool aDidSelfCopy);
|
||||
|
||||
virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
|
||||
|
||||
// Expose these protected methods from the superclass.
|
||||
virtual const nsIntRect& BufferRect() const
|
||||
{
|
||||
return RotatedContentBuffer::BufferRect();
|
||||
}
|
||||
virtual const nsIntPoint& BufferRotation() const
|
||||
{
|
||||
return RotatedContentBuffer::BufferRotation();
|
||||
}
|
||||
|
||||
virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
|
||||
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return mTextureInfo;
|
||||
}
|
||||
|
||||
protected:
|
||||
void DestroyBuffers();
|
||||
|
||||
virtual nsIntRegion GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
bool aDidSelfCopy);
|
||||
|
||||
// create and configure mDeprecatedTextureClient
|
||||
void BuildDeprecatedTextureClients(ContentType aType,
|
||||
const nsIntRect& aRect,
|
||||
uint32_t aFlags);
|
||||
|
||||
// Create the front buffer for the ContentClient/Host pair if necessary
|
||||
// and notify the compositor that we have created the buffer(s).
|
||||
virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) = 0;
|
||||
virtual void DestroyFrontBuffer() {}
|
||||
// We're about to hand off to the compositor, if you've got a back buffer,
|
||||
// lock it now.
|
||||
virtual void LockFrontBuffer() {}
|
||||
|
||||
bool CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient);
|
||||
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClientOnWhite;
|
||||
// keep a record of texture clients we have created and need to keep
|
||||
// around, then unlock when we are done painting
|
||||
nsTArray<RefPtr<DeprecatedTextureClient> > mOldTextures;
|
||||
|
||||
TextureInfo mTextureInfo;
|
||||
bool mIsNewBuffer;
|
||||
bool mFrontAndBackBufferDiffer;
|
||||
gfx::IntSize mSize;
|
||||
ContentType mContentType;
|
||||
};
|
||||
|
||||
/**
|
||||
* A double buffered ContentClient. mDeprecatedTextureClient is the back buffer, which
|
||||
* we draw into. mFrontClient is the front buffer which we may read from, but
|
||||
|
@ -465,38 +360,6 @@ private:
|
|||
nsIntPoint mFrontBufferRotation;
|
||||
};
|
||||
|
||||
class DeprecatedContentClientDoubleBuffered : public DeprecatedContentClientRemoteBuffer
|
||||
{
|
||||
public:
|
||||
DeprecatedContentClientDoubleBuffered(CompositableForwarder* aFwd)
|
||||
: DeprecatedContentClientRemoteBuffer(aFwd)
|
||||
{
|
||||
mTextureInfo.mCompositableType = BUFFER_CONTENT_DIRECT;
|
||||
}
|
||||
~DeprecatedContentClientDoubleBuffered();
|
||||
|
||||
virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
|
||||
|
||||
virtual void PrepareFrame() MOZ_OVERRIDE;
|
||||
|
||||
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
|
||||
virtual void DestroyFrontBuffer() MOZ_OVERRIDE;
|
||||
virtual void LockFrontBuffer() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
void UpdateDestinationFrom(const RotatedBuffer& aSource,
|
||||
const nsIntRegion& aUpdateRegion);
|
||||
|
||||
RefPtr<DeprecatedTextureClient> mFrontClient;
|
||||
RefPtr<DeprecatedTextureClient> mFrontClientOnWhite;
|
||||
nsIntRegion mFrontUpdatedRegion;
|
||||
nsIntRect mFrontBufferRect;
|
||||
nsIntPoint mFrontBufferRotation;
|
||||
};
|
||||
|
||||
/**
|
||||
* A single buffered ContentClient. We have a single TextureClient/Host
|
||||
* which we update and then send a message to the compositor that we are
|
||||
|
@ -521,24 +384,8 @@ protected:
|
|||
virtual void CreateFrontBuffer(const nsIntRect& aBufferRect) MOZ_OVERRIDE {}
|
||||
};
|
||||
|
||||
class DeprecatedContentClientSingleBuffered : public DeprecatedContentClientRemoteBuffer
|
||||
{
|
||||
public:
|
||||
DeprecatedContentClientSingleBuffered(CompositableForwarder* aFwd)
|
||||
: DeprecatedContentClientRemoteBuffer(aFwd)
|
||||
{
|
||||
mTextureInfo.mCompositableType = BUFFER_CONTENT;
|
||||
}
|
||||
~DeprecatedContentClientSingleBuffered();
|
||||
|
||||
virtual void PrepareFrame() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void CreateFrontBufferAndNotify(const nsIntRect& aBufferRect) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
/**
|
||||
* A single buffered ContentClient that creates temporary buffers which are
|
||||
* A single buffered ContentClient that creates temporary buffers which are
|
||||
* used to update the host-side texture. The ownership of the buffers is
|
||||
* passed to the host side during the transaction, and we need to create
|
||||
* new ones each frame.
|
||||
|
|
|
@ -145,12 +145,6 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
|
|||
case BUFFER_BRIDGE:
|
||||
MOZ_CRASH("Cannot create an image bridge compositable this way");
|
||||
break;
|
||||
case BUFFER_CONTENT:
|
||||
result = new DeprecatedContentHostSingleBuffered(aTextureInfo);
|
||||
break;
|
||||
case BUFFER_CONTENT_DIRECT:
|
||||
result = new DeprecatedContentHostDoubleBuffered(aTextureInfo);
|
||||
break;
|
||||
case BUFFER_CONTENT_INC:
|
||||
result = new ContentHostIncremental(aTextureInfo);
|
||||
break;
|
||||
|
|
|
@ -558,107 +558,6 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
|||
return true;
|
||||
}
|
||||
|
||||
DeprecatedContentHostSingleBuffered::~DeprecatedContentHostSingleBuffered()
|
||||
{
|
||||
DestroyTextures();
|
||||
DestroyFrontHost();
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentHostSingleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
MOZ_ASSERT(aTextureId == TextureFront ||
|
||||
aTextureId == TextureOnWhiteFront);
|
||||
RefPtr<DeprecatedTextureHost> *newHost =
|
||||
(aTextureId == TextureFront) ? &mNewFrontHost : &mNewFrontHostOnWhite;
|
||||
|
||||
*newHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(aSurface.type(),
|
||||
aTextureInfo.mDeprecatedTextureHostFlags,
|
||||
aTextureInfo.mTextureFlags,
|
||||
this);
|
||||
|
||||
(*newHost)->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
|
||||
Compositor* compositor = GetCompositor();
|
||||
if (compositor) {
|
||||
(*newHost)->SetCompositor(compositor);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentHostSingleBuffered::DestroyTextures()
|
||||
{
|
||||
MOZ_ASSERT(!mNewFrontHost || mNewFrontHost->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
MOZ_ASSERT(!mNewFrontHostOnWhite || mNewFrontHostOnWhite->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
mNewFrontHost = nullptr;
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
|
||||
// don't touch mDeprecatedTextureHost, we might need it for compositing
|
||||
}
|
||||
|
||||
bool
|
||||
DeprecatedContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aUpdated,
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack)
|
||||
{
|
||||
aUpdatedRegionBack->SetEmpty();
|
||||
|
||||
if (!mDeprecatedTextureHost && !mNewFrontHost) {
|
||||
mInitialised = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mNewFrontHost) {
|
||||
DestroyFrontHost();
|
||||
mDeprecatedTextureHost = mNewFrontHost;
|
||||
mNewFrontHost = nullptr;
|
||||
if (mNewFrontHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite = mNewFrontHostOnWhite;
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mDeprecatedTextureHost);
|
||||
MOZ_ASSERT(!mNewFrontHostOnWhite, "New white host without a new black?");
|
||||
|
||||
// updated is in screen coordinates. Convert it to buffer coordinates.
|
||||
nsIntRegion destRegion(aUpdated);
|
||||
destRegion.MoveBy(-aData.rect().TopLeft());
|
||||
|
||||
// Correct for rotation
|
||||
destRegion.MoveBy(aData.rotation());
|
||||
|
||||
IntSize size = aData.rect().Size().ToIntSize();
|
||||
nsIntRect destBounds = destRegion.GetBounds();
|
||||
destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
|
||||
(destBounds.y >= size.height) ? -size.height : 0);
|
||||
|
||||
// We can get arbitrary bad regions from an untrusted client,
|
||||
// which we need to be resilient to. See bug 967330.
|
||||
if((destBounds.x % size.width) + destBounds.width > size.width ||
|
||||
(destBounds.y % size.height) + destBounds.height > size.height)
|
||||
{
|
||||
NS_ERROR("updated region lies across rotation boundaries!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mDeprecatedTextureHost->Update(*mDeprecatedTextureHost->LockSurfaceDescriptor(), &destRegion);
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->Update(*mDeprecatedTextureHostOnWhite->LockSurfaceDescriptor(), &destRegion);
|
||||
}
|
||||
mInitialised = true;
|
||||
|
||||
mBufferRect = aData.rect();
|
||||
mBufferRotation = aData.rotation();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aUpdated,
|
||||
|
@ -698,137 +597,6 @@ ContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
|||
return true;
|
||||
}
|
||||
|
||||
DeprecatedContentHostDoubleBuffered::~DeprecatedContentHostDoubleBuffered()
|
||||
{
|
||||
DestroyTextures();
|
||||
DestroyFrontHost();
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentHostDoubleBuffered::EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo)
|
||||
{
|
||||
RefPtr<DeprecatedTextureHost> newHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(aSurface.type(),
|
||||
aTextureInfo.mDeprecatedTextureHostFlags,
|
||||
aTextureInfo.mTextureFlags,
|
||||
this);
|
||||
|
||||
newHost->SetBuffer(new SurfaceDescriptor(aSurface), aAllocator);
|
||||
|
||||
Compositor* compositor = GetCompositor();
|
||||
if (compositor) {
|
||||
newHost->SetCompositor(compositor);
|
||||
}
|
||||
|
||||
if (aTextureId == TextureFront) {
|
||||
mNewFrontHost = newHost;
|
||||
return;
|
||||
}
|
||||
if (aTextureId == TextureOnWhiteFront) {
|
||||
mNewFrontHostOnWhite = newHost;
|
||||
return;
|
||||
}
|
||||
if (aTextureId == TextureBack) {
|
||||
mBackHost = newHost;
|
||||
mBufferRect = nsIntRect();
|
||||
mBufferRotation = nsIntPoint();
|
||||
return;
|
||||
}
|
||||
if (aTextureId == TextureOnWhiteBack) {
|
||||
mBackHostOnWhite = newHost;
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ERROR("Bad texture identifier");
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentHostDoubleBuffered::DestroyTextures()
|
||||
{
|
||||
if (mNewFrontHost) {
|
||||
MOZ_ASSERT(mNewFrontHost->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
mNewFrontHost = nullptr;
|
||||
}
|
||||
if (mNewFrontHostOnWhite) {
|
||||
MOZ_ASSERT(mNewFrontHostOnWhite->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
}
|
||||
if (mBackHost) {
|
||||
MOZ_ASSERT(mBackHost->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
mBackHost = nullptr;
|
||||
}
|
||||
if (mBackHostOnWhite) {
|
||||
MOZ_ASSERT(mBackHostOnWhite->GetDeAllocator(),
|
||||
"We won't be able to destroy our SurfaceDescriptor");
|
||||
mBackHostOnWhite = nullptr;
|
||||
}
|
||||
|
||||
// don't touch mDeprecatedTextureHost, we might need it for compositing
|
||||
}
|
||||
|
||||
bool
|
||||
DeprecatedContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aUpdated,
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack)
|
||||
{
|
||||
if (!mDeprecatedTextureHost && !mNewFrontHost) {
|
||||
mInitialised = false;
|
||||
|
||||
*aUpdatedRegionBack = aUpdated;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mNewFrontHost) {
|
||||
DestroyFrontHost();
|
||||
mDeprecatedTextureHost = mNewFrontHost;
|
||||
mNewFrontHost = nullptr;
|
||||
if (mNewFrontHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite = mNewFrontHostOnWhite;
|
||||
mNewFrontHostOnWhite = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mDeprecatedTextureHost);
|
||||
MOZ_ASSERT(!mNewFrontHostOnWhite, "New white host without a new black?");
|
||||
MOZ_ASSERT(mBackHost);
|
||||
|
||||
RefPtr<DeprecatedTextureHost> oldFront = mDeprecatedTextureHost;
|
||||
mDeprecatedTextureHost = mBackHost;
|
||||
mBackHost = oldFront;
|
||||
|
||||
oldFront = mDeprecatedTextureHostOnWhite;
|
||||
mDeprecatedTextureHostOnWhite = mBackHostOnWhite;
|
||||
mBackHostOnWhite = oldFront;
|
||||
|
||||
mDeprecatedTextureHost->Update(*mDeprecatedTextureHost->LockSurfaceDescriptor());
|
||||
if (mDeprecatedTextureHostOnWhite) {
|
||||
mDeprecatedTextureHostOnWhite->Update(*mDeprecatedTextureHostOnWhite->LockSurfaceDescriptor());
|
||||
}
|
||||
mInitialised = true;
|
||||
|
||||
mBufferRect = aData.rect();
|
||||
mBufferRotation = aData.rotation();
|
||||
|
||||
*aUpdatedRegionBack = aUpdated;
|
||||
|
||||
// Save the current valid region of our front buffer, because if
|
||||
// we're double buffering, it's going to be the valid region for the
|
||||
// next back buffer sent back to the renderer.
|
||||
//
|
||||
// NB: we rely here on the fact that mValidRegion is initialized to
|
||||
// empty, and that the first time Swap() is called we don't have a
|
||||
// valid front buffer that we're going to return to content.
|
||||
mValidRegionForNextBackBuffer = aOldValidRegionBack;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentHostIncremental::EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo,
|
||||
|
@ -1079,82 +847,6 @@ ContentHostBase::PrintInfo(nsACString& aTo, const char* aPrefix)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentHostSingleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
aTo += aPrefix;
|
||||
aTo += nsPrintfCString("DeprecatedContentHostSingleBuffered (0x%p)", this);
|
||||
|
||||
AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
|
||||
AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
|
||||
if (PaintWillResample()) {
|
||||
aTo += " [paint-will-resample]";
|
||||
}
|
||||
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
|
||||
if (mDeprecatedTextureHost) {
|
||||
aTo += "\n";
|
||||
mDeprecatedTextureHost->PrintInfo(aTo, pfx.get());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedContentHostDoubleBuffered::PrintInfo(nsACString& aTo, const char* aPrefix)
|
||||
{
|
||||
aTo += aPrefix;
|
||||
aTo += nsPrintfCString("DeprecatedContentHostDoubleBuffered (0x%p)", this);
|
||||
|
||||
AppendToString(aTo, mBufferRect, " [buffer-rect=", "]");
|
||||
AppendToString(aTo, mBufferRotation, " [buffer-rotation=", "]");
|
||||
if (PaintWillResample()) {
|
||||
aTo += " [paint-will-resample]";
|
||||
}
|
||||
|
||||
nsAutoCString prefix(aPrefix);
|
||||
prefix += " ";
|
||||
|
||||
if (mDeprecatedTextureHost) {
|
||||
aTo += "\n";
|
||||
mDeprecatedTextureHost->PrintInfo(aTo, prefix.get());
|
||||
}
|
||||
|
||||
if (mBackHost) {
|
||||
aTo += "\n";
|
||||
mBackHost->PrintInfo(aTo, prefix.get());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
void
|
||||
DeprecatedContentHostDoubleBuffered::Dump(FILE* aFile,
|
||||
const char* aPrefix,
|
||||
bool aDumpHtml)
|
||||
{
|
||||
DeprecatedContentHostBase::Dump(aFile, aPrefix, aDumpHtml);
|
||||
if (!aDumpHtml) {
|
||||
return;
|
||||
}
|
||||
if (!aFile) {
|
||||
aFile = stderr;
|
||||
}
|
||||
fprintf_stderr(aFile, "<ul>");
|
||||
if (mBackHost) {
|
||||
fprintf_stderr(aFile, "%s", aPrefix);
|
||||
fprintf_stderr(aFile, "<li> <a href=");
|
||||
DumpDeprecatedTextureHost(aFile, mBackHost);
|
||||
fprintf_stderr(aFile, " >Back buffer</a></li>");
|
||||
}
|
||||
if (mBackHostOnWhite) {
|
||||
fprintf_stderr(aFile, "%s", aPrefix);
|
||||
fprintf_stderr(aFile, "<li> <a href=");
|
||||
DumpDeprecatedTextureHost(aFile, mBackHostOnWhite);
|
||||
fprintf_stderr(aFile, " >Back buffer on white</a> </li>");
|
||||
}
|
||||
fprintf_stderr(aFile, "</ul>");
|
||||
}
|
||||
#endif
|
||||
|
||||
LayerRenderState
|
||||
ContentHostBase::GetRenderState()
|
||||
|
|
|
@ -136,6 +136,7 @@ protected:
|
|||
bool mPaintWillResample;
|
||||
bool mInitialised;
|
||||
};
|
||||
|
||||
class DeprecatedContentHostBase : public ContentHost
|
||||
{
|
||||
public:
|
||||
|
@ -229,44 +230,6 @@ protected:
|
|||
nsIntRegion mValidRegionForNextBackBuffer;
|
||||
};
|
||||
|
||||
class DeprecatedContentHostDoubleBuffered : public DeprecatedContentHostBase
|
||||
{
|
||||
public:
|
||||
DeprecatedContentHostDoubleBuffered(const TextureInfo& aTextureInfo)
|
||||
: DeprecatedContentHostBase(aTextureInfo)
|
||||
{}
|
||||
|
||||
~DeprecatedContentHostDoubleBuffered();
|
||||
|
||||
virtual CompositableType GetType() { return BUFFER_CONTENT_DIRECT; }
|
||||
|
||||
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aUpdated,
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack);
|
||||
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
|
||||
virtual void DestroyTextures() MOZ_OVERRIDE;
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
virtual void Dump(FILE* aFile=nullptr,
|
||||
const char* aPrefix="",
|
||||
bool aDumpHtml=false) MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
protected:
|
||||
nsIntRegion mValidRegionForNextBackBuffer;
|
||||
// Texture host for the back buffer. We never read or write this buffer. We
|
||||
// only swap it with the front buffer (mDeprecatedTextureHost) when we are told by the
|
||||
// content thread.
|
||||
RefPtr<DeprecatedTextureHost> mBackHost;
|
||||
RefPtr<DeprecatedTextureHost> mBackHostOnWhite;
|
||||
};
|
||||
|
||||
/**
|
||||
* Single buffered, therefore we must synchronously upload the image from the
|
||||
* DeprecatedTextureHost in the layers transaction (i.e., in UpdateThebes).
|
||||
|
@ -287,30 +250,6 @@ public:
|
|||
nsIntRegion* aUpdatedRegionBack);
|
||||
};
|
||||
|
||||
class DeprecatedContentHostSingleBuffered : public DeprecatedContentHostBase
|
||||
{
|
||||
public:
|
||||
DeprecatedContentHostSingleBuffered(const TextureInfo& aTextureInfo)
|
||||
: DeprecatedContentHostBase(aTextureInfo)
|
||||
{}
|
||||
virtual ~DeprecatedContentHostSingleBuffered();
|
||||
|
||||
virtual CompositableType GetType() { return BUFFER_CONTENT; }
|
||||
|
||||
virtual bool UpdateThebes(const ThebesBufferData& aData,
|
||||
const nsIntRegion& aUpdated,
|
||||
const nsIntRegion& aOldValidRegionBack,
|
||||
nsIntRegion* aUpdatedRegionBack);
|
||||
|
||||
virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aSurface,
|
||||
ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
|
||||
virtual void DestroyTextures() MOZ_OVERRIDE;
|
||||
|
||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||
};
|
||||
|
||||
/**
|
||||
* Maintains a host-side only texture, and gets provided with
|
||||
* surfaces that only cover the changed pixels during an update.
|
||||
|
@ -329,7 +268,7 @@ public:
|
|||
, mDeAllocator(nullptr)
|
||||
{}
|
||||
|
||||
virtual CompositableType GetType() { return BUFFER_CONTENT; }
|
||||
virtual CompositableType GetType() { return BUFFER_CONTENT_INC; }
|
||||
|
||||
virtual void EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator* aAllocator,
|
||||
const TextureInfo& aTextureInfo,
|
||||
|
|
|
@ -54,8 +54,6 @@ bool
|
|||
ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
|
||||
{
|
||||
switch (aHost->GetType()) {
|
||||
case BUFFER_CONTENT:
|
||||
case BUFFER_CONTENT_DIRECT:
|
||||
case BUFFER_CONTENT_INC:
|
||||
case BUFFER_TILED:
|
||||
case COMPOSITABLE_CONTENT_SINGLE:
|
||||
|
|
|
@ -85,12 +85,6 @@ public:
|
|||
const TextureInfo& aTextureInfo,
|
||||
const nsIntRect& aBufferRect) = 0;
|
||||
|
||||
/**
|
||||
* Tell the compositor that a Compositable is killing its buffer(s),
|
||||
* that is TextureClient/Hosts.
|
||||
*/
|
||||
virtual void DestroyThebesBuffer(CompositableClient* aCompositable) = 0;
|
||||
|
||||
/**
|
||||
* Tell the CompositableHost on the compositor side what TiledLayerBuffer to
|
||||
* use for the next composition.
|
||||
|
|
|
@ -96,21 +96,6 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
|||
op.bufferRect());
|
||||
break;
|
||||
}
|
||||
case CompositableOperation::TOpDestroyThebesBuffer: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] Created double buffer"));
|
||||
const OpDestroyThebesBuffer& op = aEdit.get_OpDestroyThebesBuffer();
|
||||
CompositableParent* compositableParent = static_cast<CompositableParent*>(op.compositableParent());
|
||||
CompositableHost* compositableHost = compositableParent->GetCompositableHost();
|
||||
if (compositableHost->GetType() != BUFFER_CONTENT &&
|
||||
compositableHost->GetType() != BUFFER_CONTENT_DIRECT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DeprecatedContentHostBase* content = static_cast<DeprecatedContentHostBase*>(compositableHost);
|
||||
content->DestroyTextures();
|
||||
|
||||
break;
|
||||
}
|
||||
case CompositableOperation::TOpPaintTexture: {
|
||||
MOZ_LAYERS_LOG(("[ParentSide] Paint Texture X"));
|
||||
const OpPaintTexture& op = aEdit.get_OpPaintTexture();
|
||||
|
|
|
@ -298,9 +298,6 @@ public:
|
|||
const SurfaceDescriptor* aBackDescriptorOnWhite = nullptr) MOZ_OVERRIDE {
|
||||
NS_RUNTIMEABORT("should not be called");
|
||||
}
|
||||
virtual void DestroyThebesBuffer(CompositableClient* aCompositable) MOZ_OVERRIDE {
|
||||
NS_RUNTIMEABORT("should not be called");
|
||||
}
|
||||
virtual void UpdateTextureRegion(CompositableClient* aCompositable,
|
||||
const ThebesBufferData& aThebesBufferData,
|
||||
const nsIntRegion& aUpdatedRegion) MOZ_OVERRIDE {
|
||||
|
|
|
@ -308,10 +308,6 @@ struct OpCreatedIncrementalTexture {
|
|||
nsIntRect bufferRect;
|
||||
};
|
||||
|
||||
struct OpDestroyThebesBuffer {
|
||||
PCompositable compositable;
|
||||
};
|
||||
|
||||
struct OpPaintTexture {
|
||||
PCompositable compositable;
|
||||
uint32_t textureId;
|
||||
|
@ -377,7 +373,6 @@ union CompositableOperation {
|
|||
|
||||
OpCreatedTexture;
|
||||
OpCreatedIncrementalTexture;
|
||||
OpDestroyThebesBuffer;
|
||||
|
||||
OpPaintTexture;
|
||||
OpPaintTextureRegion;
|
||||
|
|
|
@ -973,12 +973,6 @@ ShadowLayerForwarder::CreatedDoubleBuffer(CompositableClient* aCompositable,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerForwarder::DestroyThebesBuffer(CompositableClient* aCompositable)
|
||||
{
|
||||
mTxn->AddEdit(OpDestroyThebesBuffer(nullptr, aCompositable->GetIPDLActor()));
|
||||
}
|
||||
|
||||
void ShadowLayerForwarder::Attach(CompositableClient* aCompositable,
|
||||
ShadowableLayer* aLayer)
|
||||
{
|
||||
|
|
|
@ -164,7 +164,6 @@ public:
|
|||
const TextureInfo& aTextureInfo,
|
||||
const SurfaceDescriptor* aFrontDescriptorOnWhite = nullptr,
|
||||
const SurfaceDescriptor* aBackDescriptorOnWhite = nullptr) MOZ_OVERRIDE;
|
||||
virtual void DestroyThebesBuffer(CompositableClient* aCompositable) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Adds an edit in the layers transaction in order to attach
|
||||
|
|
Загрузка…
Ссылка в новой задаче