Bug 991028 - Get rid of OpenDescriptor/CloseDescriptor. r=nical
☠☠ backed out by 2579095d0f7e ☠ ☠
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 07 Apr 2014 13:32:49 +1200
changeset 195720 e5bacc566e58d5c74d0fd31e61335a13ba8676ee
parent 195719 6dc852777a4d92685e2d98d7a0505d36bb277700
child 195721 147581a518c343e509531cb608567758868cc3bd
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs991028
milestone31.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 991028 - Get rid of OpenDescriptor/CloseDescriptor. r=nical
gfx/layers/client/ContentClient.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/layers/ipc/ISurfaceAllocator.cpp
gfx/layers/ipc/ISurfaceAllocator.h
gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
gfx/layers/ipc/ShadowLayerUtilsMac.cpp
gfx/layers/ipc/ShadowLayerUtilsX11.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -836,29 +836,25 @@ ContentClientIncremental::BorrowDrawTarg
 }
 
 void
 ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
                                   const nsIntRegion& aVisibleRegion,
                                   bool aDidSelfCopy)
 {
   if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
-    ShadowLayerForwarder::CloseDescriptor(mUpdateDescriptor);
-
     mForwarder->UpdateTextureIncremental(this,
                                          TextureFront,
                                          mUpdateDescriptor,
                                          aRegionToDraw,
                                          mBufferRect,
                                          mBufferRotation);
     mUpdateDescriptor = SurfaceDescriptor();
   }
   if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
-    ShadowLayerForwarder::CloseDescriptor(mUpdateDescriptorOnWhite);
-
     mForwarder->UpdateTextureIncremental(this,
                                          TextureOnWhiteFront,
                                          mUpdateDescriptorOnWhite,
                                          aRegionToDraw,
                                          mBufferRect,
                                          mBufferRotation);
     mUpdateDescriptorOnWhite = SurfaceDescriptor();
   }
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -211,18 +211,16 @@ public:
     mInvalidRegion.Or(mInvalidRegion, aRegion);
   }
 
   Compositor* GetCompositor() const
   {
     return mCompositor;
   }
 
-  bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
-
   /**
    * LayerManagerComposite provides sophisticated debug overlays
    * that can request a next frame.
    */
   bool DebugOverlayWantsNextFrame() { return mDebugOverlayWantsNextFrame; }
   void SetDebugOverlayWantsNextFrame(bool aVal)
   { mDebugOverlayWantsNextFrame = aVal; }
 
--- a/gfx/layers/ipc/ISurfaceAllocator.cpp
+++ b/gfx/layers/ipc/ISurfaceAllocator.cpp
@@ -124,25 +124,16 @@ ISurfaceAllocator::AllocSurfaceDescripto
 }
 
 bool
 ISurfaceAllocator::AllocSurfaceDescriptorWithCaps(const gfx::IntSize& aSize,
                                                   gfxContentType aContent,
                                                   uint32_t aCaps,
                                                   SurfaceDescriptor* aBuffer)
 {
-  bool tryPlatformSurface = true;
-#ifdef DEBUG
-  tryPlatformSurface = !PR_GetEnv("MOZ_LAYERS_FORCE_SHMEM_SURFACES");
-#endif
-  if (tryPlatformSurface &&
-      PlatformAllocSurfaceDescriptor(aSize, aContent, aCaps, aBuffer)) {
-    return true;
-  }
-
   if (XRE_GetProcessType() == GeckoProcessType_Default) {
     gfxImageFormat format =
       gfxPlatform::GetPlatform()->OptimalFormatForContent(aContent);
     int32_t stride = gfxASurface::FormatStrideForWidth(format, aSize.width);
     uint8_t *data = new (std::nothrow) uint8_t[stride * aSize.height];
     if (!data) {
       return false;
     }
@@ -181,19 +172,16 @@ ISurfaceAllocator::DestroySharedSurface(
 {
   MOZ_ASSERT(aSurface);
   if (!aSurface) {
     return;
   }
   if (!IPCOpen()) {
     return;
   }
-  if (PlatformDestroySharedSurface(aSurface)) {
-    return;
-  }
   switch (aSurface->type()) {
     case SurfaceDescriptor::TShmem:
       DeallocShmem(aSurface->get_Shmem());
       break;
     case SurfaceDescriptor::TYCbCrImage:
       DeallocShmem(aSurface->get_YCbCrImage().data());
       break;
     case SurfaceDescriptor::TRGBImage:
@@ -211,27 +199,16 @@ ISurfaceAllocator::DestroySharedSurface(
     case SurfaceDescriptor::T__None:
       break;
     default:
       NS_RUNTIMEABORT("surface type not implemented!");
   }
   *aSurface = SurfaceDescriptor();
 }
 
-#if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
-bool
-ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize&,
-                                                  gfxContentType,
-                                                  uint32_t,
-                                                  SurfaceDescriptor*)
-{
-  return false;
-}
-#endif
-
 // XXX - We should actually figure out the minimum shmem allocation size on
 // a certain platform and use that.
 const uint32_t sShmemPageSize = 4096;
 const uint32_t sSupportedBlockSize = 4;
 
 enum AllocationStatus
 {
   STATUS_ALLOCATED,
--- a/gfx/layers/ipc/ISurfaceAllocator.h
+++ b/gfx/layers/ipc/ISurfaceAllocator.h
@@ -175,22 +175,16 @@ public:
   virtual bool IsSameProcess() const = 0;
 
   // Returns true if aSurface wraps a Shmem.
   static bool IsShmem(SurfaceDescriptor* aSurface);
 
 protected:
 
   virtual bool IsOnCompositorSide() const = 0;
-  bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
-  virtual bool PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
-                                              gfxContentType aContent,
-                                              uint32_t aCaps,
-                                              SurfaceDescriptor* aBuffer);
-
 
   virtual ~ISurfaceAllocator();
 
   void ShrinkShmemSectionHeap();
 
   // This is used to implement an extremely simple & naive heap allocator.
   std::vector<mozilla::ipc::Shmem> mUsedShmems;
 
--- a/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp
@@ -13,87 +13,22 @@
 #include "mozilla/layers/PLayerTransaction.h"
 #include "ShadowLayers.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
-// Platform-specific shadow-layers interfaces.  See ShadowLayers.h.
-// D3D10 doesn't need all these yet.
-bool
-ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize&,
-                                                  gfxContentType,
-                                                  uint32_t,
-                                                  SurfaceDescriptor*)
-{
-  return false;
-}
-
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode,
-                                             const SurfaceDescriptor&)
-{
-  return nullptr;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor&)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfxContentType*,
-  gfxASurface**)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfx::IntSize*,
-  gfxASurface**)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfxImageFormat*,
-  gfxASurface**)
-{
-  return false;
-}
-
-bool
-ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return false;
-}
 
 /*static*/ void
 ShadowLayerForwarder::PlatformSyncBeforeUpdate()
 {
 }
 
-bool
-ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return false;
-}
-
 /*static*/ bool
 LayerManagerComposite::SupportsDirectTexturing()
 {
   return true;
 }
 
 /*static*/ void
 LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
--- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp
@@ -337,39 +337,16 @@ LayerManagerComposite::SupportsDirectTex
 }
 
 /*static*/ void
 LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
 {
   // Nothing to be done for gralloc.
 }
 
-bool
-ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aSurface->type()) {
-    return false;
-  }
-
-  // we should have either a bufferParent or bufferChild
-  // depending on whether we're on the parent or child side.
-  PGrallocBufferParent* gbp =
-    aSurface->get_SurfaceDescriptorGralloc().bufferParent();
-  if (gbp) {
-    unused << PGrallocBufferParent::Send__delete__(gbp);
-  } else {
-    PGrallocBufferChild* gbc =
-      aSurface->get_SurfaceDescriptorGralloc().bufferChild();
-    DeallocGrallocBuffer(gbc);
-  }
-
-  *aSurface = SurfaceDescriptor();
-  return true;
-}
-
 //-----------------------------------------------------------------------------
 // Child process
 
 /*static*/ PGrallocBufferChild*
 GrallocBufferActor::Create()
 {
   return new GrallocBufferActor();
 }
@@ -394,84 +371,16 @@ ShadowLayerForwarder::AllocGrallocBuffer
 
 void
 ShadowLayerForwarder::DeallocGrallocBuffer(PGrallocBufferChild* aChild)
 {
   MOZ_ASSERT(aChild);
   PGrallocBufferChild::Send__delete__(aChild);
 }
 
-bool
-ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
-                                                  gfxContentType aContent,
-                                                  uint32_t aCaps,
-                                                  SurfaceDescriptor* aBuffer)
-{
-
-  if (aSize.width <= 0 || aSize.height <= 0) {
-    return false;
-  }
-#if ANDROID_VERSION <= 15
-  // Adreno 200 fails to render gralloc textures with width < 64
-  // or with height < 32.
-  if (aSize.width < 64 || aSize.height < 32) {
-    return false;
-  }
-#endif
-  PROFILER_LABEL("ShadowLayerForwarder", "PlatformAllocSurfaceDescriptor");
-  // Gralloc buffers are efficiently mappable as gfxImageSurface, so
-  // no need to check |aCaps & MAP_AS_IMAGE_SURFACE|.
-  MaybeMagicGrallocBufferHandle handle;
-  PGrallocBufferChild* gc;
-  bool defaultRBSwap;
-
-  if (PixelFormatForContentType(aContent) == android::PIXEL_FORMAT_UNKNOWN) {
-    return false;
-  }
-
-  if (aCaps & USING_GL_RENDERING_ONLY) {
-    gc = AllocGrallocBuffer(aSize,
-                            PixelFormatForContentType(aContent),
-                            GraphicBuffer::USAGE_HW_RENDER |
-                            GraphicBuffer::USAGE_HW_TEXTURE,
-                            &handle);
-    // If you're allocating for USING_GL_RENDERING_ONLY, then we don't flag
-    // this for RB swap.
-    defaultRBSwap = false;
-  } else {
-    gc = AllocGrallocBuffer(aSize,
-                            PixelFormatForContentType(aContent),
-                            GraphicBuffer::USAGE_SW_READ_OFTEN |
-                            GraphicBuffer::USAGE_SW_WRITE_OFTEN |
-                            GraphicBuffer::USAGE_HW_TEXTURE,
-                            &handle);
-    // But if you're allocating for non-GL-only rendering, we flag for
-    // RB swap to preserve old behaviour and proper interaction with
-    // cairo.
-    defaultRBSwap = true;
-  }
-
-  if (!gc) {
-    NS_ERROR("GrallocBufferConstructor failed by returned null");
-    return false;
-  } else if (handle.Tnull_t == handle.type()) {
-    NS_ERROR("GrallocBufferConstructor failed by returning handle with type Tnull_t");
-    PGrallocBufferChild::Send__delete__(gc);
-    return false;
-  }
-
-  GrallocBufferActor* gba = static_cast<GrallocBufferActor*>(gc);
-  gba->InitFromHandle(handle.get_MagicGrallocBufferHandle());
-
-  *aBuffer = SurfaceDescriptorGralloc(nullptr, gc, aSize,
-                                      /* external */ false,
-                                      defaultRBSwap);
-  return true;
-}
-
 //-----------------------------------------------------------------------------
 // Both processes
 
 /*static*/ sp<GraphicBuffer>
 GrallocBufferActor::GetFrom(const SurfaceDescriptorGralloc& aDescriptor)
 {
   GrallocBufferActor* gba = nullptr;
   if (PGrallocBufferChild* child = aDescriptor.bufferChild()) {
@@ -483,127 +392,16 @@ GrallocBufferActor::GetFrom(const Surfac
 }
 
 android::GraphicBuffer*
 GrallocBufferActor::GetGraphicBuffer()
 {
   return mGraphicBuffer.get();
 }
 
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode aMode,
-                                             const SurfaceDescriptor& aSurface)
-{
-  PROFILER_LABEL("ShadowLayerForwarder", "PlatformOpenDescriptor");
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aSurface.type()) {
-    return nullptr;
-  }
-
-  sp<GraphicBuffer> buffer =
-    GrallocBufferActor::GetFrom(aSurface.get_SurfaceDescriptorGralloc());
-  uint32_t usage = GRALLOC_USAGE_SW_READ_OFTEN;
-  if (OPEN_READ_WRITE == aMode) {
-    usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
-  }
-  void *vaddr;
-  DebugOnly<status_t> status = buffer->lock(usage, &vaddr);
-  // If we fail to lock, we'll just end up aborting anyway.
-  MOZ_ASSERT(status == OK);
-
-  gfx::IntSize size = aSurface.get_SurfaceDescriptorGralloc().size();
-  gfxImageFormat format = ImageFormatForPixelFormat(buffer->getPixelFormat());
-  long pixelStride = buffer->getStride();
-  long byteStride = pixelStride * gfxASurface::BytePerPixelFromFormat(format);
-
-  nsRefPtr<gfxASurface> surf =
-    new gfxImageSurface((unsigned char*)vaddr,
-                        gfx::ThebesIntSize(size),
-                        byteStride,
-                        format);
-  return surf->CairoStatus() ? nullptr : surf.forget();
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfxContentType* aContent,
-  gfxASurface** aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
-    return false;
-  }
-
-  sp<GraphicBuffer> buffer =
-    GrallocBufferActor::GetFrom(aDescriptor.get_SurfaceDescriptorGralloc());
-  *aContent = ContentTypeFromPixelFormat(buffer->getPixelFormat());
-  return true;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfx::IntSize* aSize,
-  gfxASurface** aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
-    return false;
-  }
-
-  sp<GraphicBuffer> buffer =
-    GrallocBufferActor::GetFrom(aDescriptor.get_SurfaceDescriptorGralloc());
-  *aSize = aDescriptor.get_SurfaceDescriptorGralloc().size();
-  return true;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
-  const SurfaceDescriptor& aDescriptor,
-  OpenMode aMode,
-  gfxImageFormat* aImageFormat,
-  gfxASurface** aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
-    return false;
-  }
-
-  sp<GraphicBuffer> buffer =
-    GrallocBufferActor::GetFrom(aDescriptor.get_SurfaceDescriptorGralloc());
-  *aImageFormat = ImageFormatForPixelFormat(buffer->getPixelFormat());
-  return true;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aSurface->type()) {
-    return false;
-  }
-
-  PGrallocBufferChild* gbp =
-    aSurface->get_SurfaceDescriptorGralloc().bufferChild();
-  PGrallocBufferChild::Send__delete__(gbp);
-  *aSurface = SurfaceDescriptor();
-  return true;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor& aDescriptor)
-{
-  PROFILER_LABEL("ShadowLayerForwarder", "PlatformCloseDescriptor");
-  if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
-    return false;
-  }
-
-  sp<GraphicBuffer> buffer = GrallocBufferActor::GetFrom(aDescriptor);
-  DebugOnly<status_t> status = buffer->unlock();
-  // If we fail to unlock, we'll subsequently fail to lock and end up aborting anyway.
-  MOZ_ASSERT(status == OK);
-  return true;
-}
-
 /*static*/ void
 ShadowLayerForwarder::PlatformSyncBeforeUpdate()
 {
   // Nothing to be done for gralloc.
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ShadowLayerUtilsMac.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsMac.cpp
@@ -16,103 +16,26 @@
 
 #include "gfxSharedQuartzSurface.h"
 
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
-bool
-ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
-                                                  gfxContentType aContent,
-                                                  uint32_t aCaps,
-                                                  SurfaceDescriptor* aBuffer)
-{
-  return false;
-}
-
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode aMode,
-                                             const SurfaceDescriptor& aSurface)
-{
-  if (aSurface.type() == SurfaceDescriptor::TShmem) {
-    return gfxSharedQuartzSurface::Open(aSurface.get_Shmem());
-  } else if (aSurface.type() == SurfaceDescriptor::TMemoryImage) {
-    const MemoryImage& image = aSurface.get_MemoryImage();
-    gfxImageFormat format
-      = static_cast<gfxImageFormat>(image.format());
-
-    nsRefPtr<gfxASurface> surf =
-      new gfxQuartzSurface((unsigned char*)image.data(),
-                           gfx::ThebesIntSize(image.size()),
-                           image.stride(),
-                           format);
-    return surf.forget();
-
-  }
-  return nullptr;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor& aDescriptor)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfxContentType* aContent,
-  gfxASurface** aSurface)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfx::IntSize* aSize,
-  gfxASurface** aSurface)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfxImageFormat*,
-  gfxASurface**)
-{
-  return false;
-}
-
-bool
-ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
-{
-  return false;
-}
-
 /*static*/ void
 ShadowLayerForwarder::PlatformSyncBeforeUpdate()
 {
 }
 
 /*static*/ void
 LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
 {
 }
 
-bool
-ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return false;
-}
-
 /*static*/ bool
 LayerManagerComposite::SupportsDirectTexturing()
 {
   return false;
 }
 
 
 } // namespace layers
--- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
@@ -58,27 +58,16 @@ UsingXCompositing()
 static XRenderPictFormat*
 GetXRenderPictFormatFromId(Display* aDisplay, PictFormat aFormatId)
 {
   XRenderPictFormat tmplate;
   tmplate.id = aFormatId;
   return XRenderFindFormat(aDisplay, PictFormatID, &tmplate, 0);
 }
 
-static bool
-TakeAndDestroyXlibSurface(SurfaceDescriptor* aSurface)
-{
-  nsRefPtr<gfxXlibSurface> surf =
-    aSurface->get_SurfaceDescriptorX11().OpenForeign();
-  surf->TakePixmap();
-  *aSurface = SurfaceDescriptor();
-  // the Pixmap is destroyed when |surf| goes out of scope
-  return true;
-}
-
 SurfaceDescriptorX11::SurfaceDescriptorX11(gfxXlibSurface* aSurf)
   : mId(aSurf->XDrawable())
   , mSize(aSurf->GetSize().ToIntSize())
 {
   const XRenderPictFormat *pictFormat = aSurf->XRenderFormat();
   if (pictFormat) {
     mFormat = pictFormat->id;
   } else {
@@ -110,105 +99,16 @@ SurfaceDescriptorX11::OpenForeign() cons
     if (!visual)
       return nullptr;
 
     surf = new gfxXlibSurface(display, mId, visual, gfx::ThebesIntSize(mSize));
   }
   return surf->CairoStatus() ? nullptr : surf.forget();
 }
 
-bool
-ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
-                                                  gfxContentType aContent,
-                                                  uint32_t aCaps,
-                                                  SurfaceDescriptor* aBuffer)
-{
-  if (!UsingXCompositing()) {
-    // If we're not using X compositing, we're probably compositing on
-    // the client side, in which case X surfaces would just slow
-    // things down.  Use Shmem instead.
-    return false;
-  }
-  if (MAP_AS_IMAGE_SURFACE & aCaps) {
-    // We can't efficiently map pixmaps as gfxImageSurface, in
-    // general.  Fall back on Shmem.
-    return false;
-  }
-
-  gfxPlatform* platform = gfxPlatform::GetPlatform();
-  nsRefPtr<gfxASurface> buffer =
-    platform->CreateOffscreenSurface(aSize, aContent);
-  if (!buffer ||
-      buffer->GetType() != gfxSurfaceType::Xlib) {
-    NS_ERROR("creating Xlib front/back surfaces failed!");
-    return false;
-  }
-
-  gfxXlibSurface* bufferX = static_cast<gfxXlibSurface*>(buffer.get());
-  // Release Pixmap ownership to the layers model
-  bufferX->ReleasePixmap();
-
-  *aBuffer = SurfaceDescriptorX11(bufferX);
-  return true;
-}
-
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode aMode,
-                                             const SurfaceDescriptor& aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorX11 != aSurface.type()) {
-    return nullptr;
-  }
-  return aSurface.get_SurfaceDescriptorX11().OpenForeign();
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor& aDescriptor)
-{
-  // XIDs don't need to be "closed".
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfxContentType* aContent,
-  gfxASurface** aSurface)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfx::IntSize* aSize,
-  gfxASurface** aSurface)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfxImageFormat*,
-  gfxASurface**)
-{
-  return false;
-}
-
-bool
-ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorX11 != aSurface->type()) {
-    return false;
-  }
-  return TakeAndDestroyXlibSurface(aSurface);
-}
-
 /*static*/ void
 ShadowLayerForwarder::PlatformSyncBeforeUpdate()
 {
   if (UsingXCompositing()) {
     // If we're using X surfaces, then we need to finish all pending
     // operations on the back buffers before handing them to the
     // parent, otherwise the surface might be used by the parent's
     // Display in between two operations queued by our Display.
@@ -230,19 +130,10 @@ LayerManagerComposite::PlatformSyncBefor
 }
 
 /*static*/ bool
 LayerManagerComposite::SupportsDirectTexturing()
 {
   return false;
 }
 
-bool
-ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
-{
-  if (SurfaceDescriptor::TSurfaceDescriptorX11 != aSurface->type()) {
-    return false;
-  }
-  return TakeAndDestroyXlibSurface(aSurface);
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -594,195 +594,35 @@ ShadowLayerForwarder::IPCOpen() const
 }
 
 bool
 ShadowLayerForwarder::IsSameProcess() const
 {
   return mShadowManager->OtherProcess() == kInvalidProcessHandle;
 }
 
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::OpenDescriptor(OpenMode aMode,
-                                     const SurfaceDescriptor& aSurface)
-{
-  nsRefPtr<gfxASurface> surf = PlatformOpenDescriptor(aMode, aSurface);
-  if (surf) {
-    return surf.forget();
-  }
-
-  switch (aSurface.type()) {
-  case SurfaceDescriptor::TShmem: {
-    surf = gfxSharedImageSurface::Open(aSurface.get_Shmem());
-    return surf.forget();
-  } case SurfaceDescriptor::TRGBImage: {
-    const RGBImage& rgb = aSurface.get_RGBImage();
-    gfxImageFormat rgbFormat
-      = static_cast<gfxImageFormat>(rgb.rgbFormat());
-    uint32_t stride = gfxASurface::BytesPerPixel(rgbFormat) * rgb.picture().width;
-    nsIntSize size(rgb.picture().width, rgb.picture().height);
-    surf = new gfxImageSurface(rgb.data().get<uint8_t>(),
-                               size,
-                               stride,
-                               rgbFormat);
-    return surf.forget();
-  }
-  case SurfaceDescriptor::TMemoryImage: {
-    const MemoryImage& image = aSurface.get_MemoryImage();
-    gfxImageFormat format
-      = static_cast<gfxImageFormat>(image.format());
-    surf = new gfxImageSurface((unsigned char *)image.data(),
-                               gfx::ThebesIntSize(image.size()),
-                               image.stride(),
-                               format);
-    return surf.forget();
-  }
-  default:
-    NS_ERROR("unexpected SurfaceDescriptor type!");
-    return nullptr;
-  }
-}
-
-/*static*/ gfxContentType
-ShadowLayerForwarder::GetDescriptorSurfaceContentType(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfxASurface** aSurface)
-{
-  gfxContentType content;
-  if (PlatformGetDescriptorSurfaceContentType(aDescriptor, aMode,
-                                              &content, aSurface)) {
-    return content;
-  }
-
-  nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
-  content = surface->GetContentType();
-  surface.forget(aSurface);
-  return content;
-}
-
-/*static*/ gfx::IntSize
-ShadowLayerForwarder::GetDescriptorSurfaceSize(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfxASurface** aSurface)
-{
-  gfx::IntSize size;
-  if (PlatformGetDescriptorSurfaceSize(aDescriptor, aMode, &size, aSurface)) {
-    return size;
-  }
-
-  nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
-  size = surface->GetSize().ToIntSize();
-  surface.forget(aSurface);
-  return size;
-}
-
-/*static*/ gfxImageFormat
-ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
-  const SurfaceDescriptor& aDescriptor, OpenMode aMode,
-  gfxASurface** aSurface)
-{
-  gfxImageFormat format;
-  if (PlatformGetDescriptorSurfaceImageFormat(aDescriptor, aMode, &format, aSurface)) {
-    return format;
-  }
-
-  nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
-  NS_ENSURE_TRUE(surface, gfxImageFormat::Unknown);
-
-  nsRefPtr<gfxImageSurface> img = surface->GetAsImageSurface();
-  NS_ENSURE_TRUE(img, gfxImageFormat::Unknown);
-
-  format = img->Format();
-  NS_ASSERTION(format != gfxImageFormat::Unknown,
-               "ImageSurface RGB format should be known");
-
-  surface.forget(aSurface);
-  return format;
-}
-
-/*static*/ void
-ShadowLayerForwarder::CloseDescriptor(const SurfaceDescriptor& aDescriptor)
-{
-  PlatformCloseDescriptor(aDescriptor);
-  // There's no "close" needed for Shmem surfaces.
-}
-
 /**
   * We bail out when we have no shadow manager. That can happen when the
   * layer manager is created by the preallocated process.
   * See bug 914843 for details.
   */
 PLayerChild*
 ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer)
 {
   NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
   return mShadowManager->SendPLayerConstructor(new ShadowLayerChild(aLayer));
 }
 
 #if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
 
-/*static*/ already_AddRefed<gfxASurface>
-ShadowLayerForwarder::PlatformOpenDescriptor(OpenMode,
-                                             const SurfaceDescriptor&)
-{
-  return nullptr;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformCloseDescriptor(const SurfaceDescriptor&)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceContentType(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfxContentType*,
-  gfxASurface**)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfx::IntSize*,
-  gfxASurface**)
-{
-  return false;
-}
-
-/*static*/ bool
-ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
-  const SurfaceDescriptor&,
-  OpenMode,
-  gfxImageFormat*,
-  gfxASurface**)
-{
-  return false;
-}
-
-bool
-ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return false;
-}
-
 /*static*/ void
 ShadowLayerForwarder::PlatformSyncBeforeUpdate()
 {
 }
 
-bool
-ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
-{
-  return false;
-}
-
 #endif  // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
 
 void
 ShadowLayerForwarder::Connect(CompositableClient* aCompositable)
 {
 #ifdef GFX_COMPOSITOR_LOGGING
   printf("ShadowLayerForwarder::Connect(Compositable)\n");
 #endif
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -371,19 +371,16 @@ public:
 
   /**
    * Flag the next paint as the first for a document.
    */
   void SetIsFirstPaint() { mIsFirstPaint = true; }
 
   static void PlatformSyncBeforeUpdate();
 
-  static already_AddRefed<gfxASurface>
-  OpenDescriptor(OpenMode aMode, const SurfaceDescriptor& aSurface);
-
 protected:
   ShadowLayerForwarder();
 
 #ifdef DEBUG
   void CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const;
 #else
   void CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const {}
 #endif
@@ -396,71 +393,16 @@ protected:
                                                   uint32_t aFormat,
                                                   uint32_t aUsage,
                                                   MaybeMagicGrallocBufferHandle* aHandle) MOZ_OVERRIDE;
 
   virtual void DeallocGrallocBuffer(PGrallocBufferChild* aChild) MOZ_OVERRIDE;
 #endif
 
 private:
-  /**
-   * Try to query the content type efficiently, but at worst map the
-   * surface and return it in *aSurface.
-   */
-  static gfxContentType
-  GetDescriptorSurfaceContentType(const SurfaceDescriptor& aDescriptor,
-                                  OpenMode aMode,
-                                  gfxASurface** aSurface);
-  /**
-   * It can be expensive to open a descriptor just to query its
-   * content type.  If the platform impl can do this cheaply, it will
-   * set *aContent and return true.
-   */
-  static bool
-  PlatformGetDescriptorSurfaceContentType(const SurfaceDescriptor& aDescriptor,
-                                          OpenMode aMode,
-                                          gfxContentType* aContent,
-                                          gfxASurface** aSurface);
-  // (Same as above, but for surface size.)
-  static gfx::IntSize
-  GetDescriptorSurfaceSize(const SurfaceDescriptor& aDescriptor,
-                           OpenMode aMode,
-                           gfxASurface** aSurface);
-  static bool
-  PlatformGetDescriptorSurfaceSize(const SurfaceDescriptor& aDescriptor,
-                                   OpenMode aMode,
-                                   gfx::IntSize* aSize,
-                                   gfxASurface** aSurface);
-  // And again, for the image format.
-  // This function will return gfxImageFormat::Unknown only if |aDescriptor|
-  // describes a non-ImageSurface.
-  static gfxImageFormat
-  GetDescriptorSurfaceImageFormat(const SurfaceDescriptor& aDescriptor,
-                                  OpenMode aMode,
-                                  gfxASurface** aSurface);
-  static bool
-  PlatformGetDescriptorSurfaceImageFormat(const SurfaceDescriptor& aDescriptor,
-                                          OpenMode aMode,
-                                          gfxImageFormat* aContent,
-                                          gfxASurface** aSurface);
-
-  static already_AddRefed<gfxASurface>
-  PlatformOpenDescriptor(OpenMode aMode, const SurfaceDescriptor& aDescriptor);
-
-  /**
-   * Make this descriptor unusable for gfxASurface clients. A
-   * private interface with AutoOpenSurface.
-   */
-  static void
-  CloseDescriptor(const SurfaceDescriptor& aDescriptor);
-
-  static bool
-  PlatformCloseDescriptor(const SurfaceDescriptor& aDescriptor);
-
-  bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface);
 
   Transaction* mTxn;
   DiagnosticTypes mDiagnosticTypes;
   bool mIsFirstPaint;
   bool mWindowOverlayChanged;
 };
 
 class CompositableClient;