Bug 1290081 - Make canvas layer transactions asynchronous. r=sotaro
☠☠ backed out by b498c2f4fdd8 ☠ ☠
authorNicolas Silva <nsilva@mozilla.com>
Thu, 28 Jul 2016 17:58:33 +0200
changeset 307057 67cb195b1b45964b3d7a4d391c06d17228d47fe7
parent 307056 312eafb1465bf3151826cdc6bf5eae6799cb430a
child 307058 d51327ec371ec44324d42734978802f0b1eff9b9
push id80010
push usernsilva@mozilla.com
push dateThu, 28 Jul 2016 15:59:06 +0000
treeherdermozilla-inbound@d51327ec371e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1290081
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1290081 - Make canvas layer transactions asynchronous. r=sotaro
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/ClientCanvasLayer.cpp
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -93,18 +93,17 @@ CanvasClient2D::UpdateFromTexture(Textur
 }
 
 void
 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;
   }
 
   bool bufferCreated = false;
   if (!mBackBuffer) {
     bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
     gfxContentType contentType = isOpaque
@@ -117,16 +116,17 @@ CanvasClient2D::Update(gfx::IntSize aSiz
       flags |= TextureFlags::ORIGIN_BOTTOM_LEFT;
     }
 
     mBackBuffer = CreateTextureClientForCanvas(surfaceFormat, aSize, flags, aLayer);
     if (!mBackBuffer) {
       NS_WARNING("Failed to allocate the TextureClient");
       return;
     }
+    mBackBuffer->EnableReadLock();
     MOZ_ASSERT(mBackBuffer->CanExposeDrawTarget());
 
     bufferCreated = true;
   }
 
   bool updated = false;
   {
     TextureClientAutoLock autoLock(mBackBuffer, OpenMode::OPEN_WRITE_ONLY);
--- a/gfx/layers/client/ClientCanvasLayer.cpp
+++ b/gfx/layers/client/ClientCanvasLayer.cpp
@@ -85,26 +85,21 @@ void
 ClientCanvasLayer::RenderLayer()
 {
   PROFILER_LABEL("ClientCanvasLayer", "RenderLayer",
     js::ProfileEntry::Category::GRAPHICS);
 
   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;
     }
 
     mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
                                                      ClientManager()->AsShadowForwarder(),
                                                      flags);
     if (!mCanvasClient) {