Remove Composer2D remnants. (bug 1339353, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Tue, 14 Feb 2017 12:29:39 -0800
changeset 371927 13cfe25ef134da155ae827b5cc4a5c3a77219f85
parent 371926 1dbf0a33cc36641f13a084fbdd0b9a23005598e5
child 371928 8a0b376c0afac43608015827a4c34b37eab3b718
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1339353
milestone54.0a1
Remove Composer2D remnants. (bug 1339353, r=kats)
gfx/layers/Effects.h
gfx/layers/LayerScope.cpp
gfx/layers/Layers.h
gfx/layers/LayersTypes.cpp
gfx/layers/LayersTypes.h
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/CanvasLayerComposite.h
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/ContentHost.cpp
gfx/layers/composite/ContentHost.h
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/ImageHost.h
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/composite/ImageLayerComposite.h
gfx/layers/composite/PaintedLayerComposite.cpp
gfx/layers/composite/PaintedLayerComposite.h
gfx/layers/composite/TextureHost.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/TiledContentHost.h
gfx/layers/moz.build
gfx/layers/opengl/Composer2D.h
gfx/layers/wr/WebRenderImageHost.cpp
gfx/layers/wr/WebRenderImageHost.h
widget/CompositorWidget.h
widget/InProcessCompositorWidget.cpp
widget/InProcessCompositorWidget.h
widget/nsBaseWidget.h
widget/nsIWidget.h
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -72,17 +72,16 @@ struct TexturedEffect : public Effect
   virtual TexturedEffect* AsTexturedEffect() { return this; }
   virtual const char* Name() = 0;
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
 
   gfx::Rect mTextureCoords;
   TextureSource* mTexture;
   bool mPremultiplied;
   gfx::SamplingFilter mSamplingFilter;
-  LayerRenderState mState;
 };
 
 // Support an alpha mask.
 struct EffectMask : public Effect
 {
   EffectMask(TextureSource *aMaskTexture,
              gfx::IntSize aSize,
              const gfx::Matrix4x4 &aMaskTransform)
@@ -228,18 +227,17 @@ struct EffectChain
  * creating an effect that takes several texture sources (like with YCBCR
  * where aFormat would be FOMRAT_YCBCR and each texture source would be
  * a one-channel A8 texture)
  */
 inline already_AddRefed<TexturedEffect>
 CreateTexturedEffect(gfx::SurfaceFormat aFormat,
                      TextureSource* aSource,
                      const gfx::SamplingFilter aSamplingFilter,
-                     bool isAlphaPremultiplied,
-                     const LayerRenderState &state = LayerRenderState())
+                     bool isAlphaPremultiplied)
 {
   MOZ_ASSERT(aSource);
   RefPtr<TexturedEffect> result;
   switch (aFormat) {
   case gfx::SurfaceFormat::B8G8R8A8:
   case gfx::SurfaceFormat::B8G8R8X8:
   case gfx::SurfaceFormat::R8G8B8X8:
   case gfx::SurfaceFormat::R5G6B5_UINT16:
@@ -252,84 +250,77 @@ CreateTexturedEffect(gfx::SurfaceFormat 
   case gfx::SurfaceFormat::YUV:
     MOZ_ASSERT_UNREACHABLE("gfx::SurfaceFormat::YUV is invalid");
     break;
   default:
     NS_WARNING("unhandled program type");
     break;
   }
 
-  result->mState = state;
-
   return result.forget();
 }
 
 inline already_AddRefed<TexturedEffect>
 CreateTexturedEffect(TextureHost* aHost,
                      TextureSource* aSource,
                      const gfx::SamplingFilter aSamplingFilter,
-                     bool isAlphaPremultiplied,
-                     const LayerRenderState &state = LayerRenderState())
+                     bool isAlphaPremultiplied)
 {
   MOZ_ASSERT(aHost);
   MOZ_ASSERT(aSource);
 
   RefPtr<TexturedEffect> result;
   if (aHost->GetReadFormat() == gfx::SurfaceFormat::YUV) {
     MOZ_ASSERT(aHost->GetYUVColorSpace() != YUVColorSpace::UNKNOWN);
     result = new EffectYCbCr(aSource, aHost->GetYUVColorSpace(), aSamplingFilter);
   } else {
     result = CreateTexturedEffect(aHost->GetReadFormat(),
                                   aSource,
                                   aSamplingFilter,
-                                  isAlphaPremultiplied,
-                                  state);
+                                  isAlphaPremultiplied);
   }
   return result.forget();
 }
 
 /**
  * Create a textured effect based on aSource format and the presence of
  * aSourceOnWhite.
  *
  * aSourceOnWhite can be null.
  */
 inline already_AddRefed<TexturedEffect>
 CreateTexturedEffect(TextureSource* aSource,
                      TextureSource* aSourceOnWhite,
                      const gfx::SamplingFilter aSamplingFilter,
-                     bool isAlphaPremultiplied,
-                     const LayerRenderState &state = LayerRenderState())
+                     bool isAlphaPremultiplied)
 {
   MOZ_ASSERT(aSource);
   if (aSourceOnWhite) {
     MOZ_ASSERT(aSource->GetFormat() == gfx::SurfaceFormat::R8G8B8X8 ||
                aSource->GetFormat() == gfx::SurfaceFormat::B8G8R8X8);
     MOZ_ASSERT(aSource->GetFormat() == aSourceOnWhite->GetFormat());
     return MakeAndAddRef<EffectComponentAlpha>(aSource, aSourceOnWhite,
                                                aSamplingFilter);
   }
 
   return CreateTexturedEffect(aSource->GetFormat(),
                               aSource,
                               aSamplingFilter,
-                              isAlphaPremultiplied,
-                              state);
+                              isAlphaPremultiplied);
 }
 
 /**
  * Create a textured effect based on aSource format.
  *
  * This version excudes the possibility of component alpha.
  */
 inline already_AddRefed<TexturedEffect>
 CreateTexturedEffect(TextureSource *aTexture,
-                     const gfx::SamplingFilter aSamplingFilter,
-                     const LayerRenderState &state = LayerRenderState())
+                     const gfx::SamplingFilter aSamplingFilter)
 {
-  return CreateTexturedEffect(aTexture, nullptr, aSamplingFilter, true, state);
+  return CreateTexturedEffect(aTexture, nullptr, aSamplingFilter, true);
 }
 
 
 } // namespace layers
 } // namespace mozilla
 
 #endif
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This must occur *after* layers/PLayers.h to avoid typedefs conflicts. */
 #include "LayerScope.h"
 
 #include "nsAppRunner.h"
-#include "Composer2D.h"
 #include "Effects.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TimeStamp.h"
 
 #include "TexturePoolOGL.h"
 #include "mozilla/layers/CompositorOGL.h"
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -1787,18 +1787,16 @@ public:
 
   void ApplyPendingUpdatesForThisTransaction();
 
 #ifdef DEBUG
   void SetDebugColorIndex(uint32_t aIndex) { mDebugColorIndex = aIndex; }
   uint32_t GetDebugColorIndex() { return mDebugColorIndex; }
 #endif
 
-  virtual LayerRenderState GetRenderState() { return LayerRenderState(); }
-
   void Mutated() {
     mManager->Mutated(this);
   }
   void MutatedSimple() {
     mManager->MutatedSimple(this);
   }
 
   virtual int32_t GetMaxLayerSize() { return Manager()->GetMaxTextureSize(); }
deleted file mode 100644
--- a/gfx/layers/LayersTypes.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "LayersTypes.h"
-
-namespace mozilla {
-namespace layers {
-
-LayerRenderState::LayerRenderState()
-  : mFlags(LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT)
-  , mHasOwnOffset(false)
-{
-}
-
-LayerRenderState::LayerRenderState(const LayerRenderState& aOther)
-  : mFlags(aOther.mFlags)
-  , mHasOwnOffset(aOther.mHasOwnOffset)
-  , mOffset(aOther.mOffset)
-{
-}
-
-LayerRenderState::~LayerRenderState()
-{
-}
-
-} // namespace layers
-} // namespace mozilla
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -65,53 +65,16 @@ enum class DrawRegionClip : int8_t {
 
 enum class SurfaceMode : int8_t {
   SURFACE_NONE = 0,
   SURFACE_OPAQUE,
   SURFACE_SINGLE_CHANNEL_ALPHA,
   SURFACE_COMPONENT_ALPHA
 };
 
-// LayerRenderState for Composer2D
-enum class LayerRenderStateFlags : int8_t {
-  LAYER_RENDER_STATE_DEFAULT = 0,
-  ORIGIN_BOTTOM_LEFT = 1 << 0,
-  BUFFER_ROTATION = 1 << 1,
-  // Notify Composer2D to swap the RB pixels of gralloc buffer
-  FORMAT_RB_SWAP = 1 << 2,
-  // We record opaqueness here alongside the actual surface we're going to
-  // render. This avoids confusion when a layer might return different kinds
-  // of surfaces over time (e.g. video frames).
-  OPAQUE = 1 << 3
-};
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
-
-struct LayerRenderState {
-  // Constructors and destructor are defined in LayersTypes.cpp so we don't
-  // have to pull in a definition for GraphicBuffer.h here. In KK at least,
-  // that results in nasty pollution such as libui's hardware.h #defining
-  // 'version_major' and 'version_minor' which conflict with Theora's codec.c...
-  LayerRenderState();
-  LayerRenderState(const LayerRenderState& aOther);
-  ~LayerRenderState();
-
-  void SetOffset(const nsIntPoint& aOffset)
-  {
-    mOffset = aOffset;
-    mHasOwnOffset = true;
-  }
-
-  // see LayerRenderStateFlags
-  LayerRenderStateFlags mFlags;
-  // true if mOffset is applicable
-  bool mHasOwnOffset;
-  // the location of the layer's origin on mSurface
-  nsIntPoint mOffset;
-};
-
 enum class ScaleMode : int8_t {
   SCALE_NONE,
   STRETCH,
   SENTINEL
 // Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
 };
 
 struct EventRegions {
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -63,25 +63,16 @@ CanvasLayerComposite::SetLayerManager(Ho
 {
   LayerComposite::SetLayerManager(aManager);
   mManager = aManager;
   if (mCompositableHost && mCompositor) {
     mCompositableHost->SetCompositor(mCompositor);
   }
 }
 
-LayerRenderState
-CanvasLayerComposite::GetRenderState()
-{
-  if (mDestroyed || !mCompositableHost || !mCompositableHost->IsAttached()) {
-    return LayerRenderState();
-  }
-  return mCompositableHost->GetRenderState();
-}
-
 void
 CanvasLayerComposite::RenderLayer(const IntRect& aClipRect,
                                   const Maybe<gfx::Polygon>& aGeometry)
 {
   if (!mCompositableHost || !mCompositableHost->IsAttached()) {
     return;
   }
 
--- a/gfx/layers/composite/CanvasLayerComposite.h
+++ b/gfx/layers/composite/CanvasLayerComposite.h
@@ -34,18 +34,16 @@ protected:
 
 public:
   // CanvasLayer impl
   virtual void Initialize(const Data& aData) override
   {
     MOZ_CRASH("Incompatibe surface type");
   }
 
-  virtual LayerRenderState GetRenderState() override;
-
   virtual bool SetCompositableHost(CompositableHost* aHost) override;
 
   virtual void Disconnect() override
   {
     Destroy();
   }
 
   virtual void SetLayerManager(HostLayerManager* aManager) override;
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -119,18 +119,16 @@ public:
    * Returns the front buffer.
    * *aPictureRect (if non-null, and the returned TextureHost is non-null)
    * is set to the picture rect.
    */
   virtual TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) {
     return nullptr;
   }
 
-  virtual LayerRenderState GetRenderState() = 0;
-
   virtual gfx::IntSize GetImageSize() const
   {
     MOZ_ASSERT(false, "Should have been overridden");
     return gfx::IntSize();
   }
 
   /**
    * Adds a mask effect using this texture as the mask, if possible.
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -57,18 +57,17 @@ ContentHostTexture::Composite(LayerCompo
     mTextureSourceOnWhite = nullptr;
   }
   if (mTextureHostOnWhite && !mTextureHostOnWhite->BindTextureSource(mTextureSourceOnWhite)) {
     return;
   }
 
   RefPtr<TexturedEffect> effect = CreateTexturedEffect(mTextureSource.get(),
                                                        mTextureSourceOnWhite.get(),
-                                                       aSamplingFilter, true,
-                                                       GetRenderState());
+                                                       aSamplingFilter, true);
   if (!effect) {
     return;
   }
 
   aEffectChain.mPrimaryEffect = effect;
 
   nsIntRegion tmpRegion;
   const nsIntRegion* renderRegion;
@@ -430,32 +429,16 @@ ContentHostTexture::PrintInfo(std::strin
     pfx += "  ";
 
     aStream << "\n";
     mTextureHost->PrintInfo(aStream, pfx.get());
   }
 }
 
 
-LayerRenderState
-ContentHostTexture::GetRenderState()
-{
-  if (!mTextureHost) {
-    return LayerRenderState();
-  }
-
-  LayerRenderState result = mTextureHost->GetRenderState();
-
-  if (mBufferRotation != nsIntPoint()) {
-    result.mFlags |= LayerRenderStateFlags::BUFFER_ROTATION;
-  }
-  result.SetOffset(GetOriginOffset());
-  return result;
-}
-
 already_AddRefed<TexturedEffect>
 ContentHostTexture::GenEffect(const gfx::SamplingFilter aSamplingFilter)
 {
   if (!mTextureHost) {
     return nullptr;
   }
   if (!mTextureHost->BindTextureSource(mTextureSource)) {
     return nullptr;
@@ -463,18 +446,17 @@ ContentHostTexture::GenEffect(const gfx:
   if (!mTextureHostOnWhite) {
     mTextureSourceOnWhite = nullptr;
   }
   if (mTextureHostOnWhite && !mTextureHostOnWhite->BindTextureSource(mTextureSourceOnWhite)) {
     return nullptr;
   }
   return CreateTexturedEffect(mTextureSource.get(),
                               mTextureSourceOnWhite.get(),
-                              aSamplingFilter, true,
-                              GetRenderState());
+                              aSamplingFilter, true);
 }
 
 already_AddRefed<gfx::DataSourceSurface>
 ContentHostTexture::GetAsSurface()
 {
   if (!mTextureHost) {
     return nullptr;
   }
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -160,18 +160,16 @@ public:
     MOZ_ASSERT(mLocked);
     mTextureHost->Unlock();
     if (mTextureHostOnWhite) {
       mTextureHostOnWhite->Unlock();
     }
     mLocked = false;
   }
 
-  LayerRenderState GetRenderState() override;
-
   virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
 
 protected:
   CompositableTextureHostRef mTextureHost;
   CompositableTextureHostRef mTextureHostOnWhite;
   CompositableTextureSourceRef mTextureSource;
   CompositableTextureSourceRef mTextureSourceOnWhite;
   bool mLocked;
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -233,18 +233,17 @@ ImageHost::Composite(LayerComposite* aLa
       MOZ_ASSERT(false);
       return;
     }
 
     bool isAlphaPremultiplied =
         !(mCurrentTextureHost->GetFlags() & TextureFlags::NON_PREMULTIPLIED);
     RefPtr<TexturedEffect> effect =
         CreateTexturedEffect(mCurrentTextureHost,
-            mCurrentTextureSource.get(), aSamplingFilter, isAlphaPremultiplied,
-            GetRenderState());
+            mCurrentTextureSource.get(), aSamplingFilter, isAlphaPremultiplied);
     if (!effect) {
       return;
     }
 
     if (!GetCompositor()->SupportsEffect(effect->mType)) {
       return;
     }
 
@@ -379,27 +378,16 @@ ImageHost::Dump(std::stringstream& aStre
     aStream << aPrefix;
     aStream << (aDumpHtml ? "<ul><li>TextureHost: "
                              : "TextureHost: ");
     DumpTextureHost(aStream, img.mTextureHost);
     aStream << (aDumpHtml ? " </li></ul> " : " ");
   }
 }
 
-LayerRenderState
-ImageHost::GetRenderState()
-{
-  TimedImage* img = ChooseImage();
-  if (img) {
-    SetCurrentTextureHost(img->mTextureHost);
-    return img->mTextureHost->GetRenderState();
-  }
-  return LayerRenderState();
-}
-
 already_AddRefed<gfx::DataSourceSurface>
 ImageHost::GetAsSurface()
 {
   TimedImage* img = ChooseImage();
   if (img) {
     return img->mTextureHost->GetAsSurface();
   }
   return nullptr;
@@ -479,16 +467,15 @@ ImageHost::GenEffect(const gfx::Sampling
   bool isAlphaPremultiplied = true;
   if (mCurrentTextureHost->GetFlags() & TextureFlags::NON_PREMULTIPLIED) {
     isAlphaPremultiplied = false;
   }
 
   return CreateTexturedEffect(mCurrentTextureHost,
                               mCurrentTextureSource,
                               aSamplingFilter,
-                              isAlphaPremultiplied,
-                              GetRenderState());
+                              isAlphaPremultiplied);
 }
 
 } // namespace layers
 } // namespace mozilla
 
 #undef BIAS_TIME_MS
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -62,18 +62,16 @@ public:
   virtual void Attach(Layer* aLayer,
                       Compositor* aCompositor,
                       AttachFlags aFlags = NO_FLAGS) override;
 
   virtual void SetCompositor(Compositor* aCompositor) override;
 
   gfx::IntSize GetImageSize() const override;
 
-  virtual LayerRenderState GetRenderState() override;
-
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
 
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix = "",
                     bool aDumpHtml = false) override;
 
   virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
 
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -59,25 +59,16 @@ ImageLayerComposite::SetCompositableHost
 }
 
 void
 ImageLayerComposite::Disconnect()
 {
   Destroy();
 }
 
-LayerRenderState
-ImageLayerComposite::GetRenderState()
-{
-  if (mImageHost && mImageHost->IsAttached()) {
-    return mImageHost->GetRenderState();
-  }
-  return LayerRenderState();
-}
-
 Layer*
 ImageLayerComposite::GetLayer()
 {
   return this;
 }
 
 void
 ImageLayerComposite::SetLayerManager(HostLayerManager* aManager)
--- a/gfx/layers/composite/ImageLayerComposite.h
+++ b/gfx/layers/composite/ImageLayerComposite.h
@@ -30,18 +30,16 @@ class ImageLayerComposite : public Image
 
 public:
   explicit ImageLayerComposite(LayerManagerComposite* aManager);
 
 protected:
   virtual ~ImageLayerComposite();
 
 public:
-  virtual LayerRenderState GetRenderState() override;
-
   virtual void Disconnect() override;
 
   virtual bool SetCompositableHost(CompositableHost* aHost) override;
 
   virtual Layer* GetLayer() override;
 
   virtual void SetLayerManager(HostLayerManager* aManager) override;
 
--- a/gfx/layers/composite/PaintedLayerComposite.cpp
+++ b/gfx/layers/composite/PaintedLayerComposite.cpp
@@ -84,25 +84,16 @@ PaintedLayerComposite::SetLayerManager(H
 {
   LayerComposite::SetLayerManager(aManager);
   mManager = aManager;
   if (mBuffer && mCompositor) {
     mBuffer->SetCompositor(mCompositor);
   }
 }
 
-LayerRenderState
-PaintedLayerComposite::GetRenderState()
-{
-  if (!mBuffer || !mBuffer->IsAttached() || mDestroyed) {
-    return LayerRenderState();
-  }
-  return mBuffer->GetRenderState();
-}
-
 void
 PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect,
                                    const Maybe<gfx::Polygon>& aGeometry)
 {
   if (!mBuffer || !mBuffer->IsAttached()) {
     return;
   }
   PROFILER_LABEL("PaintedLayerComposite", "RenderLayer",
--- a/gfx/layers/composite/PaintedLayerComposite.h
+++ b/gfx/layers/composite/PaintedLayerComposite.h
@@ -36,18 +36,16 @@ public:
   explicit PaintedLayerComposite(LayerManagerComposite *aManager);
 
 protected:
   virtual ~PaintedLayerComposite();
 
 public:
   virtual void Disconnect() override;
 
-  virtual LayerRenderState GetRenderState() override;
-
   CompositableHost* GetCompositableHost() override;
 
   virtual void Destroy() override;
 
   virtual Layer* GetLayer() override;
 
   virtual void SetLayerManager(HostLayerManager* aManager) override;
 
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -537,27 +537,16 @@ public:
   /**
    * Return a pointer to the IPDLActor.
    *
    * This is to be used with IPDL messages only. Do not store the returned
    * pointer.
    */
   PTextureParent* GetIPDLActor();
 
-  /**
-   * Specific to B2G's Composer2D
-   * XXX - more doc here
-   */
-  virtual LayerRenderState GetRenderState()
-  {
-    // By default we return an empty render state, this should be overridden
-    // by the TextureHost implementations that are used on B2G with Composer2D
-    return LayerRenderState();
-  }
-
   // If a texture host holds a reference to shmem, it should override this method
   // to forget about the shmem _without_ releasing it.
   virtual void OnShutdown() {}
 
   // Forget buffer actor. Used only for hacky fix for bug 966446.
   virtual void ForgetBufferActor() {}
 
   virtual const char *Name() { return "TextureHost"; }
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -95,32 +95,28 @@ TiledContentHost::TiledContentHost(const
 TiledContentHost::~TiledContentHost()
 {
   MOZ_COUNT_DTOR(TiledContentHost);
 }
 
 already_AddRefed<TexturedEffect>
 TiledContentHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
 {
-  // If we can use hwc for this TiledContentHost, it implies that we have exactly
-  // one high precision tile. Please check TiledContentHost::GetRenderState() for
-  // all condition.
   MOZ_ASSERT(mTiledBuffer.GetTileCount() == 1 && mLowPrecisionTiledBuffer.GetTileCount() == 0);
   MOZ_ASSERT(mTiledBuffer.GetTile(0).mTextureHost);
 
   TileHost& tile = mTiledBuffer.GetTile(0);
   if (!tile.mTextureHost->BindTextureSource(tile.mTextureSource)) {
     return nullptr;
   }
 
   return CreateTexturedEffect(tile.mTextureSource,
                               nullptr,
                               aSamplingFilter,
-                              true,
-                              tile.mTextureHost->GetRenderState());
+                              true);
 }
 
 void
 TiledContentHost::Attach(Layer* aLayer,
                          Compositor* aCompositor,
                          AttachFlags aFlags /* = NO_FLAGS */)
 {
   CompositableHost::Attach(aLayer, aCompositor, aFlags);
@@ -477,18 +473,17 @@ TiledContentHost::RenderTile(TileHost& a
   if (aTile.mTextureHostOnWhite && !aTile.mTextureHostOnWhite->BindTextureSource(aTile.mTextureSourceOnWhite)) {
     return;
   }
 
   RefPtr<TexturedEffect> effect =
     CreateTexturedEffect(aTile.mTextureSource,
                          aTile.mTextureSourceOnWhite,
                          aSamplingFilter,
-                         true,
-                         aTile.mTextureHost->GetRenderState());
+                         true);
   if (!effect) {
     return;
   }
 
   float opacity = aTile.GetFadeInOpacity(aOpacity);
   aEffectChain.mPrimaryEffect = effect;
 
   for (auto iter = aScreenRegion.RectIter(); !iter.Done(); iter.Next()) {
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -168,40 +168,16 @@ class TiledContentHost : public ContentH
 {
 public:
   explicit TiledContentHost(const TextureInfo& aTextureInfo);
 
 protected:
   ~TiledContentHost();
 
 public:
-  virtual LayerRenderState GetRenderState() override
-  {
-    // If we have exactly one high precision tile, then we can support hwc.
-    if (mTiledBuffer.GetTileCount() == 1 &&
-        mLowPrecisionTiledBuffer.GetTileCount() == 0) {
-      TextureHost* host = mTiledBuffer.GetTile(0).mTextureHost;
-      if (host) {
-        MOZ_ASSERT(!mTiledBuffer.GetTile(0).mTextureHostOnWhite, "Component alpha not supported!");
-
-        gfx::IntPoint offset = mTiledBuffer.GetTileOffset(mTiledBuffer.GetPlacement().TilePosition(0));
-
-        // Don't try to use HWC if the content doesn't start at the top-left of the tile.
-        if (offset != GetValidRegion().GetBounds().TopLeft()) {
-          return LayerRenderState();
-        }
-
-        LayerRenderState state = host->GetRenderState();
-        state.SetOffset(offset);
-        return state;
-      }
-    }
-    return LayerRenderState();
-  }
-
   // Generate effect for layerscope when using hwc.
   virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack) override
   {
     NS_ERROR("N/A for tiled layers");
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -35,17 +35,16 @@ EXPORTS += [
     'ipc/ThreadSafeRefcountingWithMainThreadDestruction.h',
     'Layers.h',
     'LayerScope.h',
     'LayersLogging.h',
     'LayerSorter.h',
     'LayersTypes.h',
     'LayerTreeInvalidation.h',
     'LayerUserData.h',
-    'opengl/Composer2D.h',
     'opengl/OGLShaderProgram.h',
     'opengl/TexturePoolOGL.h',
     'protobuf/LayerScopePacket.pb.h',
     'ReadbackLayer.h',
     'TiledLayerBuffer.h',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
@@ -369,17 +368,16 @@ UNIFIED_SOURCES += [
     'ipc/SharedRGBImage.cpp',
     'ipc/UiCompositorControllerChild.cpp',
     'ipc/UiCompositorControllerParent.cpp',
     'ipc/VideoBridgeChild.cpp',
     'ipc/VideoBridgeParent.cpp',
     'LayerScope.cpp',
     'LayersLogging.cpp',
     'LayerSorter.cpp',
-    'LayersTypes.cpp',
     'opengl/CompositingRenderTargetOGL.cpp',
     'opengl/CompositorOGL.cpp',
     'opengl/GLBlitTextureImageHelper.cpp',
     'opengl/OGLShaderProgram.cpp',
     'opengl/TextureClientOGL.cpp',
     'opengl/TextureHostOGL.cpp',
     'opengl/TexturePoolOGL.cpp',
     'protobuf/LayerScopePacket.pb.cc',
deleted file mode 100644
--- a/gfx/layers/opengl/Composer2D.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_layers_Composer2D_h
-#define mozilla_layers_Composer2D_h
-
-#include "gfxTypes.h"
-#include "nsISupportsImpl.h"
-
-/**
- * Many platforms have dedicated hardware for simple composition.
- * This hardware is usually faster or more power efficient than the
- * GPU.  However, in exchange for this better performance, generality
- * has to be sacrificed: no 3d transforms, no intermediate surfaces,
- * no special shader effects, loss of other goodies depending on the
- * platform.
- *
- * Composer2D is a very simple interface to this class of hardware
- * that allows an implementation to "try rendering" with the fast
- * path.  If the given layer tree requires more generality than the
- * hardware provides, the implementation should bail and have the
- * layer manager fall back on full GPU composition.
- */
-
-class nsIWidget;
-
-namespace mozilla {
-namespace layers {
-
-class Layer;
-
-class Composer2D {
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Composer2D)
-
-protected:
-  // Protected destructor, to discourage deletion outside of Release():
-  virtual ~Composer2D() {}
-
-public:
-  /**
-   * Return true if |aRoot| met the implementation's criteria for fast
-   * composition and the render was successful.  Return false to fall
-   * back on the GPU.
-   *
-   * Currently, when TryRender() returns true, the entire framebuffer
-   * must have been rendered.
-   */
-  virtual bool TryRenderWithHwc(Layer* aRoot,
-                                nsIWidget* aWidget,
-                                bool aGeometryChanged,
-                                bool aHasImageHostOverlays) = 0;
-
-  /**
-   * Return true if Composer2D does composition. Return false if Composer2D
-   * failed the composition.
-   */
-  virtual bool Render(nsIWidget* aWidget) = 0;
-
-  /**
-   * Return true if Composer2D has a fast composition hardware.
-   * Return false if Composer2D does not have a fast composition hardware.
-   */
-  virtual bool HasHwc() = 0;
-};
-
-} // namespace layers
-} // namespace mozilla
-
-#endif // mozilla_layers_Composer2D_h
--- a/gfx/layers/wr/WebRenderImageHost.cpp
+++ b/gfx/layers/wr/WebRenderImageHost.cpp
@@ -152,22 +152,16 @@ WebRenderImageHost::Dump(std::stringstre
     aStream << aPrefix;
     aStream << (aDumpHtml ? "<ul><li>TextureHost: "
                              : "TextureHost: ");
     DumpTextureHost(aStream, img.mTextureHost);
     aStream << (aDumpHtml ? " </li></ul> " : " ");
   }
 }
 
-LayerRenderState
-WebRenderImageHost::GetRenderState()
-{
-  return LayerRenderState();
-}
-
 already_AddRefed<gfx::DataSourceSurface>
 WebRenderImageHost::GetAsSurface()
 {
   TimedImage* img = ChooseImage();
   if (img) {
     return img->mTextureHost->GetAsSurface();
   }
   return nullptr;
--- a/gfx/layers/wr/WebRenderImageHost.h
+++ b/gfx/layers/wr/WebRenderImageHost.h
@@ -42,18 +42,16 @@ public:
   virtual void Attach(Layer* aLayer,
                       Compositor* aCompositor,
                       AttachFlags aFlags = NO_FLAGS) override;
 
   virtual void SetCompositor(Compositor* aCompositor) override;
 
   gfx::IntSize GetImageSize() const override;
 
-  virtual LayerRenderState GetRenderState() override;
-
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
 
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix = "",
                     bool aDumpHtml = false) override;
 
   virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
 
--- a/widget/CompositorWidget.h
+++ b/widget/CompositorWidget.h
@@ -20,17 +20,16 @@ class VsyncObserver;
 namespace gl {
 class GLContext;
 } // namespace gl
 namespace layers {
 class Compositor;
 class LayerManager;
 class LayerManagerComposite;
 class Compositor;
-class Composer2D;
 } // namespace layers
 namespace gfx {
 class DrawTarget;
 class SourceSurface;
 } // namespace gfx
 namespace widget {
 
 class WinCompositorWidget;
@@ -197,27 +196,16 @@ public:
   virtual LayoutDeviceIntSize GetClientSize() = 0;
 
   /**
    * Return the internal format of the default framebuffer for this
    * widget.
    */
   virtual uint32_t GetGLFrameBufferFormat();
 
-  /**
-   * If this widget has a more efficient composer available for its
-   * native framebuffer, return it.
-   *
-   * This can be called from a non-main thread, but that thread must
-   * hold a strong reference to this.
-   */
-  virtual layers::Composer2D* GetComposer2D() {
-    return nullptr;
-  }
-
   /*
    * Access the underlying nsIWidget. This method will be removed when the compositor no longer
    * depends on nsIWidget on any platform.
    */
   virtual nsIWidget* RealWidget() = 0;
 
   /**
    * Clean up any resources used by Start/EndRemoteDrawing.
--- a/widget/InProcessCompositorWidget.cpp
+++ b/widget/InProcessCompositorWidget.cpp
@@ -113,22 +113,16 @@ InProcessCompositorWidget::GetClientSize
 }
 
 uint32_t
 InProcessCompositorWidget::GetGLFrameBufferFormat()
 {
   return mWidget->GetGLFrameBufferFormat();
 }
 
-layers::Composer2D*
-InProcessCompositorWidget::GetComposer2D()
-{
-  return mWidget->GetComposer2D();
-}
-
 uintptr_t
 InProcessCompositorWidget::GetWidgetKey()
 {
   return reinterpret_cast<uintptr_t>(mWidget);
 }
 
 nsIWidget*
 InProcessCompositorWidget::RealWidget()
--- a/widget/InProcessCompositorWidget.h
+++ b/widget/InProcessCompositorWidget.h
@@ -31,17 +31,16 @@ public:
   virtual void EndRemoteDrawing() override;
   virtual void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
                                         LayoutDeviceIntRegion& aInvalidRegion) override;
   virtual void CleanupRemoteDrawing() override;
   virtual void CleanupWindowEffects() override;
   virtual bool InitCompositor(layers::Compositor* aCompositor) override;
   virtual LayoutDeviceIntSize GetClientSize() override;
   virtual uint32_t GetGLFrameBufferFormat() override;
-  virtual layers::Composer2D* GetComposer2D() override;
   virtual void ObserveVsync(VsyncObserver* aObserver) override;
   virtual uintptr_t GetWidgetKey() override;
 
   // If you can override this method, inherit from CompositorWidget instead.
   nsIWidget* RealWidget() override;
 
 protected:
   nsBaseWidget* mWidget;
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -438,19 +438,16 @@ protected:
   virtual void CleanupRemoteDrawing()
   {}
   virtual void CleanupWindowEffects()
   {}
   virtual bool InitCompositor(mozilla::layers::Compositor* aCompositor) {
     return true;
   }
   virtual uint32_t GetGLFrameBufferFormat();
-  virtual mozilla::layers::Composer2D* GetComposer2D() {
-    return nullptr;
-  }
 
 protected:
   void            ResolveIconName(const nsAString &aIconName,
                                   const nsAString &aIconSuffix,
                                   nsIFile **aResult);
   virtual void    OnDestroy();
   void            BaseCreate(nsIWidget *aParent,
                              nsWidgetInitData* aInitData);
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -45,17 +45,16 @@ namespace mozilla {
 namespace dom {
 class TabChild;
 } // namespace dom
 namespace plugins {
 class PluginWidgetChild;
 } // namespace plugins
 namespace layers {
 class AsyncDragMetrics;
-class Composer2D;
 class Compositor;
 class CompositorBridgeChild;
 class LayerManager;
 class LayerManagerComposite;
 class PLayerTransactionChild;
 struct ScrollableLayerGuid;
 } // namespace layers
 namespace gfx {
@@ -329,17 +328,16 @@ private:
  * all basic and necessary functionality.
  */
 class nsIWidget : public nsISupports
 {
   protected:
     typedef mozilla::dom::TabChild TabChild;
 
   public:
-    typedef mozilla::layers::Composer2D Composer2D;
     typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild;
     typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics;
     typedef mozilla::layers::FrameMetrics FrameMetrics;
     typedef mozilla::layers::LayerManager LayerManager;
     typedef mozilla::layers::LayerManagerComposite LayerManagerComposite;
     typedef mozilla::layers::LayersBackend LayersBackend;
     typedef mozilla::layers::PLayerTransactionChild PLayerTransactionChild;
     typedef mozilla::layers::ZoomConstraints ZoomConstraints;