Backed out changeset 6bc1a62eb443 (bug 947781) for build failures
authorEd Morley <emorley@mozilla.com>
Wed, 30 Jul 2014 14:54:28 +0100
changeset 218484 1528900bd8cfcb5cebaa9e7fca8c6eaea5771cb8
parent 218483 90d1352dbd19ac1b711988bd2c8efed2d125b231
child 218485 327f8728d818337a842480181089598e65adc655
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs947781
milestone34.0a1
backs out6bc1a62eb4439c5805d55ef57e5433e23cb28528
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 6bc1a62eb443 (bug 947781) for build failures
gfx/layers/RotatedBuffer.cpp
gfx/layers/RotatedBuffer.h
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -90,31 +90,36 @@ RotatedBuffer::DrawBufferQuadrant(gfx::D
   // mBufferRect
   nsIntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide);
   nsIntRect fillRect;
   if (!fillRect.IntersectRect(mBufferRect, quadrantRect))
     return;
 
   gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y);
 
-  MOZ_ASSERT(aSource != BUFFER_BOTH);
-  RefPtr<SourceSurface> snapshot = GetSourceSurface(aSource);
-
   // direct2d is much slower when using OP_SOURCE so use OP_OVER and
   // (maybe) a clear instead. Normally we need to draw in a single operation
   // (to avoid flickering) but direct2d is ok since it defers rendering.
   // We should try abstract this logic in a helper when we have other use
   // cases.
   if (aTarget->GetBackendType() == BackendType::DIRECT2D && aOperator == CompositionOp::OP_SOURCE) {
     aOperator = CompositionOp::OP_OVER;
-    if (snapshot->GetFormat() == SurfaceFormat::B8G8R8A8) {
+    if (mDTBuffer->GetFormat() == SurfaceFormat::B8G8R8A8) {
       aTarget->ClearRect(ToRect(fillRect));
     }
   }
 
+  RefPtr<gfx::SourceSurface> snapshot;
+  if (aSource == BUFFER_BLACK) {
+    snapshot = mDTBuffer->Snapshot();
+  } else {
+    MOZ_ASSERT(aSource == BUFFER_WHITE);
+    snapshot = mDTBufferOnWhite->Snapshot();
+  }
+
   if (aOperator == CompositionOp::OP_SOURCE) {
     // OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
     // We also can't do a ClearRect+FillRect since we need the drawing to happen
     // as an atomic operation (to prevent flickering).
     aTarget->PushClipRect(gfx::Rect(fillRect.x, fillRect.y,
                                     fillRect.width, fillRect.height));
   }
 
@@ -171,31 +176,16 @@ RotatedBuffer::DrawBufferWithRotation(gf
   // though! Particularly on D2D Repeat should be a lot faster, need to look
   // into that. TODO[Bas]
   DrawBufferQuadrant(aTarget, LEFT, TOP, aSource, aOpacity, aOperator, aMask, aMaskTransform);
   DrawBufferQuadrant(aTarget, RIGHT, TOP, aSource, aOpacity, aOperator, aMask, aMaskTransform);
   DrawBufferQuadrant(aTarget, LEFT, BOTTOM, aSource, aOpacity, aOperator, aMask, aMaskTransform);
   DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aSource, aOpacity, aOperator,aMask, aMaskTransform);
 }
 
-TemporaryRef<SourceSurface>
-SourceRotatedBuffer::GetSourceSurface(ContextSource aSource) const
-{
-  RefPtr<SourceSurface> surf;
-  if (aSource == BUFFER_BLACK) {
-    surf = mSource;
-  } else {
-    MOZ_ASSERT(aSource == BUFFER_WHITE);
-    surf = mSourceOnWhite;
-  }
-
-  MOZ_ASSERT(surf);
-  return surf;
-}
-
 /* static */ bool
 RotatedContentBuffer::IsClippingCheap(DrawTarget* aTarget, const nsIntRegion& aRegion)
 {
   // Assume clipping is cheap if the draw target just has an integer
   // translation, and the visible region is simple.
   return !aTarget->GetTransform().HasNonIntegerTranslation() &&
          aRegion.GetNumRects() <= 1;
 }
@@ -742,24 +732,11 @@ RotatedContentBuffer::BorrowDrawTargetFo
     while ((iterRect = iter.Next())) {
       result->ClearRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
     }
   }
 
   return result;
 }
 
-TemporaryRef<SourceSurface>
-RotatedContentBuffer::GetSourceSurface(ContextSource aSource) const
-{
-  MOZ_ASSERT(mDTBuffer);
-  if (aSource == BUFFER_BLACK) {
-    return mDTBuffer->Snapshot();
-  } else {
-    MOZ_ASSERT(mDTBufferOnWhite);
-    MOZ_ASSERT(aSource == BUFFER_WHITE);
-    return mDTBufferOnWhite->Snapshot();
-  }
-}
-
 }
 }
 
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -47,19 +47,22 @@ class ThebesLayer;
  * at row 0 on the screen, and then painting rows 0 to N-1 of the buffer
  * at row H-N on the screen.
  * mBufferRotation.y would be N in this example.
  */
 class RotatedBuffer {
 public:
   typedef gfxContentType ContentType;
 
-  RotatedBuffer(const nsIntRect& aBufferRect,
+  RotatedBuffer(gfx::DrawTarget* aDTBuffer, gfx::DrawTarget* aDTBufferOnWhite,
+                const nsIntRect& aBufferRect,
                 const nsIntPoint& aBufferRotation)
-    : mBufferRect(aBufferRect)
+    : mDTBuffer(aDTBuffer)
+    , mDTBufferOnWhite(aDTBufferOnWhite)
+    , mBufferRect(aBufferRect)
     , mBufferRotation(aBufferRotation)
     , mDidSelfCopy(false)
   { }
   RotatedBuffer()
     : mDidSelfCopy(false)
   { }
 
   /*
@@ -81,20 +84,18 @@ public:
   /**
    * |BufferRect()| is the rect of device pixels that this
    * RotatedBuffer covers.  That is what DrawBufferWithRotation()
    * will paint when it's called.
    */
   const nsIntRect& BufferRect() const { return mBufferRect; }
   const nsIntPoint& BufferRotation() const { return mBufferRotation; }
 
-  virtual bool HaveBuffer() const = 0;
-  virtual bool HaveBufferOnWhite() const = 0;
-
-  virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const = 0;
+  virtual bool HaveBuffer() const { return mDTBuffer; }
+  virtual bool HaveBufferOnWhite() const { return mDTBufferOnWhite; }
 
 protected:
 
   enum XSide {
     LEFT, RIGHT
   };
   enum YSide {
     TOP, BOTTOM
@@ -110,16 +111,18 @@ protected:
    */
   void DrawBufferQuadrant(gfx::DrawTarget* aTarget, XSide aXSide, YSide aYSide,
                           ContextSource aSource,
                           float aOpacity,
                           gfx::CompositionOp aOperator,
                           gfx::SourceSurface* aMask,
                           const gfx::Matrix* aMaskTransform) const;
 
+  RefPtr<gfx::DrawTarget> mDTBuffer;
+  RefPtr<gfx::DrawTarget> mDTBufferOnWhite;
   /** The area of the ThebesLayer that is covered by the buffer as a whole */
   nsIntRect             mBufferRect;
   /**
    * The x and y rotation of the buffer. Conceptually the buffer
    * has its origin translated to mBufferRect.TopLeft() - mBufferRotation,
    * is tiled to fill the plane, and the result is clipped to mBufferRect.
    * So the pixel at mBufferRotation within the buffer is what gets painted at
    * mBufferRect.TopLeft().
@@ -128,37 +131,16 @@ protected:
    * buffer at the other end, not 2D rotation!
    */
   nsIntPoint            mBufferRotation;
   // When this is true it means that all pixels have moved inside the buffer.
   // It's not possible to sync with another buffer without a full copy.
   bool                  mDidSelfCopy;
 };
 
-class SourceRotatedBuffer : public RotatedBuffer
-{
-public:
-  SourceRotatedBuffer(gfx::SourceSurface* aSource, gfx::SourceSurface* aSourceOnWhite,
-                      const nsIntRect& aBufferRect,
-                      const nsIntPoint& aBufferRotation)
-    : RotatedBuffer(aBufferRect, aBufferRotation)
-    , mSource(aSource)
-    , mSourceOnWhite(aSourceOnWhite)
-  { }
-
-  virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
-
-  virtual bool HaveBuffer() const { return !!mSource; }
-  virtual bool HaveBufferOnWhite() const { return !!mSourceOnWhite; }
-
-private:
-  RefPtr<gfx::SourceSurface> mSource;
-  RefPtr<gfx::SourceSurface> mSourceOnWhite;
-};
-
 // Mixin class for classes which need logic for loaning out a draw target.
 // See comments on BorrowDrawTargetForQuadrantUpdate.
 class BorrowDrawTarget
 {
 protected:
   void ReturnDrawTarget(gfx::DrawTarget*& aReturned);
 
   // The draw target loaned by BorrowDrawTargetForQuadrantUpdate. It should not
@@ -321,18 +303,16 @@ public:
   /**
    * Get the underlying buffer, if any. This is useful because we can pass
    * in the buffer as the default "reference surface" if there is one.
    * Don't use it for anything else!
    */
   gfx::DrawTarget* GetDTBuffer() { return mDTBuffer; }
   gfx::DrawTarget* GetDTBufferOnWhite() { return mDTBufferOnWhite; }
 
-  virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
-
   /**
    * Complete the drawing operation. The region to draw must have been
    * drawn before this is called. The contents of the buffer are drawn
    * to aTarget.
    */
   void DrawTo(ThebesLayer* aLayer,
               gfx::DrawTarget* aTarget,
               float aOpacity,
@@ -413,19 +393,16 @@ protected:
    * Any actions that should be performed at the last moment before we begin
    * rendering the next frame. I.e., after we calculate what we will draw,
    * but before we rotate the buffer and possibly create new buffers.
    * aRegionToDraw is the region which is guaranteed to be overwritten when
    * drawing the next frame.
    */
   virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) {}
 
-  RefPtr<gfx::DrawTarget> mDTBuffer;
-  RefPtr<gfx::DrawTarget> mDTBufferOnWhite;
-
   /**
    * These members are only set transiently.  They're used to map mDTBuffer
    * when we're using surfaces that require explicit map/unmap. Only one
    * may be used at a time.
    */
   TextureClient* mBufferProvider;
   TextureClient* mBufferProviderOnWhite;
 
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -481,24 +481,24 @@ ContentClientDoubleBuffered::FinalizeFra
       !mFrontClientOnWhite->Lock(OpenMode::OPEN_READ_ONLY)) {
     mFrontClient->Unlock();
     return;
   }
   {
     // Restrict the DrawTargets and frontBuffer to a scope to make
     // sure there is no more external references to the DrawTargets
     // when we Unlock the TextureClients.
-    RefPtr<SourceSurface> surf = mFrontClient->BorrowDrawTarget()->Snapshot();
-    RefPtr<SourceSurface> surfOnWhite = mFrontClientOnWhite
-      ? mFrontClientOnWhite->BorrowDrawTarget()->Snapshot()
+    RefPtr<DrawTarget> dt = mFrontClient->BorrowDrawTarget();
+    RefPtr<DrawTarget> dtOnWhite = mFrontClientOnWhite
+      ? mFrontClientOnWhite->BorrowDrawTarget()
       : nullptr;
-    SourceRotatedBuffer frontBuffer(surf,
-                                    surfOnWhite,
-                                    mFrontBufferRect,
-                                    mFrontBufferRotation);
+    RotatedBuffer frontBuffer(dt,
+                              dtOnWhite,
+                              mFrontBufferRect,
+                              mFrontBufferRotation);
     UpdateDestinationFrom(frontBuffer, updateRegion);
   }
 
   mFrontClient->Unlock();
   if (mFrontClientOnWhite) {
     mFrontClientOnWhite->Unlock();
   }
 }