Backed out changeset e072a46f0b6a (bug 1027601) for test bustages on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 09 Jul 2014 13:23:08 +0200
changeset 193078 42e88b68a92de156400e8b78e1f826038772ab1d
parent 193077 f2aa1150d17992a28161d3f8344d825a0969a97c
child 193079 f0bc5656c80cd4de6bdeb28bea6b989560059ca3
push id27107
push userryanvm@gmail.com
push dateWed, 09 Jul 2014 19:45:31 +0000
treeherdermozilla-central@6db315bcdb6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1027601
milestone33.0a1
backs oute072a46f0b6a12bbf3ab3c3c0536da22c903174e
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
Backed out changeset e072a46f0b6a (bug 1027601) for test bustages on a CLOSED TREE
gfx/layers/ImageContainer.cpp
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/CanvasClient.h
gfx/layers/client/CompositableClient.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ImageClient.cpp
gfx/layers/client/SimpleTextureClientPool.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/client/TextureClientPool.cpp
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -632,24 +632,25 @@ CairoImage::GetTextureClient(Compositabl
   RefPtr<SourceSurface> surface = GetAsSourceSurface();
   MOZ_ASSERT(surface);
   if (!surface) {
     return nullptr;
   }
 
   // gfx::BackendType::NONE means default to content backend
   textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
-                                                         surface->GetSize(),
+                                                         TextureFlags::DEFAULT,
                                                          gfx::BackendType::NONE,
-                                                         TextureFlags::DEFAULT);
+                                                         surface->GetSize());
   if (!textureClient) {
     return nullptr;
   }
   MOZ_ASSERT(textureClient->CanExposeDrawTarget());
-  if (!textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+  if (!textureClient->AllocateForSurface(surface->GetSize()) ||
+      !textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
     return nullptr;
   }
 
   TextureClientAutoUnlock autoUnolck(textureClient);
   {
     // We must not keep a reference to the DrawTarget after it has been unlocked.
     DrawTarget* dt = textureClient->BorrowDrawTarget();
     if (!dt) {
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -69,20 +69,16 @@ CanvasClient2D::Update(gfx::IntSize aSiz
       = gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
     TextureFlags flags = TextureFlags::DEFAULT;
     if (mTextureFlags & TextureFlags::NEEDS_Y_FLIP) {
       flags |= TextureFlags::NEEDS_Y_FLIP;
     }
 
     gfx::SurfaceFormat surfaceFormat = gfx::ImageFormatToSurfaceFormat(format);
     mBuffer = CreateTextureClientForCanvas(surfaceFormat, aSize, flags, aLayer);
-    if (!mBuffer) {
-      NS_WARNING("Failed to allocate the TextureClient");
-      return;
-    }
     MOZ_ASSERT(mBuffer->CanExposeDrawTarget());
     mBuffer->AllocateForSurface(aSize);
 
     bufferCreated = true;
   }
 
   if (!mBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
     mBuffer = nullptr;
@@ -117,30 +113,26 @@ CanvasClient2D::CreateTextureClientForCa
                                              gfx::IntSize aSize,
                                              TextureFlags aFlags,
                                              ClientCanvasLayer* aLayer)
 {
   if (aLayer->IsGLLayer()) {
     // We want a cairo backend here as we don't want to be copying into
     // an accelerated backend and we like LockBits to work. This is currently
     // the most effective way to make this work.
-    return TextureClient::CreateForRawBufferAccess(GetForwarder(),
-                                                   aFormat, aSize, BackendType::CAIRO,
-                                                   mTextureInfo.mTextureFlags | aFlags);
+    return CreateBufferTextureClient(aFormat, aFlags, BackendType::CAIRO);
   }
 
   gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
 #ifdef XP_WIN
-  return CreateTextureClientForDrawing(aFormat, aSize, backend, aFlags);
+  return CreateTextureClientForDrawing(aFormat, aFlags, backend, aSize);
 #else
   // XXX - We should use CreateTextureClientForDrawing, but we first need
   // to use double buffering.
-  return TextureClient::CreateForRawBufferAccess(GetForwarder(),
-                                                 aFormat, aSize, BackendType::CAIRO,
-                                                 mTextureInfo.mTextureFlags | aFlags);
+  return CreateBufferTextureClient(aFormat, aFlags, backend);
 #endif
 }
 
 CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aLayerForwarder,
                                                      TextureFlags aFlags)
   : CanvasClient(aLayerForwarder, aFlags)
 {
 }
--- a/gfx/layers/client/CanvasClient.h
+++ b/gfx/layers/client/CanvasClient.h
@@ -96,21 +96,20 @@ public:
   }
 
   virtual void OnDetach() MOZ_OVERRIDE
   {
     mBuffer = nullptr;
   }
 
 private:
-  TemporaryRef<TextureClient>
-    CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
-                                 gfx::IntSize aSize,
-                                 TextureFlags aFlags,
-                                 ClientCanvasLayer* aLayer);
+  TemporaryRef<TextureClient> CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
+                                                           gfx::IntSize aSize,
+                                                           TextureFlags aFlags,
+                                                           ClientCanvasLayer* aLayer);
 
   RefPtr<TextureClient> mBuffer;
 };
 
 // Used for GL canvases where we don't need to do any readback, i.e., with a
 // GL backend.
 class CanvasClientSurfaceStream : public CanvasClient
 {
--- a/gfx/layers/client/CompositableClient.cpp
+++ b/gfx/layers/client/CompositableClient.cpp
@@ -186,26 +186,25 @@ CompositableClient::CreateBufferTextureC
                                               gfx::BackendType aMoz2DBackend)
 {
   return TextureClient::CreateBufferTextureClient(GetForwarder(), aFormat,
                                                   aTextureFlags | mTextureFlags,
                                                   aMoz2DBackend);
 }
 
 TemporaryRef<TextureClient>
-CompositableClient::CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
-                                                  gfx::IntSize aSize,
-                                                  gfx::BackendType aMoz2DBackend,
+CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
                                                   TextureFlags aTextureFlags,
-                                                  TextureAllocationFlags aAllocFlags)
+                                                  gfx::BackendType aMoz2DBackend,
+                                                  const IntSize& aSizeHint)
 {
-  return TextureClient::CreateForDrawing(GetForwarder(),
-                                         aFormat, aSize, aMoz2DBackend,
-                                         aTextureFlags | mTextureFlags,
-                                         aAllocFlags);
+  return TextureClient::CreateTextureClientForDrawing(GetForwarder(), aFormat,
+                                                      aTextureFlags | mTextureFlags,
+                                                      aMoz2DBackend,
+                                                      aSizeHint);
 }
 
 bool
 CompositableClient::AddTextureClient(TextureClient* aClient)
 {
   if(!aClient || !aClient->IsAllocated()) {
     return false;
   }
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -129,20 +129,19 @@ public:
 
   TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
                             TextureFlags aFlags = TextureFlags::DEFAULT,
                             gfx::BackendType aMoz2dBackend = gfx::BackendType::NONE);
 
   TemporaryRef<TextureClient>
   CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
-                                gfx::IntSize aSize,
-                                gfx::BackendType aMoz2DBackend,
                                 TextureFlags aTextureFlags,
-                                TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT);
+                                gfx::BackendType aMoz2dBackend,
+                                const gfx::IntSize& aSizeHint);
 
   virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
                                       const SurfaceDescriptor& aDescriptor)
   {
     MOZ_CRASH("If you want to call this, you should have implemented it");
   }
 
   /**
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -184,38 +184,43 @@ ContentClientRemoteBuffer::EndPaint()
   }
   ContentClientRemote::EndPaint();
 }
 
 bool
 ContentClientRemoteBuffer::CreateAndAllocateTextureClient(RefPtr<TextureClient>& aClient,
                                                           TextureFlags aFlags)
 {
-  TextureAllocationFlags allocFlags = TextureAllocationFlags::ALLOC_CLEAR_BUFFER;
+  // gfx::BackendType::NONE means fallback to the content backend
+  aClient = CreateTextureClientForDrawing(mSurfaceFormat,
+                                          mTextureInfo.mTextureFlags | aFlags,
+                                          gfx::BackendType::NONE,
+                                          mSize);
+  if (!aClient) {
+    return false;
+  }
+
+  TextureAllocationFlags flags = TextureAllocationFlags::ALLOC_CLEAR_BUFFER;
   if (aFlags & TextureFlags::ON_WHITE) {
-    allocFlags = TextureAllocationFlags::ALLOC_CLEAR_BUFFER_WHITE;
+    flags = TextureAllocationFlags::ALLOC_CLEAR_BUFFER_WHITE;
   }
 
-  // gfx::BackendType::NONE means fallback to the content backend
-  aClient = CreateTextureClientForDrawing(mSurfaceFormat, mSize,
-                                          gfx::BackendType::NONE,
-                                          mTextureInfo.mTextureFlags | aFlags,
-                                          allocFlags);
-  if (!aClient) {
-    // try with ALLOC_FALLBACK
-    aClient = CreateTextureClientForDrawing(mSurfaceFormat, mSize,
-                                            gfx::BackendType::NONE,
-                                            mTextureInfo.mTextureFlags
-                                            | TextureFlags::ALLOC_FALLBACK
-                                            | aFlags,
-                                            allocFlags);
-  }
-
-  if (!aClient) {
-    return false;
+  if (!aClient->AllocateForSurface(mSize, flags)) {
+    aClient = CreateTextureClientForDrawing(mSurfaceFormat,
+                mTextureInfo.mTextureFlags | TextureFlags::ALLOC_FALLBACK | aFlags,
+                gfx::BackendType::NONE,
+                mSize);
+    if (!aClient) {
+      return false;
+    }
+    if (!aClient->AllocateForSurface(mSize, flags)) {
+      NS_WARNING("Could not allocate texture client");
+      aClient = nullptr;
+      return false;
+    }
   }
 
   NS_WARN_IF_FALSE(aClient->IsValid(), "Created an invalid texture client");
   return true;
 }
 
 void
 ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -271,22 +271,24 @@ ImageClientSingle::UpdateImageInternal(I
       autoRemoveTexture.mTexture = mFrontBuffer;
       mFrontBuffer = nullptr;
     }
 
     bool bufferCreated = false;
     if (!mFrontBuffer) {
       gfxImageFormat format
         = gfxPlatform::GetPlatform()->OptimalFormatForContent(gfx::ContentForFormat(surface->GetFormat()));
-      mFrontBuffer = CreateTextureClientForDrawing(gfx::ImageFormatToSurfaceFormat(format), size,
-                                                   gfx::BackendType::NONE, mTextureFlags);
-      if (!mFrontBuffer) {
+      mFrontBuffer = CreateTextureClientForDrawing(gfx::ImageFormatToSurfaceFormat(format),
+                                                   mTextureFlags, gfx::BackendType::NONE, size);
+      MOZ_ASSERT(mFrontBuffer->CanExposeDrawTarget());
+      if (!mFrontBuffer->AllocateForSurface(size)) {
+        mFrontBuffer = nullptr;
         return false;
       }
-      MOZ_ASSERT(mFrontBuffer->CanExposeDrawTarget());
+
       bufferCreated = true;
     }
 
     if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
       mFrontBuffer = nullptr;
       return false;
     }
 
--- a/gfx/layers/client/SimpleTextureClientPool.cpp
+++ b/gfx/layers/client/SimpleTextureClientPool.cpp
@@ -68,22 +68,22 @@ SimpleTextureClientPool::GetTextureClien
     mAvailableTextureClients.pop();
     RECYCLE_LOG("%s Skip allocate (%i left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), mAvailableTextureClients.size(), textureClient.get());
 
   } else {
     // No unused clients in the pool, create one
     if (gfxPrefs::ForceShmemTiles()) {
       textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
         mFormat, TextureFlags::IMMEDIATE_UPLOAD | TextureFlags::RECYCLE, gfx::BackendType::NONE);
-      if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
-        NS_WARNING("TextureClient::AllocateForSurface failed!");
-      }
     } else {
-      textureClient = TextureClient::CreateForDrawing(mSurfaceAllocator,
-        mFormat, mSize, gfx::BackendType::NONE, TextureFlags::DEFAULT | TextureFlags::RECYCLE);
+      textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
+        mFormat, TextureFlags::DEFAULT | TextureFlags::RECYCLE, gfx::BackendType::NONE, mSize);
+    }
+    if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
+      NS_WARNING("TextureClient::AllocateForSurface failed!");
     }
     RECYCLE_LOG("%s Must allocate (0 left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), textureClient.get());
   }
 
   if (aAutoRecycle) {
     mOutstandingTextureClients.push_back(textureClient);
     textureClient->SetRecycleCallback(SimpleTextureClientPool::WaitForCompositorRecycleCallback, this);
   }
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -230,23 +230,23 @@ DisableGralloc(SurfaceFormat aFormat, co
     return true;
   }
 #endif
 
   return false;
 }
 #endif
 
-static
+// static
 TemporaryRef<TextureClient>
-CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
-                              SurfaceFormat aFormat,
-                              TextureFlags aTextureFlags,
-                              gfx::BackendType aMoz2DBackend,
-                              const gfx::IntSize& aSizeHint)
+TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
+                                             SurfaceFormat aFormat,
+                                             TextureFlags aTextureFlags,
+                                             gfx::BackendType aMoz2DBackend,
+                                             const gfx::IntSize& aSizeHint)
 {
   if (aMoz2DBackend == gfx::BackendType::NONE) {
     aMoz2DBackend = gfxPlatform::GetPlatform()->GetContentBackend();
   }
 
   RefPtr<TextureClient> result;
 
 #if defined(MOZ_WIDGET_GONK) || defined(XP_WIN)
@@ -310,65 +310,24 @@ CreateTextureClientForDrawing(ISurfaceAl
       result = new GrallocTextureClientOGL(aAllocator, aFormat, aMoz2DBackend,
                                            aTextureFlags);
     }
   }
 #endif
 
   // Can't do any better than a buffer texture client.
   if (!result) {
-    result = TextureClient::CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
+    result = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
   }
 
   MOZ_ASSERT(!result || result->CanExposeDrawTarget(), "texture cannot expose a DrawTarget?");
   return result;
 }
 
 // static
-TemporaryRef<TextureClient>
-TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
-                                gfx::SurfaceFormat aFormat,
-                                gfx::IntSize aSize,
-                                gfx::BackendType aMoz2DBackend,
-                                TextureFlags aTextureFlags,
-                                TextureAllocationFlags aAllocFlags)
-{
-  RefPtr<TextureClient> texture =
-    CreateTextureClientForDrawing(aAllocator, aFormat,
-                                  aTextureFlags, aMoz2DBackend,
-                                  aSize);
-  if (texture) {
-    if (!texture->AllocateForSurface(aSize, aAllocFlags)) {
-      return nullptr;
-    }
-  }
-  return texture;
-}
-
-// static
-TemporaryRef<BufferTextureClient>
-TextureClient::CreateForRawBufferAccess(ISurfaceAllocator* aAllocator,
-                                        gfx::SurfaceFormat aFormat,
-                                        gfx::IntSize aSize,
-                                        gfx::BackendType aMoz2DBackend,
-                                        TextureFlags aTextureFlags,
-                                        TextureAllocationFlags aAllocFlags)
-{
-  RefPtr<BufferTextureClient> texture =
-    CreateBufferTextureClient(aAllocator, aFormat,
-                              aTextureFlags, aMoz2DBackend);
-  if (texture) {
-    if (!texture->AllocateForSurface(aSize, aAllocFlags)) {
-      return nullptr;
-    }
-  }
-  return texture;
-}
-
-// static
 TemporaryRef<BufferTextureClient>
 TextureClient::CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
                                          SurfaceFormat aFormat,
                                          TextureFlags aTextureFlags,
                                          gfx::BackendType aMoz2DBackend)
 {
   if (aAllocator->IsSameProcess()) {
     RefPtr<BufferTextureClient> result = new MemoryTextureClient(aAllocator, aFormat,
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -115,44 +115,28 @@ public:
  */
 class TextureClient
   : public AtomicRefCountedWithFinalize<TextureClient>
 {
 public:
   TextureClient(TextureFlags aFlags = TextureFlags::DEFAULT);
   virtual ~TextureClient();
 
-  // Creates a TextureClient that can be accessed through a raw pointer.
-  // XXX - this doesn't allocate the texture data.
-  // Prefer CreateForRawBufferAccess which returns a BufferTextureClient
-  // only if allocation suceeded.
   static TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
                             gfx::SurfaceFormat aFormat,
                             TextureFlags aTextureFlags,
                             gfx::BackendType aMoz2dBackend);
 
-  // Creates and allocates a TextureClient usable with Moz2D.
   static TemporaryRef<TextureClient>
-  CreateForDrawing(ISurfaceAllocator* aAllocator,
-                   gfx::SurfaceFormat aFormat,
-                   gfx::IntSize aSize,
-                   gfx::BackendType aMoz2dBackend,
-                   TextureFlags aTextureFlags,
-                   TextureAllocationFlags flags = ALLOC_DEFAULT);
-
-  // Creates and allocates a BufferTextureClient (can beaccessed through raw
-  // pointers).
-  static TemporaryRef<BufferTextureClient>
-  CreateForRawBufferAccess(ISurfaceAllocator* aAllocator,
-                           gfx::SurfaceFormat aFormat,
-                           gfx::IntSize aSize,
-                           gfx::BackendType aMoz2dBackend,
-                           TextureFlags aTextureFlags,
-                           TextureAllocationFlags flags = ALLOC_DEFAULT);
+  CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
+                                gfx::SurfaceFormat aFormat,
+                                TextureFlags aTextureFlags,
+                                gfx::BackendType aMoz2dBackend,
+                                const gfx::IntSize& aSizeHint);
 
   virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
 
   /**
    * Locks the shared data, allowing the caller to get access to it.
    *
    * Please always lock/unlock when accessing the shared data.
    * If Lock() returns false, you should not attempt to access the shared data.
--- a/gfx/layers/client/TextureClientPool.cpp
+++ b/gfx/layers/client/TextureClientPool.cpp
@@ -53,21 +53,21 @@ TextureClientPool::GetTextureClient()
   // client, we may need to free a deferred-return TextureClient.
   ShrinkToMaximumSize();
 
   // No unused clients in the pool, create one
   if (gfxPrefs::ForceShmemTiles()) {
     // gfx::BackendType::NONE means use the content backend
     textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
       mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
-    textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);
   } else {
-    textureClient = TextureClient::CreateForDrawing(mSurfaceAllocator,
-      mFormat, mSize, gfx::BackendType::NONE, TextureFlags::IMMEDIATE_UPLOAD);
+    textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
+      mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
   }
+  textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);
 
   return textureClient;
 }
 
 void
 TextureClientPool::ReturnTextureClient(TextureClient *aClient)
 {
   if (!aClient) {