Bug 1250244 - Part 2: Remove old VR rendering paths,r=gw280 draft
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Fri, 27 May 2016 13:49:04 -0700
changeset 388452 fefff3a4d38e6686963028047f165b4574700141
parent 388451 5ac17cad66834066131953c1846b19e9b69f1e63
child 388453 f85bb960ec66203ce1a539db053c2e7db4ad857e
push id23184
push userkgilbert@mozilla.com
push dateFri, 15 Jul 2016 23:01:01 +0000
reviewersgw280
bugs1250244
milestone50.0a1
Bug 1250244 - Part 2: Remove old VR rendering paths,r=gw280 MozReview-Commit-ID: 8H7spQggI2w
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsGkAtomList.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsPIDOMWindow.h
gfx/layers/CompositorTypes.h
gfx/layers/Effects.cpp
gfx/layers/Effects.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/client/CanvasClient.cpp
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/ContainerLayerComposite.cpp
gfx/layers/composite/ContainerLayerComposite.h
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/ImageHost.h
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.h
gfx/layers/d3d11/CompositorD3D11ShadersVR.h
gfx/layers/d3d11/CompositorD3D11VR.hlsl
gfx/layers/d3d11/genshaders.sh
gfx/layers/ipc/CompositableForwarder.h
gfx/layers/ipc/CompositableTransactionParent.cpp
gfx/layers/ipc/ImageBridgeChild.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayersMessages.ipdlh
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/moz.build
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/CompositorOGL.h
gfx/layers/opengl/CompositorOGLVR.cpp
gfx/thebes/gfxPrefs.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/generic/nsBackdropFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameStateBits.h
modules/libpref/init/all.js
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -240,17 +240,16 @@
 #include "nsIDocumentActivity.h"
 #include "nsIStructuredCloneContainer.h"
 #include "nsIMutableArray.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "nsWindowMemoryReporter.h"
 #include "nsLocation.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/dom/BoxObject.h"
-#include "gfxVR.h"
 #include "gfxPrefs.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/StyleSetHandle.h"
 #include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/StyleSheetHandle.h"
 #include "mozilla/StyleSheetHandleInlines.h"
 
 #include "mozilla/DocLoadingTimelineMarker.h"
@@ -11590,18 +11589,16 @@ UpdateViewportScrollbarOverrideForFullsc
       presContext->UpdateViewportScrollbarStylesOverride();
     }
   }
 }
 
 static void
 ClearFullscreenStateOnElement(Element* aElement)
 {
-  // Remove any VR state properties
-  aElement->DeleteProperty(nsGkAtoms::vr_state);
   // Remove styles from existing top element.
   EventStateManager::SetFullScreenState(aElement, false);
   // Reset iframe fullscreen flag.
   if (aElement->IsHTMLElement(nsGkAtoms::iframe)) {
     static_cast<HTMLIFrameElement*>(aElement)->SetFullscreenFlag(false);
   }
 }
 
@@ -11763,24 +11760,16 @@ nsresult nsDocument::RemoteFrameFullscre
 /* static */ bool
 nsDocument::IsUnprefixedFullscreenEnabled(JSContext* aCx, JSObject* aObject)
 {
   MOZ_ASSERT(NS_IsMainThread());
   return nsContentUtils::IsCallerChrome() ||
          nsContentUtils::IsUnprefixedFullscreenApiEnabled();
 }
 
-static void
-ReleaseVRDeviceProxyRef(void *, nsIAtom*, void *aPropertyValue, void *)
-{
-  if (aPropertyValue) {
-    static_cast<gfx::VRDeviceProxy*>(aPropertyValue)->Release();
-  }
-}
-
 static bool
 HasFullScreenSubDocument(nsIDocument* aDoc)
 {
   uint32_t count = CountFullscreenSubDocuments(aDoc);
   NS_ASSERTION(count <= 1, "Fullscreen docs should have at most 1 fullscreen child!");
   return count >= 1;
 }
 
@@ -12051,20 +12040,17 @@ nsDocument::RequestFullScreen(UniquePtr<
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     // If we are not the top level process, dispatch an event to make
     // our parent process go fullscreen first.
     nsContentUtils::DispatchEventOnlyToChrome(
       this, ToSupports(this), NS_LITERAL_STRING("MozDOMFullscreen:Request"),
       /* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
   } else {
     // Make the window fullscreen.
-    const FullscreenRequest*
-      lastRequest = PendingFullscreenRequestList::GetLast();
-    rootWin->SetFullscreenInternal(FullscreenReason::ForFullscreenAPI, true,
-                                   lastRequest->mVRHMDDevice);
+    rootWin->SetFullscreenInternal(FullscreenReason::ForFullscreenAPI, true);
   }
 }
 
 /* static */ bool
 nsIDocument::HandlePendingFullscreenRequests(nsIDocument* aDoc)
 {
   bool handled = false;
   PendingFullscreenRequestList::Iterator iter(
@@ -12111,23 +12097,16 @@ nsDocument::ApplyFullscreen(const Fullsc
   // Remember the root document, so that if a full-screen document is hidden
   // we can reset full-screen state in the remaining visible full-screen documents.
   nsIDocument* fullScreenRootDoc = nsContentUtils::GetRootDocument(this);
 
   // If a document is already in fullscreen, then unlock the mouse pointer
   // before setting a new document to fullscreen
   UnlockPointer();
 
-  // Process options -- in this case, just HMD
-  if (aRequest.mVRHMDDevice) {
-    RefPtr<gfx::VRDeviceProxy> hmdRef = aRequest.mVRHMDDevice;
-    elem->SetProperty(nsGkAtoms::vr_state, hmdRef.forget().take(),
-                      ReleaseVRDeviceProxyRef, true);
-  }
-
   // Set the full-screen element. This sets the full-screen style on the
   // element, and the full-screen-ancestor styles on ancestors of the element
   // in this document.
   DebugOnly<bool> x = FullScreenStackPush(elem);
   NS_ASSERTION(x, "Full-screen state of requesting doc should always change!");
   // Set the iframe fullscreen flag.
   if (elem->IsHTMLElement(nsGkAtoms::iframe)) {
     static_cast<HTMLIFrameElement*>(elem)->SetFullscreenFlag(true);
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -106,17 +106,16 @@ struct FullscreenRequest : public Linked
   Element* GetElement() const { return mElement; }
   nsDocument* GetDocument() const { return mDocument; }
 
 private:
   RefPtr<Element> mElement;
   RefPtr<nsDocument> mDocument;
 
 public:
-  RefPtr<gfx::VRDeviceProxy> mVRHMDDevice;
   // This value should be true if the fullscreen request is
   // originated from chrome code.
   bool mIsCallerChrome = false;
   // This value denotes whether we should trigger a NewOrigin event if
   // requesting fullscreen in its document causes the origin which is
   // fullscreen to change. We may want *not* to trigger that event if
   // we're calling RequestFullScreen() as part of a continuation of a
   // request in a subdocument in different process, whereupon the caller
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -2433,18 +2433,16 @@ GK_ATOM(onspeechstart, "onspeechstart")
 GK_ATOM(onspeechend, "onspeechend")
 GK_ATOM(onresult, "onresult")
 GK_ATOM(onnomatch, "onnomatch")
 GK_ATOM(onresume, "onresume")
 GK_ATOM(onmark, "onmark")
 GK_ATOM(onboundary, "onboundary")
 #endif
 
-GK_ATOM(vr_state, "vr-state")
-
 // Contextual Identity / Containers
 GK_ATOM(usercontextid, "usercontextid")
 
 // Namespaces
 GK_ATOM(nsuri_xmlns, "http://www.w3.org/2000/xmlns/")
 GK_ATOM(nsuri_xml, "http://www.w3.org/XML/1998/namespace")
 GK_ATOM(nsuri_xhtml, "http://www.w3.org/1999/xhtml")
 GK_ATOM(nsuri_xlink, "http://www.w3.org/1999/xlink")
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6353,50 +6353,52 @@ FullscreenTransitionTask::Observer::Obse
     obs->RemoveObserver(this, kPaintedTopic);
     mTask->mTimer = nullptr;
     mTask->Run();
   }
   return NS_OK;
 }
 
 static bool
-MakeWidgetFullscreen(nsGlobalWindow* aWindow, gfx::VRDeviceProxy* aHMD,
-                     FullscreenReason aReason, bool aFullscreen)
+MakeWidgetFullscreen(nsGlobalWindow* aWindow, FullscreenReason aReason,
+                     bool aFullscreen)
 {
   nsCOMPtr<nsIWidget> widget = aWindow->GetMainWidget();
   if (!widget) {
     return false;
   }
 
   FullscreenTransitionDuration duration;
   bool performTransition = false;
   nsCOMPtr<nsISupports> transitionData;
   if (aReason == FullscreenReason::ForFullscreenAPI) {
     GetFullscreenTransitionDuration(aFullscreen, &duration);
     if (!duration.IsSuppressed()) {
       performTransition = widget->
         PrepareForFullscreenTransition(getter_AddRefs(transitionData));
     }
   }
-  nsCOMPtr<nsIScreen> screen = aHMD ? aHMD->GetScreen() : nullptr;
+  // We pass nullptr as the screen to SetWidgetFullscreen
+  // and FullscreenTransitionTask, as we do not wish to override
+  // the default screen selection behavior.  The screen containing
+  // most of the widget will be selected.
   if (!performTransition) {
-    return aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget, screen);
+    return aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget, nullptr);
   } else {
     nsCOMPtr<nsIRunnable> task =
       new FullscreenTransitionTask(duration, aWindow, aFullscreen,
-                                   widget, screen, transitionData);
+                                   widget, nullptr, transitionData);
     task->Run();
     return true;
   }
 }
 
 nsresult
 nsGlobalWindow::SetFullscreenInternal(FullscreenReason aReason,
-                                      bool aFullScreen,
-                                      gfx::VRDeviceProxy* aHMD)
+                                      bool aFullScreen)
 {
   MOZ_ASSERT(IsOuterWindow());
   MOZ_ASSERT(nsContentUtils::IsSafeToRunScript(),
              "Requires safe to run script as it "
              "may call FinishDOMFullscreenChange");
 
   NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
 
@@ -6415,17 +6417,17 @@ nsGlobalWindow::SetFullscreenInternal(Fu
   // via the DocShell tree, and if we are not already the root,
   // call SetFullScreen on that window instead.
   nsCOMPtr<nsIDocShellTreeItem> rootItem;
   mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
   nsCOMPtr<nsPIDOMWindowOuter> window = rootItem ? rootItem->GetWindow() : nullptr;
   if (!window)
     return NS_ERROR_FAILURE;
   if (rootItem != mDocShell)
-    return window->SetFullscreenInternal(aReason, aFullScreen, aHMD);
+    return window->SetFullscreenInternal(aReason, aFullScreen);
 
   // make sure we don't try to set full screen on a non-chrome window,
   // which might happen in embedding world
   if (mDocShell->ItemType() != nsIDocShellTreeItem::typeChrome)
     return NS_ERROR_FAILURE;
 
   // If we are already in full screen mode, just return.
   if (mFullScreen == aFullScreen)
@@ -6466,17 +6468,17 @@ nsGlobalWindow::SetFullscreenInternal(Fu
   // gone full screen, the state trap above works.
   mFullScreen = aFullScreen;
 
   // Sometimes we don't want the top-level widget to actually go fullscreen,
   // for example in the B2G desktop client, we don't want the emulated screen
   // dimensions to appear to increase when entering fullscreen mode; we just
   // want the content to fill the entire client area of the emulator window.
   if (!Preferences::GetBool("full-screen-api.ignore-widgets", false)) {
-    if (MakeWidgetFullscreen(this, aHMD, aReason, aFullScreen)) {
+    if (MakeWidgetFullscreen(this, aReason, aFullScreen)) {
       // The rest of code for switching fullscreen is in nsGlobalWindow::
       // FinishFullscreenChange() which will be called after sizemodechange
       // event is dispatched.
       return NS_OK;
     }
   }
 
   FinishFullscreenChange(aFullScreen);
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -126,19 +126,16 @@ class WakeLock;
 #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
 class WindowOrientationObserver;
 #endif
 namespace cache {
 class CacheStorage;
 } // namespace cache
 class IDBFactory;
 } // namespace dom
-namespace gfx {
-class VRDeviceProxy;
-} // namespace gfx
 } // namespace mozilla
 
 extern already_AddRefed<nsIScriptTimeoutHandler>
 NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindow *aWindow,
                           mozilla::dom::Function& aFunction,
                           const mozilla::dom::Sequence<JS::Value>& aArguments,
                           mozilla::ErrorResult& aError);
 
@@ -486,18 +483,17 @@ public:
   // Inner windows only.
   void RefreshCompartmentPrincipal();
 
   // For accessing protected field mFullScreen
   friend class FullscreenTransitionTask;
 
   // Outer windows only.
   virtual nsresult SetFullscreenInternal(
-    FullscreenReason aReason, bool aIsFullscreen,
-    mozilla::gfx::VRDeviceProxy *aHMD = nullptr) override final;
+    FullscreenReason aReason, bool aIsFullscreen) override final;
   virtual void FinishFullscreenChange(bool aIsFullscreen) override final;
   bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
                            nsIWidget* aWidget, nsIScreen* aScreen);
   bool FullScreen() const;
 
   // Inner windows only.
   virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override;
 
--- a/dom/base/nsPIDOMWindow.h
+++ b/dom/base/nsPIDOMWindow.h
@@ -40,19 +40,16 @@ typedef uint32_t SuspendTypes;
 
 namespace mozilla {
 namespace dom {
 class AudioContext;
 class Element;
 class Performance;
 class ServiceWorkerRegistration;
 } // namespace dom
-namespace gfx {
-class VRDeviceProxy;
-} // namespace gfx
 } // namespace mozilla
 
 // Popup control state enum. The values in this enum must go from most
 // permissive to least permissive so that it's safe to push state in
 // all situations. Pushing popup state onto the stack never makes the
 // current popup state less permissive (see
 // nsGlobalWindow::PushPopupControlState()).
 enum PopupControlState {
@@ -333,24 +330,20 @@ public:
       MaybeUpdateTouchState();
     }
   }
 
   /**
    * Moves the top-level window into fullscreen mode if aIsFullScreen is true,
    * otherwise exits fullscreen.
    *
-   * If aHMD is not null, the window is made full screen on the given VR HMD
-   * device instead of its currrent display.
-   *
    * Outer windows only.
    */
   virtual nsresult SetFullscreenInternal(
-    FullscreenReason aReason, bool aIsFullscreen,
-    mozilla::gfx::VRDeviceProxy *aHMD = nullptr) = 0;
+    FullscreenReason aReason, bool aIsFullscreen) = 0;
 
   /**
    * This function should be called when the fullscreen state is flipped.
    * If no widget is involved the fullscreen change, this method is called
    * by SetFullscreenInternal, otherwise, it is called when the widget
    * finishes its change to or from fullscreen.
    *
    * @param aIsFullscreen indicates whether the widget is in fullscreen.
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -131,17 +131,16 @@ enum class EffectTypes : uint8_t {
   COLOR_MATRIX,
   MAX_SECONDARY, // sentinel for the count of secondary effect types
   RGB,
   YCBCR,
   NV12,
   COMPONENT_ALPHA,
   SOLID_COLOR,
   RENDER_TARGET,
-  VR_DISTORTION,
   MAX  //sentinel for the count of all effect types
 };
 
 /**
  * How the Compositable should manage textures.
  */
 enum class CompositableType : uint8_t {
   UNKNOWN,
--- a/gfx/layers/Effects.cpp
+++ b/gfx/layers/Effects.cpp
@@ -60,15 +60,8 @@ EffectBlendMode::PrintInfo(std::stringst
 void
 EffectColorMatrix::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
   aStream << aPrefix;
   aStream << nsPrintfCString("EffectColorMatrix (0x%p)", this).get();
   AppendToString(aStream, mColorMatrix, " [matrix=", "]");
 }
 
-void
-EffectVRDistortion::PrintInfo(std::stringstream& aStream, const char* aPrefix)
-{
-  aStream << aPrefix;
-  aStream << nsPrintfCString("EffectVRDistortion (0x%p) [hmd=%p] [render-target=%p] [texture=%p]",
-                             this, mHMD.get(), mRenderTarget.get(), mTexture).get();
-}
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -13,17 +13,16 @@
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for SamplingFilter, etc
 #include "mozilla/layers/CompositorTypes.h"  // for EffectTypes, etc
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/TextureHost.h"  // for CompositingRenderTarget, etc
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nscore.h"                     // for nsACString
 #include "mozilla/EnumeratedArray.h"
-#include "gfxVR.h"
 
 namespace mozilla {
 namespace layers {
 
 /**
  * Effects and effect chains are used by the compositor API (see Compositor.h).
  * An effect chain represents a rendering method, for example some shader and
  * the data required for that shader to run. An effect is some component of the
@@ -91,46 +90,16 @@ struct EffectMask : public Effect
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
 
   TextureSource* mMaskTexture;
   gfx::IntSize mSize;
   gfx::Matrix4x4 mMaskTransform;
 };
 
-struct EffectVRDistortion : public Effect
-{
-  EffectVRDistortion(gfx::VRHMDInfo* aHMD,
-                     CompositingRenderTarget* aRenderTarget)
-    : Effect(EffectTypes::VR_DISTORTION)
-    , mHMD(aHMD)
-    , mRenderTarget(aRenderTarget)
-    , mTexture(aRenderTarget)
-  {}
-
-  EffectVRDistortion(gfx::VRHMDInfo* aHMD,
-                     TextureSource* aTexture)
-    : Effect(EffectTypes::VR_DISTORTION)
-    , mHMD(aHMD)
-    , mRenderTarget(nullptr)
-    , mTexture(aTexture)
-  {}
-
-  virtual const char* Name() { return "EffectVRDistortion"; }
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
-
-  RefPtr<gfx::VRHMDInfo> mHMD;
-  RefPtr<CompositingRenderTarget> mRenderTarget;
-  TextureSource* mTexture;
-
-  // The viewport for each eye in the source and
-  // destination textures.
-  gfx::IntRect mViewports[2];
-};
-
 struct EffectBlendMode : public Effect
 {
   explicit EffectBlendMode(gfx::CompositionOp aBlendMode)
     : Effect(EffectTypes::BLEND_MODE)
     , mBlendMode(aBlendMode)
   { }
 
   virtual const char* Name() { return "EffectBlendMode"; }
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1119,19 +1119,17 @@ ContainerLayer::ContainerLayer(LayerMana
     mInheritedXScale(1.0f),
     mInheritedYScale(1.0f),
     mPresShellResolution(1.0f),
     mScaleToResolution(false),
     mUseIntermediateSurface(false),
     mSupportsComponentAlphaChildren(false),
     mMayHaveReadbackChild(false),
     mChildrenChanged(false),
-    mEventRegionsOverride(EventRegionsOverride::NoOverride),
-    mVRDeviceID(0),
-    mInputFrameID(0)
+    mEventRegionsOverride(EventRegionsOverride::NoOverride)
 {
   MOZ_COUNT_CTOR(ContainerLayer);
   mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT
 }
 
 ContainerLayer::~ContainerLayer()
 {
   MOZ_COUNT_DTOR(ContainerLayer);
@@ -1282,19 +1280,17 @@ ContainerLayer::RepositionChild(Layer* a
 }
 
 void
 ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
 {
   aAttrs = ContainerLayerAttributes(mPreXScale, mPreYScale,
                                     mInheritedXScale, mInheritedYScale,
                                     mPresShellResolution, mScaleToResolution,
-                                    mEventRegionsOverride,
-                                    mVRDeviceID,
-                                    mInputFrameID);
+                                    mEventRegionsOverride);
 }
 
 bool
 ContainerLayer::Creates3DContextWithExtendingChildren()
 {
   if (Extend3DContext()) {
     return false;
   }
@@ -2186,19 +2182,16 @@ ContainerLayer::PrintInfo(std::stringstr
     aStream << nsPrintfCString(" [presShellResolution=%g]", mPresShellResolution).get();
   }
   if (mEventRegionsOverride & EventRegionsOverride::ForceDispatchToContent) {
     aStream << " [force-dtc]";
   }
   if (mEventRegionsOverride & EventRegionsOverride::ForceEmptyHitRegion) {
     aStream << " [force-ehr]";
   }
-  if (mVRDeviceID) {
-    aStream << nsPrintfCString(" [hmd=%lu] [hmdframe=%l]", mVRDeviceID, mInputFrameID).get();
-  }
 }
 
 void
 ContainerLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
 {
   Layer::DumpPacket(aPacket, aParent);
   // Get this layer data
   using namespace layerscope;
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -41,17 +41,16 @@
 #include "nsRect.h"                     // for mozilla::gfx::IntRect
 #include "nsRegion.h"                   // for nsIntRegion
 #include "nsString.h"                   // for nsCString
 #include "nsTArray.h"                   // for nsTArray
 #include "nsTArrayForwardDeclare.h"     // for InfallibleTArray
 #include "nscore.h"                     // for nsACString, nsAString
 #include "mozilla/Logging.h"                      // for PRLogModuleInfo
 #include "nsIWidget.h"                  // For plugin window configuration information structs
-#include "gfxVR.h"
 #include "ImageContainer.h"
 
 class gfxContext;
 
 extern uint8_t gLayerManagerLayerBuilder;
 
 namespace mozilla {
 
@@ -1780,30 +1779,16 @@ public:
    */
   void ClearExtraDumpInfo()
   {
 #ifdef MOZ_DUMP_PAINTING
      mExtraDumpInfo.Clear();
 #endif
   }
 
-  /**
-   * Replace the current effective transform with the given one,
-   * returning the old one.  This is currently added as a hack for VR
-   * rendering, and might go away if we find a better way to do this.
-   * If you think you have a need for this method, talk with
-   * vlad/mstange/mwoodrow first.
-   */
-  virtual gfx::Matrix4x4 ReplaceEffectiveTransform(const gfx::Matrix4x4& aNewEffectiveTransform) {
-    gfx::Matrix4x4 old = mEffectiveTransform;
-    mEffectiveTransform = aNewEffectiveTransform;
-    ComputeEffectiveTransformForMaskLayers(mEffectiveTransform);
-    return old;
-  }
-
 protected:
   Layer(LayerManager* aManager, void* aImplData);
 
   // Protected destructor, to discourage deletion outside of Release():
   virtual ~Layer();
 
   /**
    * We can snap layer transforms for two reasons:
@@ -2192,49 +2177,16 @@ public:
     mEventRegionsOverride = aVal;
     Mutated();
   }
 
   EventRegionsOverride GetEventRegionsOverride() const {
     return mEventRegionsOverride;
   }
 
-  /**
-   * VR
-   */
-  void SetVRDeviceID(uint32_t aVRDeviceID) {
-    mVRDeviceID = aVRDeviceID;
-    Mutated();
-  }
-  uint32_t GetVRDeviceID() {
-    return mVRDeviceID;
-  }
-  void SetInputFrameID(int32_t aInputFrameID) {
-    mInputFrameID = aInputFrameID;
-    Mutated();
-  }
-  int32_t GetInputFrameID() {
-    return mInputFrameID;
-  }
-
-  /**
-   * Replace the current effective transform with the given one,
-   * returning the old one.  This is currently added as a hack for VR
-   * rendering, and might go away if we find a better way to do this.
-   * If you think you have a need for this method, talk with
-   * vlad/mstange/mwoodrow first.
-   */
-  gfx::Matrix4x4 ReplaceEffectiveTransform(const gfx::Matrix4x4& aNewEffectiveTransform) override {
-    gfx::Matrix4x4 old = mEffectiveTransform;
-    mEffectiveTransform = aNewEffectiveTransform;
-    ComputeEffectiveTransformsForChildren(mEffectiveTransform);
-    ComputeEffectiveTransformForMaskLayers(mEffectiveTransform);
-    return old;
-  }
-
 protected:
   friend class ReadbackProcessor;
 
   void DidInsertChild(Layer* aLayer);
   void DidRemoveChild(Layer* aLayer);
 
   void Collect3DContextLeaves(nsTArray<Layer*>& aToSort);
 
@@ -2284,18 +2236,16 @@ protected:
   bool mScaleToResolution;
   bool mUseIntermediateSurface;
   bool mSupportsComponentAlphaChildren;
   bool mMayHaveReadbackChild;
   // This is updated by ComputeDifferences. This will be true if we need to invalidate
   // the intermediate surface.
   bool mChildrenChanged;
   EventRegionsOverride mEventRegionsOverride;
-  uint32_t mVRDeviceID;
-  int32_t mInputFrameID;
 };
 
 /**
  * A Layer which just renders a solid color in its visible region. It actually
  * can fill any area that contains the visible region, so if you need to
  * restrict the area filled, set a clip region on this layer.
  */
 class ColorLayer : public Layer {
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -19,17 +19,16 @@
 #include "mozilla/layers/CompositorBridgeChild.h" // for CompositorBridgeChild
 #include "mozilla/layers/GrallocTextureClient.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/TextureClient.h"  // for TextureClient, etc
 #include "mozilla/layers/TextureClientOGL.h"
 #include "nsDebug.h"                    // for printf_stderr, NS_ASSERTION
 #include "nsXULAppAPI.h"                // for XRE_GetProcessType, etc
 #include "TextureClientSharedSurface.h"
-#include "VRManagerChild.h"
 
 using namespace mozilla::gfx;
 using namespace mozilla::gl;
 
 namespace mozilla {
 namespace layers {
 
 /* static */ already_AddRefed<CanvasClient>
@@ -79,17 +78,16 @@ CanvasClient2D::UpdateFromTexture(Textur
 
   mBackBuffer = aTexture;
 
   AutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
   CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
   t->mTextureClient = mBackBuffer;
   t->mPictureRect = nsIntRect(nsIntPoint(0, 0), aTexture->GetSize());
   t->mFrameID = mFrameID;
-  t->mInputFrameID = VRManagerChild::Get()->GetInputFrameID();
 
   GetForwarder()->UseTextures(this, textures);
   aTexture->SyncWithObject(GetForwarder()->GetSyncObject());
 }
 
 void
 CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
 {
@@ -144,17 +142,16 @@ CanvasClient2D::Update(gfx::IntSize aSiz
   }
 
   if (updated) {
     AutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
     CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
     t->mTextureClient = mBackBuffer;
     t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mBackBuffer->GetSize());
     t->mFrameID = mFrameID;
-    t->mInputFrameID = VRManagerChild::Get()->GetInputFrameID();
     GetForwarder()->UseTextures(this, textures);
     mBackBuffer->SyncWithObject(GetForwarder()->GetSyncObject());
   }
 
   mBackBuffer.swap(mFrontBuffer);
 }
 
 already_AddRefed<TextureClient>
@@ -499,21 +496,16 @@ CanvasClientSharedSurface::Updated()
   // Add the new TexClient.
   MOZ_ALWAYS_TRUE( AddTextureClient(mFront) );
 
   AutoTArray<CompositableForwarder::TimedTextureClient,1> textures;
   CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
   t->mTextureClient = mFront;
   t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
   t->mFrameID = mFrameID;
-  // XXX TODO - This reference to VRManagerChild will be moved with the
-  //            implementation of the WebVR 1.0 API, which will enable
-  //            the inputFrameID to be passed through Javascript with
-  //            the new VRDisplay API.
-  t->mInputFrameID = VRManagerChild::Get()->GetInputFrameID();
   forwarder->UseTextures(this, textures);
 }
 
 void
 CanvasClientSharedSurface::OnDetach() {
   ClearSurfaces();
 }
 
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -12,17 +12,16 @@
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/Effects.h"     // for EffectChain
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsAString.h"
 #include "mozilla/RefPtr.h"                   // for nsRefPtr
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsString.h"                   // for nsAutoCString
-#include "gfxVR.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
 CanvasLayerComposite::CanvasLayerComposite(LayerManagerComposite* aManager)
   : CanvasLayer(aManager, nullptr)
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -188,17 +188,16 @@ public:
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) = 0;
 
   struct TimedTexture {
     CompositableTextureHostRef mTexture;
     TimeStamp mTimeStamp;
     gfx::IntRect mPictureRect;
     int32_t mFrameID;
     int32_t mProducerID;
-    int32_t mInputFrameID;
   };
   virtual void UseTextureHost(const nsTArray<TimedTexture>& aTextures);
   virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
                                          TextureHost* aTextureOnWhite);
   virtual void UseOverlaySource(OverlaySource aOverlay,
                                 const gfx::IntRect& aPictureRect) { }
 
   virtual void RemoveTextureHost(TextureHost* aTexture);
@@ -230,18 +229,16 @@ public:
   virtual bool Lock() { return false; }
 
   virtual void Unlock() { }
 
   virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) {
     return nullptr;
   }
 
-  virtual int32_t GetLastInputFrameID() const { return -1; }
-
   /// Called when shutting down the layer tree.
   /// This is a good place to clear all potential gpu resources before the widget
   /// is is destroyed.
   virtual void CleanupResources() {}
 
 protected:
   TextureInfo mTextureInfo;
   uint64_t mAsyncID;
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -29,17 +29,16 @@
 #include "nsDebug.h"                    // for NS_ASSERTION
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsISupportsUtils.h"           // for NS_ADDREF, NS_RELEASE
 #include "nsRegion.h"                   // for nsIntRegion
 #include "nsTArray.h"                   // for AutoTArray
 #include <stack>
 #include "TextRenderer.h"               // for TextRenderer
 #include <vector>
-#include "VRManager.h"                  // for VRManager
 #include "GeckoProfiler.h"              // for GeckoProfiler
 #ifdef MOZ_ENABLE_PROFILER_SPS
 #include "ProfilerMarkers.h"            // for ProfilerMarkers
 #endif
 
 #define CULLING_LOG(...)
 // #define CULLING_LOG(...) printf_stderr("CULLING: " __VA_ARGS__)
 
@@ -113,237 +112,16 @@ static void PrintUniformityInfo(Layer* a
 struct PreparedLayer
 {
   PreparedLayer(LayerComposite *aLayer, RenderTargetIntRect aClipRect) :
     mLayer(aLayer), mClipRect(aClipRect) {}
   LayerComposite* mLayer;
   RenderTargetIntRect mClipRect;
 };
 
-
-template<class ContainerT> void
-ContainerRenderVR(ContainerT* aContainer,
-                  LayerManagerComposite* aManager,
-                  const gfx::IntRect& aClipRect,
-                  RefPtr<gfx::VRHMDInfo> aHMD)
-{
-  int32_t inputFrameID = -1;
-
-  RefPtr<CompositingRenderTarget> surface;
-
-  Compositor* compositor = aManager->GetCompositor();
-
-  RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
-
-  float opacity = aContainer->GetEffectiveOpacity();
-
-  // The size of each individual eye surface
-  gfx::IntSize eyeResolution = aHMD->GetDeviceInfo().SuggestedEyeResolution();
-  gfx::IntRect eyeRect[2];
-  eyeRect[0] = gfx::IntRect(0, 0, eyeResolution.width, eyeResolution.height);
-  eyeRect[1] = gfx::IntRect(eyeResolution.width, 0, eyeResolution.width, eyeResolution.height);
-
-  // The intermediate surface size; we're going to assume that we're not going to run
-  // into max texture size limits
-  gfx::IntRect surfaceRect = gfx::IntRect(0, 0, eyeResolution.width * 2, eyeResolution.height);
-
-  int32_t maxTextureSize = compositor->GetMaxTextureSize();
-  surfaceRect.width = std::min(maxTextureSize, surfaceRect.width);
-  surfaceRect.height = std::min(maxTextureSize, surfaceRect.height);
-
-  gfx::VRHMDRenderingSupport *vrRendering = aHMD->GetRenderingSupport();
-  if (gfxEnv::NoVRRendering()) vrRendering = nullptr;
-  if (vrRendering) {
-    if (!aContainer->mVRRenderTargetSet || aContainer->mVRRenderTargetSet->size != surfaceRect.Size()) {
-      aContainer->mVRRenderTargetSet = vrRendering->CreateRenderTargetSet(compositor, surfaceRect.Size());
-    }
-    if (!aContainer->mVRRenderTargetSet) {
-      NS_WARNING("CreateRenderTargetSet failed");
-      return;
-    }
-    surface = aContainer->mVRRenderTargetSet->GetNextRenderTarget();
-    if (!surface) {
-      NS_WARNING("GetNextRenderTarget failed");
-      return;
-    }
-  } else {
-    surface = compositor->CreateRenderTarget(surfaceRect, INIT_MODE_CLEAR);
-    if (!surface) {
-      return;
-    }
-  }
-
-  gfx::IntRect rtBounds = previousTarget->GetRect();
-  DUMP("eyeResolution: %d %d targetRT: %d %d %d %d\n", WH(eyeResolution), XYWH(rtBounds));
-
-  compositor->SetRenderTarget(surface);
-
-  AutoTArray<Layer*, 12> children;
-  aContainer->SortChildrenBy3DZOrder(children);
-
-  gfx::Matrix4x4 origTransform = aContainer->GetEffectiveTransform();
-
-  for (uint32_t i = 0; i < children.Length(); i++) {
-    LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->ImplData());
-    Layer* layer = layerToRender->GetLayer();
-    uint32_t contentFlags = layer->GetContentFlags();
-
-    if (layer->IsBackfaceHidden()) {
-      continue;
-    }
-
-    if (!layer->IsVisible() && !layer->AsContainerLayer()) {
-      continue;
-    }
-    if (layerToRender->HasStaleCompositor()) {
-      continue;
-    }
-
-    // We flip between pre-rendered and Gecko-rendered VR based on
-    // whether the child layer of this VR container layer has
-    // CONTENT_EXTEND_3D_CONTEXT or not.
-    if ((contentFlags & Layer::CONTENT_EXTEND_3D_CONTEXT) == 0) {
-      // This layer is native VR
-      DUMP("%p Switching to pre-rendered VR\n", aContainer);
-
-      // XXX we still need depth test here, but we have no way of preserving
-      // depth anyway in native VR layers until we have a way to save them
-      // from WebGL (and maybe depth video?)
-      compositor->SetRenderTarget(surface);
-      aContainer->ReplaceEffectiveTransform(origTransform);
-
-      // If this native-VR child layer does not have sizes that match
-      // the eye resolution (that is, returned by the recommended
-      // render rect from the HMD device), then we need to scale it
-      // up/down.
-      Rect layerBounds;
-      // XXX this is a hack! Canvas layers aren't reporting the
-      // proper bounds here (visible region bounds are 0,0,0,0)
-      // and I'm not sure if this is the bounds we want anyway.
-      if (layer->GetType() == Layer::TYPE_CANVAS) {
-        layerBounds =
-          IntRectToRect(static_cast<CanvasLayer*>(layer)->GetBounds());
-      } else {
-        layerBounds =
-          IntRectToRect(layer->GetLocalVisibleRegion().ToUnknownRegion().GetBounds());
-      }
-      const gfx::Matrix4x4 childTransform = layer->GetEffectiveTransform();
-      layerBounds = childTransform.TransformBounds(layerBounds);
-
-      DUMP("  layer %p [type %d] bounds [%f %f %f %f] surfaceRect [%d %d %d %d]\n", layer, (int) layer->GetType(),
-           XYWH(layerBounds), XYWH(surfaceRect));
-
-      bool restoreTransform = false;
-      if ((layerBounds.width != 0 && layerBounds.height != 0) &&
-          (layerBounds.width != surfaceRect.width ||
-           layerBounds.height != surfaceRect.height))
-      {
-        DUMP("  layer %p doesn't match, prescaling by %f %f\n", layer,
-             surfaceRect.width / float(layerBounds.width),
-             surfaceRect.height / float(layerBounds.height));
-        gfx::Matrix4x4 scaledChildTransform(childTransform);
-        scaledChildTransform.PreScale(surfaceRect.width / layerBounds.width,
-                                      surfaceRect.height / layerBounds.height,
-                                      1.0f);
-
-        layer->ReplaceEffectiveTransform(scaledChildTransform);
-        restoreTransform = true;
-      }
-
-      // XXX these are both clip rects, which end up as scissor rects in the compositor.  So we just
-      // pass the full target surface rect here.
-      layerToRender->Prepare(RenderTargetIntRect(surfaceRect.x, surfaceRect.y,
-                                                 surfaceRect.width, surfaceRect.height));
-      layerToRender->RenderLayer(surfaceRect);
-
-      // Search all children recursively until we find the canvas with
-      // an inputFrameID
-      std::stack<LayerComposite*> searchLayers;
-      searchLayers.push(layerToRender);
-      while (!searchLayers.empty() && inputFrameID == -1) {
-        LayerComposite* searchLayer = searchLayers.top();
-        searchLayers.pop();
-        if (searchLayer) {
-          searchLayers.push(searchLayer->GetFirstChildComposite());
-          Layer* sibling = searchLayer->GetLayer();
-          if (sibling) {
-            sibling = sibling->GetNextSibling();
-          }
-          if (sibling) {
-            searchLayers.push(sibling->AsLayerComposite());
-          }
-          CompositableHost *ch = searchLayer->GetCompositableHost();
-          if (ch) {
-            int32_t compositableInputFrameID = ch->GetLastInputFrameID();
-            if (compositableInputFrameID != -1) {
-              inputFrameID = compositableInputFrameID;
-            }
-          }
-        }
-      }
-
-      if (restoreTransform) {
-        layer->ReplaceEffectiveTransform(childTransform);
-      }
-    } else {
-      // Gecko-rendered CSS VR -- not supported yet, so just don't render this layer!
-    }
-  }
-
-  DUMP(" -- ContainerRenderVR [%p] after child layers\n", aContainer);
-
-  // Now put back the original transfom on this container
-  aContainer->ReplaceEffectiveTransform(origTransform);
-
-  // then bind the original target and draw with distortion
-  compositor->SetRenderTarget(previousTarget);
-
-  if (vrRendering) {
-    vrRendering->SubmitFrame(aContainer->mVRRenderTargetSet, inputFrameID);
-    DUMP("<<< ContainerRenderVR [used vrRendering] [%p]\n", aContainer);
-    if (!gfxPrefs::VRMirrorTextures()) {
-      return;
-    }
-  }
-
-  gfx::IntRect rect(surfaceRect.x, surfaceRect.y, surfaceRect.width, surfaceRect.height);
-  gfx::IntRect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
-
-  // The VR geometry may not cover the entire area; we need to fill with a solid color
-  // first.
-  // XXX should DrawQuad handle this on its own?  Is there a time where we wouldn't want
-  // to do this? (e.g. something like Cardboard would not require distortion so will fill
-  // the entire rect)
-  EffectChain solidEffect(aContainer);
-  solidEffect.mPrimaryEffect = new EffectSolidColor(Color(0.0, 0.0, 0.0, 1.0));
-  aManager->GetCompositor()->DrawQuad(Rect(rect), rect, solidEffect, 1.0, gfx::Matrix4x4());
-
-  // draw the temporary surface with VR distortion to the original destination
-  EffectChain vrEffect(aContainer);
-  bool skipDistortion = vrRendering || gfxEnv::VRNoDistortion();
-  if (skipDistortion) {
-    vrEffect.mPrimaryEffect = new EffectRenderTarget(surface);
-  } else {
-    vrEffect.mPrimaryEffect = new EffectVRDistortion(aHMD, surface);
-  }
-
-  gfx::Matrix4x4 scaleTransform = aContainer->GetEffectiveTransform();
-  scaleTransform.PreScale(rtBounds.width / float(surfaceRect.width),
-                          rtBounds.height / float(surfaceRect.height),
-                          1.0f);
-
-  // XXX we shouldn't use visibleRect here -- the VR distortion needs to know the
-  // full rect, not just the visible one.  Luckily, right now, VR distortion is only
-  // rendered when the element is fullscreen, so the visibleRect will be right anyway.
-  aManager->GetCompositor()->DrawQuad(Rect(rect), clipRect, vrEffect, opacity,
-                                      scaleTransform);
-
-  DUMP("<<< ContainerRenderVR [%p]\n", aContainer);
-}
-
 /* all of the prepared data that we need in RenderLayer() */
 struct PreparedData
 {
   RefPtr<CompositingRenderTarget> mTmpTarget;
   AutoTArray<PreparedLayer, 12> mLayers;
   bool mNeedsSurfaceCopy;
 };
 
@@ -351,25 +129,16 @@ struct PreparedData
 template<class ContainerT> void
 ContainerPrepare(ContainerT* aContainer,
                  LayerManagerComposite* aManager,
                  const RenderTargetIntRect& aClipRect)
 {
   aContainer->mPrepared = MakeUnique<PreparedData>();
   aContainer->mPrepared->mNeedsSurfaceCopy = false;
 
-  RefPtr<gfx::VRHMDInfo> hmdInfo = gfx::VRManager::Get()->GetDevice(aContainer->GetVRDeviceID());
-  if (hmdInfo && hmdInfo->GetConfiguration().IsValid()) {
-    // we're not going to do anything here; instead, we'll do it all in ContainerRender.
-    // XXX fix this; we can win with the same optimizations.  Specifically, we
-    // want to render thebes layers only once and then composite the intermeidate surfaces
-    // with different transforms twice.
-    return;
-  }
-
   /**
    * Determine which layers to draw.
    */
   AutoTArray<Layer*, 12> children;
   aContainer->SortChildrenBy3DZOrder(children);
 
   for (uint32_t i = 0; i < children.Length(); i++) {
     LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->ImplData());
@@ -755,23 +524,16 @@ RenderIntermediate(ContainerT* aContaine
 
 template<class ContainerT> void
 ContainerRender(ContainerT* aContainer,
                  LayerManagerComposite* aManager,
                  const gfx::IntRect& aClipRect)
 {
   MOZ_ASSERT(aContainer->mPrepared);
 
-  RefPtr<gfx::VRHMDInfo> hmdInfo = gfx::VRManager::Get()->GetDevice(aContainer->GetVRDeviceID());
-  if (hmdInfo && hmdInfo->GetConfiguration().IsValid()) {
-    ContainerRenderVR(aContainer, aManager, aClipRect, hmdInfo);
-    aContainer->mPrepared = nullptr;
-    return;
-  }
-
   if (aContainer->UseIntermediateSurface()) {
     RefPtr<CompositingRenderTarget> surface;
 
     if (aContainer->mPrepared->mNeedsSurfaceCopy) {
       // we needed to copy the background so we waited until now to render the intermediate
       surface = CreateTemporaryTargetAndCopyFromBackground(aContainer, aManager);
       RenderIntermediate(aContainer, aManager,
                          aClipRect, surface);
@@ -886,17 +648,16 @@ ContainerLayerComposite::Prepare(const R
 {
   ContainerPrepare(this, mCompositeManager, aClipRect);
 }
 
 void
 ContainerLayerComposite::CleanupResources()
 {
   mLastIntermediateSurface = nullptr;
-  mVRRenderTargetSet = nullptr;
   mPrepared = nullptr;
 
   for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
     LayerComposite* layerToCleanup = static_cast<LayerComposite*>(l->ImplData());
     layerToCleanup->CleanupResources();
   }
 }
 
@@ -939,14 +700,13 @@ RefLayerComposite::Prepare(const RenderT
 {
   ContainerPrepare(this, mCompositeManager, aClipRect);
 }
 
 void
 RefLayerComposite::CleanupResources()
 {
   mLastIntermediateSurface = nullptr;
-  mVRRenderTargetSet = nullptr;
   mPrepared = nullptr;
 }
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/composite/ContainerLayerComposite.h
+++ b/gfx/layers/composite/ContainerLayerComposite.h
@@ -6,17 +6,16 @@
 #ifndef GFX_ContainerLayerComposite_H
 #define GFX_ContainerLayerComposite_H
 
 #include "Layers.h"                     // for Layer (ptr only), etc
 #include "mozilla/Attributes.h"         // for override
 #include "mozilla/UniquePtr.h"          // for UniquePtr
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/gfx/Rect.h"
-#include "gfxVR.h"
 
 namespace mozilla {
 namespace layers {
 
 class CompositableHost;
 class CompositingRenderTarget;
 struct PreparedData;
 
@@ -112,17 +111,16 @@ public:
     }
     return mPostYScale;
   }
 
   virtual const char* Name() const override { return "ContainerLayerComposite"; }
   UniquePtr<PreparedData> mPrepared;
 
   RefPtr<CompositingRenderTarget> mLastIntermediateSurface;
-  RefPtr<gfx::VRHMDRenderingSupport::RenderTargetSet> mVRRenderTargetSet;
 };
 
 class RefLayerComposite : public RefLayer,
                           public LayerComposite
 {
   template<class ContainerT>
   friend void ContainerPrepare(ContainerT* aContainer,
                                LayerManagerComposite* aManager,
@@ -178,15 +176,14 @@ public:
   virtual LayerComposite* AsLayerComposite() override { return this; }
 
   // ref layers don't use a compositable
   CompositableHost* GetCompositableHost() override { return nullptr; }
 
   virtual const char* Name() const override { return "RefLayerComposite"; }
   UniquePtr<PreparedData> mPrepared;
   RefPtr<CompositingRenderTarget> mLastIntermediateSurface;
-  RefPtr<gfx::VRHMDRenderingSupport::RenderTargetSet> mVRRenderTargetSet;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* GFX_ContainerLayerComposite_H */
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -27,17 +27,16 @@ namespace layers {
 
 class ISurfaceAllocator;
 
 ImageHost::ImageHost(const TextureInfo& aTextureInfo)
   : CompositableHost(aTextureInfo)
   , mImageContainer(nullptr)
   , mLastFrameID(-1)
   , mLastProducerID(-1)
-  , mLastInputFrameID(-1)
   , mBias(BIAS_NONE)
   , mLocked(false)
 {}
 
 ImageHost::~ImageHost()
 {
   SetImageContainer(nullptr);
 }
@@ -64,17 +63,16 @@ ImageHost::UseTextureHost(const nsTArray
       continue;
     }
     TimedImage& img = *newImages.AppendElement();
     img.mTextureHost = t.mTexture;
     img.mTimeStamp = t.mTimeStamp;
     img.mPictureRect = t.mPictureRect;
     img.mFrameID = t.mFrameID;
     img.mProducerID = t.mProducerID;
-    img.mInputFrameID = t.mInputFrameID;
     img.mTextureHost->SetCropRect(img.mPictureRect);
     img.mTextureHost->Updated();
   }
 
   mImages.SwapElements(newImages);
   newImages.Clear();
 
   // If we only have one image we can upload it right away, otherwise we'll upload
@@ -376,17 +374,16 @@ ImageHost::Composite(LayerComposite* aLa
         aLayer->GetLayerManager()->
             AppendImageCompositeNotification(ImageCompositeNotification(
                 mImageContainer, nullptr,
                 img->mTimeStamp, GetCompositor()->GetCompositionTime(),
                 img->mFrameID, img->mProducerID));
       }
       mLastFrameID = img->mFrameID;
       mLastProducerID = img->mProducerID;
-      mLastInputFrameID = img->mInputFrameID;
     }
     aEffectChain.mPrimaryEffect = effect;
     gfx::Rect pictureRect(0, 0, img->mPictureRect.width, img->mPictureRect.height);
     BigImageIterator* it = mCurrentTextureSource->AsBigImageIterator();
     if (it) {
 
       // This iteration does not work if we have multiple texture sources here
       // (e.g. 3 YCbCr textures). There's nothing preventing the different
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -99,17 +99,16 @@ public:
   int32_t GetProducerID()
   {
     const TimedImage* img = ChooseImage();
     return img ? img->mProducerID : -1;
   }
 
   int32_t GetLastFrameID() const { return mLastFrameID; }
   int32_t GetLastProducerID() const { return mLastProducerID; }
-  virtual int32_t GetLastInputFrameID() const override { return mLastInputFrameID; }
 
   enum Bias {
     // Don't apply bias to frame times
     BIAS_NONE,
     // Apply a negative bias to frame times to keep them before the vsync time
     BIAS_NEGATIVE,
     // Apply a positive bias to frame times to keep them after the vsync time
     BIAS_POSITIVE,
@@ -119,17 +118,16 @@ public:
 
 protected:
   struct TimedImage {
     CompositableTextureHostRef mTextureHost;
     TimeStamp mTimeStamp;
     gfx::IntRect mPictureRect;
     int32_t mFrameID;
     int32_t mProducerID;
-    int32_t mInputFrameID;
   };
 
   // Use a simple RefPtr because the same texture is already held by a
   // a CompositableTextureHostRef in the array of TimedImage.
   // See the comment in CompositableTextureRef for more details.
   RefPtr<TextureHost> mCurrentTextureHost;
   CompositableTextureSourceRef mCurrentTextureSource;
   // When doing texture uploads it's best to alternate between two (or three)
@@ -147,17 +145,16 @@ protected:
   TimedImage* ChooseImage();
   int ChooseImageIndex() const;
 
   nsTArray<TimedImage> mImages;
   // Weak reference, will be null if mImageContainer has been destroyed.
   ImageContainerParent* mImageContainer;
   int32_t mLastFrameID;
   int32_t mLastProducerID;
-  int32_t mLastInputFrameID;
   /**
    * Bias to apply to the next frame.
    */
   Bias mBias;
 
   bool mLocked;
 
   RefPtr<ImageHostOverlay> mImageHostOverlay;
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -2,29 +2,27 @@
  * 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 "CompositorD3D11.h"
 
 #include "TextureD3D11.h"
 #include "CompositorD3D11Shaders.h"
-#include "CompositorD3D11ShadersVR.h"
 
 #include "gfxWindowsPlatform.h"
 #include "nsIWidget.h"
 #include "nsIGfxInfo.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"
 #include "mozilla/gfx/StackArray.h"
 #include "mozilla/Services.h"
 #include "mozilla/widget/WinCompositorWidget.h"
 
 #include "mozilla/EnumeratedArray.h"
 #include "mozilla/Telemetry.h"
 #include "BlendShaderConstants.h"
 
@@ -95,39 +93,16 @@ struct DeviceAttachmentsD3D11
   RefPtr<ID3D11SamplerState> mPointSamplerState;
   RefPtr<ID3D11BlendState> mPremulBlendState;
   RefPtr<ID3D11BlendState> mNonPremulBlendState;
   RefPtr<ID3D11BlendState> mComponentBlendState;
   RefPtr<ID3D11BlendState> mDisabledBlendState;
   RefPtr<IDXGIResource> mSyncTexture;
   HANDLE mSyncHandle;
 
-  //
-  // VR pieces
-  //
-  typedef EnumeratedArray<VRHMDType, VRHMDType::NumHMDTypes, RefPtr<ID3D11InputLayout>>
-          VRDistortionInputLayoutArray;
-  typedef EnumeratedArray<VRHMDType, VRHMDType::NumHMDTypes, RefPtr<ID3D11VertexShader>>
-          VRVertexShaderArray;
-  typedef EnumeratedArray<VRHMDType, VRHMDType::NumHMDTypes, RefPtr<ID3D11PixelShader>>
-          VRPixelShaderArray;
-
-  VRDistortionInputLayoutArray mVRDistortionInputLayout;
-  VRVertexShaderArray mVRDistortionVS;
-  VRPixelShaderArray mVRDistortionPS;
-
-  RefPtr<ID3D11Buffer> mVRDistortionConstants;
-
-  // These will be created/filled in as needed during rendering whenever the configuration
-  // changes.
-  VRHMDConfiguration mVRConfiguration;
-  RefPtr<ID3D11Buffer> mVRDistortionVertices[2]; // one for each eye
-  RefPtr<ID3D11Buffer> mVRDistortionIndices[2];
-  uint32_t mVRDistortionIndexCount[2];
-
 private:
   void InitVertexShader(const ShaderBytes& aShader, VertexShaderArray& aArray, MaskType aMaskType) {
     InitVertexShader(aShader, getter_AddRefs(aArray[aMaskType]));
   }
   void InitPixelShader(const ShaderBytes& aShader, PixelShaderArray& aArray, MaskType aMaskType) {
     InitPixelShader(aShader, getter_AddRefs(aArray[aMaskType]));
   }
   void InitVertexShader(const ShaderBytes& aShader, ID3D11VertexShader** aOut) {
@@ -373,45 +348,17 @@ CompositorD3D11::Initialize(nsCString* c
       *out_failureReason = "FEATURE_FAILURE_D3D11_NULL_BLENDER";
       return false;
     }
 
     if (!mAttachments->InitSyncObject()) {
       *out_failureReason = "FEATURE_FAILURE_D3D11_OBJ_SYNC";
       return false;
     }
-
-    //
-    // VR additions
-    //
-    D3D11_INPUT_ELEMENT_DESC vrlayout[] =
-    {
-      { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT,       0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-      { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,       0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-      { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT,       0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-      { "TEXCOORD", 2, DXGI_FORMAT_R32G32_FLOAT,       0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-      { "COLOR",    0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-    };
-
-    hr = mDevice->CreateInputLayout(vrlayout,
-                                    sizeof(vrlayout) / sizeof(D3D11_INPUT_ELEMENT_DESC),
-                                    Oculus050VRDistortionVS,
-                                    sizeof(Oculus050VRDistortionVS),
-                                    getter_AddRefs(mAttachments->mVRDistortionInputLayout[VRHMDType::Oculus050]));
-
-    // XXX shared for now, rename
-    mAttachments->mVRDistortionInputLayout[VRHMDType::Cardboard] =
-      mAttachments->mVRDistortionInputLayout[VRHMDType::Oculus050];
-
-    cBufferDesc.ByteWidth = sizeof(gfx::VRDistortionConstants);
-    hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, getter_AddRefs(mAttachments->mVRDistortionConstants));
-    if (Failed(hr, "create vr buffer ")) {
       *out_failureReason = "FEATURE_FAILURE_D3D11_VR_BUFFER";
-      return false;
-    }
   }
 
   RefPtr<IDXGIDevice> dxgiDevice;
   RefPtr<IDXGIAdapter> dxgiAdapter;
 
   mDevice->QueryInterface(dxgiDevice.StartAssignment());
   dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter));
 
@@ -708,161 +655,16 @@ CompositorD3D11::ClearRect(const gfx::Re
     return;
   }
 
   mContext->Draw(4, 0);
 
   mContext->OMSetBlendState(mAttachments->mPremulBlendState, sBlendFactor, 0xFFFFFFFF);
 }
 
-void
-CompositorD3D11::DrawVRDistortion(const gfx::Rect& aRect,
-                                  const gfx::IntRect& aClipRect,
-                                  const EffectChain& aEffectChain,
-                                  gfx::Float aOpacity,
-                                  const gfx::Matrix4x4& aTransform)
-{
-  MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EffectTypes::VR_DISTORTION);
-
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK] ||
-      aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE])
-  {
-    NS_WARNING("DrawVRDistortion: ignoring secondary effect!");
-  }
-
-  HRESULT hr;
-
-  EffectVRDistortion* vrEffect =
-    static_cast<EffectVRDistortion*>(aEffectChain.mPrimaryEffect.get());
-
-  TextureSourceD3D11* source = vrEffect->mTexture->AsSourceD3D11();
-
-  VRHMDInfo* hmdInfo = vrEffect->mHMD;
-  VRHMDType hmdType = hmdInfo->GetDeviceInfo().GetType();
-
-  if (!mAttachments->mVRDistortionVS[hmdType] ||
-      !mAttachments->mVRDistortionPS[hmdType])
-  {
-    NS_WARNING("No VS/PS for hmd type for VR distortion!");
-    return;
-  }
-
-  VRDistortionConstants shaderConstants;
-
-  // do we need to recreate the VR buffers, since the config has changed?
-  if (hmdInfo->GetConfiguration() != mAttachments->mVRConfiguration) {
-    D3D11_SUBRESOURCE_DATA sdata = { 0 };
-    CD3D11_BUFFER_DESC desc(0, D3D11_BIND_VERTEX_BUFFER, D3D11_USAGE_IMMUTABLE);
-
-    // XXX as an optimization, we should really pack the indices and vertices for both eyes
-    // into one buffer instead of needing one eye each.  Then we can just bind them once.
-    for (uint32_t eye = 0; eye < 2; eye++) {
-      const gfx::VRDistortionMesh& mesh = hmdInfo->GetDistortionMesh(eye);
-
-      desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
-      desc.ByteWidth = mesh.mVertices.Length() * sizeof(gfx::VRDistortionVertex);
-      sdata.pSysMem = mesh.mVertices.Elements();
-      
-      hr = mDevice->CreateBuffer(&desc, &sdata, getter_AddRefs(mAttachments->mVRDistortionVertices[eye]));
-      if (FAILED(hr)) {
-        NS_WARNING("CreateBuffer failed");
-        return;
-      }
-
-      desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
-      desc.ByteWidth = mesh.mIndices.Length() * sizeof(uint16_t);
-      sdata.pSysMem = mesh.mIndices.Elements();
-
-      hr = mDevice->CreateBuffer(&desc, &sdata, getter_AddRefs(mAttachments->mVRDistortionIndices[eye]));
-      if (FAILED(hr)) {
-        NS_WARNING("CreateBuffer failed");
-        return;
-      }
-
-      mAttachments->mVRDistortionIndexCount[eye] = mesh.mIndices.Length();
-    }
-
-    mAttachments->mVRConfiguration = hmdInfo->GetConfiguration();
-  }
-
-  // XXX do I need to set a scissor rect? Is this the right scissor rect?
-  D3D11_RECT scissor;
-  scissor.left = aClipRect.x;
-  scissor.right = aClipRect.XMost();
-  scissor.top = aClipRect.y;
-  scissor.bottom = aClipRect.YMost();
-  mContext->RSSetScissorRects(1, &scissor);
-
-  // Triangle lists and same layout for both eyes
-  mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
-  mContext->IASetInputLayout(mAttachments->mVRDistortionInputLayout[hmdType]);
-  mContext->VSSetShader(mAttachments->mVRDistortionVS[hmdType], nullptr, 0);
-  mContext->PSSetShader(mAttachments->mVRDistortionPS[hmdType], nullptr, 0);
-
-  // This is the source texture SRV for the pixel shader
-  ID3D11ShaderResourceView* srView = source->GetShaderResourceView();
-  mContext->PSSetShaderResources(0, 1, &srView);
-
-  Rect destRect = aTransform.TransformBounds(aRect);
-  gfx::IntSize preDistortionSize = vrEffect->mRenderTarget->GetSize(); // XXX source->GetSize()
-  gfx::Size vpSize = destRect.Size();
-
-  ID3D11Buffer* vbuffer;
-  UINT vsize, voffset;
-
-  for (uint32_t eye = 0; eye < 2; eye++) {
-    gfx::IntRect eyeViewport;
-    eyeViewport.x = eye * preDistortionSize.width / 2;
-    eyeViewport.y = 0;
-    eyeViewport.width = preDistortionSize.width / 2;
-    eyeViewport.height = preDistortionSize.height;
-
-    hmdInfo->FillDistortionConstants(eye,
-                                     preDistortionSize, eyeViewport,
-                                     vpSize, destRect,
-                                     shaderConstants);
-
-    // D3D has clip space top-left as -1,1 so we need to flip the Y coordinate offset here
-    shaderConstants.destinationScaleAndOffset[1] = - shaderConstants.destinationScaleAndOffset[1];
-
-    // XXX I really want to write a templated helper for these next 4 lines
-    D3D11_MAPPED_SUBRESOURCE resource;
-    hr = mContext->Map(mAttachments->mVRDistortionConstants, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
-    if (FAILED(hr) || !resource.pData) {
-      gfxCriticalError() << "Failed to map VRDistortionConstants. Result: " << hr;
-      HandleError(hr);
-      return;
-    }
-    *(gfx::VRDistortionConstants*)resource.pData = shaderConstants;
-    mContext->Unmap(mAttachments->mVRDistortionConstants, 0);
-    resource.pData = nullptr;
-
-    // XXX is there a better way to change a bunch of these things from what they were set to
-    // in BeginFrame/etc?
-    vbuffer = mAttachments->mVRDistortionVertices[eye];
-    vsize = sizeof(gfx::VRDistortionVertex);
-    voffset = 0;
-    mContext->IASetVertexBuffers(0, 1, &vbuffer, &vsize, &voffset);
-    mContext->IASetIndexBuffer(mAttachments->mVRDistortionIndices[eye], DXGI_FORMAT_R16_UINT, 0);
-
-    ID3D11Buffer* constBuf = mAttachments->mVRDistortionConstants;
-    mContext->VSSetConstantBuffers(0, 1, &constBuf);
-
-    mContext->DrawIndexed(mAttachments->mVRDistortionIndexCount[eye], 0, 0);
-  }
-
-  // restore previous configurations
-  vbuffer = mAttachments->mVertexBuffer;
-  vsize = sizeof(Vertex);
-  voffset = 0;
-  mContext->IASetVertexBuffers(0, 1, &vbuffer, &vsize, &voffset);
-  mContext->IASetIndexBuffer(nullptr, DXGI_FORMAT_R16_UINT, 0);
-  mContext->IASetInputLayout(mAttachments->mInputLayout);
-}
-
 static inline bool
 EffectHasPremultipliedAlpha(Effect* aEffect)
 {
   if (aEffect->mType == EffectTypes::RGB) {
     return static_cast<TexturedEffect*>(aEffect)->mPremultiplied;
   }
   return true;
 }
@@ -898,21 +700,16 @@ CompositorD3D11::DrawQuad(const gfx::Rec
                           const gfx::Rect& aVisibleRect)
 {
   if (mCurrentClip.IsEmpty()) {
     return;
   }
 
   MOZ_ASSERT(mCurrentRT, "No render target");
 
-  if (aEffectChain.mPrimaryEffect->mType == EffectTypes::VR_DISTORTION) {
-    DrawVRDistortion(aRect, aClipRect, aEffectChain, aOpacity, aTransform);
-    return;
-  }
-
   memcpy(&mVSConstants.layerTransform, &aTransform._11, 64);
   IntPoint origin = mCurrentRT->GetOrigin();
   mVSConstants.renderTargetOffset[0] = origin.x;
   mVSConstants.renderTargetOffset[1] = origin.y;
 
   mPSConstants.layerOpacity[0] = aOpacity;
 
   bool restoreBlendMode = false;
@@ -1567,23 +1364,16 @@ DeviceAttachmentsD3D11::CreateShaders()
   InitPixelShader(sRGBAShaderMask, mRGBAShader, MaskType::Mask);
   InitPixelShader(sYCbCrShader, mYCbCrShader, MaskType::MaskNone);
   InitPixelShader(sYCbCrShaderMask, mYCbCrShader, MaskType::Mask);
   if (gfxPrefs::ComponentAlphaEnabled()) {
     InitPixelShader(sComponentAlphaShader, mComponentAlphaShader, MaskType::MaskNone);
     InitPixelShader(sComponentAlphaShaderMask, mComponentAlphaShader, MaskType::Mask);
   }
 
-  InitVertexShader(sOculus050VRDistortionVS, getter_AddRefs(mVRDistortionVS[VRHMDType::Oculus050]));
-  InitPixelShader(sOculus050VRDistortionPS, getter_AddRefs(mVRDistortionPS[VRHMDType::Oculus050]));
-
-  // These are shared
-  // XXX rename Oculus050 shaders to something more generic
-  mVRDistortionVS[VRHMDType::Cardboard] = mVRDistortionVS[VRHMDType::Oculus050];
-  mVRDistortionPS[VRHMDType::Cardboard] = mVRDistortionPS[VRHMDType::Oculus050];
   return mInitOkay;
 }
 
 bool
 CompositorD3D11::UpdateConstantBuffers()
 {
   HRESULT hr;
   D3D11_MAPPED_SUBRESOURCE resource;
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -93,23 +93,16 @@ public:
 
   virtual void DrawQuad(const gfx::Rect &aRect,
                         const gfx::IntRect &aClipRect,
                         const EffectChain &aEffectChain,
                         gfx::Float aOpacity,
                         const gfx::Matrix4x4& aTransform,
                         const gfx::Rect& aVisibleRect) override;
 
-  /* Helper for when the primary effect is VR_DISTORTION */
-  void DrawVRDistortion(const gfx::Rect &aRect,
-                        const gfx::IntRect &aClipRect,
-                        const EffectChain &aEffectChain,
-                        gfx::Float aOpacity,
-                        const gfx::Matrix4x4 &aTransform);
-
   /**
    * Start a new frame. If aClipRectIn is null, sets *aClipRectOut to the
    * screen dimensions. 
    */
   virtual void BeginFrame(const nsIntRegion& aInvalidRegion,
                           const gfx::IntRect *aClipRectIn,
                           const gfx::IntRect& aRenderBounds,
                           const nsIntRegion& aOpaqueRegion,
deleted file mode 100644
--- a/gfx/layers/d3d11/CompositorD3D11ShadersVR.h
+++ /dev/null
@@ -1,638 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
-//
-//
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 VREyeToSource;              // Offset:    0 Size:    16
-//   float4 VRDestinationScaleAndOffset;// Offset:   16 Size:    16
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim      HLSL Bind  Count
-// ------------------------------ ---------- ------- ----------- -------------- ------
-// $Globals                          cbuffer      NA          NA            cb0      1 
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// POSITION                 0   xy          0     NONE   float   xy  
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1   xy          2     NONE   float   xy  
-// TEXCOORD                 2   xy          3     NONE   float   xy  
-// COLOR                    0   xyzw        4     NONE   float   xyzw
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float   xyzw
-// TEXCOORD                 0   xyz         1     NONE   float   xyz 
-// TEXCOORD                 1   xyz         2     NONE   float   xyz 
-// TEXCOORD                 2   xyz         3     NONE   float   xyz 
-// COLOR                    0   xyzw        4     NONE   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c1         cb0             0         2  ( FLT, FLT, FLT, FLT)
-//
-//
-// Runtime generated constant mappings:
-//
-// Target Reg                               Constant Description
-// ---------- --------------------------------------------------
-// c0                              Vertex Shader position offset
-//
-//
-// Level9 shader bytecode:
-//
-    vs_2_x
-    def c3, 0.5, 1, 0, 0
-    dcl_texcoord v0
-    dcl_texcoord1 v1
-    dcl_texcoord2 v2
-    dcl_texcoord3 v3
-    dcl_texcoord4 v4
-    mad oT0.xy, v1, c1.zwzw, c1
-    mad oT1.xy, v2, c1.zwzw, c1
-    mad oT2.xy, v3, c1.zwzw, c1
-    mad r0.xy, v0, c2.zwzw, c2
-    add oPos.xy, r0, c0
-    mov oPos.zw, c3.xyxy
-    mov oT0.z, c3.y
-    mov oT1.z, c3.y
-    mov oT2.z, c3.y
-    mov oT3, v4
-
-// approximately 10 instruction slots used
-vs_4_0
-dcl_constantbuffer CB0[2], immediateIndexed
-dcl_input v0.xy
-dcl_input v1.xy
-dcl_input v2.xy
-dcl_input v3.xy
-dcl_input v4.xyzw
-dcl_output_siv o0.xyzw, position
-dcl_output o1.xyz
-dcl_output o2.xyz
-dcl_output o3.xyz
-dcl_output o4.xyzw
-mad o0.xy, v0.xyxx, cb0[1].zwzz, cb0[1].xyxx
-mov o0.zw, l(0,0,0.500000,1.000000)
-mad o1.xy, v1.xyxx, cb0[0].zwzz, cb0[0].xyxx
-mov o1.z, l(1.000000)
-mad o2.xy, v2.xyxx, cb0[0].zwzz, cb0[0].xyxx
-mov o2.z, l(1.000000)
-mad o3.xy, v3.xyxx, cb0[0].zwzz, cb0[0].xyxx
-mov o3.z, l(1.000000)
-mov o4.xyzw, v4.xyzw
-ret 
-// Approximately 10 instruction slots used
-#endif
-
-const BYTE Oculus050VRDistortionVS[] =
-{
-     68,  88,  66,  67,  92, 195, 
-    173, 230,  45,  84,  78,  45, 
-    143, 175,  88,  53,  65, 235, 
-    243, 174,   1,   0,   0,   0, 
-    244,   5,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    108,   1,   0,   0,  44,   3, 
-      0,   0, 168,   3,   0,   0, 
-    176,   4,   0,   0,  80,   5, 
-      0,   0,  65, 111, 110,  57, 
-     44,   1,   0,   0,  44,   1, 
-      0,   0,   0,   2, 254, 255, 
-    248,   0,   0,   0,  52,   0, 
-      0,   0,   1,   0,  36,   0, 
-      0,   0,  48,   0,   0,   0, 
-     48,   0,   0,   0,  36,   0, 
-      1,   0,  48,   0,   0,   0, 
-      0,   0,   2,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 254, 255, 
-     81,   0,   0,   5,   3,   0, 
-     15, 160,   0,   0,   0,  63, 
-      0,   0, 128,  63,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     31,   0,   0,   2,   5,   0, 
-      0, 128,   0,   0,  15, 144, 
-     31,   0,   0,   2,   5,   0, 
-      1, 128,   1,   0,  15, 144, 
-     31,   0,   0,   2,   5,   0, 
-      2, 128,   2,   0,  15, 144, 
-     31,   0,   0,   2,   5,   0, 
-      3, 128,   3,   0,  15, 144, 
-     31,   0,   0,   2,   5,   0, 
-      4, 128,   4,   0,  15, 144, 
-      4,   0,   0,   4,   0,   0, 
-      3, 224,   1,   0, 228, 144, 
-      1,   0, 238, 160,   1,   0, 
-    228, 160,   4,   0,   0,   4, 
-      1,   0,   3, 224,   2,   0, 
-    228, 144,   1,   0, 238, 160, 
-      1,   0, 228, 160,   4,   0, 
-      0,   4,   2,   0,   3, 224, 
-      3,   0, 228, 144,   1,   0, 
-    238, 160,   1,   0, 228, 160, 
-      4,   0,   0,   4,   0,   0, 
-      3, 128,   0,   0, 228, 144, 
-      2,   0, 238, 160,   2,   0, 
-    228, 160,   2,   0,   0,   3, 
-      0,   0,   3, 192,   0,   0, 
-    228, 128,   0,   0, 228, 160, 
-      1,   0,   0,   2,   0,   0, 
-     12, 192,   3,   0,  68, 160, 
-      1,   0,   0,   2,   0,   0, 
-      4, 224,   3,   0,  85, 160, 
-      1,   0,   0,   2,   1,   0, 
-      4, 224,   3,   0,  85, 160, 
-      1,   0,   0,   2,   2,   0, 
-      4, 224,   3,   0,  85, 160, 
-      1,   0,   0,   2,   3,   0, 
-     15, 224,   4,   0, 228, 144, 
-    255, 255,   0,   0,  83,  72, 
-     68,  82, 184,   1,   0,   0, 
-     64,   0,   1,   0, 110,   0, 
-      0,   0,  89,   0,   0,   4, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-     95,   0,   0,   3,  50,  16, 
-     16,   0,   0,   0,   0,   0, 
-     95,   0,   0,   3,  50,  16, 
-     16,   0,   1,   0,   0,   0, 
-     95,   0,   0,   3,  50,  16, 
-     16,   0,   2,   0,   0,   0, 
-     95,   0,   0,   3,  50,  16, 
-     16,   0,   3,   0,   0,   0, 
-     95,   0,   0,   3, 242,  16, 
-     16,   0,   4,   0,   0,   0, 
-    103,   0,   0,   4, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0, 101,   0, 
-      0,   3, 114,  32,  16,   0, 
-      1,   0,   0,   0, 101,   0, 
-      0,   3, 114,  32,  16,   0, 
-      2,   0,   0,   0, 101,   0, 
-      0,   3, 114,  32,  16,   0, 
-      3,   0,   0,   0, 101,   0, 
-      0,   3, 242,  32,  16,   0, 
-      4,   0,   0,   0,  50,   0, 
-      0,  11,  50,  32,  16,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   0,   0,   0,   0, 
-    230, 138,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     70, 128,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     54,   0,   0,   8, 194,  32, 
-     16,   0,   0,   0,   0,   0, 
-      2,  64,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,  63,   0,   0, 
-    128,  63,  50,   0,   0,  11, 
-     50,  32,  16,   0,   1,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  70, 128, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  54,   0, 
-      0,   5,  66,  32,  16,   0, 
-      1,   0,   0,   0,   1,  64, 
-      0,   0,   0,   0, 128,  63, 
-     50,   0,   0,  11,  50,  32, 
-     16,   0,   2,   0,   0,   0, 
-     70,  16,  16,   0,   2,   0, 
-      0,   0, 230, 138,  32,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  70, 128,  32,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  54,   0,   0,   5, 
-     66,  32,  16,   0,   2,   0, 
-      0,   0,   1,  64,   0,   0, 
-      0,   0, 128,  63,  50,   0, 
-      0,  11,  50,  32,  16,   0, 
-      3,   0,   0,   0,  70,  16, 
-     16,   0,   3,   0,   0,   0, 
-    230, 138,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     70, 128,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     54,   0,   0,   5,  66,  32, 
-     16,   0,   3,   0,   0,   0, 
-      1,  64,   0,   0,   0,   0, 
-    128,  63,  54,   0,   0,   5, 
-    242,  32,  16,   0,   4,   0, 
-      0,   0,  70,  30,  16,   0, 
-      4,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,  10,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  10,   0, 
-      0,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   5,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70,   0,   1, 
-      0,   0,   1,   0,   0,   0, 
-     72,   0,   0,   0,   1,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 254, 255,   0,   1, 
-      0,   0, 204,   0,   0,   0, 
-     60,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,  36,  71, 108, 111, 
-     98,  97, 108, 115,   0, 171, 
-    171, 171,  60,   0,   0,   0, 
-      2,   0,   0,   0,  96,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 144,   0,   0,   0, 
-      0,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    160,   0,   0,   0,   0,   0, 
-      0,   0, 176,   0,   0,   0, 
-     16,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    160,   0,   0,   0,   0,   0, 
-      0,   0,  86,  82,  69, 121, 
-    101,  84, 111,  83, 111, 117, 
-    114,  99, 101,   0, 171, 171, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  86,  82, 
-     68, 101, 115, 116, 105, 110, 
-     97, 116, 105, 111, 110,  83, 
-     99,  97, 108, 101,  65, 110, 
-    100,  79, 102, 102, 115, 101, 
-    116,   0,  77, 105,  99, 114, 
-    111, 115, 111, 102, 116,  32, 
-     40,  82,  41,  32,  72,  76, 
-     83,  76,  32,  83, 104,  97, 
-    100, 101, 114,  32,  67, 111, 
-    109, 112, 105, 108, 101, 114, 
-     32,  49,  48,  46,  48,  46, 
-     49,  48,  48,  49,  49,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78, 152,   0, 
-      0,   0,   5,   0,   0,   0, 
-      8,   0,   0,   0, 128,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   3,   0,   0, 137,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   3,   0,   0, 137,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   2,   0,   0,   0, 
-      3,   3,   0,   0, 137,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   3,   0,   0,   0, 
-      3,   3,   0,   0, 146,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   4,   0,   0,   0, 
-     15,  15,   0,   0,  80,  79, 
-     83,  73,  84,  73,  79,  78, 
-      0,  84,  69,  88,  67,  79, 
-     79,  82,  68,   0,  67,  79, 
-     76,  79,  82,   0,  79,  83, 
-     71,  78, 156,   0,   0,   0, 
-      5,   0,   0,   0,   8,   0, 
-      0,   0, 128,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0, 140,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      1,   0,   0,   0,   7,   8, 
-      0,   0, 140,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      2,   0,   0,   0,   7,   8, 
-      0,   0, 140,   0,   0,   0, 
-      2,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      3,   0,   0,   0,   7,   8, 
-      0,   0, 149,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      4,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  80, 
-    111, 115, 105, 116, 105, 111, 
-    110,   0,  84,  69,  88,  67, 
-     79,  79,  82,  68,   0,  67, 
-     79,  76,  79,  82,   0, 171
-};
-ShaderBytes sOculus050VRDistortionVS = { Oculus050VRDistortionVS, sizeof(Oculus050VRDistortionVS) };
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim      HLSL Bind  Count
-// ------------------------------ ---------- ------- ----------- -------------- ------
-// Linear                            sampler      NA          NA             s0      1 
-// Texture                           texture  float4          2d             t0      1 
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xyz         1     NONE   float   xy  
-// TEXCOORD                 1   xyz         2     NONE   float   xy  
-// TEXCOORD                 2   xyz         3     NONE   float   xy  
-// COLOR                    0   xyzw        4     NONE   float   x   
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t0               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    def c0, 1, 0, 0, 0
-    dcl t0.xyz
-    dcl t1.xyz
-    dcl t2.xyz
-    dcl t3
-    dcl_2d s0
-    texld r0, t1, s0
-    texld r1, t0, s0
-    mul r1.x, r1.x, t3.x
-    mul r1.y, r0.y, t3.x
-    texld r0, t2, s0
-    mul r1.z, r0.z, t3.x
-    mov r1.w, c0.x
-    mov oC0, r1
-
-// approximately 8 instruction slots used (3 texture, 5 arithmetic)
-ps_4_0
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_input_ps linear v1.xy
-dcl_input_ps linear v2.xy
-dcl_input_ps linear v3.xy
-dcl_input_ps linear v4.x
-dcl_output o0.xyzw
-dcl_temps 1
-sample r0.xyzw, v1.xyxx, t0.xyzw, s0
-mul o0.x, r0.x, v4.x
-sample r0.xyzw, v2.xyxx, t0.xyzw, s0
-mul o0.y, r0.y, v4.x
-sample r0.xyzw, v3.xyxx, t0.xyzw, s0
-mul o0.z, r0.z, v4.x
-mov o0.w, l(1.000000)
-ret 
-// Approximately 8 instruction slots used
-#endif
-
-const BYTE Oculus050VRDistortionPS[] =
-{
-     68,  88,  66,  67,  17, 210, 
-    217, 234, 219,  61,  77,  84, 
-      3,  36,  81, 127, 138,  35, 
-    252,  53,   1,   0,   0,   0, 
-    128,   4,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-     60,   1,   0,   0, 132,   2, 
-      0,   0,   0,   3,   0,   0, 
-    168,   3,   0,   0,  76,   4, 
-      0,   0,  65, 111, 110,  57, 
-    252,   0,   0,   0, 252,   0, 
-      0,   0,   0,   2, 255, 255, 
-    212,   0,   0,   0,  40,   0, 
-      0,   0,   0,   0,  40,   0, 
-      0,   0,  40,   0,   0,   0, 
-     40,   0,   1,   0,  36,   0, 
-      0,   0,  40,   0,   0,   0, 
-      0,   0,   1,   2, 255, 255, 
-     81,   0,   0,   5,   0,   0, 
-     15, 160,   0,   0, 128,  63, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   0,   0,   7, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   1,   0,   7, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   2,   0,   7, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   3,   0,  15, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   0,   8,  15, 160, 
-     66,   0,   0,   3,   0,   0, 
-     15, 128,   1,   0, 228, 176, 
-      0,   8, 228, 160,  66,   0, 
-      0,   3,   1,   0,  15, 128, 
-      0,   0, 228, 176,   0,   8, 
-    228, 160,   5,   0,   0,   3, 
-      1,   0,   1, 128,   1,   0, 
-      0, 128,   3,   0,   0, 176, 
-      5,   0,   0,   3,   1,   0, 
-      2, 128,   0,   0,  85, 128, 
-      3,   0,   0, 176,  66,   0, 
-      0,   3,   0,   0,  15, 128, 
-      2,   0, 228, 176,   0,   8, 
-    228, 160,   5,   0,   0,   3, 
-      1,   0,   4, 128,   0,   0, 
-    170, 128,   3,   0,   0, 176, 
-      1,   0,   0,   2,   1,   0, 
-      8, 128,   0,   0,   0, 160, 
-      1,   0,   0,   2,   0,   8, 
-     15, 128,   1,   0, 228, 128, 
-    255, 255,   0,   0,  83,  72, 
-     68,  82,  64,   1,   0,   0, 
-     64,   0,   0,   0,  80,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   0,   0, 
-      0,   0,  85,  85,   0,   0, 
-     98,  16,   0,   3,  50,  16, 
-     16,   0,   1,   0,   0,   0, 
-     98,  16,   0,   3,  50,  16, 
-     16,   0,   2,   0,   0,   0, 
-     98,  16,   0,   3,  50,  16, 
-     16,   0,   3,   0,   0,   0, 
-     98,  16,   0,   3,  18,  16, 
-     16,   0,   4,   0,   0,   0, 
-    101,   0,   0,   3, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-    104,   0,   0,   2,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   7, 
-     18,  32,  16,   0,   0,   0, 
-      0,   0,  10,   0,  16,   0, 
-      0,   0,   0,   0,  10,  16, 
-     16,   0,   4,   0,   0,   0, 
-     69,   0,   0,   9, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  16,  16,   0,   2,   0, 
-      0,   0,  70, 126,  16,   0, 
-      0,   0,   0,   0,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-     56,   0,   0,   7,  34,  32, 
-     16,   0,   0,   0,   0,   0, 
-     26,   0,  16,   0,   0,   0, 
-      0,   0,  10,  16,  16,   0, 
-      4,   0,   0,   0,  69,   0, 
-      0,   9, 242,   0,  16,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   3,   0,   0,   0, 
-     70, 126,  16,   0,   0,   0, 
-      0,   0,   0,  96,  16,   0, 
-      0,   0,   0,   0,  56,   0, 
-      0,   7,  66,  32,  16,   0, 
-      0,   0,   0,   0,  42,   0, 
-     16,   0,   0,   0,   0,   0, 
-     10,  16,  16,   0,   4,   0, 
-      0,   0,  54,   0,   0,   5, 
-    130,  32,  16,   0,   0,   0, 
-      0,   0,   1,  64,   0,   0, 
-      0,   0, 128,  63,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,   8,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   5,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70, 160,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 255, 255,   0,   1, 
-      0,   0, 107,   0,   0,   0, 
-     92,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,  99,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     13,   0,   0,   0,  76, 105, 
-    110, 101,  97, 114,   0,  84, 
-    101, 120, 116, 117, 114, 101, 
-      0,  77, 105,  99, 114, 111, 
-    115, 111, 102, 116,  32,  40, 
-     82,  41,  32,  72,  76,  83, 
-     76,  32,  83, 104,  97, 100, 
-    101, 114,  32,  67, 111, 109, 
-    112, 105, 108, 101, 114,  32, 
-     49,  48,  46,  48,  46,  49, 
-     48,  48,  49,  49,  46,  49, 
-     54,  51,  56,  52,   0, 171, 
-     73,  83,  71,  78, 156,   0, 
-      0,   0,   5,   0,   0,   0, 
-      8,   0,   0,   0, 128,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0, 140,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      7,   3,   0,   0, 140,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   2,   0,   0,   0, 
-      7,   3,   0,   0, 140,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   3,   0,   0,   0, 
-      7,   3,   0,   0, 149,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   4,   0,   0,   0, 
-     15,   1,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0,  67,  79,  76,  79,  82, 
-      0, 171,  79,  83,  71,  78, 
-     44,   0,   0,   0,   1,   0, 
-      0,   0,   8,   0,   0,   0, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,  15,   0,   0,   0, 
-     83,  86,  95,  84,  97, 114, 
-    103, 101, 116,   0, 171, 171
-};
-ShaderBytes sOculus050VRDistortionPS = { Oculus050VRDistortionPS, sizeof(Oculus050VRDistortionPS) };
deleted file mode 100644
--- a/gfx/layers/d3d11/CompositorD3D11VR.hlsl
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; 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/. */
-
-/* These constants should match mozilla:gfx::VRDistortionConstants */
-float4 VREyeToSource : register(vs, c0);
-float4 VRDestinationScaleAndOffset : register(vs, c1);
-
-/* This is the input undistorted texture */
-Texture2D Texture    : register(ps, t0);
-
-/* This maps to mozilla::gfx::VRDistortionVertex in gfxVR.h.
- * It's shared amongst all of the different rendering types;
- * some might not be in use for a particular distortion effect.
- */
-struct VS_VR_INPUT {
-  float2 vPosition : POSITION;
-  float2 vTexCoord0 : TEXCOORD0;
-  float2 vTexCoord1 : TEXCOORD1;
-  float2 vTexCoord2 : TEXCOORD2;
-  float4 vGenericAttribs : COLOR0;
-};
-
-struct VS_VR_OUTPUT {
-  float4 vPosition : SV_Position;
-  float3 vTexCoord0 : TEXCOORD0;
-  float3 vTexCoord1 : TEXCOORD1;
-  float3 vTexCoord2 : TEXCOORD2;
-  float4 vGenericAttribs : COLOR;
-};
-
-SamplerState Linear
-{
-  Filter = MIN_MAG_MIP_LINEAR;
-  AddressU = Clamp;
-  AddressV = Clamp;
-};
-
-/*
- * Oculus050 basic distortion, with chroma aberration correction
- */
-VS_VR_OUTPUT Oculus050VRDistortionVS(const VS_VR_INPUT aVertex)
-{
-  VS_VR_OUTPUT res;
-
-  float2 tc0 = aVertex.vTexCoord0 * VREyeToSource.zw + VREyeToSource.xy;
-  float2 tc1 = aVertex.vTexCoord1 * VREyeToSource.zw + VREyeToSource.xy;
-  float2 tc2 = aVertex.vTexCoord2 * VREyeToSource.zw + VREyeToSource.xy;
-
-  //res.vPosition.xy = aVertex.vPosition.xy;
-  res.vPosition.xy = aVertex.vPosition.xy * VRDestinationScaleAndOffset.zw + VRDestinationScaleAndOffset.xy;
-  res.vPosition.zw = float2(0.5, 1.0);
-
-  res.vTexCoord0 = float3(tc0, 1);
-  res.vTexCoord1 = float3(tc1, 1);
-  res.vTexCoord2 = float3(tc2, 1);
-
-  res.vGenericAttribs = aVertex.vGenericAttribs;
-  
-  return res;
-}
-
-float4 Oculus050VRDistortionPS(const VS_VR_OUTPUT aVertex) : SV_Target
-{
-  float resR = Texture.Sample(Linear, aVertex.vTexCoord0.xy).r;
-  float resG = Texture.Sample(Linear, aVertex.vTexCoord1.xy).g;
-  float resB = Texture.Sample(Linear, aVertex.vTexCoord2.xy).b;
-
-  return float4(resR * aVertex.vGenericAttribs.r,
-                resG * aVertex.vGenericAttribs.r,
-                resB * aVertex.vGenericAttribs.r,
-                1.0);
-}
--- a/gfx/layers/d3d11/genshaders.sh
+++ b/gfx/layers/d3d11/genshaders.sh
@@ -42,16 +42,9 @@ makeShaderPS RGBAShaderMask
 makeShaderPS YCbCrShaderMask
 makeShaderPS ComponentAlphaShaderMask
 
 # Mix-blend shaders
 makeShaderVS LayerQuadBlendVS
 makeShaderVS LayerQuadBlendMaskVS
 makeShaderPS BlendShader
 
-SRC=CompositorD3D11VR.hlsl
-DEST=CompositorD3D11ShadersVR.h
-
-rm -f $DEST
-makeShaderVS Oculus050VRDistortionVS
-makeShaderPS Oculus050VRDistortionPS
-
 rm $tempfile
--- a/gfx/layers/ipc/CompositableForwarder.h
+++ b/gfx/layers/ipc/CompositableForwarder.h
@@ -136,24 +136,23 @@ public:
    * Only ImageBridge implements it.
    */
   virtual void RemoveTextureFromCompositableAsync(AsyncTransactionTracker* aAsyncTransactionTracker,
                                                   CompositableClient* aCompositable,
                                                   TextureClient* aTexture) {}
 
   struct TimedTextureClient {
     TimedTextureClient()
-        : mTextureClient(nullptr), mFrameID(0), mProducerID(0), mInputFrameID(0) {}
+        : mTextureClient(nullptr), mFrameID(0), mProducerID(0) {}
 
     TextureClient* mTextureClient;
     TimeStamp mTimeStamp;
     nsIntRect mPictureRect;
     int32_t mFrameID;
     int32_t mProducerID;
-    int32_t mInputFrameID;
   };
   /**
    * Tell the CompositableHost on the compositor side what textures to use for
    * the next composition.
    */
   virtual void UseTextures(CompositableClient* aCompositable,
                            const nsTArray<TimedTextureClient>& aTextures) = 0;
   virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -182,17 +182,16 @@ CompositableParentManager::ReceiveCompos
         CompositableHost::TimedTexture* t = textures.AppendElement();
         t->mTexture =
             TextureHost::AsTextureHost(timedTexture.textureParent());
         MOZ_ASSERT(t->mTexture);
         t->mTimeStamp = timedTexture.timeStamp();
         t->mPictureRect = timedTexture.picture();
         t->mFrameID = timedTexture.frameID();
         t->mProducerID = timedTexture.producerID();
-        t->mInputFrameID = timedTexture.inputFrameID();
         t->mTexture->DeserializeReadLock(timedTexture.sharedLock(), this);
         MOZ_ASSERT(ValidatePictureRect(t->mTexture->GetSize(), t->mPictureRect));
 
         MaybeFence maybeFence = timedTexture.fence();
         if (maybeFence.type() == MaybeFence::TFenceHandle) {
           FenceHandle fence = maybeFence.get_FenceHandle();
           if (fence.IsValid()) {
             t->mTexture->SetAcquireFenceHandle(fence);
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -189,17 +189,17 @@ ImageBridgeChild::UseTextures(Compositab
     ReadLockDescriptor readLock;
     t.mTextureClient->SerializeReadLock(readLock);
 
     FenceHandle fence = t.mTextureClient->GetAcquireFenceHandle();
     textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(),
                                         readLock,
                                         fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
                                         t.mTimeStamp, t.mPictureRect,
-                                        t.mFrameID, t.mProducerID, t.mInputFrameID));
+                                        t.mFrameID, t.mProducerID));
 
     // Wait end of usage on host side if TextureFlags::RECYCLE is set or GrallocTextureData case
     HoldUntilCompositableRefReleasedIfNecessary(t.mTextureClient);
   }
   mTxn->AddNoSwapEdit(CompositableOperation(nullptr, aCompositable->GetIPDLActor(),
                                             OpUseTexture(textures)));
 }
 
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -429,21 +429,16 @@ LayerTransactionParent::RecvUpdate(Infal
         }
         const ContainerLayerAttributes& attrs =
           specific.get_ContainerLayerAttributes();
         containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
         containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
         containerLayer->SetScaleToResolution(attrs.scaleToResolution(),
                                              attrs.presShellResolution());
         containerLayer->SetEventRegionsOverride(attrs.eventRegionsOverride());
-        containerLayer->SetInputFrameID(attrs.inputFrameID());
-
-        if (attrs.hmdDeviceID()) {
-          containerLayer->SetVRDeviceID(attrs.hmdDeviceID());
-        }
 
         break;
       }
       case Specific::TColorLayerAttributes: {
         MOZ_LAYERS_LOG(("[ParentSide]   color layer"));
 
         ColorLayerComposite* colorLayer = layerParent->AsColorLayerComposite();
         if (!colorLayer) {
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -249,18 +249,16 @@ struct PaintedLayerAttributes {
 struct ContainerLayerAttributes {
   float preXScale;
   float preYScale;
   float inheritedXScale;
   float inheritedYScale;
   float presShellResolution;
   bool scaleToResolution;
   EventRegionsOverride eventRegionsOverride;
-  uint32_t hmdDeviceID;
-  int32_t inputFrameID;
 };
 struct ColorLayerAttributes     { LayerColor color; IntRect bounds; };
 struct CanvasLayerAttributes    { SamplingFilter samplingFilter; IntRect bounds; };
 struct RefLayerAttributes {
   int64_t id;
   // TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override
   // explicitly here.
   EventRegionsOverride eventRegionsOverride;
@@ -396,17 +394,16 @@ union MaybeFence {
 struct TimedTexture {
   PTexture texture;
   ReadLockDescriptor sharedLock;
   MaybeFence fence;
   TimeStamp timeStamp;
   IntRect picture;
   uint32_t frameID;
   uint32_t producerID;
-  int32_t inputFrameID;
 };
 
 /**
  * Tells the compositor-side which textures to use (for example, as front buffer
  * if there are several textures for double buffering).
  * This provides a list of textures with timestamps, ordered by timestamp.
  * The newest texture whose timestamp is <= the current time is rendered
  * (where null is considered less than every other timestamp). If there is no
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -439,17 +439,17 @@ ShadowLayerForwarder::UseTextures(Compos
     MOZ_ASSERT(t.mTextureClient->GetIPDLActor());
     FenceHandle fence = t.mTextureClient->GetAcquireFenceHandle();
     ReadLockDescriptor readLock;
     t.mTextureClient->SerializeReadLock(readLock);
     textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(),
                                         readLock,
                                         fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
                                         t.mTimeStamp, t.mPictureRect,
-                                        t.mFrameID, t.mProducerID, t.mInputFrameID));
+                                        t.mFrameID, t.mProducerID));
     if ((t.mTextureClient->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD)
         && t.mTextureClient->HasIntermediateBuffer()) {
 
       // We use IMMEDIATE_UPLOAD when we want to be sure that the upload cannot
       // race with updates on the main thread. In this case we want the transaction
       // to be synchronous.
       mTxn->MarkSyncTransaction();
     }
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -366,17 +366,16 @@ UNIFIED_SOURCES += [
     'ipc/SharedRGBImage.cpp',
     'ipc/TextureForwarder.cpp',
     'LayerScope.cpp',
     'LayersLogging.cpp',
     'LayerSorter.cpp',
     'LayersTypes.cpp',
     'opengl/CompositingRenderTargetOGL.cpp',
     'opengl/CompositorOGL.cpp',
-    'opengl/CompositorOGLVR.cpp',
     'opengl/GLBlitTextureImageHelper.cpp',
     'opengl/OGLShaderProgram.cpp',
     'opengl/TextureClientOGL.cpp',
     'opengl/TextureHostOGL.cpp',
     'opengl/TexturePoolOGL.cpp',
     'protobuf/LayerScopePacket.pb.cc',
     'ReadbackProcessor.cpp',
     'RenderTrace.cpp',
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -199,18 +199,16 @@ CompositorOGL::CleanupResources()
 
   ctx->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
 
   if (mQuadVBO) {
     ctx->fDeleteBuffers(1, &mQuadVBO);
     mQuadVBO = 0;
   }
 
-  DestroyVR(ctx);
-
   mGLContext->MakeCurrent();
 
   mBlitTextureImageHelper = nullptr;
 
   mContextStateTracker.DestroyOGL(mGLContext);
 
   // On the main thread the Widget will be destroyed soon and calling MakeCurrent
   // after that could cause a crash (at least with GLX, see bug 1059793), unless
@@ -415,23 +413,16 @@ CompositorOGL::Initialize(nsCString* con
     msg += NS_LITERAL_STRING("\nFBO Texture Target: ");
     if (mFBOTextureTarget == LOCAL_GL_TEXTURE_2D)
       msg += NS_LITERAL_STRING("TEXTURE_2D");
     else
       msg += NS_LITERAL_STRING("TEXTURE_RECTANGLE");
     console->LogStringMessage(msg.get());
   }
 
-  mVR.mInitialized = false;
-  if (gfxPrefs::VREnabled()) {
-    if (!InitializeVR()) {
-      NS_WARNING("Failed to initialize VR in CompositorOGL");
-    }
-  }
-
   reporter.SetSuccessful();
 
   return true;
 }
 
 /*
  * Returns a size that is equal to, or larger than and closest to,
  * aSize where both width and height are powers of two.
@@ -1014,21 +1005,16 @@ CompositorOGL::DrawQuad(const Rect& aRec
                         const gfx::Rect& aVisibleRect)
 {
   PROFILER_LABEL("CompositorOGL", "DrawQuad",
     js::ProfileEntry::Category::GRAPHICS);
 
   MOZ_ASSERT(mFrameInProgress, "frame not started");
   MOZ_ASSERT(mCurrentRenderTarget, "No destination");
 
-  if (aEffectChain.mPrimaryEffect->mType == EffectTypes::VR_DISTORTION) {
-    DrawVRDistortion(aRect, aClipRect, aEffectChain, aOpacity, aTransform);
-    return;
-  }
-
   MakeCurrent();
 
   IntPoint offset = mCurrentRenderTarget->GetOrigin();
   IntSize size = mCurrentRenderTarget->GetSize();
 
   Rect renderBound(0, 0, size.width, size.height);
   renderBound.IntersectRect(renderBound, Rect(aClipRect));
   renderBound.MoveBy(offset);
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -26,17 +26,16 @@
 #include "mozilla/layers/LayersTypes.h"
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_ASSERTION, NS_WARNING
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsTArray.h"                   // for AutoTArray, nsTArray, etc
 #include "nsThreadUtils.h"              // for nsRunnable
 #include "nsXULAppAPI.h"                // for XRE_GetProcessType
 #include "nscore.h"                     // for NS_IMETHOD
-#include "gfxVR.h"
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
 #include "nsTHashtable.h"               // for nsTHashtable
 #endif
 
 class nsIWidget;
 
 namespace mozilla {
@@ -149,43 +148,16 @@ protected:
   void DestroyTextures();
 
   GLenum mTextureTarget;
   RefPtr<gl::GLContext> mGL;
   nsTArray<GLuint> mCreatedTextures;
   nsTArray<GLuint> mUnusedTextures;
 };
 
-struct CompositorOGLVRObjects {
-  bool mInitialized;
-
-  gfx::VRHMDConfiguration mConfiguration;
-
-  GLuint mDistortionVertices[2];
-  GLuint mDistortionIndices[2];
-  GLuint mDistortionIndexCount[2];
-
-  GLint mAPosition;
-  GLint mATexCoord0;
-  GLint mATexCoord1;
-  GLint mATexCoord2;
-  GLint mAGenericAttribs;
-
-  // The program here implements distortion rendering for VR devices
-  // (in this case Oculus only).  We'll need to extend this to support
-  // other device types in the future.
-
-  // 0 = TEXTURE_2D, 1 = TEXTURE_RECTANGLE for source
-  GLuint mDistortionProgram[2];
-  GLint mUTexture[2];
-  GLint mUVREyeToSource[2];
-  GLint mUVRDestionatinScaleAndOffset[2];
-  GLint mUHeight[2];
-};
-
 // If you want to make this class not final, first remove calls to virtual
 // methods (Destroy) that are made in the destructor.
 class CompositorOGL final : public Compositor
 {
   typedef mozilla::gl::GLContext GLContext;
 
   friend class GLManagerCompositor;
   friend class CompositingRenderTargetOGL;
@@ -332,25 +304,16 @@ public:
     return gfx::IntSize (mSurfaceSize.width, mSurfaceSize.height);
   }
 
   const ScreenPoint& GetScreenRenderOffset() const {
     return mRenderOffset;
   }
 
 private:
-  bool InitializeVR();
-  void DestroyVR(GLContext *gl);
-
-  void DrawVRDistortion(const gfx::Rect& aRect,
-                        const gfx::IntRect& aClipRect,
-                        const EffectChain& aEffectChain,
-                        gfx::Float aOpacity,
-                        const gfx::Matrix4x4& aTransform);
-
   void PrepareViewport(CompositingRenderTargetOGL *aRenderTarget);
 
   /** Widget associated with this compositor */
   LayoutDeviceIntSize mWidgetSize;
   RefPtr<GLContext> mGLContext;
   UniquePtr<GLBlitTextureImageHelper> mBlitTextureImageHelper;
   gfx::Matrix4x4 mProjMatrix;
 
@@ -478,18 +441,16 @@ private:
   /**
    * Size of the OpenGL context's primary framebuffer in pixels. Used by
    * FlipY for the y-flipping calculation and by the DEAA shader.
    */
   gfx::IntSize mViewportSize;
 
   ShaderProgramOGL *mCurrentProgram;
 
-  CompositorOGLVRObjects mVR;
-
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
   nsTHashtable<nsPtrHashKey<ImageHostOverlay> > mImageHostOverlays;
 #endif
 
 };
 
 } // namespace layers
 } // namespace mozilla
deleted file mode 100644
--- a/gfx/layers/opengl/CompositorOGLVR.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; 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 "CompositorOGL.h"
-#include <sstream>                      // for ostringstream
-#include <stddef.h>                     // for size_t
-#include <stdint.h>                     // for uint32_t, uint8_t
-#include <stdlib.h>                     // for free, malloc
-#include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
-#include "mozilla/layers/Effects.h"     // for EffectChain, TexturedEffect, etc
-#include "mozilla/layers/CompositingRenderTargetOGL.h"
-#include "mozilla/layers/TextureHost.h"  // for TextureSource, etc
-#include "mozilla/layers/TextureHostOGL.h"  // for TextureSourceOGL, etc
-#include "GLContextProvider.h"          // for GLContextProvider
-#include "GLContext.h"                  // for GLContext
-#include "GLUploadHelpers.h"
-#include "Layers.h"                     // for WriteSnapshotToDumpFile
-#include "LayerScope.h"                 // for LayerScope
-#include "gfxCrashReporterUtils.h"      // for ScopedGfxFeatureReporter
-#include "gfxMatrix.h"                  // for gfxMatrix
-#include "gfxPlatform.h"                // for gfxPlatform
-#include "gfxPrefs.h"                   // for gfxPrefs
-#include "gfxRect.h"                    // for gfxRect
-#include "gfxUtils.h"                   // for NextPowerOfTwo, gfxUtils, etc
-#include "gfxVR.h"
-
-namespace mozilla {
-
-using namespace std;
-using namespace gfx;
-
-namespace layers {
-
-using namespace mozilla::gl;
-
-bool
-CompositorOGL::InitializeVR()
-{
-  gl()->fGenBuffers(2, mVR.mDistortionVertices);
-  gl()->fGenBuffers(2, mVR.mDistortionIndices);
-
-  // these are explicitly bound later
-  mVR.mAPosition = 0;
-  mVR.mATexCoord0 = 1;
-  mVR.mATexCoord1 = 2;
-  mVR.mATexCoord2 = 3;
-  mVR.mAGenericAttribs = 4;
-
-  ostringstream vs;
-
-  vs << "uniform vec4 uVREyeToSource;\n";
-  vs << "uniform vec4 uVRDestinationScaleAndOffset;\n";
-  vs << "uniform float uHeight;\n";
-  vs << "attribute vec2 aPosition;\n";
-  vs << "attribute vec2 aTexCoord0;\n";
-  vs << "attribute vec2 aTexCoord1;\n";
-  vs << "attribute vec2 aTexCoord2;\n";
-  vs << "attribute vec4 aGenericAttribs;\n";
-  vs << "varying vec2 vTexCoord0;\n";
-  vs << "varying vec2 vTexCoord1;\n";
-  vs << "varying vec2 vTexCoord2;\n";
-  vs << "varying vec4 vGenericAttribs;\n";
-  vs << "void main() {\n";
-  vs << "  gl_Position = vec4(aPosition.xy * uVRDestinationScaleAndOffset.zw + uVRDestinationScaleAndOffset.xy, 0.5, 1.0);\n";
-  vs << "  vTexCoord0 = uVREyeToSource.zw * aTexCoord0 + uVREyeToSource.xy;\n";
-  vs << "  vTexCoord1 = uVREyeToSource.zw * aTexCoord1 + uVREyeToSource.xy;\n";
-  vs << "  vTexCoord2 = uVREyeToSource.zw * aTexCoord2 + uVREyeToSource.xy;\n";
-  vs << "  vTexCoord0.y = uHeight - vTexCoord0.y;\n";
-  vs << "  vTexCoord1.y = uHeight - vTexCoord1.y;\n";
-  vs << "  vTexCoord2.y = uHeight - vTexCoord2.y;\n";
-  vs << "  vGenericAttribs = aGenericAttribs;\n";
-  vs << "}\n";
-
-  std::string vsSrcString(vs.str());
-  const char *vsSrc = vsSrcString.c_str();
-
-  for (int programIndex = 0; programIndex < 2; programIndex++) {
-    GLenum textureTarget = programIndex == 0 ? LOCAL_GL_TEXTURE_2D : LOCAL_GL_TEXTURE_RECTANGLE;
-
-    const char *sampler2D = "sampler2D";
-    const char *texture2D = "texture2D";
-
-    ostringstream fs;
-
-    if (textureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB) {
-      fs << "#extension GL_ARB_texture_rectangle : require\n";
-      sampler2D = "sampler2DRect";
-      texture2D = "texture2DRect";
-    }
-
-    if (gl()->IsGLES()) {
-      fs << "precision highp float;\n";
-    }
-
-    fs << "uniform " << sampler2D << " uTexture;\n";
-    fs << "varying vec2 vTexCoord0;\n";
-    fs << "varying vec2 vTexCoord1;\n";
-    fs << "varying vec2 vTexCoord2;\n";
-    fs << "varying vec4 vGenericAttribs;\n";
-    fs << "void main() {\n";
-    fs << "  float resR = " << texture2D << "(uTexture, vTexCoord0.xy).r;\n";
-    fs << "  float resG = " << texture2D << "(uTexture, vTexCoord1.xy).g;\n";
-    fs << "  float resB = " << texture2D << "(uTexture, vTexCoord2.xy).b;\n";
-    fs << "  gl_FragColor = vec4(resR * vGenericAttribs.r, resG * vGenericAttribs.r, resB * vGenericAttribs.r, 1.0);\n";
-    fs << "}\n";
-
-    std::string fsSrcString(fs.str());
-    const char *fsSrc = fsSrcString.c_str();
-
-    GLint status;
-#ifdef DEBUG
-    GLint length;
-    nsCString logStr;
-#endif
-
-    GLuint shaders[2];
-    shaders[0] = gl()->fCreateShader(LOCAL_GL_VERTEX_SHADER);
-    shaders[1] = gl()->fCreateShader(LOCAL_GL_FRAGMENT_SHADER);
-
-    GLint shaderLen[2] = { (GLint) strlen(vsSrc), (GLint) strlen(fsSrc) };
-    gl()->fShaderSource(shaders[0], 1, &vsSrc, &shaderLen[0]);
-    gl()->fShaderSource(shaders[1], 1, &fsSrc, &shaderLen[1]);
-
-    for (int k = 0; k < 2; ++k) {
-      gl()->fCompileShader(shaders[k]);
-      gl()->fGetShaderiv(shaders[k], LOCAL_GL_COMPILE_STATUS, &status);
-      if (!status) {
-        NS_WARNING("VR GL shader failed to compile!");
-
-#ifdef DEBUG
-        gl()->fGetShaderiv(shaders[k], LOCAL_GL_INFO_LOG_LENGTH, &length);
-        logStr.SetLength(length);
-        gl()->fGetShaderInfoLog(shaders[k], length, &length, logStr.BeginWriting());
-        printf_stderr("GL %s shader failed to compile:\n%s\n", k == 0 ? "vertex" : "fragment", logStr.BeginReading());
-#endif
-
-        gl()->fDeleteShader(shaders[0]);
-        gl()->fDeleteShader(shaders[1]);
-
-        return false;
-      }
-    }
-
-    GLuint prog = gl()->fCreateProgram();
-    gl()->fAttachShader(prog, shaders[0]);
-    gl()->fAttachShader(prog, shaders[1]);
-
-    gl()->fBindAttribLocation(prog, mVR.mAPosition, "aPosition");
-    gl()->fBindAttribLocation(prog, mVR.mATexCoord0, "aTexCoord0");
-    gl()->fBindAttribLocation(prog, mVR.mATexCoord1, "aTexCoord1");
-    gl()->fBindAttribLocation(prog, mVR.mATexCoord2, "aTexCoord2");
-    gl()->fBindAttribLocation(prog, mVR.mAGenericAttribs, "aGenericAttribs");
-
-    gl()->fLinkProgram(prog);
-
-    gl()->fGetProgramiv(prog, LOCAL_GL_LINK_STATUS, &status);
-    if (!status) {
-      NS_WARNING("VR GL program failed to link!");
-
-#ifdef DEBUG
-      gl()->fGetProgramiv(prog, LOCAL_GL_INFO_LOG_LENGTH, &length);
-      logStr.SetLength(length);
-      gl()->fGetProgramInfoLog(prog, length, &length, logStr.BeginWriting());
-      printf_stderr("GL shader failed to link:\n%s\n", logStr.BeginReading());
-#endif
-
-      gl()->fDeleteProgram(prog);
-      gl()->fDeleteShader(shaders[0]);
-      gl()->fDeleteShader(shaders[1]);
-
-      return false;
-    }
-
-    mVR.mUTexture[programIndex] = gl()->fGetUniformLocation(prog, "uTexture");
-    mVR.mUVREyeToSource[programIndex] = gl()->fGetUniformLocation(prog, "uVREyeToSource");
-    mVR.mUVRDestionatinScaleAndOffset[programIndex] = gl()->fGetUniformLocation(prog, "uVRDestinationScaleAndOffset");
-    mVR.mUHeight[programIndex] = gl()->fGetUniformLocation(prog, "uHeight");
-
-    mVR.mDistortionProgram[programIndex] = prog;
-
-    gl()->fDeleteShader(shaders[0]);
-    gl()->fDeleteShader(shaders[1]);
-  }
-
-  mVR.mInitialized = true;
-  return true;
-}
-
-void
-CompositorOGL::DestroyVR(GLContext *gl)
-{
-  if (!mVR.mInitialized)
-    return;
-
-  gl->fDeleteBuffers(2, mVR.mDistortionVertices);
-  gl->fDeleteBuffers(2, mVR.mDistortionIndices);
-  gl->fDeleteProgram(mVR.mDistortionProgram[0]);
-  gl->fDeleteProgram(mVR.mDistortionProgram[1]);
-
-  mVR.mInitialized = false;
-}
-
-void
-CompositorOGL::DrawVRDistortion(const gfx::Rect& aRect,
-                                const gfx::IntRect& aClipRect,
-                                const EffectChain& aEffectChain,
-                                gfx::Float aOpacity,
-                                const gfx::Matrix4x4& aTransform)
-{
-  MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EffectTypes::VR_DISTORTION);
-  MOZ_ASSERT(mVR.mInitialized);
-
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK] ||
-      aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE])
-  {
-    NS_WARNING("DrawVRDistortion: ignoring secondary effect!");
-  }
-
-  EffectVRDistortion* vrEffect =
-    static_cast<EffectVRDistortion*>(aEffectChain.mPrimaryEffect.get());
-
-  GLenum textureTarget = LOCAL_GL_TEXTURE_2D;
-  if (vrEffect->mRenderTarget)
-    textureTarget = mFBOTextureTarget;
-
-  RefPtr<CompositingRenderTargetOGL> surface =
-    static_cast<CompositingRenderTargetOGL*>(vrEffect->mRenderTarget.get());
-
-  VRHMDInfo* hmdInfo = vrEffect->mHMD;
-  VRDistortionConstants shaderConstants;
-
-  if (hmdInfo->GetConfiguration() != mVR.mConfiguration) {
-    for (uint32_t eye = 0; eye < 2; eye++) {
-      const gfx::VRDistortionMesh& mesh = hmdInfo->GetDistortionMesh(eye);
-      gl()->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mVR.mDistortionVertices[eye]);
-      gl()->fBufferData(LOCAL_GL_ARRAY_BUFFER,
-                       mesh.mVertices.Length() * sizeof(gfx::VRDistortionVertex),
-                       mesh.mVertices.Elements(),
-                       LOCAL_GL_STATIC_DRAW);
-
-      gl()->fBindBuffer(LOCAL_GL_ELEMENT_ARRAY_BUFFER, mVR.mDistortionIndices[eye]);
-      gl()->fBufferData(LOCAL_GL_ELEMENT_ARRAY_BUFFER,
-                       mesh.mIndices.Length() * sizeof(uint16_t),
-                       mesh.mIndices.Elements(),
-                       LOCAL_GL_STATIC_DRAW);
-
-      mVR.mDistortionIndexCount[eye] = mesh.mIndices.Length();
-    }
-
-    mVR.mConfiguration = hmdInfo->GetConfiguration();
-  }
-
-  int programIndex = textureTarget == LOCAL_GL_TEXTURE_2D ? 0 : 1;
-
-  gl()->fScissor(aClipRect.x, FlipY(aClipRect.y + aClipRect.height),
-                 aClipRect.width, aClipRect.height);
-
-  // Clear out the entire area that we want to render; this ensures that
-  // the layer will be opaque, even though the mesh geometry we'll be
-  // drawing below won't cover the full rectangle.
-  gl()->fClearColor(0.0, 0.0, 0.0, 1.0);
-  gl()->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
-
-  // Make sure that the cached current program is reset for the
-  // rest of the compositor, since we're using a custom program here
-  ResetProgram();
-
-  gl()->fUseProgram(mVR.mDistortionProgram[programIndex]);
-
-  gl()->fEnableVertexAttribArray(mVR.mAPosition);
-  gl()->fEnableVertexAttribArray(mVR.mATexCoord0);
-  gl()->fEnableVertexAttribArray(mVR.mATexCoord1);
-  gl()->fEnableVertexAttribArray(mVR.mATexCoord2);
-  gl()->fEnableVertexAttribArray(mVR.mAGenericAttribs);
-
-  surface->BindTexture(LOCAL_GL_TEXTURE0, mFBOTextureTarget);
-  gl()->fUniform1i(mVR.mUTexture[programIndex], 0);
-
-  Rect destRect = aTransform.TransformBounds(aRect);
-  gfx::IntSize preDistortionSize = surface->GetInitSize(); // XXX source->GetSize()
-  gfx::Size vpSize = destRect.Size();
-
-  for (uint32_t eye = 0; eye < 2; eye++) {
-    gfx::IntRect eyeViewport;
-    eyeViewport.x = eye * preDistortionSize.width / 2;
-    eyeViewport.y = 0;
-    eyeViewport.width = preDistortionSize.width / 2;
-    eyeViewport.height = preDistortionSize.height;
-
-    hmdInfo->FillDistortionConstants(eye,
-                                     preDistortionSize, eyeViewport,
-                                     vpSize, destRect,
-                                     shaderConstants);
-
-    float height = 1.0f;
-    float texScaleAndOffset[4] = { shaderConstants.eyeToSourceScaleAndOffset[0],
-                                   shaderConstants.eyeToSourceScaleAndOffset[1],
-                                   shaderConstants.eyeToSourceScaleAndOffset[2],
-                                   shaderConstants.eyeToSourceScaleAndOffset[3] };
-    if (textureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB) {
-      texScaleAndOffset[0] *= preDistortionSize.width;
-      texScaleAndOffset[1] *= preDistortionSize.height;
-      texScaleAndOffset[2] *= preDistortionSize.width;
-      texScaleAndOffset[3] *= preDistortionSize.height;
-      height = preDistortionSize.height;
-    }
-
-    gl()->fUniform4fv(mVR.mUVRDestionatinScaleAndOffset[programIndex], 1, shaderConstants.destinationScaleAndOffset);
-    gl()->fUniform4fv(mVR.mUVREyeToSource[programIndex], 1, texScaleAndOffset);
-    gl()->fUniform1f(mVR.mUHeight[programIndex], height);
-
-    gl()->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mVR.mDistortionVertices[eye]);
-
-    /* This is for Oculus DistortionVertex */
-
-    gl()->fVertexAttribPointer(mVR.mAPosition,  2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, sizeof(gfx::VRDistortionVertex), (void*) (sizeof(float) * 0));
-    gl()->fVertexAttribPointer(mVR.mATexCoord0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, sizeof(gfx::VRDistortionVertex), (void*) (sizeof(float) * 2));
-    gl()->fVertexAttribPointer(mVR.mATexCoord1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, sizeof(gfx::VRDistortionVertex), (void*) (sizeof(float) * 4));
-    gl()->fVertexAttribPointer(mVR.mATexCoord2, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, sizeof(gfx::VRDistortionVertex), (void*) (sizeof(float) * 6));
-    gl()->fVertexAttribPointer(mVR.mAGenericAttribs, 4, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, sizeof(gfx::VRDistortionVertex),  (void*) (sizeof(float) * 8));
-
-    gl()->fBindBuffer(LOCAL_GL_ELEMENT_ARRAY_BUFFER, mVR.mDistortionIndices[eye]);
-    gl()->fDrawElements(LOCAL_GL_TRIANGLES, mVR.mDistortionIndexCount[eye], LOCAL_GL_UNSIGNED_SHORT, 0);
-  }
-
-  // Not clear if I should disable all of this; but going to do it and hope that
-  // any later code will enable what it needs.
-  gl()->fDisableVertexAttribArray(mVR.mAPosition);
-  gl()->fDisableVertexAttribArray(mVR.mATexCoord0);
-  gl()->fDisableVertexAttribArray(mVR.mATexCoord1);
-  gl()->fDisableVertexAttribArray(mVR.mATexCoord2);
-  gl()->fDisableVertexAttribArray(mVR.mAGenericAttribs);
-}
-
-} // namespace layers
-} // namespace mozilla
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -380,18 +380,16 @@ private:
 
   // These times should be in milliseconds
   DECL_GFX_PREF(Once, "gfx.touch.resample.delay-threshold",    TouchResampleVsyncDelayThreshold, int32_t, 20);
   DECL_GFX_PREF(Once, "gfx.touch.resample.max-predict",        TouchResampleMaxPredict, int32_t, 8);
   DECL_GFX_PREF(Once, "gfx.touch.resample.min-delta",          TouchResampleMinDelta, int32_t, 2);
   DECL_GFX_PREF(Once, "gfx.touch.resample.old-touch-threshold",TouchResampleOldTouchThreshold, int32_t, 17);
   DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust",       TouchVsyncSampleAdjust, int32_t, 5);
 
-  DECL_GFX_PREF(Once, "gfx.vr.mirror-textures",                VRMirrorTextures, bool, false);
-
   DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms",   CollectScrollTransforms, bool, false);
   // On b2g, in really bad cases, I've seen up to 80 ms delays between touch events and the main thread
   // processing them. So 80 ms / 16 = 5 vsync events. Double it up just to be on the safe side, so 10.
   DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count",  CompositorUnobserveCount, int32_t, 10);
   // Use vsync events generated by hardware
   DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs",           WorkAroundDriverBugs, bool, true);
   DECL_GFX_PREF(Once, "gfx.screen-mirroring.enabled",          ScreenMirroringEnabled, bool, false);
 
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -25,17 +25,16 @@
 #include "nsRenderingContext.h"
 #include "nsISelectionController.h"
 #include "nsIPresShell.h"
 #include "nsRegion.h"
 #include "nsStyleStructInlines.h"
 #include "nsStyleTransformMatrix.h"
 #include "gfxMatrix.h"
 #include "gfxPrefs.h"
-#include "gfxVR.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsIScrollableFrame.h"
 #include "nsIFrameInlines.h"
 #include "nsThemeConstants.h"
 #include "LayerTreeInvalidation.h"
 
@@ -6604,41 +6603,16 @@ nsDisplaySVGEffects::nsDisplaySVGEffects
 
 #ifdef NS_BUILD_REFCNT_LOGGING
 nsDisplaySVGEffects::~nsDisplaySVGEffects()
 {
   MOZ_COUNT_DTOR(nsDisplaySVGEffects);
 }
 #endif
 
-nsDisplayVR::nsDisplayVR(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
-                         nsDisplayList* aList, mozilla::gfx::VRDeviceProxy* aHMD)
-  : nsDisplayOwnLayer(aBuilder, aFrame, aList)
-  , mHMD(aHMD)
-{
-}
-
-already_AddRefed<Layer>
-nsDisplayVR::BuildLayer(nsDisplayListBuilder* aBuilder,
-                        LayerManager* aManager,
-                        const ContainerLayerParameters& aContainerParameters)
-{
-  ContainerLayerParameters newContainerParameters = aContainerParameters;
-  uint32_t flags = FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR;
-  RefPtr<ContainerLayer> container = aManager->GetLayerBuilder()->
-    BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList,
-                           newContainerParameters, nullptr, flags);
-
-  container->SetVRDeviceID(mHMD->GetDeviceInfo().GetDeviceID());
-  container->SetInputFrameID(mHMD->GetSensorState().inputFrameID);
-  container->SetUserData(nsIFrame::LayerIsPrerenderedDataKey(),
-                         /*the value is irrelevant*/nullptr);
-
-  return container.forget();
-}
 nsRegion nsDisplaySVGEffects::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                               bool* aSnap)
 {
   *aSnap = false;
   return nsRegion();
 }
 
 void
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -51,19 +51,16 @@ class nsCaret;
 namespace mozilla {
 class FrameLayerBuilder;
 class DisplayItemScrollClip;
 namespace layers {
 class Layer;
 class ImageLayer;
 class ImageContainer;
 } // namespace layers
-namespace gfx {
-class VRDeviceProxy;
-} // namespace gfx
 } // namespace mozilla
 
 // A set of blend modes, that never includes OP_OVER (since it's
 // considered the default, rather than a specific blend mode).
 typedef mozilla::EnumSet<mozilla::gfx::CompositionOp> BlendModeSet;
 
 /*
  * An nsIFrame can have many different visual parts. For example an image frame
@@ -4371,34 +4368,9 @@ public:
   // (i.e. left and right respectively in horizontal writing modes,
   // regardless of bidi directionality; top and bottom in vertical modes).
   nscoord mVisIStartEdge;
   nscoord mVisIEndEdge;
   // Cached result of mFrame->IsSelected().  Only initialized when needed.
   mutable mozilla::Maybe<bool> mIsFrameSelected;
 };
 
-/**
- * A wrapper layer that wraps its children in a container, then renders
- * everything with an appropriate VR effect based on the HMDInfo.
- */
-
-class nsDisplayVR : public nsDisplayOwnLayer {
-public:
-  nsDisplayVR(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
-              nsDisplayList* aList, mozilla::gfx::VRDeviceProxy* aHMD);
-
-  virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
-                                   LayerManager* aManager,
-                                   const ContainerLayerParameters& aParameters) override
-  {
-    return mozilla::LAYER_ACTIVE;
-  }
-
-  virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
-                                             LayerManager* aManager,
-                                             const ContainerLayerParameters& aContainerParameters) override;
-
-protected:
-  RefPtr<mozilla::gfx::VRDeviceProxy> mHMD;
-};
-
 #endif /*NSDISPLAYLIST_H_*/
--- a/layout/generic/nsBackdropFrame.cpp
+++ b/layout/generic/nsBackdropFrame.cpp
@@ -45,26 +45,16 @@ nsBackdropFrame::BuildDisplayList(nsDisp
   // none or contents so that we can respond to style change on it. To
   // support those values, we skip painting ourselves in those cases.
   auto display = StyleDisplay()->mDisplay;
   if (display == NS_STYLE_DISPLAY_NONE ||
       display == NS_STYLE_DISPLAY_CONTENTS) {
     return;
   }
 
-  // The WebVR specific render path in nsContainerLayerComposite
-  // results in an alternating frame strobing effect when an nsBackdropFrame is
-  // rendered.
-  // Currently, VR content is composed of a fullscreen canvas element that
-  // is expected to cover the entire viewport so a backdrop should not
-  // be necessary.
-  if (GetStateBits() & NS_FRAME_HAS_VR_CONTENT) {
-    return;
-  }
-
   DisplayBorderBackgroundOutline(aBuilder, aLists);
 }
 
 /* virtual */ LogicalSize
 nsBackdropFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  WritingMode aWM,
                                  const LogicalSize& aCBSize,
                                  nscoord aAvailableISize,
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -109,22 +109,16 @@
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
 typedef nsAbsoluteContainingBlock::AbsPosReflowFlags AbsPosReflowFlags;
 
-namespace mozilla {
-namespace gfx {
-class VRDeviceProxy;
-} // namespace gfx
-} // namespace mozilla
-
 // Struct containing cached metrics for box-wrapped frames.
 struct nsBoxLayoutMetrics
 {
   nsSize mPrefSize;
   nsSize mMinSize;
   nsSize mMaxSize;
 
   nsSize mBlockMinSize;
@@ -598,20 +592,16 @@ nsFrame::Init(nsIContent*       aContent
         AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
       }
     }
     NS_ASSERTION(GetParent() ||
                  (GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER),
                  "root frame should always be a container");
   }
 
-  if (aContent && aContent->GetProperty(nsGkAtoms::vr_state) != nullptr) {
-    AddStateBits(NS_FRAME_HAS_VR_CONTENT);
-  }
-
   if (PresContext()->PresShell()->AssumeAllFramesVisible() &&
       TrackingVisibility()) {
     IncVisibilityCount(VisibilityCounter::IN_DISPLAYPORT);
   }
 
   DidSetStyleContext(nullptr);
 
   if (::IsXULBoxWrapped(this))
@@ -2273,21 +2263,16 @@ nsIFrame::BuildDisplayListForStackingCon
                         nsLayoutUtils::GetNearestScrollableFrame(GetParent(),
                         nsLayoutUtils::SCROLLABLE_SAME_DOC |
                         nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN));
   bool useFixedPosition = nsLayoutUtils::IsFixedPosFrameInDisplayPort(this);
 
   nsDisplayListBuilder::AutoBuildingDisplayList
     buildingDisplayList(aBuilder, this, dirtyRect, true);
 
-  mozilla::gfx::VRDeviceProxy* vrHMDInfo = nullptr;
-  if ((GetStateBits() & NS_FRAME_HAS_VR_CONTENT)) {
-    vrHMDInfo = static_cast<mozilla::gfx::VRDeviceProxy*>(mContent->GetProperty(nsGkAtoms::vr_state));
-  }
-
   DisplayListClipState::AutoSaveRestore clipState(aBuilder);
 
   bool clearClip = false;
   if (isTransformed || usingSVGEffects || useFixedPosition || useStickyPosition) {
     // We don't need to pass ancestor clipping down to our children;
     // everything goes inside a display item's child list, and the display
     // item itself will be clipped.
     // For transforms we also need to clear ancestor clipping because it's
@@ -2566,23 +2551,16 @@ nsIFrame::BuildDisplayListForStackingCon
   if (useFixedPosition) {
     resultList.AppendNewToTop(
         new (aBuilder) nsDisplayFixedPosition(aBuilder, this, &resultList));
   } else if (useStickyPosition) {
     resultList.AppendNewToTop(
         new (aBuilder) nsDisplayStickyPosition(aBuilder, this, &resultList));
   }
 
-  /* If we're doing VR rendering, then we need to wrap everything in a nsDisplayVR
-   */
-  if (vrHMDInfo && !resultList.IsEmpty()) {
-    resultList.AppendNewToTop(
-      new (aBuilder) nsDisplayVR(aBuilder, this, &resultList, vrHMDInfo));
-  }
-
   /* If there's blending, wrap up the list in a blend-mode item. Note
    * that opacity can be applied before blending as the blend color is
    * not affected by foreground opacity (only background alpha).
    */
 
   if (useBlendMode && !resultList.IsEmpty()) {
     DisplayListClipState::AutoSaveRestore mixBlendClipState(aBuilder);
     mixBlendClipState.Clear();
@@ -2766,18 +2744,17 @@ nsIFrame::BuildDisplayListForChild(nsDis
   const nsStyleEffects* effects = child->StyleEffects();
   const nsStylePosition* pos = child->StylePosition();
   bool isVisuallyAtomic = child->HasOpacity()
     || child->IsTransformed()
     // strictly speaking, 'perspective' doesn't require visual atomicity,
     // but the spec says it acts like the rest of these
     || disp->mChildPerspective.GetUnit() == eStyleUnit_Coord
     || effects->mMixBlendMode != NS_STYLE_BLEND_NORMAL
-    || nsSVGIntegrationUtils::UsingEffectsForFrame(child)
-    || (child->GetStateBits() & NS_FRAME_HAS_VR_CONTENT);
+    || nsSVGIntegrationUtils::UsingEffectsForFrame(child);
 
   bool isPositioned = disp->IsAbsPosContainingBlock(child);
   bool isStackingContext =
     (isPositioned && (disp->IsPositionForcingStackingContext() ||
                       pos->mZIndex.GetUnit() == eStyleUnit_Integer)) ||
      (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_STACKING_CONTEXT) ||
      disp->mIsolation != NS_STYLE_ISOLATION_AUTO ||
      isVisuallyAtomic || (aFlags & DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -261,19 +261,16 @@ FRAME_STATE_BIT(Generic, 52, NS_FRAME_HA
 
 // Frame is not displayed directly due to it being, or being under, an SVG
 // <defs> element or an SVG resource element (<mask>, <pattern>, etc.)
 FRAME_STATE_BIT(Generic, 53, NS_FRAME_IS_NONDISPLAY)
 
 // Frame has a LayerActivityProperty property
 FRAME_STATE_BIT(Generic, 54, NS_FRAME_HAS_LAYER_ACTIVITY_PROPERTY)
 
-// Frame has VR content, and needs VR display items created
-FRAME_STATE_BIT(Generic, 57, NS_FRAME_HAS_VR_CONTENT)
-
 // Set for all descendants of MathML sub/supscript elements (other than the
 // base frame) to indicate that the SSTY font feature should be used.
 FRAME_STATE_BIT(Generic, 58, NS_FRAME_MATHML_SCRIPT_DESCENDANT)
 
 // This state bit is set on frames within token MathML elements if the
 // token represents an <mi> tag whose inner HTML consists of a single
 // non-whitespace character to allow special rendering behaviour.
 FRAME_STATE_BIT(Generic, 59, NS_FRAME_IS_IN_SINGLE_CHAR_MI)
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4924,19 +4924,16 @@ pref("dom.vr.cardboard.enabled", false);
 pref("dom.vr.osvr.enabled", false);
 // 0 = never; 1 = only if real devices aren't there; 2 = always
 pref("dom.vr.add-test-devices", 0);
 // Pose prediction reduces latency effects by returning future predicted HMD
 // poses to callers of the WebVR API.  This currently only has an effect for
 // Oculus Rift on SDK 0.8 or greater.  It is disabled by default for now due to
 // frame uniformity issues with e10s.
 pref("dom.vr.poseprediction.enabled", false);
-// true = show the VR textures in our compositing output; false = don't.
-// true might have performance impact
-pref("gfx.vr.mirror-textures", false);
 // path to OSVR DLLs
 pref("gfx.vr.osvr.utilLibPath", "");
 pref("gfx.vr.osvr.commonLibPath", "");
 pref("gfx.vr.osvr.clientLibPath", "");
 pref("gfx.vr.osvr.clientKitLibPath", "");
 
 // MMS UA Profile settings
 pref("wap.UAProf.url", "");