Backed out changeset 02d76f158f3d (bug 1259571) for talos xperf regressions
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 08 Aug 2016 11:53:51 +0200
changeset 349955 f33e41f8366b58cc9740e1c71b20f4cdde632398
parent 349954 92a9c724b77fba587edd4d5a662fbee29c5ea0c2
child 349956 66202815aab1b24db07d62f56c98fc7c348ff6c7
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1259571
milestone51.0a1
backs out02d76f158f3d6af4063eb6d2e9ddea513cec6e5c
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
Backed out changeset 02d76f158f3d (bug 1259571) for talos xperf regressions
dom/media/platforms/wmf/DXVA2Manager.cpp
dom/plugins/ipc/D3D11SurfaceHolder.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
gfx/config/gfxFeature.h
gfx/gl/GLScreenBuffer.cpp
gfx/gl/SharedSurfaceANGLE.cpp
gfx/gl/SharedSurfaceD3D11Interop.cpp
gfx/layers/Compositor.h
gfx/layers/IMFYCbCrImage.cpp
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/BasicCompositor.h
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/CompositorBridgeParent.h
gfx/thebes/DeviceManagerD3D11.cpp
gfx/thebes/DeviceManagerD3D11.h
gfx/thebes/DeviceManagerDx.cpp
gfx/thebes/DeviceManagerDx.h
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/gfxWindowsPlatform.h
gfx/thebes/moz.build
widget/CompositorWidget.h
widget/windows/GfxInfo.cpp
widget/windows/WinCompositorWidget.cpp
widget/windows/WinCompositorWidget.h
widget/windows/moz.build
widget/windows/nsWindow.cpp
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp
+++ b/dom/media/platforms/wmf/DXVA2Manager.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DXVA2Manager.h"
 #include <d3d11.h>
 #include "nsThreadUtils.h"
 #include "ImageContainer.h"
 #include "gfxWindowsPlatform.h"
 #include "D3D9SurfaceImage.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/layers/D3D11ShareHandleImage.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/Telemetry.h"
 #include "MediaTelemetryConstants.h"
 #include "mfapi.h"
 #include "MediaPrefs.h"
 #include "MFTDecoder.h"
 #include "DriverCrashGuard.h"
@@ -625,17 +625,17 @@ D3D11DXVA2Manager::Init(nsACString& aFai
 
   gfx::D3D11VideoCrashGuard crashGuard;
   if (crashGuard.Crashed()) {
     NS_WARNING("DXVA2D3D11 crash detected");
     aFailureReason.AssignLiteral("DXVA2D3D11 crashes detected in the past");
     return E_FAIL;
   }
 
-  mDevice = gfx::DeviceManagerDx::Get()->CreateDecoderDevice();
+  mDevice = gfx::DeviceManagerD3D11::Get()->CreateDecoderDevice();
   if (!mDevice) {
     aFailureReason.AssignLiteral("Failed to create D3D11 device for decoder");
     return E_FAIL;
   }
 
   mDevice->GetImmediateContext(getter_AddRefs(mContext));
   if (!mContext) {
     aFailureReason.AssignLiteral("Failed to get immediate context for d3d11 device");
--- a/dom/plugins/ipc/D3D11SurfaceHolder.cpp
+++ b/dom/plugins/ipc/D3D11SurfaceHolder.cpp
@@ -1,44 +1,44 @@
 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "nsDebug.h"
 #include "D3D11SurfaceHolder.h"
 #include "mozilla/gfx/2D.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/layers/TextureD3D11.h"
 #include <d3d11.h>
 
 namespace mozilla {
 namespace plugins {
 
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 D3D11SurfaceHolder::D3D11SurfaceHolder(ID3D11Texture2D* back,
                                        SurfaceFormat format,
                                        const IntSize& size)
- : mDevice11(DeviceManagerDx::Get()->GetContentDevice()),
+ : mDevice11(DeviceManagerD3D11::Get()->GetContentDevice()),
    mBack(back),
    mFormat(format),
    mSize(size)
 {
 }
 
 D3D11SurfaceHolder::~D3D11SurfaceHolder()
 {
 }
 
 bool
 D3D11SurfaceHolder::IsValid()
 {
   // If a TDR occurred, platform devices will be recreated.
-  if (DeviceManagerDx::Get()->GetContentDevice() != mDevice11) {
+  if (DeviceManagerD3D11::Get()->GetContentDevice() != mDevice11) {
      return false;
   }
   return true;
 }
 
 bool
 D3D11SurfaceHolder::CopyToTextureClient(TextureClient* aClient)
 {
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -40,17 +40,17 @@
 #include "GLContextProvider.h"
 #include "gfxPrefs.h"
 #include "LayersLogging.h"
 #include "mozilla/layers/TextureWrapperImage.h"
 #include "mozilla/layers/TextureClientRecycleAllocator.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #if defined(XP_WIN)
 # include "mozilla/layers/D3D11ShareHandleImage.h"
-# include "mozilla/gfx/DeviceManagerDx.h"
+# include "mozilla/gfx/DeviceManagerD3D11.h"
 # include "mozilla/layers/TextureD3D11.h"
 #endif
 
 #ifdef XP_MACOSX
 #include "MacIOSurfaceImage.h"
 #endif
 
 #if defined(OS_WIN)
@@ -396,17 +396,17 @@ bool
 PluginInstanceParent::AnswerNPN_GetValue_PreferredDXGIAdapter(DxgiAdapterDesc* aOutDesc)
 {
     PodZero(aOutDesc);
 #ifdef XP_WIN
     if (!AllowDirectDXGISurfaceDrawing()) {
         return false;
     }
 
-    RefPtr<ID3D11Device> device = DeviceManagerDx::Get()->GetContentDevice();
+    RefPtr<ID3D11Device> device = DeviceManagerD3D11::Get()->GetContentDevice();
     if (!device) {
         return false;
     }
 
     RefPtr<IDXGIDevice> dxgi;
     if (FAILED(device->QueryInterface(__uuidof(IDXGIDevice), getter_AddRefs(dxgi))) || !dxgi) {
         return false;
     }
@@ -677,17 +677,17 @@ PluginInstanceParent::RecvInitDXGISurfac
         return true;
     }
 
     ImageBridgeChild* forwarder = ImageBridgeChild::GetSingleton();
     if (!forwarder) {
         return true;
     }
 
-    RefPtr<ID3D11Device> d3d11 = DeviceManagerDx::Get()->GetContentDevice();
+    RefPtr<ID3D11Device> d3d11 = DeviceManagerD3D11::Get()->GetContentDevice();
     if (!d3d11) {
         return true;
     }
 
     // Create the texture we'll give to the plugin process.
     HANDLE sharedHandle = 0;
     RefPtr<ID3D11Texture2D> back;
     {
--- a/gfx/config/gfxFeature.h
+++ b/gfx/config/gfxFeature.h
@@ -17,18 +17,17 @@ namespace gfx {
 
 #define GFX_FEATURE_MAP(_)                                                        \
   /* Name,                        Type,         Description */                    \
   _(HW_COMPOSITING,               Feature,      "Compositing")                    \
   _(D3D11_COMPOSITING,            Feature,      "Direct3D11 Compositing")         \
   _(D3D9_COMPOSITING,             Feature,      "Direct3D9 Compositing")          \
   _(OPENGL_COMPOSITING,           Feature,      "OpenGL Compositing")             \
   _(DIRECT2D,                     Feature,      "Direct2D")                       \
-  _(D3D11_HW_ANGLE,               Feature,      "Direct3D11 hardware ANGLE")      \
-  _(DIRECT_DRAW,                  Feature,      "DirectDraw")                     \
+  _(D3D11_HW_ANGLE,               Feature,      "Direct3D11 hardware ANGLE")               \
   _(GPU_PROCESS,                  Feature,      "GPU Process")                    \
   /* Add new entries above this comment */
 
 enum class Feature : uint32_t {
 #define MAKE_ENUM(name, type, desc) name,
   GFX_FEATURE_MAP(MAKE_ENUM)
 #undef MAKE_ENUM
   NumValues
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -16,17 +16,17 @@
 #include "gfx2DGlue.h"
 #include "../layers/ipc/ShadowLayers.h"
 #include "mozilla/layers/CompositableForwarder.h"
 #include "mozilla/layers/TextureClientSharedSurface.h"
 
 #ifdef XP_WIN
 #include "SharedSurfaceANGLE.h"         // for SurfaceFactory_ANGLEShareHandle
 #include "SharedSurfaceD3D11Interop.h"  // for SurfaceFactory_D3D11Interop
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "SharedSurfaceGralloc.h"
 #include "nsXULAppAPI.h"
 #endif
 
 #ifdef XP_MACOSX
@@ -103,17 +103,17 @@ GLScreenBuffer::CreateFactory(GLContext*
                 }
 #endif
                 break;
             }
             case mozilla::layers::LayersBackend::LAYERS_D3D11: {
 #ifdef XP_WIN
                 // Enable surface sharing only if ANGLE and compositing devices
                 // are both WARP or both not WARP
-                gfx::DeviceManagerDx* dm = gfx::DeviceManagerDx::Get();
+                gfx::DeviceManagerD3D11* dm = gfx::DeviceManagerD3D11::Get();
                 if (gl->IsANGLE() &&
                     (gl->IsWARP() == dm->IsWARP()) &&
                     dm->TextureSharingWorks())
                 {
                     factory = SurfaceFactory_ANGLEShareHandle::Create(gl, caps, allocator, flags);
                 }
 
                 if (!factory && gfxPrefs::WebGLDXGLEnabled()) {
--- a/gfx/gl/SharedSurfaceANGLE.cpp
+++ b/gfx/gl/SharedSurfaceANGLE.cpp
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SharedSurfaceANGLE.h"
 
 #include <d3d11.h>
 #include "GLContextEGL.h"
 #include "GLLibraryEGL.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor, etc
 
 namespace mozilla {
 namespace gl {
 
 // Returns `EGL_NO_SURFACE` (`0`) on error.
 static EGLSurface
 CreatePBufferSurface(GLLibraryEGL* egl,
@@ -193,17 +193,17 @@ public:
 
             if (FAILED(hr)) {
                 NS_WARNING("Failed to lock the texture");
                 return;
             }
         }
 
         RefPtr<ID3D11Device> device =
-          gfx::DeviceManagerDx::Get()->GetContentDevice();
+          gfx::DeviceManagerD3D11::Get()->GetContentDevice();
         if (!device) {
             return;
         }
 
         device->GetImmediateContext(getter_AddRefs(mDeviceContext));
 
         mTexture->GetDesc(&mDesc);
         mDesc.BindFlags = 0;
@@ -250,17 +250,17 @@ public:
 };
 
 bool
 SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surface)
 {
     MOZ_ASSERT(out_surface);
 
     RefPtr<ID3D11Device> device =
-      gfx::DeviceManagerDx::Get()->GetContentDevice();
+      gfx::DeviceManagerD3D11::Get()->GetContentDevice();
     if (!device) {
         return false;
     }
 
     RefPtr<ID3D11Texture2D> tex;
     HRESULT hr = device->OpenSharedResource(mShareHandle,
                                             __uuidof(ID3D11Texture2D),
                                             (void**)(ID3D11Texture2D**)getter_AddRefs(tex));
--- a/gfx/gl/SharedSurfaceD3D11Interop.cpp
+++ b/gfx/gl/SharedSurfaceD3D11Interop.cpp
@@ -5,17 +5,17 @@
 
 #include "SharedSurfaceD3D11Interop.h"
 
 #include <d3d11.h>
 #include "gfxPrefs.h"
 #include "GLContext.h"
 #include "WGLLibrary.h"
 #include "nsPrintfCString.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 
 namespace mozilla {
 namespace gl {
 
 /*
 Sample Code for WGL_NV_DX_interop2:
 Example: Render to Direct3D 11 backbuffer with openGL:
 
@@ -122,17 +122,17 @@ public:
     WGLLibrary* const mWGL;
     const RefPtr<ID3D11Device> mD3D; // Only needed for lifetime guarantee.
     const HANDLE mDXGLDeviceHandle;
 
     static already_AddRefed<DXGLDevice> Open(WGLLibrary* wgl)
     {
         MOZ_ASSERT(wgl->HasDXInterop2());
 
-        RefPtr<ID3D11Device> d3d = gfx::DeviceManagerDx::Get()->GetContentDevice();
+        RefPtr<ID3D11Device> d3d = gfx::DeviceManagerD3D11::Get()->GetContentDevice();
         if (!d3d) {
             NS_WARNING("Failed to create D3D11 device.");
             return nullptr;
         }
 
         HANDLE dxglDeviceHandle = wgl->fDXOpenDevice(d3d);
         if (!dxglDeviceHandle) {
             NS_WARNING("Failed to open D3D device for use by WGL.");
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -472,20 +472,16 @@ public:
   /**
    * Call before rendering begins to ensure the compositor is ready to
    * composite. Returns false if rendering should be aborted.
    */
   virtual bool Ready() { return true; }
 
   virtual void ForcePresent() { }
 
-  virtual bool IsPendingComposite() { return false; }
-
-  virtual void FinishPendingComposite() {}
-
   widget::CompositorWidget* GetWidget() const { return mWidget; }
 
   virtual bool HasImageHostOverlays() { return false; }
 
   virtual void AddImageHostOverlay(ImageHostOverlay* aOverlay) {}
 
   virtual void RemoveImageHostOverlay(ImageHostOverlay* aOverlay) {}
 
--- a/gfx/layers/IMFYCbCrImage.cpp
+++ b/gfx/layers/IMFYCbCrImage.cpp
@@ -2,17 +2,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "IMFYCbCrImage.h"
 #include "mozilla/layers/TextureD3D11.h"
 #include "mozilla/layers/CompositableClient.h"
 #include "mozilla/layers/CompositableForwarder.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/gfx/Types.h"
 #include "mozilla/layers/TextureClient.h"
 #include "d3d9.h"
 
 namespace mozilla {
 namespace layers {
 
 IMFYCbCrImage::IMFYCbCrImage(IMFMediaBuffer* aBuffer, IMF2DBuffer* a2DBuffer)
@@ -221,17 +221,17 @@ IMFYCbCrImage::GetD3D9TextureClient(Comp
 TextureClient*
 IMFYCbCrImage::GetTextureClient(CompositableClient* aClient)
 {
   if (mTextureClient) {
     return mTextureClient;
   }
 
   RefPtr<ID3D11Device> device =
-    gfx::DeviceManagerDx::Get()->GetContentDevice();
+    gfx::DeviceManagerD3D11::Get()->GetContentDevice();
 
   LayersBackend backend = aClient->GetForwarder()->GetCompositorBackendType();
   if (!device || backend != LayersBackend::LAYERS_D3D11) {
     if (backend == LayersBackend::LAYERS_D3D9 ||
         backend == LayersBackend::LAYERS_D3D11) {
       return GetD3D9TextureClient(aClient);
     }
     return nullptr;
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -177,17 +177,16 @@ public:
   const gfx::IntSize mSize;
   RefPtr<gfx::DataSourceSurface> mSurface;
   bool mNeedsUpdate;
 };
 
 BasicCompositor::BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
   : Compositor(aWidget, aParent)
   , mDidExternalComposition(false)
-  , mIsPendingEndRemoteDrawing(false)
 {
   MOZ_COUNT_CTOR(BasicCompositor);
 
   mMaxTextureSize = Factory::GetMaxSurfaceSize(gfxVars::ContentBackend());
 }
 
 BasicCompositor::~BasicCompositor()
 {
@@ -674,22 +673,16 @@ BasicCompositor::ClearRect(const gfx::Re
 void
 BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
                             const gfx::IntRect *aClipRectIn,
                             const gfx::IntRect& aRenderBounds,
                             const nsIntRegion& aOpaqueRegion,
                             gfx::IntRect *aClipRectOut /* = nullptr */,
                             gfx::IntRect *aRenderBoundsOut /* = nullptr */)
 {
-  if (mIsPendingEndRemoteDrawing) {
-    // Force to end previous remote drawing.
-    TryToEndRemoteDrawing(/* aForceToEnd */ true);
-    MOZ_ASSERT(!mIsPendingEndRemoteDrawing);
-  }
-
   LayoutDeviceIntRect intRect(LayoutDeviceIntPoint(), mWidget->GetClientSize());
   IntRect rect = IntRect(0, 0, intRect.width, intRect.height);
 
   LayoutDeviceIntRegion invalidRegionSafe;
   if (mDidExternalComposition) {
     // We do not know rendered region during external composition, just redraw
     // whole widget.
     invalidRegionSafe = intRect;
@@ -798,39 +791,16 @@ BasicCompositor::EndFrame()
     mRenderTarget->mDrawTarget->FillRect(
       IntRectToRect(mInvalidRegion.GetBounds()).ToUnknownRect(),
       ColorPattern(Color(r, g, b, 0.2f)));
   }
 
   // Pop aInvalidregion
   mRenderTarget->mDrawTarget->PopClip();
 
-  TryToEndRemoteDrawing();
-}
-
-void
-BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd)
-{
-  if (mIsDestroyed || !mRenderTarget) {
-    return;
-  }
-
-  // It it is not a good timing for EndRemoteDrawing, defter to call it.
-  if (!aForceToEnd && NeedsToDeferEndRemoteDrawing()) {
-    mIsPendingEndRemoteDrawing = true;
-
-    const uint32_t retryMs = 2;
-    RefPtr<BasicCompositor> self = this;
-    RefPtr<Runnable> runnable = NS_NewRunnableFunction([self]() {
-      self->TryToEndRemoteDrawing();
-    });
-    MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs);
-    return;
-  }
-
   if (mRenderTarget->mDrawTarget != mDrawTarget) {
     // Note: Most platforms require us to buffer drawing to the widget surface.
     // That's why we don't draw to mDrawTarget directly.
     RefPtr<SourceSurface> source;
     if (mRenderTarget->mDrawTarget != mDrawTarget) {
       source = mWidget->EndBackBufferDrawing();
     } else {
       source = mRenderTarget->mDrawTarget->Snapshot();
@@ -851,36 +821,16 @@ BasicCompositor::TryToEndRemoteDrawing(b
   }
 
   if (!mTarget) {
     mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion);
   }
 
   mDrawTarget = nullptr;
   mRenderTarget = nullptr;
-  mIsPendingEndRemoteDrawing = false;
-}
-
-bool
-BasicCompositor::NeedsToDeferEndRemoteDrawing()
-{
-  MOZ_ASSERT(mDrawTarget);
-  MOZ_ASSERT(mRenderTarget);
-
-  if (mTarget || mRenderTarget->mDrawTarget == mDrawTarget) {
-    return false;
-  }
-
-  return mWidget->NeedsToDeferEndRemoteDrawing();
-}
-
-void
-BasicCompositor::FinishPendingComposite()
-{
-  TryToEndRemoteDrawing(/* aForceToEnd */ true);
 }
 
 void
 BasicCompositor::EndFrameForExternalComposition(const gfx::Matrix& aTransform)
 {
   MOZ_ASSERT(!mTarget);
   MOZ_ASSERT(!mDrawTarget);
   MOZ_ASSERT(!mRenderTarget);
--- a/gfx/layers/basic/BasicCompositor.h
+++ b/gfx/layers/basic/BasicCompositor.h
@@ -123,40 +123,28 @@ public:
 #endif // MOZ_DUMP_PAINTING
 
   virtual LayersBackend GetBackendType() const override {
     return LayersBackend::LAYERS_BASIC;
   }
 
   gfx::DrawTarget *GetDrawTarget() { return mDrawTarget; }
 
-  virtual bool IsPendingComposite() override
-  {
-    return mIsPendingEndRemoteDrawing;
-  }
-
-  virtual void FinishPendingComposite() override;
-
 private:
 
-  void TryToEndRemoteDrawing(bool aForceToEnd = false);
-
-  bool NeedsToDeferEndRemoteDrawing();
-
   // The final destination surface
   RefPtr<gfx::DrawTarget> mDrawTarget;
   // The current render target for drawing
   RefPtr<BasicCompositingRenderTarget> mRenderTarget;
 
   LayoutDeviceIntRect mInvalidRect;
   LayoutDeviceIntRegion mInvalidRegion;
   bool mDidExternalComposition;
 
   uint32_t mMaxTextureSize;
-  bool mIsPendingEndRemoteDrawing;
 };
 
 BasicCompositor* AssertBasicCompositor(Compositor* aCompositor);
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_BASICCOMPOSITOR_H */
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -30,17 +30,17 @@
 #include "TiledLayerBuffer.h"
 #include "mozilla/dom/WindowBinding.h"  // for Overfill Callback
 #include "FrameLayerBuilder.h"          // for FrameLayerbuilder
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #include "LayerMetricsWrapper.h"
 #endif
 #ifdef XP_WIN
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #endif
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
 void
@@ -767,17 +767,17 @@ ClientLayerManager::GetBackendName(nsASt
 {
   switch (mForwarder->GetCompositorBackendType()) {
     case LayersBackend::LAYERS_NONE: aName.AssignLiteral("None"); return;
     case LayersBackend::LAYERS_BASIC: aName.AssignLiteral("Basic"); return;
     case LayersBackend::LAYERS_OPENGL: aName.AssignLiteral("OpenGL"); return;
     case LayersBackend::LAYERS_D3D9: aName.AssignLiteral("Direct3D 9"); return;
     case LayersBackend::LAYERS_D3D11: {
 #ifdef XP_WIN
-      if (DeviceManagerDx::Get()->IsWARP()) {
+      if (DeviceManagerD3D11::Get()->IsWARP()) {
         aName.AssignLiteral("Direct3D 11 WARP");
       } else {
         aName.AssignLiteral("Direct3D 11");
       }
 #endif
       return;
     }
     default: NS_RUNTIMEABORT("Invalid backend");
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -29,17 +29,17 @@
 #include "LayersLogging.h"              // for AppendToString
 #include "gfxUtils.h"                   // for gfxUtils::GetAsLZ4Base64Str
 #include "IPDLActor.h"
 #include "BufferTexture.h"
 #include "gfxPrefs.h"
 #include "mozilla/layers/ShadowLayers.h"
 
 #ifdef XP_WIN
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/layers/TextureD3D9.h"
 #include "mozilla/layers/TextureD3D11.h"
 #include "mozilla/layers/TextureDIB.h"
 #include "gfxWindowsPlatform.h"
 #include "gfx2DGlue.h"
 #endif
 #ifdef MOZ_X11
 #include "mozilla/layers/TextureClientX11.h"
@@ -1035,17 +1035,17 @@ TextureClient::CreateForDrawing(TextureF
   int32_t maxTextureSize = aAllocator->GetMaxTextureSize();
 #endif
 
 #ifdef XP_WIN
   if (aLayersBackend == LayersBackend::LAYERS_D3D11 &&
       (moz2DBackend == gfx::BackendType::DIRECT2D ||
        moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
        (!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
-        DeviceManagerDx::Get()->GetContentDevice())) &&
+        DeviceManagerD3D11::Get()->GetContentDevice())) &&
       aSize.width <= maxTextureSize &&
       aSize.height <= maxTextureSize)
   {
     data = DXGITextureData::Create(aSize, aFormat, aAllocFlags);
   }
   if (aLayersBackend == LayersBackend::LAYERS_D3D9 &&
       moz2DBackend == gfx::BackendType::CAIRO &&
       aAllocator->IsSameProcess() &&
@@ -1134,17 +1134,17 @@ TextureClient::CreateFromSurface(Texture
   gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(aLayersBackend, aSelector);
 
   int32_t maxTextureSize = aAllocator->GetMaxTextureSize();
 
   if (aLayersBackend == LayersBackend::LAYERS_D3D11 &&
     (moz2DBackend == gfx::BackendType::DIRECT2D ||
       moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
       (!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
-       DeviceManagerDx::Get()->GetContentDevice())) &&
+       DeviceManagerD3D11::Get()->GetContentDevice())) &&
     size.width <= maxTextureSize &&
     size.height <= maxTextureSize)
   {
     data = D3D11TextureData::Create(aSurface, aAllocFlags);
   }
 #endif
 
   if (data) {
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -7,17 +7,17 @@
 
 #include "TextureD3D11.h"
 #include "CompositorD3D11Shaders.h"
 #include "CompositorD3D11ShadersVR.h"
 
 #include "gfxWindowsPlatform.h"
 #include "nsIWidget.h"
 #include "nsIGfxInfo.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/layers/ImageHost.h"
 #include "mozilla/layers/ContentHost.h"
 #include "mozilla/layers/Effects.h"
 #include "nsWindowsHelpers.h"
 #include "gfxPrefs.h"
 #include "gfxConfig.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxVR.h"
@@ -199,17 +199,17 @@ bool
 CompositorD3D11::Initialize(nsCString* const out_failureReason)
 {
   ScopedGfxFeatureReporter reporter("D3D11 Layers");
 
   MOZ_ASSERT(gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING));
 
   HRESULT hr;
 
-  mDevice = DeviceManagerDx::Get()->GetCompositorDevice();
+  mDevice = DeviceManagerD3D11::Get()->GetCompositorDevice();
   if (!mDevice) {
     *out_failureReason = "FEATURE_FAILURE_D3D11_NO_DEVICE";
     return false;
   }
 
   mDevice->GetImmediateContext(getter_AddRefs(mContext));
 
   if (!mContext) {
@@ -1254,17 +1254,17 @@ CompositorD3D11::EndFrame()
   CD3D11_QUERY_DESC  desc(D3D11_QUERY_EVENT);
   mDevice->CreateQuery(&desc, getter_AddRefs(query));
   if (query) {
     mContext->End(query);
   }
 
   UINT presentInterval = 0;
 
-  bool isWARP = DeviceManagerDx::Get()->IsWARP();
+  bool isWARP = DeviceManagerD3D11::Get()->IsWARP();
   if (isWARP) {
     // When we're using WARP we cannot present immediately as it causes us
     // to tear when rendering. When not using WARP it appears the DWM takes
     // care of tearing for us.
     presentInterval = 1;
   }
 
   if (oldSize == mSize) {
@@ -1504,17 +1504,17 @@ CompositorD3D11::UpdateRenderTarget()
 
   return true;
 }
 
 bool
 DeviceAttachmentsD3D11::InitSyncObject()
 {
   // Sync object is not supported on WARP.
-  if (DeviceManagerDx::Get()->IsWARP()) {
+  if (DeviceManagerD3D11::Get()->IsWARP()) {
     return true;
   }
 
   // It's okay to do this on Windows 8. But for now we'll just bail
   // whenever we're using WARP.
   CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, 1, 1, 1, 1,
                              D3D11_BIND_SHADER_RESOURCE |
                              D3D11_BIND_RENDER_TARGET);
@@ -1706,17 +1706,17 @@ CompositorD3D11::HandleError(HRESULT hr,
   if (SUCCEEDED(hr)) {
     return;
   }
 
   if (aSeverity == Critical) {
     MOZ_CRASH("GFX: Unrecoverable D3D11 error");
   }
 
-  if (mDevice && DeviceManagerDx::Get()->GetCompositorDevice() != mDevice) {
+  if (mDevice && DeviceManagerD3D11::Get()->GetCompositorDevice() != mDevice) {
     gfxCriticalError() << "Out of sync D3D11 devices in HandleError, " << (int)mVerifyBuffersFailed;
   }
 
   HRESULT hrOnReset = S_OK;
   bool deviceRemoved = hr == DXGI_ERROR_DEVICE_REMOVED;
 
   if (deviceRemoved && mDevice) {
     hrOnReset = mDevice->GetDeviceRemovedReason();
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -6,17 +6,17 @@
 #include "TextureD3D11.h"
 #include "CompositorD3D11.h"
 #include "gfxContext.h"
 #include "Effects.h"
 #include "gfxWindowsPlatform.h"
 #include "gfx2DGlue.h"
 #include "gfxPrefs.h"
 #include "ReadbackManagerD3D11.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/gfx/Logging.h"
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
@@ -360,17 +360,17 @@ DXGITextureData::Create(IntSize aSize, S
 DXGITextureData*
 D3D11TextureData::Create(IntSize aSize, SurfaceFormat aFormat, SourceSurface* aSurface,
                          TextureAllocationFlags aFlags, ID3D11Device* aDevice)
 {
   // Just grab any device. We never use the immediate context, so the devices are fine
   // to use from any thread.
   RefPtr<ID3D11Device> device = aDevice;
   if (!device) {
-    device = DeviceManagerDx::Get()->GetContentDevice();
+    device = DeviceManagerD3D11::Get()->GetContentDevice();
     if (!device) {
       return nullptr;
     }
   }
 
   CD3D11_TEXTURE2D_DESC newDesc(DXGI_FORMAT_B8G8R8A8_UNORM,
                                 aSize.width, aSize.height, 1, 1,
                                 D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE);
@@ -691,17 +691,17 @@ DXGITextureHostD3D11::OpenSharedHandle()
 
 RefPtr<ID3D11Device>
 DXGITextureHostD3D11::GetDevice()
 {
   if (mFlags & TextureFlags::INVALID_COMPOSITOR) {
     return nullptr;
   }
 
-  return DeviceManagerDx::Get()->GetCompositorDevice();
+  return DeviceManagerD3D11::Get()->GetCompositorDevice();
 }
 
 static CompositorD3D11* AssertD3D11Compositor(Compositor* aCompositor)
 {
   CompositorD3D11* compositor = aCompositor ? aCompositor->AsCompositorD3D11()
                                             : nullptr;
   if (!compositor) {
     gfxCriticalNote << "[D3D11] Attempt to set an incompatible compositor";
@@ -827,17 +827,17 @@ DXGIYCbCrTextureHostD3D11::OpenSharedHan
 
 RefPtr<ID3D11Device>
 DXGIYCbCrTextureHostD3D11::GetDevice()
 {
   if (mFlags & TextureFlags::INVALID_COMPOSITOR) {
     return nullptr;
   }
 
-  return DeviceManagerDx::Get()->GetCompositorDevice();
+  return DeviceManagerD3D11::Get()->GetCompositorDevice();
 }
 
 void
 DXGIYCbCrTextureHostD3D11::SetCompositor(Compositor* aCompositor)
 {
   mCompositor = AssertD3D11Compositor(aCompositor);
   if (!mCompositor) {
     mTextureSources[0] = nullptr;
@@ -1151,17 +1151,17 @@ SyncObjectD3D11::RegisterTexture(ID3D11T
 }
 
 void
 SyncObjectD3D11::FinalizeFrame()
 {
   HRESULT hr;
 
   if (!mD3D11Texture && mD3D11SyncedTextures.size()) {
-    RefPtr<ID3D11Device> device = DeviceManagerDx::Get()->GetContentDevice();
+    RefPtr<ID3D11Device> device = DeviceManagerD3D11::Get()->GetContentDevice();
 
     hr = device->OpenSharedResource(mHandle, __uuidof(ID3D11Texture2D), (void**)(ID3D11Texture2D**)getter_AddRefs(mD3D11Texture));
 
     if (FAILED(hr) || !mD3D11Texture) {
       gfxCriticalError() << "Failed to D3D11 OpenSharedResource for frame finalization: " << hexa(hr);
 
       if (gfxWindowsPlatform::GetPlatform()->DidRenderingDeviceReset()) {
         return;
@@ -1194,17 +1194,17 @@ SyncObjectD3D11::FinalizeFrame()
       }
       gfxDevCrash(LogReason::D3D11SyncLock) << "Timeout on the D3D11 sync lock";
     }
 
     D3D11_BOX box;
     box.front = box.top = box.left = 0;
     box.back = box.bottom = box.right = 1;
 
-    RefPtr<ID3D11Device> dev = DeviceManagerDx::Get()->GetContentDevice();
+    RefPtr<ID3D11Device> dev = DeviceManagerD3D11::Get()->GetContentDevice();
     if (!dev) {
       if (gfxWindowsPlatform::GetPlatform()->DidRenderingDeviceReset()) {
         return;
       }
       MOZ_CRASH("GFX: Invalid D3D11 content device");
     }
 
     RefPtr<ID3D11DeviceContext> ctx;
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -476,24 +476,16 @@ CompositorVsyncScheduler::Composite(Time
 
   if ((aVsyncTimestamp < mLastCompose) && !mAsapScheduling) {
     // We can sometimes get vsync timestamps that are in the past
     // compared to the last compose with force composites.
     // In those cases, wait until the next vsync;
     return;
   }
 
-  MOZ_ASSERT(mCompositorBridgeParent);
-  if (!mAsapScheduling && mCompositorBridgeParent->IsPendingComposite()) {
-    // If previous composite is still on going, finish it and does a next
-    // composite in a next vsync.
-    mCompositorBridgeParent->FinishPendingComposite();
-    return;
-  }
-
   DispatchTouchEvents(aVsyncTimestamp);
   DispatchVREvents(aVsyncTimestamp);
 
   if (mNeedsComposite || mAsapScheduling) {
     mNeedsComposite = 0;
     mLastCompose = aVsyncTimestamp;
     ComposeToTarget(nullptr);
     mVsyncNotificationsSkipped = 0;
@@ -1946,36 +1938,16 @@ CompositorBridgeParent::DeallocPComposit
 #if defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
   static_cast<widget::CompositorWidgetParent*>(aActor)->Release();
   return true;
 #else
   return false;
 #endif
 }
 
-bool
-CompositorBridgeParent::IsPendingComposite()
-{
-  MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
-  if (!mCompositor) {
-    return false;
-  }
-  return mCompositor->IsPendingComposite();
-}
-
-void
-CompositorBridgeParent::FinishPendingComposite()
-{
-  MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
-  if (!mCompositor) {
-    return;
-  }
-  return mCompositor->FinishPendingComposite();
-}
-
 /**
  * This class handles layer updates pushed directly from child processes to
  * the compositor thread. It's associated with a CompositorBridgeParent on the
  * compositor thread. While it uses the PCompositorBridge protocol to manage
  * these updates, it doesn't actually drive compositing itself. For that it
  * hands off work to the CompositorBridgeParent it's associated with.
  */
 class CrossProcessCompositorBridgeParent final : public PCompositorBridgeParent,
--- a/gfx/layers/ipc/CompositorBridgeParent.h
+++ b/gfx/layers/ipc/CompositorBridgeParent.h
@@ -547,18 +547,16 @@ protected:
 
   void InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints);
   void PauseComposition();
   void ResumeComposition();
   void ResumeCompositionAndResize(int width, int height);
   void ForceComposition();
   void CancelCurrentCompositeTask();
   void Invalidate();
-  bool IsPendingComposite();
-  void FinishPendingComposite();
 
   RefPtr<Compositor> NewCompositor(const nsTArray<LayersBackend>& aBackendHints);
   void ResetCompositorTask(const nsTArray<LayersBackend>& aBackendHints,
                            Maybe<TextureFactoryIdentifier>* aOutNewIdentifier);
   Maybe<TextureFactoryIdentifier> ResetCompositorImpl(const nsTArray<LayersBackend>& aBackendHints);
 
   /**
    * Add a compositor to the global compositor map.
rename from gfx/thebes/DeviceManagerDx.cpp
rename to gfx/thebes/DeviceManagerD3D11.cpp
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerD3D11.cpp
@@ -1,59 +1,53 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "DeviceManagerDx.h"
+#include "DeviceManagerD3D11.h"
 #include "D3D11Checks.h"
 #include "gfxConfig.h"
 #include "GfxDriverInfo.h"
 #include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/D3DMessageUtils.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/GraphicsMessages.h"
 #include "mozilla/gfx/Logging.h"
 #include "nsIGfxInfo.h"
 #include "nsWindowsHelpers.h"
 #include <d3d11.h>
-#include <ddraw.h>
 
 namespace mozilla {
 namespace gfx {
 
 using namespace mozilla::widget;
 
-StaticAutoPtr<DeviceManagerDx> DeviceManagerDx::sInstance;
+StaticAutoPtr<DeviceManagerD3D11> DeviceManagerD3D11::sInstance;
 
 // We don't have access to the D3D11CreateDevice type in gfxWindowsPlatform.h,
 // since it doesn't include d3d11.h, so we use a static here. It should only
 // be used within InitializeD3D11.
 decltype(D3D11CreateDevice)* sD3D11CreateDeviceFn = nullptr;
 
-// We don't have access to the DirectDrawCreateEx type in gfxWindowsPlatform.h,
-// since it doesn't include ddraw.h, so we use a static here. It should only
-// be used within InitializeDirectDrawConfig.
-decltype(DirectDrawCreateEx)* sDirectDrawCreateExFn = nullptr;
-
 /* static */ void
-DeviceManagerDx::Init()
+DeviceManagerD3D11::Init()
 {
-  sInstance = new DeviceManagerDx();
+  sInstance = new DeviceManagerD3D11();
 }
 
 /* static */ void
-DeviceManagerDx::Shutdown()
+DeviceManagerD3D11::Shutdown()
 {
   sInstance = nullptr;
 }
 
-DeviceManagerDx::DeviceManagerDx()
+DeviceManagerD3D11::DeviceManagerD3D11()
  : mDeviceLock("gfxWindowsPlatform.mDeviceLock"),
    mIsWARP(false),
    mTextureSharingWorks(false),
    mCompositorDeviceSupportsVideo(false)
 {
   // Set up the D3D11 feature levels we can ask for.
   if (IsWin8OrLater()) {
     mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
@@ -70,17 +64,17 @@ IsWARPStable()
   // It seems like nvdxgiwrap makes a mess of WARP. See bug 1154703.
   if (!IsWin8OrLater() || GetModuleHandleA("nvdxgiwrap.dll")) {
     return false;
   }
   return true;
 }
 
 void
-DeviceManagerDx::CreateDevices()
+DeviceManagerD3D11::CreateDevices()
 {
   FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);
   MOZ_ASSERT(d3d11.IsEnabled());
 
   nsModuleHandle d3d11Module(LoadLibrarySystem32(L"d3d11.dll"));
   sD3D11CreateDeviceFn =
     (decltype(D3D11CreateDevice)*)GetProcAddress(d3d11Module, "D3D11CreateDevice");
 
@@ -148,17 +142,17 @@ DeviceManagerDx::CreateDevices()
 
   // We leak these everywhere and we need them our entire runtime anyway, let's
   // leak it here as well. We keep the pointer to sD3D11CreateDeviceFn around
   // as well for D2D1 and device resets.
   d3d11Module.disown();
 }
 
 IDXGIAdapter1*
-DeviceManagerDx::GetDXGIAdapter()
+DeviceManagerD3D11::GetDXGIAdapter()
 {
   if (mAdapter) {
     return mAdapter;
   }
 
   nsModuleHandle dxgiModule(LoadLibrarySystem32(L"dxgi.dll"));
   decltype(CreateDXGIFactory1)* createDXGIFactory1 = (decltype(CreateDXGIFactory1)*)
     GetProcAddress(dxgiModule, "CreateDXGIFactory1");
@@ -213,17 +207,17 @@ DeviceManagerDx::GetDXGIAdapter()
   }
 
   // We leak this module everywhere, we might as well do so here as well.
   dxgiModule.disown();
   return mAdapter;
 }
 
 bool
-DeviceManagerDx::AttemptD3D11DeviceCreationHelperInner(
+DeviceManagerD3D11::AttemptD3D11DeviceCreationHelperInner(
   IDXGIAdapter1* aAdapter, bool aAttemptVideoSupport, RefPtr<ID3D11Device>& aOutDevice, HRESULT& aResOut)
 {
   // Use D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
   // to prevent bug 1092260. IE 11 also uses this flag.
   UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS;
   if (aAttemptVideoSupport) {
     flags |= D3D11_CREATE_DEVICE_VIDEO_SUPPORT;
   }
@@ -236,17 +230,17 @@ DeviceManagerDx::AttemptD3D11DeviceCreat
         D3D11_SDK_VERSION, getter_AddRefs(aOutDevice), nullptr, nullptr);
   } MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
     return false;
   }
   return true;
 }
 
 bool
-DeviceManagerDx::AttemptD3D11DeviceCreationHelper(
+DeviceManagerD3D11::AttemptD3D11DeviceCreationHelper(
   FeatureState& aD3d11, IDXGIAdapter1* aAdapter, bool aAttemptVideoSupport, RefPtr<ID3D11Device>& aOutDevice)
 {
   HRESULT hr;
   RefPtr<ID3D11Device> device;
   if (!AttemptD3D11DeviceCreationHelperInner(aAdapter, aAttemptVideoSupport, device, hr)) {
     if (!aAttemptVideoSupport) {
       gfxCriticalError() << "Crash during D3D11 device creation";
       aD3d11.SetFailed(FeatureStatus::CrashedInHandler, "Crashed trying to acquire a D3D11 device",
@@ -271,17 +265,17 @@ DeviceManagerDx::AttemptD3D11DeviceCreat
     return false;
   }
 
   aOutDevice = device;
   return true;
 }
 
 void
-DeviceManagerDx::AttemptD3D11DeviceCreation(FeatureState& d3d11)
+DeviceManagerD3D11::AttemptD3D11DeviceCreation(FeatureState& d3d11)
 {
   RefPtr<IDXGIAdapter1> adapter = GetDXGIAdapter();
   if (!adapter) {
     d3d11.SetFailed(FeatureStatus::Unavailable, "Failed to acquire a DXGI adapter",
                     NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D11_DXGI"));
     return;
   }
 
@@ -320,17 +314,17 @@ DeviceManagerDx::AttemptD3D11DeviceCreat
   // It seems like this may only happen when we're using the NVIDIA gpu
   D3D11Checks::WarnOnAdapterMismatch(mCompositorDevice);
 
   mCompositorDevice->SetExceptionMode(0);
   mIsWARP = false;
 }
 
 bool
-DeviceManagerDx::AttemptWARPDeviceCreationHelper(
+DeviceManagerD3D11::AttemptWARPDeviceCreationHelper(
   ScopedGfxFeatureReporter& aReporterWARP,
   RefPtr<ID3D11Device>& aOutDevice,
   HRESULT& aResOut)
 {
   MOZ_SEH_TRY {
     aResOut =
       sD3D11CreateDeviceFn(
         nullptr, D3D_DRIVER_TYPE_WARP, nullptr,
@@ -343,17 +337,17 @@ DeviceManagerDx::AttemptWARPDeviceCreati
     aReporterWARP.SetSuccessful();
   } MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
     return false;
   }
   return true;
 }
 
 void
-DeviceManagerDx::AttemptWARPDeviceCreation()
+DeviceManagerD3D11::AttemptWARPDeviceCreation()
 {
   ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP());
   FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);
 
   HRESULT hr;
   RefPtr<ID3D11Device> device;
   if (!AttemptWARPDeviceCreationHelper(reporterWARP, device, hr)) {
     gfxCriticalError() << "Exception occurred initializing WARP D3D11 device!";
@@ -380,17 +374,17 @@ DeviceManagerDx::AttemptWARPDeviceCreati
   if (IsWin8OrLater()) {
     mTextureSharingWorks = D3D11Checks::DoesTextureSharingWork(mCompositorDevice);
   }
   mCompositorDevice->SetExceptionMode(0);
   mIsWARP = true;
 }
 
 bool
-DeviceManagerDx::AttemptD3D11ContentDeviceCreationHelper(
+DeviceManagerD3D11::AttemptD3D11ContentDeviceCreationHelper(
   IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aOutDevice, HRESULT& aResOut)
 {
   MOZ_SEH_TRY {
     aResOut =
       sD3D11CreateDeviceFn(
         aAdapter, mIsWARP ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN,
         nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT,
         mFeatureLevels.Elements(), mFeatureLevels.Length(),
@@ -398,17 +392,17 @@ DeviceManagerDx::AttemptD3D11ContentDevi
 
   } MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
     return false;
   }
   return true;
 }
 
 FeatureStatus
-DeviceManagerDx::AttemptD3D11ContentDeviceCreation()
+DeviceManagerD3D11::AttemptD3D11ContentDeviceCreation()
 {
   RefPtr<IDXGIAdapter1> adapter;
   if (!mIsWARP) {
     adapter = GetDXGIAdapter();
     if (!adapter) {
       return FeatureStatus::Unavailable;
     }
   }
@@ -457,17 +451,17 @@ DeviceManagerDx::AttemptD3D11ContentDevi
   hr = mContentDevice->QueryInterface(__uuidof(ID3D10Multithread), getter_AddRefs(multi));
   if (SUCCEEDED(hr) && multi) {
     multi->SetMultithreadProtected(TRUE);
   }
   return FeatureStatus::Available;
 }
 
 bool
-DeviceManagerDx::CreateD3D11DecoderDeviceHelper(
+DeviceManagerD3D11::CreateD3D11DecoderDeviceHelper(
   IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice, HRESULT& aResOut)
 {
   MOZ_SEH_TRY{
     aResOut =
       sD3D11CreateDeviceFn(
         aAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
         D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS | D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
         mFeatureLevels.Elements(), mFeatureLevels.Length(),
@@ -475,17 +469,17 @@ DeviceManagerDx::CreateD3D11DecoderDevic
 
   } MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
     return false;
   }
   return true;
 }
 
 RefPtr<ID3D11Device>
-DeviceManagerDx::CreateDecoderDevice()
+DeviceManagerD3D11::CreateDecoderDevice()
 {
   if (mCompositorDevice && mCompositorDeviceSupportsVideo && !mDecoderDevice) {
     mDecoderDevice = mCompositorDevice;
 
     RefPtr<ID3D10Multithread> multi;
     mDecoderDevice->QueryInterface(__uuidof(ID3D10Multithread), getter_AddRefs(multi));
     if (multi) {
       multi->SetMultithreadProtected(TRUE);
@@ -522,27 +516,27 @@ DeviceManagerDx::CreateDecoderDevice()
 
   multi->SetMultithreadProtected(TRUE);
 
   mDecoderDevice = device;
   return device;
 }
 
 void
-DeviceManagerDx::ResetDevices()
+DeviceManagerD3D11::ResetDevices()
 {
   MutexAutoLock lock(mDeviceLock);
 
   mCompositorDevice = nullptr;
   mContentDevice = nullptr;
   Factory::SetDirect3D11Device(nullptr);
 }
 
 bool
-DeviceManagerDx::ContentAdapterIsParentAdapter(ID3D11Device* device)
+DeviceManagerD3D11::ContentAdapterIsParentAdapter(ID3D11Device* device)
 {
   DXGI_ADAPTER_DESC desc;
   if (!D3D11Checks::GetDxgiDesc(device, &desc)) {
     gfxCriticalNote << "Could not query device DXGI adapter info";
     return false;
   }
 
   const DxgiAdapterDesc& parent =
@@ -592,117 +586,68 @@ DidDeviceReset(RefPtr<ID3D11Device> aDev
     return false;
   }
 
   *aOutReason = HResultToResetReason(hr);
   return true;
 }
 
 bool
-DeviceManagerDx::GetAnyDeviceRemovedReason(DeviceResetReason* aOutReason)
+DeviceManagerD3D11::GetAnyDeviceRemovedReason(DeviceResetReason* aOutReason)
 {
   // Note: this can be called off the main thread, so we need to use
   // our threadsafe getters.
   if (DidDeviceReset(GetCompositorDevice(), aOutReason) ||
       DidDeviceReset(GetContentDevice(), aOutReason))
   {
     return true;
   }
   return false;
 }
 
 void
-DeviceManagerDx::DisableD3D11AfterCrash()
+DeviceManagerD3D11::DisableD3D11AfterCrash()
 {
   gfxConfig::Disable(Feature::D3D11_COMPOSITING,
     FeatureStatus::CrashedInHandler,
     "Crashed while acquiring a Direct3D11 device",
     NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D11_CRASH"));
   ResetDevices();
 }
 
 RefPtr<ID3D11Device>
-DeviceManagerDx::GetCompositorDevice()
+DeviceManagerD3D11::GetCompositorDevice()
 {
   MutexAutoLock lock(mDeviceLock);
   return mCompositorDevice;
 }
 
 RefPtr<ID3D11Device>
-DeviceManagerDx::GetContentDevice()
+DeviceManagerD3D11::GetContentDevice()
 {
   MutexAutoLock lock(mDeviceLock);
   return mContentDevice;
 }
 
 unsigned
-DeviceManagerDx::GetD3D11Version() const
+DeviceManagerD3D11::GetD3D11Version() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (!mCompositorDevice) {
     return 0;
   }
   return mCompositorDevice->GetFeatureLevel();
 }
 
 bool
-DeviceManagerDx::TextureSharingWorks() const
+DeviceManagerD3D11::TextureSharingWorks() const
 {
   return mTextureSharingWorks;
 }
 
 bool
-DeviceManagerDx::IsWARP() const
+DeviceManagerD3D11::IsWARP() const
 {
   return mIsWARP;
 }
 
-void
-DeviceManagerDx::InitializeDirectDraw()
-{
-  MOZ_ASSERT(!mDirectDraw);
-
-  FeatureState& ddraw = gfxConfig::GetFeature(Feature::DIRECT_DRAW);
-  if (!ddraw.IsEnabled()) {
-    return;
-  }
-
-  // Check if DirectDraw is available on this system.
-  mDirectDrawDLL.own(LoadLibrarySystem32(L"ddraw.dll"));
-  if (!mDirectDrawDLL) {
-    ddraw.SetFailed(FeatureStatus::Unavailable, "DirectDraw not available on this computer",
-                    NS_LITERAL_CSTRING("FEATURE_FAILURE_DDRAW_LIB"));
-    return;
-  }
-
-  sDirectDrawCreateExFn =
-    (decltype(DirectDrawCreateEx)*)GetProcAddress(mDirectDrawDLL, "DirectDrawCreateEx");
-  if (!sDirectDrawCreateExFn) {
-    ddraw.SetFailed(FeatureStatus::Unavailable, "DirectDraw not available on this computer",
-                    NS_LITERAL_CSTRING("FEATURE_FAILURE_DDRAW_LIB"));
-    return;
-  }
-
-  HRESULT hr;
-  MOZ_SEH_TRY {
-    hr = sDirectDrawCreateExFn(nullptr, getter_AddRefs(mDirectDraw), IID_IDirectDraw7, nullptr);
-  } MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
-    ddraw.SetFailed(FeatureStatus::Failed, "Failed to create DirectDraw",
-                    NS_LITERAL_CSTRING("FEATURE_FAILURE_DDRAW_LIB"));
-    gfxCriticalNote << "DoesCreatingDirectDrawFailed";
-    return;
-  }
-  if (FAILED(hr)) {
-    ddraw.SetFailed(FeatureStatus::Failed, "Failed to create DirectDraw",
-                    NS_LITERAL_CSTRING("FEATURE_FAILURE_DDRAW_LIB"));
-    gfxCriticalNote << "DoesCreatingDirectDrawFailed " << hexa(hr);
-    return;
-  }
-}
-
-IDirectDraw7*
-DeviceManagerDx::GetDirectDraw()
-{
-  return mDirectDraw;
-}
-
 } // namespace gfx
 } // namespace mozilla
rename from gfx/thebes/DeviceManagerDx.h
rename to gfx/thebes/DeviceManagerD3D11.h
--- a/gfx/thebes/DeviceManagerDx.h
+++ b/gfx/thebes/DeviceManagerD3D11.h
@@ -1,71 +1,67 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_gfx_thebes_DeviceManagerDx_h
-#define mozilla_gfx_thebes_DeviceManagerDx_h
+#ifndef mozilla_gfx_thebes_DeviceManagerD3D11_h
+#define mozilla_gfx_thebes_DeviceManagerD3D11_h
 
 #include "gfxPlatform.h"
 #include "gfxTelemetry.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/StaticPtr.h"
 #include "nsTArray.h"
-#include "nsWindowsHelpers.h"
 
 #include <windows.h>
 #include <objbase.h>
 
 #include <dxgi.h>
 
 // This header is available in the June 2010 SDK and in the Win8 SDK
 #include <d3dcommon.h>
 // Win 8.0 SDK types we'll need when building using older sdks.
 #if !defined(D3D_FEATURE_LEVEL_11_1) // defined in the 8.0 SDK only
 #define D3D_FEATURE_LEVEL_11_1 static_cast<D3D_FEATURE_LEVEL>(0xb100)
 #define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
 #define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
 #endif
 
 struct ID3D11Device;
-struct IDirectDraw7;
 
 namespace mozilla {
 class ScopedGfxFeatureReporter;
 
 namespace gfx {
 class FeatureState;
 
-class DeviceManagerDx final
+class DeviceManagerD3D11 final
 {
 public:
   static void Init();
   static void Shutdown();
 
-  DeviceManagerDx();
+  DeviceManagerD3D11();
 
-  static DeviceManagerDx* Get() {
+  static DeviceManagerD3D11* Get() {
     return sInstance;
   }
 
   RefPtr<ID3D11Device> GetCompositorDevice();
   RefPtr<ID3D11Device> GetContentDevice();
   RefPtr<ID3D11Device> CreateDecoderDevice();
-  IDirectDraw7* GetDirectDraw();
 
   unsigned GetD3D11Version() const;
   bool TextureSharingWorks() const;
   bool IsWARP() const;
 
   void CreateDevices();
   void ResetDevices();
-  void InitializeDirectDraw();
 
   // Call GetDeviceRemovedReason on each device until one returns
   // a failure.
   bool GetAnyDeviceRemovedReason(DeviceResetReason* aOutReason);
 
 private:
   IDXGIAdapter1 *GetDXGIAdapter();
 
@@ -98,27 +94,25 @@ private:
   // Create a D3D11 device to be used for DXVA decoding.
   bool CreateD3D11DecoderDeviceHelper(
       IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice,
       HRESULT& aResOut);
 
   bool ContentAdapterIsParentAdapter(ID3D11Device* device);
 
 private:
-  static StaticAutoPtr<DeviceManagerDx> sInstance;
+  static StaticAutoPtr<DeviceManagerD3D11> sInstance;
 
   mozilla::Mutex mDeviceLock;
   nsTArray<D3D_FEATURE_LEVEL> mFeatureLevels;
   RefPtr<IDXGIAdapter1> mAdapter;
   RefPtr<ID3D11Device> mCompositorDevice;
   RefPtr<ID3D11Device> mContentDevice;
   RefPtr<ID3D11Device> mDecoderDevice;
   mozilla::Atomic<bool> mIsWARP;
   mozilla::Atomic<bool> mTextureSharingWorks;
   bool mCompositorDeviceSupportsVideo;
-  nsModuleHandle mDirectDrawDLL;
-  RefPtr<IDirectDraw7> mDirectDraw;
 };
 
 } // namespace gfx
 } // namespace mozilla
 
-#endif // mozilla_gfx_thebes_DeviceManagerDx_h
+#endif // mozilla_gfx_thebes_DeviceManagerD3D11_h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -21,17 +21,17 @@
 #include "GeckoProfiler.h"
 #include "gfx2DGlue.h"
 #include "mozilla/gfx/PathHelpers.h"
 #include "mozilla/gfx/DrawTargetTiled.h"
 #include <algorithm>
 
 #if XP_WIN
 #include "gfxWindowsPlatform.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 UserDataKey gfxContext::sDontUseAsSourceKey;
 
 
@@ -1239,17 +1239,17 @@ gfxContext::PushNewDT(gfxContentType con
   if (!newDT) {
     NS_WARNING("Failed to create DrawTarget of sufficient size.");
     newDT = mDT->CreateSimilarDrawTarget(IntSize(64, 64), format);
 
     if (!newDT) {
       if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()
 #ifdef XP_WIN
           && !(mDT->GetBackendType() == BackendType::DIRECT2D1_1 &&
-               !DeviceManagerDx::Get()->GetContentDevice())
+               !DeviceManagerD3D11::Get()->GetContentDevice())
 #endif
           ) {
         // If even this fails.. we're most likely just out of memory!
         NS_ABORT_OOM(BytesPerPixel(format) * 64 * 64);
       }
       newDT = CurrentState().drawTarget;
     }
   }
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -68,17 +68,17 @@
 
 #include "base/thread.h"
 #include "SurfaceCache.h"
 #include "gfxPrefs.h"
 #include "gfxConfig.h"
 #include "VsyncSource.h"
 #include "DriverCrashGuard.h"
 #include "mozilla/dom/ContentParent.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "D3D11Checks.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 using namespace mozilla::widget;
 using namespace mozilla::image;
 
@@ -346,17 +346,17 @@ gfxWindowsPlatform::gfxWindowsPlatform()
 
   RegisterStrongMemoryReporter(new GfxD2DVramReporter());
   RegisterStrongMemoryReporter(new GPUAdapterReporter());
   RegisterStrongMemoryReporter(new D3DSharedTexturesReporter());
 }
 
 gfxWindowsPlatform::~gfxWindowsPlatform()
 {
-  DeviceManagerDx::Shutdown();
+  DeviceManagerD3D11::Shutdown();
   mDeviceManager = nullptr;
 
   mozilla::gfx::Factory::D2DCleanup();
 
   /* 
    * Uninitialize COM 
    */ 
   CoUninitialize();
@@ -379,29 +379,28 @@ gfxWindowsPlatform::InitAcceleration()
   if (IsWin8OrLater()) {
     mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
   }
   mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_11_0);
   mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_1);
   mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
   mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_9_3);
 
-  DeviceManagerDx::Init();
+  DeviceManagerD3D11::Init();
 
   InitializeConfig();
   InitializeDevices();
-  InitializeDirectDraw();
   UpdateANGLEConfig();
   UpdateRenderMode();
 }
 
 bool
 gfxWindowsPlatform::CanUseHardwareVideoDecoding()
 {
-  DeviceManagerDx* dm = DeviceManagerDx::Get();
+  DeviceManagerD3D11* dm = DeviceManagerD3D11::Get();
   if (!gfxPrefs::LayersPreferD3D9() && !dm->TextureSharingWorks()) {
     return false;
   }
   return !dm->IsWARP() && gfxPlatform::CanUseHardwareVideoDecoding();
 }
 
 bool
 gfxWindowsPlatform::InitDWriteSupport()
@@ -441,17 +440,17 @@ gfxWindowsPlatform::HandleDeviceReset()
     return false;
   }
 
   if (!mHasFakeDeviceReset) {
     Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
   }
 
   // Remove devices and adapters.
-  DeviceManagerDx::Get()->ResetDevices();
+  DeviceManagerD3D11::Get()->ResetDevices();
 
   // Reset local state. Note: we leave feature status variables as-is. They
   // will be recomputed by InitializeDevices().
   mHasDeviceReset = false;
   mHasFakeDeviceReset = false;
   mHasD3D9DeviceReset = false;
   mDeviceResetReason = DeviceResetReason::OK;
 
@@ -934,17 +933,17 @@ gfxWindowsPlatform::DidRenderingDeviceRe
       *aResetReason = mDeviceResetReason;
     }
     return true;
   }
   if (aResetReason) {
     *aResetReason = DeviceResetReason::OK;
   }
 
-  if (DeviceManagerDx::Get()->GetAnyDeviceRemovedReason(&mDeviceResetReason)) {
+  if (DeviceManagerD3D11::Get()->GetAnyDeviceRemovedReason(&mDeviceResetReason)) {
     mHasDeviceReset = true;
     if (aResetReason) {
       *aResetReason = mDeviceResetReason;
     }
     return true;
   }
 
   if (mHasD3D9DeviceReset) {
@@ -1419,43 +1418,27 @@ InitializeANGLEConfig()
   if (!gfxPlatform::IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, &message,
                            failureId)) {
     d3d11ANGLE.Disable(FeatureStatus::Blacklisted, message.get(), failureId);
   }
 
 }
 
 void
-gfxWindowsPlatform::InitializeDirectDrawConfig()
-{
-  MOZ_ASSERT(XRE_IsParentProcess());
-
-  FeatureState& ddraw = gfxConfig::GetFeature(Feature::DIRECT_DRAW);
-  ddraw.EnableByDefault();
-}
-
-void
-gfxWindowsPlatform::InitializeDirectDraw()
-{
-  DeviceManagerDx::Get()->InitializeDirectDraw();
-}
-
-void
 gfxWindowsPlatform::InitializeConfig()
 {
   if (!XRE_IsParentProcess()) {
     // Child processes init their configuration via UpdateDeviceInitData().
     return;
   }
 
   InitializeD3D9Config();
   InitializeD3D11Config();
   InitializeANGLEConfig();
   InitializeD2DConfig();
-  InitializeDirectDrawConfig();
 }
 
 void
 gfxWindowsPlatform::InitializeD3D9Config()
 {
   MOZ_ASSERT(XRE_IsParentProcess());
 
   FeatureState& d3d9 = gfxConfig::GetFeature(Feature::D3D9_COMPOSITING);
@@ -1635,17 +1618,17 @@ gfxWindowsPlatform::InitializeD3D11()
   // blacklisted, then this function will abort if WARP is disabled, causing us
   // to fallback to D3D9 or Basic layers. If WARP is not disabled it will use
   // a WARP device which should always be available on Windows 7 and higher.
   FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);
   if (!d3d11.IsEnabled()) {
     return;
   }
 
-  DeviceManagerDx::Get()->CreateDevices();
+  DeviceManagerD3D11::Get()->CreateDevices();
 }
 
 void
 gfxWindowsPlatform::InitializeD2DConfig()
 {
   FeatureState& d2d1 = gfxConfig::GetFeature(Feature::DIRECT2D);
 
   if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
@@ -1677,17 +1660,17 @@ gfxWindowsPlatform::InitializeD2DConfig(
 
 void
 gfxWindowsPlatform::InitializeD2D()
 {
   ScopedGfxFeatureReporter d2d1_1("D2D1.1");
 
   FeatureState& d2d1 = gfxConfig::GetFeature(Feature::DIRECT2D);
 
-  DeviceManagerDx* dm = DeviceManagerDx::Get();
+  DeviceManagerD3D11* dm = DeviceManagerD3D11::Get();
 
   // We don't know this value ahead of time, but the user can force-override
   // it, so we use Disable instead of SetFailed.
   if (dm->IsWARP()) {
     d2d1.Disable(FeatureStatus::Blocked, "Direct2D is not compatible with Direct3D11 WARP",
                  NS_LITERAL_CSTRING("FEATURE_FAILURE_D2D_WARP_BLOCK"));
   }
 
@@ -2043,17 +2026,17 @@ gfxWindowsPlatform::GetAcceleratedCompos
   if (gfxConfig::IsEnabled(Feature::OPENGL_COMPOSITING) && gfxPrefs::LayersPreferOpenGL()) {
     aBackends.AppendElement(LayersBackend::LAYERS_OPENGL);
   }
 
   if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && gfxPrefs::LayersPreferD3D9()) {
     aBackends.AppendElement(LayersBackend::LAYERS_D3D9);
   }
 
-  if (DeviceManagerDx::Get()->GetCompositorDevice()) {
+  if (DeviceManagerD3D11::Get()->GetCompositorDevice()) {
     aBackends.AppendElement(LayersBackend::LAYERS_D3D11);
   } else {
     NS_WARNING("Direct3D 11-accelerated layers are not supported on this system.");
   }
 
   if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && !gfxPrefs::LayersPreferD3D9()) {
     aBackends.AppendElement(LayersBackend::LAYERS_D3D9);
   }
@@ -2067,17 +2050,17 @@ gfxWindowsPlatform::GetDeviceInitData(De
 
   gfxPlatform::GetDeviceInitData(aOut);
 
   // IPDL initializes each field to false for us so we can early return.
   if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
     return;
   }
 
-  DeviceManagerDx* dm = DeviceManagerDx::Get();
+  DeviceManagerD3D11* dm = DeviceManagerD3D11::Get();
 
   aOut->useD3D11() = true;
   aOut->d3d11TextureSharingWorks() = dm->TextureSharingWorks();
   aOut->useD3D11WARP() = dm->IsWARP();
   aOut->useD2D1() = gfxConfig::IsEnabled(Feature::DIRECT2D);
 
   if (RefPtr<ID3D11Device> device = dm->GetCompositorDevice()) {
     DXGI_ADAPTER_DESC desc;
@@ -2086,14 +2069,14 @@ gfxWindowsPlatform::GetDeviceInitData(De
     }
     aOut->adapter() = DxgiAdapterDesc::From(desc);
   }
 }
 
 bool
 gfxWindowsPlatform::SupportsPluginDirectDXGIDrawing()
 {
-  DeviceManagerDx* dm = DeviceManagerDx::Get();
+  DeviceManagerD3D11* dm = DeviceManagerD3D11::Get();
   if (!dm->GetContentDevice() || !dm->TextureSharingWorks()) {
     return false;
   }
   return true;
 }
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -42,17 +42,17 @@
 #define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
 #define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
 #endif
 
 namespace mozilla {
 namespace gfx {
 class DrawTarget;
 class FeatureState;
-class DeviceManagerDx;
+class DeviceManagerD3D11;
 }
 namespace layers {
 class DeviceManagerD3D9;
 class ReadbackManagerD3D11;
 }
 }
 struct IDirect3DDevice9;
 struct ID3D11Device;
@@ -95,17 +95,17 @@ struct ClearTypeParameterInfo {
     int32_t     gamma;
     int32_t     pixelStructure;
     int32_t     clearTypeLevel;
     int32_t     enhancedContrast;
 };
 
 class gfxWindowsPlatform : public gfxPlatform
 {
-  friend class mozilla::gfx::DeviceManagerDx;
+  friend class mozilla::gfx::DeviceManagerD3D11;
 
 public:
     enum TextRenderingMode {
         TEXT_RENDERING_NO_CLEARTYPE,
         TEXT_RENDERING_NORMAL,
         TEXT_RENDERING_GDI_CLASSIC,
         TEXT_RENDERING_COUNT
     };
@@ -264,26 +264,24 @@ protected:
 private:
     void Init();
     void InitAcceleration() override;
 
     void InitializeDevices();
     void InitializeD3D11();
     void InitializeD2D();
     bool InitDWriteSupport();
-    void InitializeDirectDraw();
 
     void DisableD2D(mozilla::gfx::FeatureStatus aStatus, const char* aMessage,
                     const nsACString& aFailureId);
 
     void InitializeConfig();
     void InitializeD3D9Config();
     void InitializeD3D11Config();
     void InitializeD2DConfig();
-    void InitializeDirectDrawConfig();
 
     RefPtr<IDWriteFactory> mDWriteFactory;
     RefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
     DWRITE_MEASURING_MODE mMeasuringMode;
 
     mozilla::Mutex mDeviceLock;
     RefPtr<mozilla::layers::DeviceManagerD3D9> mDeviceManager;
     bool mHasDeviceReset;
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -46,17 +46,17 @@ EXPORTS += [
     'gfxUserFontSet.h',
     'gfxUtils.h',
     'RoundedRect.h',
     'SoftwareVsyncSource.h',
     'VsyncSource.h',
 ]
 
 EXPORTS.mozilla.gfx += [
-    'DeviceManagerDx.h',
+    'DeviceManagerD3D11.h',
     'PrintTarget.h',
     'PrintTargetThebes.h',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     EXPORTS += [
         'gfxAndroidPlatform.h',
         'gfxFT2FontBase.h',
@@ -231,17 +231,17 @@ UNIFIED_SOURCES += [
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     UNIFIED_SOURCES += [
         'gfxMacPlatformFontList.mm',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     UNIFIED_SOURCES += [
         'D3D11Checks.cpp',
-        'DeviceManagerDx.cpp',
+        'DeviceManagerD3D11.cpp',
     ]
 
 # We prefer to use ICU for normalization functions, but currently it is only
 # available if we're building with the Intl API enabled:
 if CONFIG['ENABLE_INTL_API']:
     USE_LIBS += [
         'icu',
     ]
--- a/widget/CompositorWidget.h
+++ b/widget/CompositorWidget.h
@@ -132,26 +132,16 @@ public:
   {}
   virtual void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
                                         LayoutDeviceIntRegion& aInvalidRegion)
   {
     EndRemoteDrawing();
   }
 
   /**
-   * Return true when it is better to defer EndRemoteDrawing().
-   *
-   * Called by BasicCompositor on the compositor thread for OMTC drawing
-   * after each composition.
-   */
-  virtual bool NeedsToDeferEndRemoteDrawing() {
-    return false;
-  }
-
-  /**
    * Called when shutting down the LayerManager to clean-up any cached resources.
    *
    * Always called from the compositing thread.
    */
   virtual void CleanupWindowEffects()
   {}
 
   /**
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -11,17 +11,17 @@
 #include "gfxWindowsPlatform.h"
 #include "GfxInfo.h"
 #include "GfxInfoWebGL.h"
 #include "nsUnicharUtils.h"
 #include "prenv.h"
 #include "prprf.h"
 #include "GfxDriverInfo.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/gfx/Logging.h"
 #include "nsPrintfCString.h"
 #include "jsapi.h"
 
 #if defined(MOZ_CRASHREPORTER)
 #include "nsExceptionHandler.h"
 #include "nsICrashReporter.h"
 #define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
@@ -1330,17 +1330,17 @@ GfxInfo::DescribeFeatures(JSContext* aCx
   JS::Rooted<JSObject*> obj(aCx);
 
   gfx::FeatureStatus d3d11 = gfxConfig::GetValue(Feature::D3D11_COMPOSITING);
   if (!InitFeatureObject(aCx, aObj, "d3d11", FEATURE_DIRECT3D_11_ANGLE,
                          Some(d3d11), &obj)) {
     return;
   }
   if (d3d11 == gfx::FeatureStatus::Available) {
-    DeviceManagerDx* dm = DeviceManagerDx::Get();
+    DeviceManagerD3D11* dm = DeviceManagerD3D11::Get();
     JS::Rooted<JS::Value> val(aCx, JS::Int32Value(dm->GetD3D11Version()));
     JS_SetProperty(aCx, obj, "version", val);
 
     val = JS::BooleanValue(dm->IsWARP());
     JS_SetProperty(aCx, obj, "warp", val);
 
     val = JS::BooleanValue(dm->TextureSharingWorks());
     JS_SetProperty(aCx, obj, "textureSharing", val);
--- a/widget/windows/WinCompositorWidget.cpp
+++ b/widget/windows/WinCompositorWidget.cpp
@@ -1,43 +1,33 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WinCompositorWidget.h"
-#include "gfxPrefs.h"
-#include "mozilla/gfx/DeviceManagerDx.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/widget/PlatformWidgetTypes.h"
 #include "nsWindow.h"
 #include "VsyncDispatcher.h"
 
-#include <ddraw.h>
-
 namespace mozilla {
 namespace widget {
 
 using namespace mozilla::gfx;
 
 WinCompositorWidget::WinCompositorWidget(const CompositorWidgetInitData& aInitData)
  : mWidgetKey(aInitData.widgetKey()),
    mWnd(reinterpret_cast<HWND>(aInitData.hWnd())),
    mTransparencyMode(static_cast<nsTransparencyMode>(aInitData.transparencyMode())),
    mMemoryDC(nullptr),
    mCompositeDC(nullptr),
    mLockedBackBufferData(nullptr)
 {
   MOZ_ASSERT(mWnd && ::IsWindow(mWnd));
-
-  // mNotDeferEndRemoteDrawing is set on the main thread during init,
-  // but is only accessed after on the compositor thread.
-  mNotDeferEndRemoteDrawing = gfxPrefs::LayersCompositionFrameRate() == 0 ||
-                              gfxPlatform::IsInLayoutAsapMode() ||
-                              gfxPlatform::ForceSoftwareVsync();
 }
 
 void
 WinCompositorWidget::OnDestroyWindow()
 {
   mTransparentSurface = nullptr;
   mMemoryDC = nullptr;
 }
@@ -117,46 +107,16 @@ WinCompositorWidget::EndRemoteDrawing()
     RedrawTransparentWindow();
   }
   if (mCompositeDC) {
     FreeWindowSurface(mCompositeDC);
   }
   mCompositeDC = nullptr;
 }
 
-bool
-WinCompositorWidget::NeedsToDeferEndRemoteDrawing()
-{
-  if(mNotDeferEndRemoteDrawing) {
-    return false;
-  }
-
-  IDirectDraw7* ddraw = DeviceManagerDx::Get()->GetDirectDraw();
-  if (!ddraw) {
-    return false;
-  }
-
-  DWORD scanLine = 0;
-  int height = ::GetSystemMetrics(SM_CYSCREEN);
-  HRESULT ret = ddraw->GetScanLine(&scanLine);
-  if (ret == DDERR_VERTICALBLANKINPROGRESS) {
-    scanLine = 0;
-  } else if (ret != DD_OK) {
-    return false;
-  }
-
-  // Check if there is a risk of tearing with GDI.
-  if (static_cast<int>(scanLine) > height / 2) {
-    // No need to defer.
-    return false;
-  }
-
-  return true;
-}
-
 already_AddRefed<gfx::DrawTarget>
 WinCompositorWidget::GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
                                              const LayoutDeviceIntRect& aRect,
                                              const LayoutDeviceIntRect& aClearRect)
 {
   MOZ_ASSERT(!mLockedBackBufferData);
 
   RefPtr<gfx::DrawTarget> target =
--- a/widget/windows/WinCompositorWidget.h
+++ b/widget/windows/WinCompositorWidget.h
@@ -44,17 +44,16 @@ class WinCompositorWidget
 {
 public:
   WinCompositorWidget(const CompositorWidgetInitData& aInitData);
 
   bool PreRender(layers::LayerManagerComposite*) override;
   void PostRender(layers::LayerManagerComposite*) override;
   already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
   void EndRemoteDrawing() override;
-  bool NeedsToDeferEndRemoteDrawing() override;
   LayoutDeviceIntSize GetClientSize() override;
   already_AddRefed<gfx::DrawTarget> GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
                                                             const LayoutDeviceIntRect& aRect,
                                                             const LayoutDeviceIntRect& aClearRect) override;
   already_AddRefed<gfx::SourceSurface> EndBackBufferDrawing() override;
   uintptr_t GetWidgetKey() override;
   WinCompositorWidget* AsWindows() override {
     return this;
@@ -96,16 +95,14 @@ private:
   // Transparency handling.
   nsTransparencyMode mTransparencyMode;
   RefPtr<gfxASurface> mTransparentSurface;
   HDC mMemoryDC;
   HDC mCompositeDC;
 
   // Locked back buffer of BasicCompositor
   uint8_t* mLockedBackBufferData;
-
-  bool mNotDeferEndRemoteDrawing;
 };
 
 } // namespace widget
 } // namespace mozilla
 
 #endif // widget_windows_CompositorWidgetParent_h
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -56,30 +56,30 @@ UNIFIED_SOURCES += [
     'nsWindowDbg.cpp',
     'nsWindowGfx.cpp',
     'nsWinGesture.cpp',
     'TaskbarPreview.cpp',
     'TaskbarPreviewButton.cpp',
     'TaskbarTabPreview.cpp',
     'TaskbarWindowPreview.cpp',
     'WidgetTraceEvent.cpp',
+    'WinCompositorWidget.cpp',
     'WindowHook.cpp',
     'WinIMEHandler.cpp',
     'WinTaskbar.cpp',
     'WinTextEventDispatcherListener.cpp',
     'WinUtils.cpp',
 ]
 
 # The following files cannot be built in unified mode because of name clashes.
 SOURCES += [
     'JumpListBuilder.cpp',
     'nsBidiKeyboard.cpp',
     'nsFilePicker.cpp',
     'nsWidgetFactory.cpp',
-    'WinCompositorWidget.cpp',
     'WindowsUIUtils.cpp',
     'WinMouseScrollHandler.cpp',
 ]
 
 if CONFIG['MOZ_CRASHREPORTER']:
     UNIFIED_SOURCES += [
         'LSPAnnotator.cpp',
     ]
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -196,17 +196,17 @@
 #if !defined(SM_CONVERTIBLESLATEMODE)
 #define SM_CONVERTIBLESLATEMODE 0x2003
 #endif
 
 #if !defined(WM_DPICHANGED)
 #define WM_DPICHANGED 0x02E0
 #endif
 
-#include "mozilla/gfx/DeviceManagerDx.h"
+#include "mozilla/gfx/DeviceManagerD3D11.h"
 #include "mozilla/layers/APZCTreeManager.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include "mozilla/layers/ScrollInputMethods.h"
 #include "ClientLayerManager.h"
 #include "InputData.h"
 
 #include "mozilla/Telemetry.h"
 
@@ -7793,17 +7793,17 @@ nsWindow::ComputeShouldAccelerate()
   // We don't currently support using an accelerated layer manager with
   // transparent windows so don't even try. I'm also not sure if we even
   // want to support this case. See bug 593471.
   //
   // Also see bug 1150376, D3D11 composition can cause issues on some devices
   // on Windows 7 where presentation fails randomly for windows with drop
   // shadows.
   if (mTransparencyMode == eTransparencyTransparent ||
-      (IsPopup() && DeviceManagerDx::Get()->IsWARP()))
+      (IsPopup() && DeviceManagerD3D11::Get()->IsWARP()))
   {
     return false;
   }
   return nsBaseWidget::ComputeShouldAccelerate();
 }
 
 void
 nsWindow::SetCandidateWindowForPlugin(const CandidateWindowPosition& aPosition)