Bug 1072528. Part 2: Remove layers code. r=bas
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 24 Sep 2014 16:35:06 -0400
changeset 211049 20d9430a0d6251dbee096930bd04c2f47b402f06
parent 211048 f321139439a151811fc6abec905304395e881623
child 211050 820188e039a05e5bae4cbdd50a0235293a989eaf
push id50632
push userrocallahan@mozilla.com
push dateSun, 19 Oct 2014 09:14:51 +0000
treeherdermozilla-inbound@820188e039a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1072528
milestone36.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 1072528. Part 2: Remove layers code. r=bas
gfx/layers/ImageContainer.cpp
gfx/layers/ImageContainer.h
gfx/layers/ImageTypes.h
gfx/layers/d3d10/ImageLayerD3D10.cpp
gfx/layers/d3d10/ImageLayerD3D10.h
gfx/layers/d3d9/ImageLayerD3D9.cpp
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -126,18 +126,16 @@ BufferRecycleBin::GetBuffer(uint32_t aSi
 }
 
 ImageContainer::ImageContainer(int flag)
 : mReentrantMonitor("ImageContainer.mReentrantMonitor"),
   mPaintCount(0),
   mPreviousImagePainted(false),
   mImageFactory(new ImageFactory()),
   mRecycleBin(new BufferRecycleBin()),
-  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();
     MOZ_ASSERT(mImageClient);
@@ -176,29 +174,18 @@ ImageContainer::CreateImage(ImageFormat 
   return mImageFactory->CreateImage(aFormat, mScaleHint, mRecycleBin);
 }
 
 void
 ImageContainer::SetCurrentImageInternal(Image *aImage)
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
 
-  if (mRemoteData) {
-    NS_ASSERTION(mRemoteDataMutex, "Should have remote data mutex when having remote data!");
-    mRemoteDataMutex->Lock();
-    // This is important since it ensures we won't change the active image
-    // when we currently have a locked image that depends on mRemoteData.
-  }
-
   mActiveImage = aImage;
   CurrentImageChanged();
-
-  if (mRemoteData) {
-    mRemoteDataMutex->Unlock();
-  }
 }
 
 void
 ImageContainer::ClearCurrentImage()
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
   SetCurrentImageInternal(nullptr);
 }
@@ -263,199 +250,74 @@ uint64_t ImageContainer::GetAsyncContain
   }
 }
 
 bool
 ImageContainer::HasCurrentImage()
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
 
-  if (mRemoteData) {
-    CrossProcessMutexAutoLock autoLock(*mRemoteDataMutex);
-
-    EnsureActiveImage();
-
-    return !!mActiveImage.get();
-  }
-
   return !!mActiveImage.get();
 }
 
 already_AddRefed<Image>
 ImageContainer::LockCurrentImage()
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
 
-  if (mRemoteData) {
-    NS_ASSERTION(mRemoteDataMutex, "Should have remote data mutex when having remote data!");
-    mRemoteDataMutex->Lock();
-  }
-
-  EnsureActiveImage();
-
   nsRefPtr<Image> retval = mActiveImage;
   return retval.forget();
 }
 
 TemporaryRef<gfx::SourceSurface>
 ImageContainer::LockCurrentAsSourceSurface(gfx::IntSize *aSize, Image** aCurrentImage)
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
 
-  if (mRemoteData) {
-    NS_ASSERTION(mRemoteDataMutex, "Should have remote data mutex when having remote data!");
-    mRemoteDataMutex->Lock();
-
-    EnsureActiveImage();
-
-    if (aCurrentImage) {
-      NS_IF_ADDREF(mActiveImage);
-      *aCurrentImage = mActiveImage.get();
-    }
-
-    if (!mActiveImage) {
-      return nullptr;
-    }
-
-    if (mActiveImage->GetFormat() == ImageFormat::REMOTE_IMAGE_BITMAP) {
-      gfxImageFormat fmt = mRemoteData->mFormat == RemoteImageData::BGRX32
-                           ? gfxImageFormat::ARGB32
-                           : gfxImageFormat::RGB24;
-
-      RefPtr<gfx::DataSourceSurface> newSurf
-        = gfx::Factory::CreateWrappingDataSourceSurface(mRemoteData->mBitmap.mData,
-                                                        mRemoteData->mBitmap.mStride,
-                                                        mRemoteData->mSize,
-                                                        gfx::ImageFormatToSurfaceFormat(fmt));
-      *aSize = newSurf->GetSize();
-
-      return newSurf;
-    }
-
-    *aSize = mActiveImage->GetSize();
-    return mActiveImage->GetAsSourceSurface();
-  }
-
   if (aCurrentImage) {
     NS_IF_ADDREF(mActiveImage);
     *aCurrentImage = mActiveImage.get();
   }
 
   if (!mActiveImage) {
     return nullptr;
   }
 
   *aSize = mActiveImage->GetSize();
   return mActiveImage->GetAsSourceSurface();
 }
 
 void
 ImageContainer::UnlockCurrentImage()
 {
-  if (mRemoteData) {
-    NS_ASSERTION(mRemoteDataMutex, "Should have remote data mutex when having remote data!");
-    mRemoteDataMutex->Unlock();
-  }
 }
 
 TemporaryRef<gfx::SourceSurface>
 ImageContainer::GetCurrentAsSourceSurface(gfx::IntSize *aSize)
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
 
-  if (mRemoteData) {
-    CrossProcessMutexAutoLock autoLock(*mRemoteDataMutex);
-    EnsureActiveImage();
-
-    if (!mActiveImage)
-      return nullptr;
-    *aSize = mRemoteData->mSize;
-  } else {
-    if (!mActiveImage)
-      return nullptr;
-    *aSize = mActiveImage->GetSize();
-  }
+  if (!mActiveImage)
+    return nullptr;
+  *aSize = mActiveImage->GetSize();
   return mActiveImage->GetAsSourceSurface();
 }
 
 gfx::IntSize
 ImageContainer::GetCurrentSize()
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
 
-  if (mRemoteData) {
-    CrossProcessMutexAutoLock autoLock(*mRemoteDataMutex);
-
-    // We don't need to ensure we have an active image here, as we need to
-    // be in the mutex anyway, and this is easiest to return from there.
-    return mRemoteData->mSize;
-  }
-
   if (!mActiveImage) {
     return gfx::IntSize(0, 0);
   }
 
   return mActiveImage->GetSize();
 }
 
-void
-ImageContainer::SetRemoteImageData(RemoteImageData *aData, CrossProcessMutex *aMutex)
-{
-  ReentrantMonitorAutoEnter mon(mReentrantMonitor);
-
-  NS_ASSERTION(!mActiveImage || !aData, "No active image expected when SetRemoteImageData is called with non-NULL aData.");
-  NS_ASSERTION(!mRemoteData || !aData, "No remote data expected when SetRemoteImageData is called with non-NULL aData.");
-
-  mRemoteData = aData;
-
-  if (aData) {
-    memset(aData, 0, sizeof(RemoteImageData));
-  } else {
-    mActiveImage = nullptr;
-  }
-
-  mRemoteDataMutex = aMutex;
-}
-
-void
-ImageContainer::EnsureActiveImage()
-{
-  if (mRemoteData) {
-    if (mRemoteData->mWasUpdated) {
-      mActiveImage = nullptr;
-    }
-
-    if (mRemoteData->mType == RemoteImageData::RAW_BITMAP &&
-        mRemoteData->mBitmap.mData && !mActiveImage) {
-      nsRefPtr<RemoteBitmapImage> newImg = new RemoteBitmapImage();
-
-      newImg->mFormat = mRemoteData->mFormat;
-      newImg->mData = mRemoteData->mBitmap.mData;
-      newImg->mSize = mRemoteData->mSize;
-      newImg->mStride = mRemoteData->mBitmap.mStride;
-      mRemoteData->mWasUpdated = false;
-
-      mActiveImage = newImg;
-    }
-#ifdef XP_WIN
-    else if (mRemoteData->mType == RemoteImageData::DXGI_TEXTURE_HANDLE &&
-             mRemoteData->mTextureHandle && !mActiveImage) {
-      nsRefPtr<RemoteDXGITextureImage> newImg = new RemoteDXGITextureImage();
-      newImg->mSize = mRemoteData->mSize;
-      newImg->mHandle = mRemoteData->mTextureHandle;
-      newImg->mFormat = mRemoteData->mFormat;
-      mRemoteData->mWasUpdated = false;
-
-      mActiveImage = newImg;
-    }
-#endif
-  }
-}
-
-
 PlanarYCbCrImage::PlanarYCbCrImage(BufferRecycleBin *aRecycleBin)
   : Image(nullptr, ImageFormat::PLANAR_YCBCR)
   , mBufferSize(0)
   , mOffscreenFormat(gfxImageFormat::Unknown)
   , mRecycleBin(aRecycleBin)
 {
 }
 
@@ -602,36 +464,16 @@ PlanarYCbCrImage::GetAsSourceSurface()
 
   gfx::ConvertYCbCrToRGB(mData, format, size, surface->GetData(), surface->Stride());
 
   mSourceSurface = surface;
 
   return surface.forget();
 }
 
-TemporaryRef<gfx::SourceSurface>
-RemoteBitmapImage::GetAsSourceSurface()
-{
-  gfx::SurfaceFormat fmt = mFormat == RemoteImageData::BGRX32
-                         ? gfx::SurfaceFormat::B8G8R8X8
-                         : gfx::SurfaceFormat::B8G8R8A8;
-  RefPtr<gfx::DataSourceSurface> newSurf = gfx::Factory::CreateDataSourceSurface(mSize, fmt);
-  if (NS_WARN_IF(!newSurf)) {
-    return nullptr;
-  }
-
-  for (int y = 0; y < mSize.height; y++) {
-    memcpy(newSurf->GetData() + newSurf->Stride() * y,
-           mData + mStride * y,
-           mSize.width * 4);
-  }
-
-  return newSurf;
-}
-
 CairoImage::CairoImage()
   : Image(nullptr, ImageFormat::CAIRO_SURFACE)
 {}
 
 CairoImage::~CairoImage()
 {
 }
 
--- a/gfx/layers/ImageContainer.h
+++ b/gfx/layers/ImageContainer.h
@@ -262,87 +262,32 @@ protected:
 
   virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat,
                                               const gfx::IntSize &aScaleHint,
                                               BufferRecycleBin *aRecycleBin);
 
 };
  
 /**
- * This struct is used to store RemoteImages, it is meant to be able to live in
- * shared memory. Therefor it should not contain a vtable pointer. Remote
- * users can manipulate the data in this structure to specify what image is to
- * be drawn by the container. When accessing this data users should make sure
- * the mutex synchronizing access to the structure is held!
- */
-struct RemoteImageData {
-  enum Type {
-    /**
-     * This is a format that uses raw bitmap data.
-     */
-    RAW_BITMAP,
-
-    /**
-     * This is a format that uses a pointer to a texture do draw directly
-     * from a shared texture. Any process may have created this texture handle,
-     * the process creating the texture handle is responsible for managing it's
-     * lifetime by managing the lifetime of the first D3D texture object this
-     * handle was created for. It must also ensure the handle is not set
-     * current anywhere when the last reference to this object is released.
-     */
-    DXGI_TEXTURE_HANDLE
-  };
-  /* These formats describe the format in the memory byte-order */
-  enum Format {
-    /* 8 bits per channel */
-    BGRA32,
-    /* 8 bits per channel, alpha channel is ignored */
-    BGRX32
-  };
-
-  // This should be set to true if a change was made so that the ImageContainer
-  // knows to throw out any cached RemoteImage objects.
-  bool mWasUpdated;
-  Type mType;
-  Format mFormat;
-  gfx::IntSize mSize;
-  union {
-    struct {
-      /* This pointer is set by a remote process, however it will be set to
-       * the container process' address the memory of the raw bitmap resides
-       * at.
-       */
-      unsigned char *mData;
-      int mStride;
-    } mBitmap;
-#ifdef XP_WIN
-    HANDLE mTextureHandle;
-#endif
-  };
-};
-
-/**
  * A class that manages Images for an ImageLayer. The only reason
  * we need a separate class here is that ImageLayers aren't threadsafe
  * (because layers can only be used on the main thread) and we want to
  * be able to set the current Image from any thread, to facilitate
  * video playback without involving the main thread, for example.
  *
- * An ImageContainer can operate in one of three modes:
+ * An ImageContainer can operate in one of these modes:
  * 1) Normal. Triggered by constructing the ImageContainer with
  * DISABLE_ASYNC or when compositing is happening on the main thread.
  * SetCurrentImage changes ImageContainer state but nothing is sent to the
  * compositor until the next layer transaction.
  * 2) Asynchronous. Initiated by constructing the ImageContainer with
  * ENABLE_ASYNC when compositing is happening on the main thread.
  * SetCurrentImage sends a message through the ImageBridge to the compositor
  * thread to update the image, without going through the main thread or
  * a layer transaction.
- * 3) Remote. Initiated by calling SetRemoteImageData on the ImageContainer
- * before any other activity.
  * The ImageContainer uses a shared memory block containing a cross-process mutex
  * to communicate with the compositor thread. SetCurrentImage synchronously
  * updates the shared state to point to the new image and the old image
  * is immediately released (not true in Normal or Asynchronous modes).
  */
 class ImageContainer MOZ_FINAL : public SupportsWeakPtr<ImageContainer> {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ImageContainer)
 public:
@@ -571,31 +516,16 @@ public:
       mCompositionNotifySink->DidComposite();
     }
   }
 
   void SetCompositionNotifySink(CompositionNotifySink *aSink) {
     mCompositionNotifySink = aSink;
   }
 
-  /**
-   * This function is called to tell the ImageContainer where the
-   * (cross-process) segment lives where the shared data about possible
-   * remote images are stored. In addition to this a CrossProcessMutex object
-   * is passed telling the container how to synchronize access to this data.
-   * NOTE: This should be called during setup of the container and not after
-   * usage has started.
-   */
-  void SetRemoteImageData(RemoteImageData *aRemoteData,
-                          CrossProcessMutex *aRemoteDataMutex);
-  /**
-   * This can be used to check if the container has RemoteData set.
-   */
-  RemoteImageData *GetRemoteImageData() { return mRemoteData; }
-
 private:
   typedef mozilla::ReentrantMonitor ReentrantMonitor;
 
   // Private destructor, to discourage deletion outside of Release():
   ~ImageContainer();
 
   void SetCurrentImageInternal(Image* aImage);
 
@@ -636,26 +566,16 @@ private:
   // this container can set an alternative image factory that will be used to
   // create images for this container.
   nsRefPtr<ImageFactory> mImageFactory;
 
   gfx::IntSize mScaleHint;
 
   nsRefPtr<BufferRecycleBin> mRecycleBin;
 
-  // This contains the remote image data for this container, if this is nullptr
-  // that means the container has no other process that may control its active
-  // image.
-  RemoteImageData *mRemoteData;
-
-  // This cross-process mutex is used to synchronise access to mRemoteData.
-  // When this mutex is held, we will always be inside the mReentrantMonitor
-  // however the same is not true vice versa.
-  CrossProcessMutex *mRemoteDataMutex;
-
   CompositionNotifySink *mCompositionNotifySink;
 
   // This member points to an ImageClient if this ImageContainer was
   // sucessfully created with ENABLE_ASYNC, or points to null otherwise.
   // 'unsuccessful' in this case only means that the ImageClient could not
   // be created, most likely because off-main-thread compositing is not enabled.
   // In this case the ImageContainer is perfectly usable, but it will forward
   // frames to the compositor through transactions in the main thread rather than
@@ -899,30 +819,16 @@ public:
   ~CairoImage();
 
   gfx::IntSize mSize;
 
   nsCountedRef<nsMainThreadSourceSurfaceRef> mSourceSurface;
   nsDataHashtable<nsUint32HashKey, RefPtr<TextureClient> >  mTextureClients;
 };
 
-class RemoteBitmapImage : public Image {
-public:
-  RemoteBitmapImage() : Image(nullptr, ImageFormat::REMOTE_IMAGE_BITMAP) {}
-
-  TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
-
-  gfx::IntSize GetSize() { return mSize; }
-
-  unsigned char *mData;
-  int mStride;
-  gfx::IntSize mSize;
-  RemoteImageData::Format mFormat;
-};
-
 #ifdef MOZ_WIDGET_GONK
 class OverlayImage : public Image {
   /**
    * OverlayImage is a special Image type that does not hold any buffer.
    * It only hold an Id as identifier to the real content of the Image.
    * Therefore, OverlayImage must be handled by some specialized hardware(e.g. HWC) 
    * to show its content.
    */
--- a/gfx/layers/ImageTypes.h
+++ b/gfx/layers/ImageTypes.h
@@ -48,37 +48,27 @@ MOZ_BEGIN_ENUM_CLASS(ImageFormat)
   CAIRO_SURFACE,
 
   /**
    * A MacIOSurface object.
    */
   MAC_IOSURFACE,
 
   /**
-   * An bitmap image that can be shared with a remote process.
-   */
-  REMOTE_IMAGE_BITMAP,
-
-  /**
    * An Android SurfaceTexture ID that can be shared across threads and
    * processes.
    */
   SURFACE_TEXTURE,
 
   /**
    * An EGL Image that can be shared across threads.
    */
   EGLIMAGE,
 
   /**
-   * An DXGI shared surface handle that can be shared with a remote process.
-   */
-  REMOTE_IMAGE_DXGI_TEXTURE,
-
-  /**
    * The D3D9_RGB32_TEXTURE format creates a D3D9SurfaceImage, and wraps a
    * IDirect3DTexture9 in RGB32 layout.
    */
   D3D9_RGB32_TEXTURE,
 
   /**
    * An Image type carries an opaque handle once for each stream.
    * The opaque handle would be a platform specific identifier.
--- a/gfx/layers/d3d10/ImageLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp
@@ -83,49 +83,27 @@ SurfaceToTexture(ID3D10Device *aDevice,
 
 Layer*
 ImageLayerD3D10::GetLayer()
 {
   return this;
 }
 
 /**
- * Returns a shader resource view for a Cairo or remote image.
+ * Returns a shader resource view for an image.
  * Returns nullptr if unsuccessful.
  * If successful, aHasAlpha will be true iff the resulting texture
  * has an alpha component.
  */
 ID3D10ShaderResourceView*
 ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex **aMutex)
 {
   NS_ASSERTION(aImage, "Null image.");
 
-  if (aImage->GetFormat() == ImageFormat::REMOTE_IMAGE_BITMAP) {
-    RemoteBitmapImage *remoteImage =
-      static_cast<RemoteBitmapImage*>(aImage);
-
-    if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
-      nsAutoPtr<TextureD3D10BackendData> dat(new TextureD3D10BackendData());
-      dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize);
-
-      if (dat->mTexture) {
-        device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
-        aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, dat.forget());
-      }
-    }
-
-    aHasAlpha = remoteImage->mFormat == RemoteImageData::BGRA32;
-  } else if (aImage->GetFormat() == ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE) {
-    RemoteDXGITextureImage *remoteImage =
-      static_cast<RemoteDXGITextureImage*>(aImage);
-
-    remoteImage->GetD3D10TextureBackendData(device());
-
-    aHasAlpha = remoteImage->mFormat == RemoteImageData::BGRA32;
-  } else if (aImage->GetFormat() == ImageFormat::CAIRO_SURFACE) {
+  if (aImage->GetFormat() == ImageFormat::CAIRO_SURFACE) {
     CairoImage *cairoImage =
       static_cast<CairoImage*>(aImage);
 
     RefPtr<SourceSurface> surf = cairoImage->GetAsSourceSurface();
     if (!surf) {
       return nullptr;
     }
 
@@ -207,18 +185,16 @@ ImageLayerD3D10::RenderLayer()
   IntSize size = image->GetSize();
 
   SetEffectTransformAndOpacity();
 
   ID3D10EffectTechnique *technique;
   nsRefPtr<IDXGIKeyedMutex> keyedMutex;
 
   if (image->GetFormat() == ImageFormat::CAIRO_SURFACE ||
-      image->GetFormat() == ImageFormat::REMOTE_IMAGE_BITMAP ||
-      image->GetFormat() == ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE ||
       image->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE) {
     NS_ASSERTION(image->GetFormat() != ImageFormat::CAIRO_SURFACE ||
                  !static_cast<CairoImage*>(image)->mSourceSurface ||
                  static_cast<CairoImage*>(image)->mSourceSurface->GetFormat() != SurfaceFormat::A8,
                  "Image layer has alpha image");
     bool hasAlpha = false;
 
     nsRefPtr<ID3D10ShaderResourceView> srView = GetImageSRView(image, hasAlpha, getter_AddRefs(keyedMutex));
@@ -413,121 +389,10 @@ ImageLayerD3D10::GetAsTexture(gfx::IntSi
   }
 
   *aSize = image->GetSize();
   bool dontCare;
   nsRefPtr<ID3D10ShaderResourceView> result = GetImageSRView(image, dontCare);
   return result.forget();
 }
 
-TemporaryRef<gfx::SourceSurface>
-RemoteDXGITextureImage::GetAsSourceSurface()
-{
-  nsRefPtr<ID3D10Device1> device =
-    gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
-  if (!device) {
-    NS_WARNING("Cannot readback from shared texture because no D3D10 device is available.");
-    return nullptr;
-  }
-
-  TextureD3D10BackendData* data = GetD3D10TextureBackendData(device);
-
-  if (!data) {
-    return nullptr;
-  }
-
-  nsRefPtr<IDXGIKeyedMutex> keyedMutex;
-
-  if (FAILED(data->mTexture->QueryInterface(IID_IDXGIKeyedMutex, getter_AddRefs(keyedMutex)))) {
-    NS_WARNING("Failed to QueryInterface for IDXGIKeyedMutex, strange.");
-    return nullptr;
-  }
-
-  if (FAILED(keyedMutex->AcquireSync(0, 0))) {
-    NS_WARNING("Failed to acquire sync for keyedMutex, plugin failed to release?");
-    return nullptr;
-  }
-
-  D3D10_TEXTURE2D_DESC desc;
-
-  data->mTexture->GetDesc(&desc);
-
-  desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
-  desc.BindFlags = 0;
-  desc.MiscFlags = 0;
-  desc.Usage = D3D10_USAGE_STAGING;
-
-  nsRefPtr<ID3D10Texture2D> softTexture;
-  HRESULT hr = device->CreateTexture2D(&desc, nullptr, getter_AddRefs(softTexture));
-
-  if (FAILED(hr)) {
-    NS_WARNING("Failed to create 2D staging texture.");
-    return nullptr;
-  }
-
-  device->CopyResource(softTexture, data->mTexture);
-  keyedMutex->ReleaseSync(0);
-
-  RefPtr<gfx::DataSourceSurface> surface
-    = gfx::Factory::CreateDataSourceSurface(mSize,
-                                            mFormat == RemoteImageData::BGRX32
-                                              ? gfx::SurfaceFormat::B8G8R8X8
-                                              : gfx::SurfaceFormat::B8G8R8A8);
-  if (NS_WARN_IF(!surface)) {
-    return nullptr;
-  }
-
-  gfx::DataSourceSurface::MappedSurface mappedSurface;
-  if (!surface->Map(gfx::DataSourceSurface::WRITE, &mappedSurface)) {
-    NS_WARNING("Failed to map source surface");
-    return nullptr;
-  }
-
-  D3D10_MAPPED_TEXTURE2D mapped;
-  softTexture->Map(0, D3D10_MAP_READ, 0, &mapped);
-
-  for (int y = 0; y < mSize.height; y++) {
-    memcpy(mappedSurface.mData + mappedSurface.mStride * y,
-           (unsigned char*)(mapped.pData) + mapped.RowPitch * y,
-           mSize.width * 4);
-  }
-
-  softTexture->Unmap(0);
-  surface->Unmap();
-
-  return surface;
-}
-
-TextureD3D10BackendData*
-RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
-{
-  if (GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10)) {
-    TextureD3D10BackendData *data =
-      static_cast<TextureD3D10BackendData*>(GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10));
-
-    nsRefPtr<ID3D10Device> device;
-    data->mTexture->GetDevice(getter_AddRefs(device));
-
-    if (device == aDevice) {
-      return data;
-    }
-  }
-  nsRefPtr<ID3D10Texture2D> texture;
-  aDevice->OpenSharedResource(mHandle, __uuidof(ID3D10Texture2D), getter_AddRefs(texture));
-
-  if (!texture) {
-    NS_WARNING("Failed to get texture for shared texture handle.");
-    return nullptr;
-  }
-
-  nsAutoPtr<TextureD3D10BackendData> data(new TextureD3D10BackendData());
-
-  data->mTexture = texture;
-
-  aDevice->CreateShaderResourceView(texture, nullptr, getter_AddRefs(data->mSRView));
-
-  SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D10, data);
-
-  return data.forget();
-}
-
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/d3d10/ImageLayerD3D10.h
+++ b/gfx/layers/d3d10/ImageLayerD3D10.h
@@ -30,17 +30,18 @@ public:
 
   virtual void RenderLayer();
 
   void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage);
 
   virtual already_AddRefed<ID3D10ShaderResourceView> GetAsTexture(gfx::IntSize* aSize);
 
 private:
- ID3D10ShaderResourceView* GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex **aMutex = nullptr);
+ ID3D10ShaderResourceView* GetImageSRView(Image* aImage, bool& aHasAlpha,
+                                          IDXGIKeyedMutex **aMutex = nullptr);
 };
 
 struct PlanarYCbCrD3D10BackendData : public ImageBackendData
 {
   nsRefPtr<ID3D10Texture2D> mYTexture;
   nsRefPtr<ID3D10Texture2D> mCrTexture;
   nsRefPtr<ID3D10Texture2D> mCbTexture;
   nsRefPtr<ID3D10ShaderResourceView> mYView;
@@ -49,26 +50,11 @@ struct PlanarYCbCrD3D10BackendData : pub
 };
 
 struct TextureD3D10BackendData : public ImageBackendData
 {
   nsRefPtr<ID3D10Texture2D> mTexture;
   nsRefPtr<ID3D10ShaderResourceView> mSRView;
 };
 
-class RemoteDXGITextureImage : public Image {
-public:
-  RemoteDXGITextureImage() : Image(nullptr, ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE) {}
-
-  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
-
-  mozilla::gfx::IntSize GetSize() { return mSize; }
-
-  TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice);
-
-  mozilla::gfx::IntSize mSize;
-  RemoteImageData::Format mFormat;
-  HANDLE mHandle;
-};
-
 } /* layers */
 } /* mozilla */
 #endif /* GFX_IMAGELAYERD3D10_H */
--- a/gfx/layers/d3d9/ImageLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp
@@ -310,40 +310,27 @@ static void AllocateTexturesYCbCr(Planar
 Layer*
 ImageLayerD3D9::GetLayer()
 {
   return this;
 }
 
 /*
   * Returns a texture which backs aImage
-  * Will only work if aImage is a cairo or remote image.
+  * Will only work if aImage is a cairo image.
   * Returns nullptr if unsuccessful.
   * If successful, aHasAlpha will be set to true if the texture has an
   * alpha component, false otherwise.
   */
 IDirect3DTexture9*
 ImageLayerD3D9::GetTexture(Image *aImage, bool& aHasAlpha)
 {
   NS_ASSERTION(aImage, "Null image.");
 
-  if (aImage->GetFormat() == ImageFormat::REMOTE_IMAGE_BITMAP) {
-    RemoteBitmapImage *remoteImage =
-      static_cast<RemoteBitmapImage*>(aImage);
-
-    if (!aImage->GetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9)) {
-      nsAutoPtr<TextureD3D9BackendData> dat(new TextureD3D9BackendData());
-      dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize, D3DFMT_A8R8G8B8);
-      if (dat->mTexture) {
-        aImage->SetBackendData(mozilla::layers::LayersBackend::LAYERS_D3D9, dat.forget());
-      }
-    }
-
-    aHasAlpha = remoteImage->mFormat == RemoteImageData::BGRA32;
-  } else if (aImage->GetFormat() == ImageFormat::CAIRO_SURFACE) {
+  if (aImage->GetFormat() == ImageFormat::CAIRO_SURFACE) {
     CairoImage *cairoImage =
       static_cast<CairoImage*>(aImage);
 
     RefPtr<SourceSurface> surf = cairoImage->GetAsSourceSurface();
     if (!surf) {
       return nullptr;
     }
 
@@ -404,17 +391,16 @@ ImageLayerD3D9::RenderLayer()
     return;
   }
 
   SetShaderTransformAndOpacity();
 
   gfx::IntSize size = image->GetSize();
 
   if (image->GetFormat() == ImageFormat::CAIRO_SURFACE ||
-      image->GetFormat() == ImageFormat::REMOTE_IMAGE_BITMAP ||
       image->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE)
   {
     NS_ASSERTION(image->GetFormat() != ImageFormat::CAIRO_SURFACE ||
                  !static_cast<CairoImage*>(image)->mSourceSurface ||
                  static_cast<CairoImage*>(image)->mSourceSurface->GetFormat() != SurfaceFormat::A8,
                  "Image layer has alpha image");
 
     bool hasAlpha = false;
@@ -556,18 +542,17 @@ ImageLayerD3D9::GetAsTexture(gfx::IntSiz
   AutoLockImage autoLock(GetContainer());
 
   Image *image = autoLock.GetImage();
 
   if (!image) {
     return nullptr;
   }
 
-  if (image->GetFormat() != ImageFormat::CAIRO_SURFACE &&
-      image->GetFormat() != ImageFormat::REMOTE_IMAGE_BITMAP) {
+  if (image->GetFormat() != ImageFormat::CAIRO_SURFACE) {
     return nullptr;
   }
 
   bool dontCare;
   *aSize = image->GetSize();
   nsRefPtr<IDirect3DTexture9> result = GetTexture(image, dontCare);
   return result.forget();
 }