From 63733308d3b2f603524846bff295249482c8425a Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Fri, 29 Jul 2016 20:19:23 +0200 Subject: [PATCH] Bug 1290081 - Make canvas layer transactions asynchronous. r=sotaro --- gfx/layers/client/CanvasClient.cpp | 4 ++-- gfx/layers/client/ClientCanvasLayer.cpp | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 0c4f03317935..61ce67505f83 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -98,8 +98,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) mBufferProviderTexture = nullptr; AutoRemoveTexture autoRemove(this); - if (mBackBuffer && - (mBackBuffer->IsImmutable() || mBackBuffer->GetSize() != aSize)) { + if (mBackBuffer && (mBackBuffer->IsReadLocked() || mBackBuffer->GetSize() != aSize)) { autoRemove.mTexture = mBackBuffer; mBackBuffer = nullptr; } @@ -122,6 +121,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) NS_WARNING("Failed to allocate the TextureClient"); return; } + mBackBuffer->EnableReadLock(); MOZ_ASSERT(mBackBuffer->CanExposeDrawTarget()); bufferCreated = true; diff --git a/gfx/layers/client/ClientCanvasLayer.cpp b/gfx/layers/client/ClientCanvasLayer.cpp index 6ded430dbee9..e9fec82c3580 100644 --- a/gfx/layers/client/ClientCanvasLayer.cpp +++ b/gfx/layers/client/ClientCanvasLayer.cpp @@ -90,16 +90,11 @@ ClientCanvasLayer::RenderLayer() RenderMaskLayers(this); if (!mCanvasClient) { - TextureFlags flags = TextureFlags::IMMEDIATE_UPLOAD; + TextureFlags flags = TextureFlags::DEFAULT; if (mOriginPos == gl::OriginPos::BottomLeft) { flags |= TextureFlags::ORIGIN_BOTTOM_LEFT; } - if (!mGLContext) { - // We don't support locking for buffer surfaces currently - flags |= TextureFlags::IMMEDIATE_UPLOAD; - } - if (!mIsAlphaPremultiplied) { flags |= TextureFlags::NON_PREMULTIPLIED; }