Bug 966999 - Remove some deprecated GL textures code. r=vlad
authorNicolas Silva <nical@mozilla.com>
Tue, 04 Feb 2014 21:47:20 +0100
changeset 166819 4ab773616cadd09ac98212da24d3f3ba015b0857
parent 166818 dbeb31399750e6e46599e89c76cfcef5f8a7553c
child 166820 aaf73bfa3900c3d7d9577fb5b2474e005d251ffd
push id39294
push usernsilva@mozilla.com
push dateTue, 04 Feb 2014 20:47:33 +0000
treeherdermozilla-inbound@4ab773616cad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs966999
milestone30.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 966999 - Remove some deprecated GL textures code. r=vlad
gfx/layers/client/CompositableClient.cpp
gfx/layers/opengl/TextureClientOGL.cpp
gfx/layers/opengl/TextureClientOGL.h
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
modules/libpref/src/init/all.js
--- a/gfx/layers/client/CompositableClient.cpp
+++ b/gfx/layers/client/CompositableClient.cpp
@@ -97,36 +97,26 @@ CompositableClient::CreateDeprecatedText
                                                   gfxContentType aContentType)
 {
   MOZ_ASSERT(GetForwarder(), "Can't create a texture client if the compositable is not connected to the compositor.");
   LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
   RefPtr<DeprecatedTextureClient> result;
 
   switch (aDeprecatedTextureClientType) {
   case TEXTURE_SHARED_GL:
-    if (parentBackend == LayersBackend::LAYERS_OPENGL) {
-      result = new DeprecatedTextureClientSharedOGL(GetForwarder(), GetTextureInfo());
-    }
-     break;
   case TEXTURE_SHARED_GL_EXTERNAL:
-    if (parentBackend == LayersBackend::LAYERS_OPENGL) {
-      result = new DeprecatedTextureClientSharedOGLExternal(GetForwarder(), GetTextureInfo());
-    }
-    break;
   case TEXTURE_STREAM_GL:
-    if (parentBackend == LayersBackend::LAYERS_OPENGL) {
-      result = new DeprecatedTextureClientStreamOGL(GetForwarder(), GetTextureInfo());
-    }
-    break;
+    MOZ_CRASH("Unsupported. this should not be reached");
   case TEXTURE_YCBCR:
-    if (parentBackend == LayersBackend::LAYERS_OPENGL ||
-        parentBackend == LayersBackend::LAYERS_D3D9 ||
+    if (parentBackend == LayersBackend::LAYERS_D3D9 ||
         parentBackend == LayersBackend::LAYERS_D3D11 ||
         parentBackend == LayersBackend::LAYERS_BASIC) {
       result = new DeprecatedTextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
+    } else {
+      MOZ_CRASH("Unsupported. this should not be reached");
     }
     break;
   case TEXTURE_CONTENT:
 #ifdef XP_WIN
     if (parentBackend == LayersBackend::LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
       result = new DeprecatedTextureClientD3D11(GetForwarder(), GetTextureInfo());
       break;
     }
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -134,38 +134,11 @@ StreamTextureClientOGL::InitWith(gfx::Su
 }
 
 bool
 StreamTextureClientOGL::IsAllocated() const
 {
   return mStream != 0;
 }
 
-DeprecatedTextureClientSharedOGL::DeprecatedTextureClientSharedOGL(CompositableForwarder* aForwarder,
-                                               const TextureInfo& aTextureInfo)
-  : DeprecatedTextureClient(aForwarder, aTextureInfo)
-  , mGL(nullptr)
-{
-}
-
-void
-DeprecatedTextureClientSharedOGL::ReleaseResources()
-{
-  if (!IsSurfaceDescriptorValid(mDescriptor)) {
-    return;
-  }
-  MOZ_ASSERT(mDescriptor.type() == SurfaceDescriptor::TSharedTextureDescriptor);
-  mDescriptor = SurfaceDescriptor();
-  // It's important our handle gets released! SharedDeprecatedTextureHostOGL will take
-  // care of this for us though.
-}
-
-bool
-DeprecatedTextureClientSharedOGL::EnsureAllocated(gfx::IntSize aSize,
-                                        gfxContentType aContentType)
-{
-  mSize = aSize;
-  return true;
-}
-
 
 } // namespace
 } // namespace
--- a/gfx/layers/opengl/TextureClientOGL.h
+++ b/gfx/layers/opengl/TextureClientOGL.h
@@ -96,56 +96,12 @@ public:
 
   virtual gfx::IntSize GetSize() const { return gfx::IntSize(); }
 
 protected:
   gfx::SurfaceStream* mStream;
   bool mIsLocked;
 };
 
-class DeprecatedTextureClientSharedOGL : public DeprecatedTextureClient
-{
-public:
-  DeprecatedTextureClientSharedOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo);
-  ~DeprecatedTextureClientSharedOGL() { ReleaseResources(); }
-
-  virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL; }
-  virtual bool EnsureAllocated(gfx::IntSize aSize, gfxContentType aType);
-  virtual void ReleaseResources();
-  virtual gfxContentType GetContentType() MOZ_OVERRIDE { return gfxContentType::COLOR_ALPHA; }
-
-protected:
-  gl::GLContext* mGL;
-  gfx::IntSize mSize;
-
-  friend class CompositingFactory;
-};
-
-// Doesn't own the surface descriptor, so we shouldn't delete it
-class DeprecatedTextureClientSharedOGLExternal : public DeprecatedTextureClientSharedOGL
-{
-public:
-  DeprecatedTextureClientSharedOGLExternal(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
-    : DeprecatedTextureClientSharedOGL(aForwarder, aTextureInfo)
-  {}
-
-  virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_SHARED_GL_EXTERNAL; }
-  virtual void ReleaseResources() {}
-};
-
-class DeprecatedTextureClientStreamOGL : public DeprecatedTextureClient
-{
-public:
-  DeprecatedTextureClientStreamOGL(CompositableForwarder* aForwarder, const TextureInfo& aTextureInfo)
-    : DeprecatedTextureClient(aForwarder, aTextureInfo)
-  {}
-  ~DeprecatedTextureClientStreamOGL() { ReleaseResources(); }
-
-  virtual bool SupportsType(DeprecatedTextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_STREAM_GL; }
-  virtual bool EnsureAllocated(gfx::IntSize aSize, gfxContentType aType) { return true; }
-  virtual void ReleaseResources() { mDescriptor = SurfaceDescriptor(); }
-  virtual gfxContentType GetContentType() MOZ_OVERRIDE { return gfxContentType::COLOR_ALPHA; }
-};
-
 } // namespace
 } // namespace
 
 #endif
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -58,28 +58,22 @@ CreateCompositableBackendSpecificDataOGL
 
 TemporaryRef<DeprecatedTextureHost>
 CreateDeprecatedTextureHostOGL(SurfaceDescriptorType aDescriptorType,
                      uint32_t aDeprecatedTextureHostFlags,
                      uint32_t aTextureFlags)
 {
   RefPtr<DeprecatedTextureHost> result = nullptr;
 
-  if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
-    result = new YCbCrDeprecatedTextureHostOGL();
-  } else if (aDescriptorType == SurfaceDescriptor::TSurfaceStreamDescriptor) {
-    result = new SurfaceStreamHostOGL();
-  } else if (aDescriptorType == SurfaceDescriptor::TSharedTextureDescriptor) {
-    result = new SharedDeprecatedTextureHostOGL();
+  if (aDeprecatedTextureHostFlags & TEXTURE_HOST_TILED) {
+    result = new TiledDeprecatedTextureHostOGL();
 #ifdef MOZ_WIDGET_GONK
   } else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorGralloc) {
     result = new GrallocDeprecatedTextureHostOGL();
 #endif
-  } else if (aDeprecatedTextureHostFlags & TEXTURE_HOST_TILED) {
-    result = new TiledDeprecatedTextureHostOGL();
   } else {
     result = new TextureImageDeprecatedTextureHostOGL();
   }
 
   NS_ASSERTION(result, "Result should have been created.");
 
   result->SetFlags(aTextureFlags);
   return result.forget();
@@ -129,39 +123,16 @@ CreateTextureHostOGL(const SurfaceDescri
       break;
     }
 #endif
     default: return nullptr;
   }
   return result.forget();
 }
 
-static void
-MakeTextureIfNeeded(gl::GLContext* gl, GLenum aTarget, GLuint& aTexture)
-{
-  if (aTexture != 0)
-    return;
-
-  GLenum target = aTarget;
-  // GL_TEXTURE_EXTERNAL requires us to initialize the texture
-  // using the GL_TEXTURE_2D attachment.
-  if (target == LOCAL_GL_TEXTURE_EXTERNAL) {
-    target = LOCAL_GL_TEXTURE_2D;
-  }
-
-  gl->fGenTextures(1, &aTexture);
-
-  gl->fBindTexture(target, aTexture);
-
-  gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
-  gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
-  gl->fTexParameteri(target, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
-  gl->fTexParameteri(target, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
-}
-
 static gl::TextureImage::Flags
 FlagsToGLFlags(TextureFlags aFlags)
 {
   uint32_t result = TextureImage::NoFlags;
 
   if (aFlags & TEXTURE_USE_NEAREST_FILTER)
     result |= TextureImage::UseNearestFilter;
   if (aFlags & TEXTURE_NEEDS_Y_FLIP)
@@ -789,352 +760,16 @@ TextureImageDeprecatedTextureHostOGL::Lo
     return false;
   }
 
   mFormat = mTexture->GetTextureFormat();
 
   return true;
 }
 
-void
-SharedDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
-{
-  CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
-  if (mGL && !glCompositor) {
-    DeleteTextures();
-  }
-  mGL = glCompositor ? glCompositor->gl() : nullptr;
-}
-
-void
-SharedDeprecatedTextureHostOGL::DeleteTextures()
-{
-  MOZ_ASSERT(mGL);
-  if (!mGL->MakeCurrent()) {
-    mSharedHandle = 0;
-    mTextureHandle = 0;
-    return;
-  }
-  if (mSharedHandle) {
-    ReleaseSharedHandle(mGL, mShareType, mSharedHandle);
-    mSharedHandle = 0;
-  }
-  if (mTextureHandle) {
-    mGL->fDeleteTextures(1, &mTextureHandle);
-    mTextureHandle = 0;
-  }
-}
-
-void
-SharedDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
-                                 nsIntRegion* aRegion,
-                                 nsIntPoint* aOffset)
-{
-  SwapTexturesImpl(aImage, aRegion);
-}
-
-void
-SharedDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
-                                       nsIntRegion* aRegion)
-{
-  NS_ASSERTION(aImage.type() == SurfaceDescriptor::TSharedTextureDescriptor,
-              "Invalid descriptor");
-
-  SharedTextureDescriptor texture = aImage.get_SharedTextureDescriptor();
-
-  SharedTextureHandle newHandle = texture.handle();
-  mSize = texture.size();
-  if (texture.inverted()) {
-    mFlags |= TEXTURE_NEEDS_Y_FLIP;
-  }
-
-  if (mSharedHandle && mSharedHandle != newHandle) {
-    ReleaseSharedHandle(mGL, mShareType, mSharedHandle);
-  }
-
-  mShareType = texture.shareType();
-  mSharedHandle = newHandle;
-
-  SharedHandleDetails handleDetails;
-  if (mSharedHandle && GetSharedHandleDetails(mGL, mShareType, mSharedHandle, handleDetails)) {
-    mTextureTarget = handleDetails.mTarget;
-    mFormat = handleDetails.mTextureFormat;
-  }
-}
-
-bool
-SharedDeprecatedTextureHostOGL::Lock()
-{
-  MakeTextureIfNeeded(mGL, mTextureTarget, mTextureHandle);
-
-  mGL->fActiveTexture(LOCAL_GL_TEXTURE0);
-  mGL->fBindTexture(mTextureTarget, mTextureHandle);
-  if (!AttachSharedHandle(mGL, mShareType, mSharedHandle)) {
-    NS_ERROR("Failed to bind shared texture handle");
-    return false;
-  }
-
-  return true;
-}
-
-void
-SharedDeprecatedTextureHostOGL::Unlock()
-{
-  DetachSharedHandle(mGL, mShareType, mSharedHandle);
-  mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, 0);
-}
-
-
-gfx::Matrix4x4
-SharedDeprecatedTextureHostOGL::GetTextureTransform()
-{
-  SharedHandleDetails handleDetails;
-  // GetSharedHandleDetails can call into Java which we'd
-  // rather not do from the compositor
-  if (mSharedHandle) {
-    GetSharedHandleDetails(mGL, mShareType, mSharedHandle, handleDetails);
-  }
-  return handleDetails.mTextureTransform;
-}
-
-
-void
-SurfaceStreamHostOGL::SetCompositor(Compositor* aCompositor)
-{
-  CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
-  if (mGL && !glCompositor) {
-    DeleteTextures();
-  }
-  mGL = glCompositor ? glCompositor->gl() : nullptr;
-}
-
-void
-SurfaceStreamHostOGL::DeleteTextures()
-{
-  if (mUploadTexture) {
-    MOZ_ASSERT(mGL);
-    if (mGL->MakeCurrent()) {
-      mGL->fDeleteTextures(1, &mUploadTexture);
-    }
-    mUploadTexture = 0;
-    mTextureHandle = 0;
-  }
-}
-
-void
-SurfaceStreamHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
-                                 nsIntRegion* aRegion,
-                                 nsIntPoint* aOffset)
-{
-  MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceStreamDescriptor,
-             "Invalid descriptor");
-
-  // Bug 894405
-  //
-  // The SurfaceStream's GLContext was refed before being passed up to us, so
-  // we need to ensure it gets unrefed when we are finished.
-  const SurfaceStreamDescriptor& streamDesc =
-      aImage.get_SurfaceStreamDescriptor();
-
-
-  mStream = SurfaceStream::FromHandle(streamDesc.handle());
-  MOZ_ASSERT(mStream);
-  mStreamGL = dont_AddRef(mStream->GLContext());
-}
-
-void
-SurfaceStreamHostOGL::Unlock()
-{
-  // We don't know what this is unless we're locked
-  mFormat = gfx::SurfaceFormat::UNKNOWN;
-}
-
-bool
-SurfaceStreamHostOGL::Lock()
-{
-  if (!mGL->MakeCurrent()) {
-    return false;
-  }
-
-  SharedSurface* sharedSurf = mStream->SwapConsumer();
-  if (!sharedSurf) {
-    // We don't have a valid surf to show yet.
-    return false;
-  }
-
-  mGL->MakeCurrent();
-
-  mSize = IntSize(sharedSurf->Size().width, sharedSurf->Size().height);
-
-  DataSourceSurface* toUpload = nullptr;
-  switch (sharedSurf->Type()) {
-    case SharedSurfaceType::GLTextureShare: {
-      SharedSurface_GLTexture* glTexSurf = SharedSurface_GLTexture::Cast(sharedSurf);
-      glTexSurf->SetConsumerGL(mGL);
-      mTextureHandle = glTexSurf->Texture();
-      mTextureTarget = glTexSurf->TextureTarget();
-      MOZ_ASSERT(mTextureHandle);
-      mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
-                                       : SurfaceFormat::R8G8B8X8;
-      break;
-    }
-    case SharedSurfaceType::EGLImageShare: {
-      SharedSurface_EGLImage* eglImageSurf =
-          SharedSurface_EGLImage::Cast(sharedSurf);
-
-      mTextureHandle = eglImageSurf->AcquireConsumerTexture(mGL);
-      mTextureTarget = eglImageSurf->TextureTarget();
-      if (!mTextureHandle) {
-        toUpload = eglImageSurf->GetPixels();
-        MOZ_ASSERT(toUpload);
-      } else {
-        mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
-                                         : SurfaceFormat::R8G8B8X8;
-      }
-      break;
-    }
-#ifdef XP_MACOSX
-    case SharedSurfaceType::IOSurface: {
-      SharedSurface_IOSurface* glTexSurf = SharedSurface_IOSurface::Cast(sharedSurf);
-      mTextureHandle = glTexSurf->Texture();
-      mTextureTarget = glTexSurf->TextureTarget();
-      MOZ_ASSERT(mTextureHandle);
-      mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
-                                       : SurfaceFormat::R8G8B8X8;
-      break;
-    }
-#endif
-    case SharedSurfaceType::Basic: {
-      toUpload = SharedSurface_Basic::Cast(sharedSurf)->GetData();
-      MOZ_ASSERT(toUpload);
-      break;
-    }
-    default:
-      MOZ_CRASH("Invalid SharedSurface type.");
-  }
-
-  if (toUpload) {
-    // mBounds seems to end up as (0,0,0,0) a lot, so don't use it?
-    nsIntSize size(ThebesIntSize(toUpload->GetSize()));
-    nsIntRect rect(nsIntPoint(0,0), size);
-    nsIntRegion bounds(rect);
-    mFormat = UploadSurfaceToTexture(mGL,
-                                     toUpload,
-                                     bounds,
-                                     mUploadTexture,
-                                     true);
-    mTextureHandle = mUploadTexture;
-    mTextureTarget = LOCAL_GL_TEXTURE_2D;
-  }
-
-  MOZ_ASSERT(mTextureHandle);
-  mGL->fBindTexture(mTextureTarget, mTextureHandle);
-  mGL->fTexParameteri(mTextureTarget,
-                      LOCAL_GL_TEXTURE_WRAP_S,
-                      LOCAL_GL_CLAMP_TO_EDGE);
-  mGL->fTexParameteri(mTextureTarget,
-                      LOCAL_GL_TEXTURE_WRAP_T,
-                      LOCAL_GL_CLAMP_TO_EDGE);
-  return true;
-}
-
-void
-SurfaceStreamHostOGL::BindTexture(GLenum activetex)
-{
-  MOZ_ASSERT(mGL);
-  mGL->fActiveTexture(activetex);
-  mGL->fBindTexture(mTextureTarget, mTextureHandle);
-}
-
-
-void
-YCbCrDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
-{
-  CompositorOGL* glCompositor = static_cast<CompositorOGL*>(aCompositor);
-  GLContext* newGL = glCompositor ? glCompositor->gl() : nullptr;
-  if (mGL != newGL) {
-    mGL = newGL;
-    mYTexture->mTexImage = nullptr;
-    mCbTexture->mTexImage = nullptr;
-    mCrTexture->mTexImage = nullptr;
-    // if we have a buffer we reupload it with the new gl context
-    if (newGL && mBuffer && mBuffer->type() == SurfaceDescriptor::TYCbCrImage) {
-      UpdateImpl(*mBuffer);
-    }
-  }
-}
-
-void
-YCbCrDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
-                                nsIntRegion* aRegion,
-                                nsIntPoint* aOffset)
-{
-  if (!mGL) {
-    return;
-  }
-  NS_ASSERTION(aImage.type() == SurfaceDescriptor::TYCbCrImage, "SurfaceDescriptor mismatch");
-
-  YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
-
-  gfx::IntSize gfxSize = deserializer.GetYSize();
-  gfx::IntSize gfxCbCrSize = deserializer.GetCbCrSize();
-
-  if (!mYTexture->mTexImage || mYTexture->mTexImage->GetSize() != gfxSize) {
-    mYTexture->mTexImage = CreateBasicTextureImage(mGL,
-                                                   gfxSize,
-                                                   gfxContentType::ALPHA,
-                                                   WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
-                                                   FlagsToGLFlags(mFlags));
-  }
-  if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize) {
-    mCbTexture->mTexImage = CreateBasicTextureImage(mGL,
-                                                    gfxCbCrSize,
-                                                    gfxContentType::ALPHA,
-                                                    WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
-                                                    FlagsToGLFlags(mFlags));
-  }
-  if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize) {
-    mCrTexture->mTexImage = CreateBasicTextureImage(mGL,
-                                                    gfxCbCrSize,
-                                                    gfxContentType::ALPHA,
-                                                    WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
-                                                    FlagsToGLFlags(mFlags));
-  }
-
-  RefPtr<gfxImageSurface> tempY =
-    new gfxImageSurface(deserializer.GetYData(),
-                        gfx::ThebesIntSize(gfxSize),
-                        deserializer.GetYStride(),
-                        gfxImageFormat::A8);
-  RefPtr<gfxImageSurface> tempCb =
-    new gfxImageSurface(deserializer.GetCbData(),
-                        gfx::ThebesIntSize(gfxCbCrSize),
-                        deserializer.GetCbCrStride(),
-                        gfxImageFormat::A8);
-  RefPtr<gfxImageSurface> tempCr =
-    new gfxImageSurface(deserializer.GetCrData(),
-                        gfx::ThebesIntSize(gfxCbCrSize),
-                        deserializer.GetCbCrStride(),
-                        gfxImageFormat::A8);
-
-  nsIntRegion yRegion(nsIntRect(0, 0, gfxSize.width, gfxSize.height));
-  nsIntRegion cbCrRegion(nsIntRect(0, 0, gfxCbCrSize.width, gfxCbCrSize.height));
-
-  mYTexture->mTexImage->DirectUpdate(tempY, yRegion);
-  mCbTexture->mTexImage->DirectUpdate(tempCb, cbCrRegion);
-  mCrTexture->mTexImage->DirectUpdate(tempCr, cbCrRegion);
-}
-
-bool
-YCbCrDeprecatedTextureHostOGL::Lock()
-{
-  return true;
-}
-
-
 TiledDeprecatedTextureHostOGL::~TiledDeprecatedTextureHostOGL()
 {
   DeleteTextures();
 }
 
 void
 TiledDeprecatedTextureHostOGL::BindTexture(GLenum aTextureUnit)
 {
@@ -1533,41 +1168,16 @@ TextureImageDeprecatedTextureHostOGL::Ge
   RefPtr<gfx::DataSourceSurface> surf =
     IsValid() ? ReadBackSurface(mGL, mTexture->GetTextureID(),
                                 false, mTexture->GetTextureFormat())
               : nullptr;
   return surf.forget();
 }
 
 TemporaryRef<gfx::DataSourceSurface>
-YCbCrDeprecatedTextureHostOGL::GetAsSurface() {
-  RefPtr<gfx::DataSourceSurface> surf =
-    IsValid() ? ReadBackSurface(mGL, mYTexture->mTexImage->GetTextureID(),
-                                false, mYTexture->mTexImage->GetTextureFormat())
-              : nullptr;
-  return surf.forget();
-}
-
-TemporaryRef<gfx::DataSourceSurface>
-SharedDeprecatedTextureHostOGL::GetAsSurface() {
-  RefPtr<gfx::DataSourceSurface> surf =
-    IsValid() ? ReadBackSurface(mGL, GetTextureHandle(), false, GetFormat())
-              : nullptr;
-  return surf.forget();
-}
-
-TemporaryRef<gfx::DataSourceSurface>
-SurfaceStreamHostOGL::GetAsSurface() {
-  RefPtr<gfx::DataSourceSurface> surf =
-    IsValid() ? ReadBackSurface(mGL, mTextureHandle, false, GetFormat())
-              : nullptr;
-  return surf.forget();
-}
-
-TemporaryRef<gfx::DataSourceSurface>
 TiledDeprecatedTextureHostOGL::GetAsSurface() {
   RefPtr<DataSourceSurface> surf =
     IsValid() ? ReadBackSurface(mGL, mTextureHandle, false, GetFormat())
               : nullptr;
   return surf.forget();
 }
 
 #ifdef MOZ_WIDGET_GONK
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -556,304 +556,16 @@ public:
   virtual const char* Name() { return "TextureImageDeprecatedTextureHostOGL"; }
 
 protected:
   nsRefPtr<gl::TextureImage> mTexture;
   gl::GLContext* mGL;
   bool mIterating;
 };
 
-/**
- * DeprecatedTextureHost implementation for YCbCr images in the OpenGL backend.
- *
- * This DeprecatedTextureHost is a little bit particular in that it implements
- * the TextureSource interface, as it is required that a DeprecatedTextureHost
- * provides access to a TextureSource, but does not implement the
- * DeprecatedTextureHostOGL interface. Instead it contains 3 channels (one per
- * plane) that implement the TextureSourceOGL interface, and
- * YCbCrDeprecatedTextureHostOGL's TextureSource implementation provide access
- * to these channels with the GetSubSource method.
- */
-class YCbCrDeprecatedTextureHostOGL : public DeprecatedTextureHost
-{
-public:
-  YCbCrDeprecatedTextureHostOGL()
-    : mGL(nullptr)
-  {
-    MOZ_COUNT_CTOR(YCbCrDeprecatedTextureHostOGL);
-    mYTexture  = new Channel;
-    mCbTexture = new Channel;
-    mCrTexture = new Channel;
-    mFormat = gfx::SurfaceFormat::YUV;
-  }
-
-  ~YCbCrDeprecatedTextureHostOGL()
-  {
-    MOZ_COUNT_DTOR(YCbCrDeprecatedTextureHostOGL);
-  }
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-  virtual void UpdateImpl(const SurfaceDescriptor& aImage,
-                          nsIntRegion* aRegion = nullptr,
-                          nsIntPoint* aOffset = nullptr) MOZ_OVERRIDE;
-
-  virtual bool Lock() MOZ_OVERRIDE;
-
-  virtual bool IsValid() const MOZ_OVERRIDE
-  {
-    return mYTexture->IsValid()
-        && mCbTexture->IsValid()
-        && mCrTexture->IsValid();
-  }
-
-  struct Channel : public TextureSourceOGL
-                 , public TextureSource
-  {
-    TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE
-    {
-      return this;
-    }
-    nsRefPtr<gl::TextureImage> mTexImage;
-
-    void BindTexture(GLenum aUnit) MOZ_OVERRIDE
-    {
-      mTexImage->BindTexture(aUnit);
-    }
-    virtual bool IsValid() const MOZ_OVERRIDE
-    {
-      return !!mTexImage;
-    }
-    virtual gfx::IntSize GetSize() const MOZ_OVERRIDE
-    {
-      return gfx::IntSize(mTexImage->GetSize().width, mTexImage->GetSize().height);
-    }
-    virtual GLenum GetWrapMode() const MOZ_OVERRIDE
-    {
-      return mTexImage->GetWrapMode();
-    }
-    virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
-    {
-      return gfx::SurfaceFormat::A8;
-    }
-  };
-
-  // TextureSource implementation
-
-  TextureSource* GetSubSource(int index) MOZ_OVERRIDE
-  {
-    switch (index) {
-      case 0 : return mYTexture.get();
-      case 1 : return mCbTexture.get();
-      case 2 : return mCrTexture.get();
-    }
-    return nullptr;
-  }
-
-  gfx::IntSize GetSize() const MOZ_OVERRIDE
-  {
-    if (!mYTexture->mTexImage) {
-      NS_WARNING("YCbCrDeprecatedTextureHost::GetSize called but no data has been set yet");
-      return gfx::IntSize(0,0);
-    }
-    return mYTexture->GetSize();
-  }
-
-  virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
-
-  virtual const char* Name() { return "YCbCrDeprecatedTextureHostOGL"; }
-
-private:
-  RefPtr<Channel> mYTexture;
-  RefPtr<Channel> mCbTexture;
-  RefPtr<Channel> mCrTexture;
-  gl::GLContext* mGL;
-};
-
-
-class SharedDeprecatedTextureHostOGL : public DeprecatedTextureHost
-                           , public TextureSourceOGL
-{
-public:
-  typedef gfxContentType ContentType;
-  typedef mozilla::gl::GLContext GLContext;
-  typedef mozilla::gl::TextureImage TextureImage;
-
-  SharedDeprecatedTextureHostOGL()
-    : mGL(nullptr)
-    , mTextureHandle(0)
-    , mWrapMode(LOCAL_GL_CLAMP_TO_EDGE)
-    , mSharedHandle(0)
-    , mShareType(gl::SharedTextureShareType::SameProcess)
-  {}
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-  virtual ~SharedDeprecatedTextureHostOGL()
-  {
-    if (mSharedHandle || mTextureHandle) {
-      DeleteTextures();
-    }
-  }
-
-  virtual GLuint GetTextureHandle()
-  {
-    return mTextureHandle;
-  }
-
-  virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
-  {
-    return DeprecatedTextureHost::GetFormat();
-  }
-
-  virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
-
-  bool IsValid() const MOZ_OVERRIDE { return !!mSharedHandle; }
-
-  // override from DeprecatedTextureHost, we support both buffered
-  // and unbuffered operation.
-  virtual void UpdateImpl(const SurfaceDescriptor& aImage,
-                          nsIntRegion* aRegion = nullptr,
-                          nsIntPoint* aOffset = nullptr) MOZ_OVERRIDE;
-  virtual void SwapTexturesImpl(const SurfaceDescriptor& aImage,
-                                nsIntRegion* aRegion = nullptr) MOZ_OVERRIDE;
-  virtual bool Lock() MOZ_OVERRIDE;
-  virtual void Unlock() MOZ_OVERRIDE;
-
-  virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
-  virtual void SetWrapMode(GLenum aMode) { mWrapMode = aMode; }
-
-  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE
-  {
-    return mTextureTarget;
-  }
-
-  gfx::IntSize GetSize() const MOZ_OVERRIDE {
-    return mSize;
-  }
-
-  void BindTexture(GLenum activetex) MOZ_OVERRIDE
-  {
-    MOZ_ASSERT(mGL);
-    // Lock already bound us!
-    MOZ_ASSERT(activetex == LOCAL_GL_TEXTURE0);
-  }
-  GLuint GetTextureID() { return mTextureHandle; }
-  ContentType GetContentType()
-  {
-    return (mFormat == gfx::SurfaceFormat::B8G8R8A8) ?
-             gfxContentType::COLOR_ALPHA :
-             gfxContentType::COLOR;
-  }
-
-  virtual gfx::Matrix4x4 GetTextureTransform() MOZ_OVERRIDE;
-
-  virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
-
-  virtual const char* Name() { return "SharedDeprecatedTextureHostOGL"; }
-
-protected:
-  void DeleteTextures();
-
-  gfx::IntSize mSize;
-  nsRefPtr<gl::GLContext> mGL;
-  GLuint mTextureHandle;
-  GLenum mWrapMode;
-  GLenum mTextureTarget;
-  gl::SharedTextureHandle mSharedHandle;
-  gl::SharedTextureShareType mShareType;
-};
-
-class SurfaceStreamHostOGL : public DeprecatedTextureHost
-                           , public TextureSourceOGL
-{
-public:
-  typedef gfxContentType ContentType;
-  typedef mozilla::gl::GLContext GLContext;
-  typedef mozilla::gl::TextureImage TextureImage;
-
-  virtual ~SurfaceStreamHostOGL()
-  {
-    DeleteTextures();
-  }
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-  virtual GLuint GetTextureHandle()
-  {
-    return mTextureHandle;
-  }
-
-  virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
-  {
-    return DeprecatedTextureHost::GetFormat();
-  }
-
-  virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
-
-  bool IsValid() const MOZ_OVERRIDE { return true; }
-
-  // override from DeprecatedTextureHost
-  virtual void UpdateImpl(const SurfaceDescriptor& aImage,
-                          nsIntRegion* aRegion,
-                          nsIntPoint* aOffset);
-  virtual bool Lock() MOZ_OVERRIDE;
-  virtual void Unlock() MOZ_OVERRIDE;
-
-  virtual GLenum GetWrapMode() const MOZ_OVERRIDE {
-    return mWrapMode;
-  }
-  virtual void SetWrapMode(GLenum aMode) {
-    mWrapMode = aMode;
-  }
-
-  gfx::IntSize GetSize() const MOZ_OVERRIDE {
-    return mSize;
-  }
-
-  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE
-  {
-    return mTextureTarget;
-  }
-
-  void BindTexture(GLenum activetex) MOZ_OVERRIDE;
-
-  GLuint GetTextureID() { return mTextureHandle; }
-  ContentType GetContentType() {
-    return (mFormat == gfx::SurfaceFormat::B8G8R8A8) ?
-             gfxContentType::COLOR_ALPHA :
-             gfxContentType::COLOR;
-  }
-
-  virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
-
-  virtual const char* Name() { return "SurfaceStreamHostOGL"; }
-
-  SurfaceStreamHostOGL()
-    : mGL(nullptr)
-    , mTextureHandle(0)
-    , mTextureTarget(LOCAL_GL_TEXTURE_2D)
-    , mUploadTexture(0)
-    , mWrapMode(LOCAL_GL_CLAMP_TO_EDGE)
-    , mStream(nullptr)
-  {}
-
-protected:
-  void DeleteTextures();
-
-  gfx::IntSize mSize;
-  nsRefPtr<GLContext> mGL;
-  GLuint mTextureHandle;
-  GLenum mTextureTarget;
-  GLuint mUploadTexture;
-  GLenum mWrapMode;
-  nsRefPtr<GLContext> mStreamGL;
-  gfx::SurfaceStream *mStream;
-};
-
 class TiledDeprecatedTextureHostOGL : public DeprecatedTextureHost
                           , public TextureSourceOGL
 {
 public:
   TiledDeprecatedTextureHostOGL()
     : mTextureHandle(0)
     , mGL(nullptr)
   {}
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -4087,40 +4087,37 @@ pref("layers.scroll-graph", false);
 // Set the default values, and then override per-platform as needed
 pref("layers.offmainthreadcomposition.enabled", false);
 // Compositor target frame rate. NOTE: If vsync is enabled the compositor
 // frame rate will still be capped.
 // -1 -> default (match layout.frame_rate or 60 FPS)
 // 0  -> full-tilt mode: Recomposite even if not transaction occured.
 pref("layers.offmainthreadcomposition.frame-rate", -1);
 // Whether to use the deprecated texture architecture rather than the new one.
-pref("layers.use-deprecated-textures", true);
 #ifndef XP_WIN
 // Asynchonous video compositing using the ImageBridge IPDL protocol.
 // requires off-main-thread compositing.
 // Never works on Windows, so no point pref'ing it on.
 pref("layers.async-video.enabled",false);
+pref("layers.use-deprecated-textures", true);
 #endif
 
 #ifdef MOZ_X11
 // OMTC off by default on Linux, but if activated, use new textures and async-video.
-pref("layers.use-deprecated-textures", false);
 pref("layers.async-video.enabled", true);
 #endif
 
 #ifdef XP_MACOSX
 pref("layers.offmainthreadcomposition.enabled", true);
-pref("layers.use-deprecated-textures", false);
 pref("layers.async-video.enabled",true);
 #endif
 
 // ANDROID covers android and b2g
 #ifdef ANDROID
 pref("layers.offmainthreadcomposition.enabled", true);
-pref("layers.use-deprecated-textures", false);
 pref("layers.async-video.enabled",true);
 #endif
 
 // same effect as layers.offmainthreadcomposition.enabled, but specifically for
 // use with tests.
 pref("layers.offmainthreadcomposition.testing.enabled", false);
 
 // whether to allow use of the basic compositor