Bug 1101552 - Remove the double-buffered ImageClient. r=sotaro a=lsblakk
authorNicolas Silva <nsilva@mozilla.com>
Thu, 20 Nov 2014 19:49:51 +0100
changeset 234039 8ff014d18f0fc1f05b0b28445d67e7315b463850
parent 234038 b2570a8f6e91a9045ae77f51bee36b78232417a5
child 234040 4d72f5451cd0ccd5a8e26b7cc7ab406b33ba58c5
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro, lsblakk
bugs1101552
milestone35.0a2
Bug 1101552 - Remove the double-buffered ImageClient. r=sotaro a=lsblakk
gfx/layers/CompositorTypes.h
gfx/layers/ImageContainer.cpp
gfx/layers/client/ClientImageLayer.cpp
gfx/layers/client/ImageClient.cpp
gfx/layers/client/ImageClient.h
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/CompositableHost.cpp
gfx/layers/composite/ImageLayerComposite.cpp
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -154,27 +154,25 @@ MOZ_BEGIN_ENUM_CLASS(EffectTypes, uint8_
 MOZ_END_ENUM_CLASS(EffectTypes)
 
 /**
  * How the Compositable should manage textures.
  */
 MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
   BUFFER_UNKNOWN,
   // the deprecated compositable types
-  BUFFER_IMAGE_SINGLE,    // image/canvas with a single texture, single buffered
-  BUFFER_IMAGE_BUFFERED,  // canvas, double buffered
-  BUFFER_BRIDGE,          // image bridge protocol
   BUFFER_CONTENT_INC,     // painted layer interface, only sends incremental
                           // updates to a texture on the compositor side.
   // somewhere in the middle
   BUFFER_TILED,           // tiled painted layer
   BUFFER_SIMPLE_TILED,
   // the new compositable types
-  IMAGE,     // image with single buffering
-  IMAGE_OVERLAY, // image without buffer
+  IMAGE,           // image with single buffering
+  IMAGE_OVERLAY,   // image without buffer
+  IMAGE_BRIDGE,    // ImageBridge protocol
   CONTENT_SINGLE,  // painted layer interface, single buffering
   CONTENT_DOUBLE,  // painted layer interface, double buffering
   BUFFER_COUNT
 MOZ_END_ENUM_CLASS(CompositableType)
 
 /**
  * How the texture host is used for composition,
  */
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -134,17 +134,17 @@ ImageContainer::ImageContainer(int flag)
   mRemoteData(nullptr),
   mRemoteDataMutex(nullptr),
   mCompositionNotifySink(nullptr),
   mImageClient(nullptr)
 {
   if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
     // the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount
     // of this class must be done on the ImageBridge thread.
-    mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::BUFFER_IMAGE_SINGLE).drop();
+    mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE).drop();
     MOZ_ASSERT(mImageClient);
   }
 }
 
 ImageContainer::~ImageContainer()
 {
   if (IsAsync()) {
     ImageBridgeChild::DispatchReleaseImageClient(mImageClient);
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -96,43 +96,32 @@ protected:
 
   CompositableType GetImageClientType()
   {
     if (mImageClientTypeContainer != CompositableType::BUFFER_UNKNOWN) {
       return mImageClientTypeContainer;
     }
 
     if (mContainer->IsAsync()) {
-      mImageClientTypeContainer = CompositableType::BUFFER_BRIDGE;
-      return mImageClientTypeContainer;
-    }
-
-    // Since D3D11 TextureClient doesn't have an internal buffer, modifying the
-    // front buffer directly may break the transactional property of layer updates.
-    if (ClientManager()->GetCompositorBackendType() == LayersBackend::LAYERS_D3D11) {
-      mImageClientTypeContainer = CompositableType::BUFFER_IMAGE_BUFFERED;
+      mImageClientTypeContainer = CompositableType::IMAGE_BRIDGE;
       return mImageClientTypeContainer;
     }
 
     AutoLockImage autoLock(mContainer);
 
 #ifdef MOZ_WIDGET_GONK
-    // gralloc buffer needs CompositableType::BUFFER_IMAGE_BUFFERED to prevent
-    // the buffer's usage conflict.
     if (autoLock.GetImage()->GetFormat() == ImageFormat::OVERLAY_IMAGE) {
       mImageClientTypeContainer = CompositableType::IMAGE_OVERLAY;
       return mImageClientTypeContainer;
     }
+#endif
 
-    mImageClientTypeContainer = autoLock.GetImage() ?
-                                  CompositableType::BUFFER_IMAGE_BUFFERED : CompositableType::BUFFER_UNKNOWN;
-#else
-    mImageClientTypeContainer = autoLock.GetImage() ?
-                                  CompositableType::BUFFER_IMAGE_SINGLE : CompositableType::BUFFER_UNKNOWN;
-#endif
+  	mImageClientTypeContainer = autoLock.GetImage()
+							  ? CompositableType::IMAGE
+							  : CompositableType::BUFFER_UNKNOWN;
     return mImageClientTypeContainer;
   }
 
   RefPtr<ImageClient> mImageClient;
   CompositableType mImageClientTypeContainer;
 };
 
 void
@@ -158,17 +147,17 @@ ClientImageLayer::RenderLayer()
     }
     TextureFlags flags = TextureFlags::FRONT;
     if (mDisallowBigImage) {
       flags |= TextureFlags::DISALLOW_BIGIMAGE;
     }
     mImageClient = ImageClient::CreateImageClient(type,
                                                   ClientManager()->AsShadowForwarder(),
                                                   flags);
-    if (type == CompositableType::BUFFER_BRIDGE) {
+    if (type == CompositableType::IMAGE_BRIDGE) {
       static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
     }
 
     if (!mImageClient) {
       return;
     }
     if (HasShadow() && !mContainer->IsAsync()) {
       mImageClient->Connect();
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -44,23 +44,19 @@ using namespace mozilla::gfx;
 /* static */ TemporaryRef<ImageClient>
 ImageClient::CreateImageClient(CompositableType aCompositableHostType,
                                CompositableForwarder* aForwarder,
                                TextureFlags aFlags)
 {
   RefPtr<ImageClient> result = nullptr;
   switch (aCompositableHostType) {
   case CompositableType::IMAGE:
-  case CompositableType::BUFFER_IMAGE_SINGLE:
     result = new ImageClientSingle(aForwarder, aFlags, CompositableType::IMAGE);
     break;
-  case CompositableType::BUFFER_IMAGE_BUFFERED:
-    result = new ImageClientBuffered(aForwarder, aFlags, CompositableType::IMAGE);
-    break;
-  case CompositableType::BUFFER_BRIDGE:
+  case CompositableType::IMAGE_BRIDGE:
     result = new ImageClientBridge(aForwarder, aFlags);
     break;
   case CompositableType::BUFFER_UNKNOWN:
     result = nullptr;
     break;
 #ifdef MOZ_WIDGET_GONK
   case CompositableType::IMAGE_OVERLAY:
     result = new ImageClientOverlay(aForwarder, aFlags);
@@ -111,23 +107,16 @@ ImageClient::RemoveTextureWithTracker(Te
 
 ImageClientSingle::ImageClientSingle(CompositableForwarder* aFwd,
                                      TextureFlags aFlags,
                                      CompositableType aType)
   : ImageClient(aFwd, aFlags, aType)
 {
 }
 
-ImageClientBuffered::ImageClientBuffered(CompositableForwarder* aFwd,
-                                         TextureFlags aFlags,
-                                         CompositableType aType)
-  : ImageClientSingle(aFwd, aFlags, aType)
-{
-}
-
 TextureInfo ImageClientSingle::GetTextureInfo() const
 {
   return TextureInfo(CompositableType::IMAGE);
 }
 
 TemporaryRef<AsyncTransactionTracker>
 ImageClientSingle::PrepareFlushAllImages()
 {
@@ -143,253 +132,138 @@ ImageClientSingle::FlushAllImages(bool a
     RemoveTextureWithTracker(mFrontBuffer, aAsyncTransactionTracker);
     mFrontBuffer = nullptr;
   } else if(aAsyncTransactionTracker) {
     // already flushed
     aAsyncTransactionTracker->NotifyComplete();
   }
 }
 
-void
-ImageClientBuffered::FlushAllImages(bool aExceptFront,
-                                    AsyncTransactionTracker* aAsyncTransactionTracker)
-{
-  if (!aExceptFront && mFrontBuffer) {
-    RemoveTexture(mFrontBuffer);
-    mFrontBuffer = nullptr;
-  }
-  if (mBackBuffer) {
-    RemoveTextureWithTracker(mBackBuffer, aAsyncTransactionTracker);
-    mBackBuffer = nullptr;
-  }
-}
-
 bool
-ImageClientSingle::UpdateImage(ImageContainer* aContainer,
-                               uint32_t aContentFlags)
-{
-  bool isSwapped = false;
-  return UpdateImageInternal(aContainer, aContentFlags, &isSwapped);
-}
-
-bool
-ImageClientSingle::UpdateImageInternal(ImageContainer* aContainer,
-                                       uint32_t aContentFlags, bool* aIsSwapped)
+ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags)
 {
   AutoLockImage autoLock(aContainer);
-  *aIsSwapped = false;
 
   Image *image = autoLock.GetImage();
   if (!image) {
     return false;
   }
 
   if (mLastPaintedImageSerial == image->GetSerial()) {
     return true;
   }
 
-  AutoRemoveTexture autoRemoveTexture(this);
+  RefPtr<TextureClient> texture = image->AsSharedImage()
+                                ? image->AsSharedImage()->GetTextureClient(this)
+                                : nullptr;
 
-  if (image->AsSharedImage() && image->AsSharedImage()->GetTextureClient(this)) {
-    // fast path: no need to allocate and/or copy image data
-    RefPtr<TextureClient> texture = image->AsSharedImage()->GetTextureClient(this);
-
+  AutoRemoveTexture autoRemoveTexture(this);
+  if (texture != mFrontBuffer) {
     autoRemoveTexture.mTexture = mFrontBuffer;
-    mFrontBuffer = texture;
-    if (!AddTextureClient(texture)) {
-      mFrontBuffer = nullptr;
-      return false;
-    }
-    GetForwarder()->UpdatedTexture(this, texture, nullptr);
-    GetForwarder()->UseTexture(this, texture);
-  } else if (image->GetFormat() == ImageFormat::PLANAR_YCBCR) {
-    PlanarYCbCrImage* ycbcr = static_cast<PlanarYCbCrImage*>(image);
-    const PlanarYCbCrData* data = ycbcr->GetData();
-    if (!data) {
-      return false;
-    }
+    mFrontBuffer = nullptr;
+  }
 
-    if (mFrontBuffer && mFrontBuffer->IsImmutable()) {
-      autoRemoveTexture.mTexture = mFrontBuffer;
-      mFrontBuffer = nullptr;
-    }
-
-    bool bufferCreated = false;
-    if (!mFrontBuffer) {
-      gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
-      gfx::IntSize cbCrSize(data->mCbCrSize.width, data->mCbCrSize.height);
-      mFrontBuffer = TextureClient::CreateForYCbCr(GetForwarder(),
-                                                   ySize, cbCrSize, data->mStereoMode,
-                                                   TextureFlags::DEFAULT|mTextureFlags);
-      if (!mFrontBuffer) {
+  if (!texture) {
+    // Slow path, we should not be hitting it very often and if we do it means
+    // we are using an Image class that is not backed by textureClient and we
+    // should fix it.
+    if (image->GetFormat() == ImageFormat::PLANAR_YCBCR) {
+      PlanarYCbCrImage* ycbcr = static_cast<PlanarYCbCrImage*>(image);
+      const PlanarYCbCrData* data = ycbcr->GetData();
+      if (!data) {
         return false;
       }
-      bufferCreated = true;
-    }
+      texture = TextureClient::CreateForYCbCr(GetForwarder(),
+        data->mYSize, data->mCbCrSize, data->mStereoMode,
+        TextureFlags::DEFAULT | mTextureFlags
+      );
+      if (!texture || !texture->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+        return false;
+      }
+      bool status = texture->AsTextureClientYCbCr()->UpdateYCbCr(*data);
+      MOZ_ASSERT(status);
 
-    if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
-      mFrontBuffer = nullptr;
-      return false;
-    }
-    bool status = mFrontBuffer->AsTextureClientYCbCr()->UpdateYCbCr(*data);
-    mFrontBuffer->Unlock();
-
-    if (bufferCreated) {
-      if (!AddTextureClient(mFrontBuffer)) {
-        mFrontBuffer = nullptr;
+      texture->Unlock();
+      if (!status) {
         return false;
       }
-    }
-
-    if (status) {
-      GetForwarder()->UpdatedTexture(this, mFrontBuffer, nullptr);
-      GetForwarder()->UseTexture(this, mFrontBuffer);
-    } else {
-      MOZ_ASSERT(false);
-      return false;
-    }
-
-  } else if (image->GetFormat() == ImageFormat::SURFACE_TEXTURE ||
-             image->GetFormat() == ImageFormat::EGLIMAGE)
-  {
-    gfx::IntSize size = gfx::IntSize(image->GetSize().width, image->GetSize().height);
 
-    if (mFrontBuffer) {
-      autoRemoveTexture.mTexture = mFrontBuffer;
-      mFrontBuffer = nullptr;
-    }
-
-    RefPtr<TextureClient> buffer;
+    } else if (image->GetFormat() == ImageFormat::SURFACE_TEXTURE ||
+               image->GetFormat() == ImageFormat::EGLIMAGE) {
+      gfx::IntSize size = image->GetSize();
 
-    if (image->GetFormat() == ImageFormat::EGLIMAGE) {
-      EGLImageImage* typedImage = static_cast<EGLImageImage*>(image);
-      const EGLImageImage::Data* data = typedImage->GetData();
-
-      buffer = new EGLImageTextureClient(mTextureFlags,
-                                         data->mImage,
-                                         size,
-                                         data->mInverted);
-#ifdef MOZ_WIDGET_ANDROID
-    } else if (image->GetFormat() == ImageFormat::SURFACE_TEXTURE) {
-      SurfaceTextureImage* typedImage = static_cast<SurfaceTextureImage*>(image);
-      const SurfaceTextureImage::Data* data = typedImage->GetData();
+      if (image->GetFormat() == ImageFormat::EGLIMAGE) {
+        EGLImageImage* typedImage = static_cast<EGLImageImage*>(image);
+        const EGLImageImage::Data* data = typedImage->GetData();
 
-      buffer = new SurfaceTextureClient(mTextureFlags,
-                                        data->mSurfTex,
-                                        size,
-                                        data->mInverted);
+        texture = new EGLImageTextureClient(mTextureFlags, data->mImage,
+                                           size, data->mInverted);
+#ifdef MOZ_WIDGET_ANDROID
+      } else if (image->GetFormat() == ImageFormat::SURFACE_TEXTURE) {
+        SurfaceTextureImage* typedImage = static_cast<SurfaceTextureImage*>(image);
+        const SurfaceTextureImage::Data* data = typedImage->GetData();
+        texture = new SurfaceTextureClient(mTextureFlags, data->mSurfTex,
+                                          size, data->mInverted);
 #endif
+      } else {
+        MOZ_ASSERT(false, "Bad ImageFormat.");
+      }
     } else {
-      MOZ_ASSERT(false, "Bad ImageFormat.");
-    }
-
-    mFrontBuffer = buffer;
-    if (!AddTextureClient(mFrontBuffer)) {
-      mFrontBuffer = nullptr;
-      return false;
-    }
-
-    GetForwarder()->UseTexture(this, mFrontBuffer);
-
-  } else {
-    RefPtr<gfx::SourceSurface> surface = image->GetAsSourceSurface();
-    MOZ_ASSERT(surface);
-
-    gfx::IntSize size = image->GetSize();
-
-    if (mFrontBuffer &&
-        (mFrontBuffer->IsImmutable() || mFrontBuffer->GetSize() != size)) {
-      autoRemoveTexture.mTexture = mFrontBuffer;
-      mFrontBuffer = nullptr;
-    }
-
-    bool bufferCreated = false;
-    if (!mFrontBuffer) {
-      mFrontBuffer = CreateTextureClientForDrawing(surface->GetFormat(), size,
-                                                   gfx::BackendType::NONE, mTextureFlags);
-      if (!mFrontBuffer) {
+      RefPtr<gfx::SourceSurface> surface = image->GetAsSourceSurface();
+      MOZ_ASSERT(surface);
+      texture = CreateTextureClientForDrawing(surface->GetFormat(), image->GetSize(),
+                                              gfx::BackendType::NONE, mTextureFlags);
+      if (!texture) {
         return false;
       }
-      MOZ_ASSERT(mFrontBuffer->CanExposeDrawTarget());
-      bufferCreated = true;
-    }
-
-    if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
-      mFrontBuffer = nullptr;
-      return false;
-    }
 
-    {
-      // We must not keep a reference to the DrawTarget after it has been unlocked.
-      DrawTarget* dt = mFrontBuffer->BorrowDrawTarget();
-      MOZ_ASSERT(surface.get());
-      dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint());
-    }
+      MOZ_ASSERT(texture->CanExposeDrawTarget());
 
-    mFrontBuffer->Unlock();
-
-    if (bufferCreated) {
-      if (!AddTextureClient(mFrontBuffer)) {
-        mFrontBuffer = nullptr;
+      if (!texture->Lock(OpenMode::OPEN_WRITE_ONLY)) {
         return false;
       }
-    }
+
+      {
+        // We must not keep a reference to the DrawTarget after it has been unlocked.
+        DrawTarget* dt = texture->BorrowDrawTarget();
+        MOZ_ASSERT(surface.get());
+        dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint());
+      }
 
-    GetForwarder()->UpdatedTexture(this, mFrontBuffer, nullptr);
-    GetForwarder()->UseTexture(this, mFrontBuffer);
+      texture->Unlock();
+    }
   }
+  if (!texture || !AddTextureClient(texture)) {
+    return false;
+  }
+
+  mFrontBuffer = texture;
+  GetForwarder()->UpdatedTexture(this, texture, nullptr);
+  GetForwarder()->UseTexture(this, texture);
 
   UpdatePictureRect(image->GetPictureRect());
 
   mLastPaintedImageSerial = image->GetSerial();
   aContainer->NotifyPaintedImage(image);
-  *aIsSwapped = true;
   return true;
 }
 
 bool
-ImageClientBuffered::UpdateImage(ImageContainer* aContainer,
-                                 uint32_t aContentFlags)
-{
-  RefPtr<TextureClient> temp = mFrontBuffer;
-  mFrontBuffer = mBackBuffer;
-  mBackBuffer = temp;
-
-  bool isSwapped = false;
-  bool ret = ImageClientSingle::UpdateImageInternal(aContainer, aContentFlags, &isSwapped);
-
-  if (!isSwapped) {
-    // If buffer swap did not happen at Host side, swap back the buffers.
-    RefPtr<TextureClient> temp = mFrontBuffer;
-    mFrontBuffer = mBackBuffer;
-    mBackBuffer = temp;
-  }
-  return ret;
-}
-
-bool
 ImageClientSingle::AddTextureClient(TextureClient* aTexture)
 {
   MOZ_ASSERT((mTextureFlags & aTexture->GetFlags()) == mTextureFlags);
   return CompositableClient::AddTextureClient(aTexture);
 }
 
 void
 ImageClientSingle::OnDetach()
 {
   mFrontBuffer = nullptr;
 }
 
-void
-ImageClientBuffered::OnDetach()
-{
-  mFrontBuffer = nullptr;
-  mBackBuffer = nullptr;
-}
-
 ImageClient::ImageClient(CompositableForwarder* aFwd, TextureFlags aFlags,
                          CompositableType aType)
 : CompositableClient(aFwd, aFlags)
 , mType(aType)
 , mLastPaintedImageSerial(0)
 {}
 
 void
@@ -400,17 +274,17 @@ ImageClient::UpdatePictureRect(nsIntRect
   }
   mPictureRect = aRect;
   MOZ_ASSERT(mForwarder);
   GetForwarder()->UpdatePictureRect(this, aRect);
 }
 
 ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
                                      TextureFlags aFlags)
-: ImageClient(aFwd, aFlags, CompositableType::BUFFER_BRIDGE)
+: ImageClient(aFwd, aFlags, CompositableType::IMAGE_BRIDGE)
 , mAsyncContainerID(0)
 , mLayer(nullptr)
 {
 }
 
 bool
 ImageClientBridge::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags)
 {
--- a/gfx/layers/client/ImageClient.h
+++ b/gfx/layers/client/ImageClient.h
@@ -110,44 +110,20 @@ public:
   virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) MOZ_OVERRIDE;
 
   virtual TemporaryRef<AsyncTransactionTracker> PrepareFlushAllImages() MOZ_OVERRIDE;
 
   virtual void FlushAllImages(bool aExceptFront,
                               AsyncTransactionTracker* aAsyncTransactionTracker) MOZ_OVERRIDE;
 
 protected:
-  virtual bool UpdateImageInternal(ImageContainer* aContainer, uint32_t aContentFlags, bool* aIsSwapped);
-
-protected:
   RefPtr<TextureClient> mFrontBuffer;
 };
 
 /**
- * An image client which uses two texture clients.
- */
-class ImageClientBuffered : public ImageClientSingle
-{
-public:
-  ImageClientBuffered(CompositableForwarder* aFwd,
-                      TextureFlags aFlags,
-                      CompositableType aType);
-
-  virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
-
-  virtual void OnDetach() MOZ_OVERRIDE;
-
-  virtual void FlushAllImages(bool aExceptFront,
-                              AsyncTransactionTracker* aAsyncTransactionTracker) MOZ_OVERRIDE;
-
-protected:
-  RefPtr<TextureClient> mBackBuffer;
-};
-
-/**
  * Image class to be used for async image uploads using the image bridge
  * protocol.
  * We store the ImageBridge id in the TextureClientIdentifier.
  */
 class ImageClientBridge : public ImageClient
 {
 public:
   ImageClientBridge(CompositableForwarder* aFwd,
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -40,18 +40,16 @@ CanvasLayerComposite::~CanvasLayerCompos
 
   CleanupResources();
 }
 
 bool
 CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   switch (aHost->GetType()) {
-    case CompositableType::BUFFER_IMAGE_SINGLE:
-    case CompositableType::BUFFER_IMAGE_BUFFERED:
     case CompositableType::IMAGE:
       mImageHost = aHost;
       return true;
     default:
       return false;
   }
 
 }
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -195,17 +195,17 @@ CompositableHost::RemoveMaskEffect()
 // implemented in TextureHostOGL.cpp
 TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
 
 /* static */ TemporaryRef<CompositableHost>
 CompositableHost::Create(const TextureInfo& aTextureInfo)
 {
   RefPtr<CompositableHost> result;
   switch (aTextureInfo.mCompositableType) {
-  case CompositableType::BUFFER_BRIDGE:
+  case CompositableType::IMAGE_BRIDGE:
     NS_ERROR("Cannot create an image bridge compositable this way");
     break;
   case CompositableType::BUFFER_CONTENT_INC:
     result = new ContentHostIncremental(aTextureInfo);
     break;
   case CompositableType::BUFFER_TILED:
   case CompositableType::BUFFER_SIMPLE_TILED:
     result = new TiledContentHost(aTextureInfo);
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -46,18 +46,16 @@ ImageLayerComposite::~ImageLayerComposit
 
   CleanupResources();
 }
 
 bool
 ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   switch (aHost->GetType()) {
-    case CompositableType::BUFFER_IMAGE_SINGLE:
-    case CompositableType::BUFFER_IMAGE_BUFFERED:
     case CompositableType::IMAGE:
     case CompositableType::IMAGE_OVERLAY:
       mImageHost = aHost;
       return true;
     default:
       return false;
   }
 }