Bug 1250244 - Part 4: Remove Cardboard VR Support,r=gw280 draft
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Fri, 27 May 2016 13:49:13 -0700
changeset 400215 f981b20c79785fb902e8786700bb7eca2239f0c6
parent 400214 b3a9b4a6b1681bb79ef5f20dec4ff248c2c9479c
child 400216 b24cd092b1c5a76bae1802e620abeabcdabf94ff
push id26092
push userkgilbert@mozilla.com
push dateFri, 12 Aug 2016 18:50:19 +0000
reviewersgw280
bugs1250244
milestone51.0a1
Bug 1250244 - Part 4: Remove Cardboard VR Support,r=gw280 - The Cardboard VR support has hardcoded values and uses low-performance orientation APIs and rendering paths. - There is little benefit to this Cardboard VR implementation over using polyfills. - A future implementation would be based on Google VR support in Android N and/or Samsung Gear VR Oculus Mobile APIs. MozReview-Commit-ID: 7e9Th8ZTmj8
b2g/app/b2g.js
gfx/thebes/gfxPrefs.h
gfx/vr/VRDeviceProxyOrientationFallBack.cpp
gfx/vr/VRDeviceProxyOrientationFallBack.h
gfx/vr/VRManager.cpp
gfx/vr/gfxVR.cpp
gfx/vr/gfxVR.h
gfx/vr/gfxVRCardboard.cpp
gfx/vr/gfxVRCardboard.h
gfx/vr/gfxVROSVR.cpp
gfx/vr/gfxVROculus.cpp
gfx/vr/ipc/VRManagerChild.cpp
gfx/vr/ipc/VRMessageUtils.h
gfx/vr/moz.build
mobile/android/app/mobile.js
modules/libpref/init/all.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -1065,19 +1065,16 @@ pref("dom.push.enabled", false);
 pref("dom.webnotifications.serviceworker.enabled", false);
 #else
 pref("dom.webnotifications.serviceworker.enabled", true);
 #endif
 
 // Retain at most 10 processes' layers buffers
 pref("layers.compositor-lru-size", 10);
 
-// Enable Cardboard VR on mobile, assuming VR at all is enabled
-pref("dom.vr.cardboard.enabled", true);
-
 // In B2G by deafult any AudioChannelAgent is muted when created.
 pref("dom.audiochannel.mutedByDefault", true);
 
 // The app origin of bluetooth app, which is responsible for listening pairing
 // requests.
 pref("dom.bluetooth.app-origin", "app://bluetooth.gaiamobile.org");
 
 // Enable W3C WebBluetooth API and disable B2G only GATT client API.
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -304,17 +304,16 @@ private:
 
   DECL_GFX_PREF(Live, "browser.ui.zoom.force-user-scalable",   ForceUserScalable, bool, false);
   DECL_GFX_PREF(Live, "browser.viewport.desktopWidth",         DesktopViewportWidth, int32_t, 980);
 
   DECL_GFX_PREF(Live, "dom.ipc.plugins.asyncdrawing.enabled",  PluginAsyncDrawingEnabled, bool, false);
   DECL_GFX_PREF(Live, "dom.meta-viewport.enabled",             MetaViewportEnabled, bool, false);
   DECL_GFX_PREF(Once, "dom.vr.enabled",                        VREnabled, bool, false);
   DECL_GFX_PREF(Once, "dom.vr.oculus.enabled",                 VROculusEnabled, bool, true);
-  DECL_GFX_PREF(Once, "dom.vr.cardboard.enabled",              VRCardboardEnabled, bool, false);
   DECL_GFX_PREF(Once, "dom.vr.osvr.enabled",                   VROSVREnabled, bool, false);
   DECL_GFX_PREF(Live, "dom.vr.poseprediction.enabled",         VRPosePredictionEnabled, bool, false);
   DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled",        PointerEventsEnabled, bool, false);
   DECL_GFX_PREF(Live, "dom.w3c_touch_events.enabled",          TouchEventsEnabled, int32_t, 0);
 
   DECL_GFX_PREF(Live, "general.smoothScroll",                  SmoothScrollEnabled, bool, true);
   DECL_GFX_PREF(Live, "general.smoothScroll.currentVelocityWeighting",
                 SmoothScrollCurrentVelocityWeighting, float, 0.25);
deleted file mode 100644
--- a/gfx/vr/VRDeviceProxyOrientationFallBack.cpp
+++ /dev/null
@@ -1,206 +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 <math.h>
-#include "VRDeviceProxyOrientationFallBack.h"
-#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientationInternal
-#include "mozilla/Hal.h"
-
-using namespace mozilla;
-using namespace mozilla::gfx;
-
-// 1/sqrt(2) (aka sqrt(2)/2)
-#ifndef M_SQRT1_2
-# define M_SQRT1_2	0.70710678118654752440
-#endif
-
-#ifdef ANDROID
-#include <android/log.h>
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoVR" , ## args)
-#else
-#define LOG(...) do { } while(0)
-#endif
-
-namespace {
-// some utility functions
-
-// This remaps axes in the given matrix to a new configuration based on the
-// screen orientation.  Similar to what Android SensorManager.remapCoordinateSystem
-// does, except only for a fixed number of transforms that we need.
-Matrix4x4
-RemapMatrixForOrientation(dom::ScreenOrientationInternal screenConfig, const Matrix4x4& aMatrix)
-{
-  Matrix4x4 out;
-  const float *in = &aMatrix._11;
-  float *o = &out._11;
-
-  if (screenConfig == dom::eScreenOrientation_LandscapePrimary) {
-    // remap X,Y -> Y,-X
-    o[0] = -in[1]; o[1] = in[0]; o[2] = in[2];
-    o[4] = -in[5]; o[5] = in[4]; o[6] = in[6];
-    o[8] = -in[9]; o[9] = in[8]; o[10] = in[10];
-  } else if (screenConfig == dom::eScreenOrientation_LandscapeSecondary) {
-    // remap X,Y -> -Y,X
-    o[0] = in[1]; o[1] = -in[0]; o[2] = in[2];
-    o[4] = in[5]; o[5] = -in[4]; o[6] = in[6];
-    o[8] = in[9]; o[9] = -in[8]; o[10] = in[10];
-  } else if (screenConfig == dom::eScreenOrientation_PortraitPrimary) {
-    out = aMatrix;
-  } else if (screenConfig == dom::eScreenOrientation_PortraitSecondary) {
-    // remap X,Y -> X,-Z
-    o[0] = in[0]; o[1] = in[2]; o[2] = -in[1];
-    o[4] = in[4]; o[5] = in[6]; o[6] = -in[5];
-    o[8] = in[8]; o[9] = in[10]; o[10] = -in[9];
-  } else {
-    MOZ_ASSERT(0, "gfxVRCardboard::RemapMatrixForOrientation invalid screenConfig");
-  }
-
-  return out;
-}
-
-} // namespace
-
-namespace mozilla {
-namespace gfx {
-
-VRDeviceProxyOrientationFallBack::VRDeviceProxyOrientationFallBack(const VRDeviceUpdate& aDeviceUpdate)
-  : VRDeviceProxy(aDeviceUpdate)
-  , mOrient(dom::eScreenOrientation_PortraitPrimary)
-  , mTracking(false)
-{
-  MOZ_COUNT_CTOR_INHERITED(VRDeviceProxyOrientationFallBack, VRDeviceProxy);
-}
-
-VRDeviceProxyOrientationFallBack::~VRDeviceProxyOrientationFallBack()
-{
-  StopSensorTracking();
-  MOZ_COUNT_DTOR_INHERITED(VRDeviceProxyOrientationFallBack, VRDeviceProxy);
-}
-
-void
-VRDeviceProxyOrientationFallBack::StartSensorTracking()
-{
-  if (!mTracking) {
-    // it's never been started before; initialize observers and
-    // initial state.
-
-    hal::ScreenConfiguration sconfig;
-    hal::GetCurrentScreenConfiguration(&sconfig);
-    this->Notify(sconfig);
-
-    hal::RegisterSensorObserver(hal::SENSOR_GAME_ROTATION_VECTOR, this);
-    hal::RegisterScreenConfigurationObserver(this);
-
-    mSensorState.Clear();
-
-    mTracking = true;
-  }
-}
-
-void
-VRDeviceProxyOrientationFallBack::StopSensorTracking()
-{
-  if (mTracking) {
-    hal::UnregisterScreenConfigurationObserver(this);
-    hal::UnregisterSensorObserver(hal::SENSOR_GAME_ROTATION_VECTOR, this);
-    mTracking = false;
-  }
-}
-
-// Android sends us events that have a 90-degree rotation about 
-// the x axis compared to what we want (phone flat vs. phone held in front of the eyes).
-// Correct for this by applying a transform to undo this rotation.
-void
-VRDeviceProxyOrientationFallBack::Notify(const hal::ScreenConfiguration& config)
-{
-  mOrient = config.orientation();
-
-  if (mOrient == dom::eScreenOrientation_LandscapePrimary) {
-    mScreenTransform = Quaternion(-0.5f, 0.5f, 0.5f, 0.5f);
-  } else if (mOrient == dom::eScreenOrientation_LandscapeSecondary) {
-    mScreenTransform = Quaternion(-0.5f, -0.5f, -0.5f, 0.5f);
-  } else if (mOrient == dom::eScreenOrientation_PortraitPrimary) {
-    mScreenTransform = Quaternion((float) -M_SQRT1_2, 0.f, 0.f, (float) M_SQRT1_2);
-  } else if (mOrient == dom::eScreenOrientation_PortraitSecondary) {
-    // Currently, PortraitSecondary event doesn't be triggered.
-    mScreenTransform = Quaternion((float) M_SQRT1_2, 0.f, 0.f, (float) M_SQRT1_2);
-  }
-}
-
-void
-VRDeviceProxyOrientationFallBack::Notify(const hal::SensorData& data)
-{
-  if (data.sensor() != hal::SENSOR_GAME_ROTATION_VECTOR)
-    return;
-
-  const nsTArray<float>& sensorValues = data.values();
-
-  // This is super chatty
-  //LOG("HMDInfoCardboard::Notify %f %f %f %f\n", sensorValues[0], sensorValues[1], sensorValues[2], sensorValues[3]);
-
-  mSavedLastSensor.Set(sensorValues[0], sensorValues[1], sensorValues[2], sensorValues[3]);
-  mSavedLastSensorTime = data.timestamp();
-  mNeedsSensorCompute = true;
-}
-
-void
-VRDeviceProxyOrientationFallBack::ZeroSensor()
-{
-  mSensorZeroInverse = mSavedLastSensor;
-  mSensorZeroInverse.Invert();
-}
-
-void
-VRDeviceProxyOrientationFallBack::ComputeStateFromLastSensor()
-{
-  if (!mNeedsSensorCompute)
-    return;
-
-  // apply the zero orientation
-  Quaternion q = mSensorZeroInverse * mSavedLastSensor;
-
-  // make a matrix from the quat
-  Matrix4x4 qm;
-  qm.SetRotationFromQuaternion(q);
-
-  // remap the coordinate space, based on the orientation
-  Matrix4x4 qmRemapped = RemapMatrixForOrientation(mOrient, qm);
-
-  // turn it back into a quat
-  q.SetFromRotationMatrix(qmRemapped);
-
-  // apply adjustment based on what's been done to the screen and the original zero
-  // position of the base coordinate space
-  q = mScreenTransform * q;
-
-  mSensorState.flags |= VRStateValidFlags::State_Orientation;
-  mSensorState.orientation[0] = q.x;
-  mSensorState.orientation[1] = q.y;
-  mSensorState.orientation[2] = q.z;
-  mSensorState.orientation[3] = q.w;
-
-  mSensorState.timestamp = mSavedLastSensorTime / 1000000.0;
-
-  mNeedsSensorCompute = false;
-}
-
-VRHMDSensorState
-VRDeviceProxyOrientationFallBack::GetSensorState()
-{
-  StartSensorTracking();
-  ComputeStateFromLastSensor();
-  return mSensorState;
-}
-
-VRHMDSensorState
-VRDeviceProxyOrientationFallBack::GetImmediateSensorState()
-{
-  // XXX TODO - Should return actual immediate sensor state
-  return GetSensorState();
-}
-
-} // namespace gfx
-} // namespace mozilla
-
deleted file mode 100644
--- a/gfx/vr/VRDeviceProxyOrientationFallBack.h
+++ /dev/null
@@ -1,55 +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/. */
-
-#ifndef GFX_VR_PROXY_ORIENTATION_FALLBACK_H
-#define GFX_VR_PROXY_ORIENTATION_FALLBACK_H
-
-#include "VRDeviceProxy.h"
-
-#include "mozilla/HalSensor.h"
-#include "mozilla/HalScreenConfiguration.h"
-
-namespace mozilla {
-namespace gfx {
-
-class VRDeviceProxyOrientationFallBack : public VRDeviceProxy
-                                       , public hal::ISensorObserver
-                                       , public hal::ScreenConfigurationObserver
-{
-public:
-
-  explicit VRDeviceProxyOrientationFallBack(const VRDeviceUpdate& aDeviceUpdate);
-
-  virtual void ZeroSensor() override;
-  virtual VRHMDSensorState GetSensorState() override;
-  virtual VRHMDSensorState GetImmediateSensorState() override;
-
-  // ISensorObserver interface
-  void Notify(const hal::SensorData& SensorData) override;
-  // ScreenConfigurationObserver interface
-  void Notify(const hal::ScreenConfiguration& ScreenConfiguration) override;
-
-
-protected:
-  virtual ~VRDeviceProxyOrientationFallBack();
-
-  void StartSensorTracking();
-  void StopSensorTracking();
-  void ComputeStateFromLastSensor();
-
-  uint32_t mOrient;
-  Quaternion mScreenTransform;
-  Quaternion mSensorZeroInverse;
-  Quaternion mSavedLastSensor;
-  double mSavedLastSensorTime;
-  bool mNeedsSensorCompute;    // if we need to compute the state from mSavedLastSensor
-
-  bool mTracking;
-};
-
-} // namespace gfx
-} // namespace mozilla
-
-#endif /* GFX_VR_PROXY_ORIENTATION_FALLBACK_H */
\ No newline at end of file
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -14,18 +14,16 @@
 #include "gfxPrefs.h"
 #include "gfxVR.h"
 #if defined(XP_WIN)
 #include "gfxVROculus.h"
 #endif
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_LINUX)
 #include "gfxVROSVR.h"
 #endif
-#include "gfxVRCardboard.h"
-
 
 namespace mozilla {
 namespace gfx {
 
 static StaticRefPtr<VRManager> sVRManagerSingleton;
 
 /*static*/ void
 VRManager::ManagerInit()
@@ -56,21 +54,16 @@ VRManager::VRManager()
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_LINUX)
   // OSVR is cross platform compatible
   mgr = VRHMDManagerOSVR::Create();
   if (mgr){
       mManagers.AppendElement(mgr);
   }
 
 #endif
-
-  mgr = VRHMDManagerCardboard::Create();
-  if (mgr) {
-    mManagers.AppendElement(mgr);
-  }
 }
 
 VRManager::~VRManager()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!mInitialized);
   MOZ_COUNT_DTOR(VRManager);
 }
@@ -184,20 +177,18 @@ VRManager::DispatchVRDeviceInfoUpdate()
 
 void
 VRManager::DispatchVRDeviceSensorUpdate()
 {
   nsTArray<VRSensorUpdate> update;
 
   for (auto iter = mVRDevices.Iter(); !iter.Done(); iter.Next()) {
     gfx::VRHMDInfo* device = iter.UserData();
-    if (!device->GetDeviceInfo().GetUseMainThreadOrientation()) {
-      update.AppendElement(VRSensorUpdate(device->GetDeviceInfo().GetDeviceID(),
-                                          device->GetSensorState()));
-    }
+    update.AppendElement(VRSensorUpdate(device->GetDeviceInfo().GetDeviceID(),
+                                        device->GetSensorState()));
   }
   if (update.Length() > 0) {
     for (auto iter = mVRManagerParents.Iter(); !iter.Done(); iter.Next()) {
       Unused << iter.Get()->GetKey()->SendUpdateDeviceSensors(update);
     }
   }
 }
 
--- a/gfx/vr/gfxVR.cpp
+++ b/gfx/vr/gfxVR.cpp
@@ -13,37 +13,35 @@
 #include "gfxPrefs.h"
 #include "gfxVR.h"
 #if defined(XP_WIN)
 #include "gfxVROculus.h"
 #endif
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_LINUX)
 #include "gfxVROSVR.h"
 #endif
-#include "gfxVRCardboard.h"
 
 #include "mozilla/unused.h"
 #include "mozilla/layers/Compositor.h"
 #include "mozilla/layers/TextureHost.h"
 
 #ifndef M_PI
 # define M_PI 3.14159265358979323846
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 Atomic<uint32_t> VRHMDManager::sDeviceBase(0);
 
-VRHMDInfo::VRHMDInfo(VRHMDType aType, bool aUseMainThreadOrientation)
+VRHMDInfo::VRHMDInfo(VRHMDType aType)
 {
   MOZ_COUNT_CTOR(VRHMDInfo);
   mDeviceInfo.mType = aType;
   mDeviceInfo.mDeviceID = VRHMDManager::AllocateDeviceID();
-  mDeviceInfo.mUseMainThreadOrientation = aUseMainThreadOrientation;
 }
 
 VRHMDInfo::~VRHMDInfo()
 {
   MOZ_COUNT_DTOR(VRHMDInfo);
 }
 
 /* static */ uint32_t
--- a/gfx/vr/gfxVR.h
+++ b/gfx/vr/gfxVR.h
@@ -22,17 +22,16 @@ namespace layers {
 class Compositor;
 class CompositingRenderTarget;
 }
 
 namespace gfx {
 
 enum class VRHMDType : uint16_t {
   Oculus,
-  Cardboard,
   OSVR,
   NumHMDTypes
 };
 
 enum class VRStateValidFlags : uint16_t {
   State_None = 0,
   State_Position = 1 << 1,
   State_Orientation = 1 << 2,
@@ -97,17 +96,16 @@ struct VRDeviceInfo
   VRStateValidFlags GetSupportedSensorStateBits() const { return mSupportedSensorBits; }
   const VRFieldOfView& GetRecommendedEyeFOV(uint32_t whichEye) const { return mRecommendedEyeFOV[whichEye]; }
   const VRFieldOfView& GetMaximumEyeFOV(uint32_t whichEye) const { return mMaximumEyeFOV[whichEye]; }
 
   const IntSize& SuggestedEyeResolution() const { return mEyeResolution; }
   const Point3D& GetEyeTranslation(uint32_t whichEye) const { return mEyeTranslation[whichEye]; }
   const Matrix4x4& GetEyeProjectionMatrix(uint32_t whichEye) const { return mEyeProjectionMatrix[whichEye]; }
   const VRFieldOfView& GetEyeFOV(uint32_t whichEye) const { return mEyeFOV[whichEye]; }
-  bool GetUseMainThreadOrientation() const { return mUseMainThreadOrientation; }
 
   enum Eye {
     Eye_Left,
     Eye_Right,
     NumEyes
   };
 
   uint32_t mDeviceID;
@@ -122,29 +120,27 @@ struct VRDeviceInfo
   /* Suggested resolution for rendering a single eye.
    * Assumption is that left/right rendering will be 2x of this size.
    * XXX fix this for vertical displays
    */
   IntSize mEyeResolution;
   IntRect mScreenRect;
 
   bool mIsFakeScreen;
-  bool mUseMainThreadOrientation;
 
 
 
   bool operator==(const VRDeviceInfo& other) const {
     return mType == other.mType &&
            mDeviceID == other.mDeviceID &&
            mDeviceName == other.mDeviceName &&
            mSupportedSensorBits == other.mSupportedSensorBits &&
            mEyeResolution == other.mEyeResolution &&
            mScreenRect == other.mScreenRect &&
            mIsFakeScreen == other.mIsFakeScreen &&
-           mUseMainThreadOrientation == other.mUseMainThreadOrientation &&
            mMaximumEyeFOV[0] == other.mMaximumEyeFOV[0] &&
            mMaximumEyeFOV[1] == other.mMaximumEyeFOV[1] &&
            mRecommendedEyeFOV[0] == other.mRecommendedEyeFOV[0] &&
            mRecommendedEyeFOV[1] == other.mRecommendedEyeFOV[1] &&
            mEyeFOV[0] == other.mEyeFOV[0] &&
            mEyeFOV[1] == other.mEyeFOV[1] &&
            mEyeTranslation[0] == other.mEyeTranslation[0] &&
            mEyeTranslation[1] == other.mEyeTranslation[1] &&
@@ -276,17 +272,17 @@ public:
                                        const IntSize& textureSize, // the full size of the texture
                                        const IntRect& eyeViewport, // the viewport within the texture for the current eye
                                        const Size& destViewport,   // the size of the destination viewport
                                        const Rect& destRect,       // the rectangle within the dest viewport that this should be rendered
                                        VRDistortionConstants& values) = 0;
 
   const VRDistortionMesh& GetDistortionMesh(uint32_t whichEye) const { return mDistortionMesh[whichEye]; }
 protected:
-  explicit VRHMDInfo(VRHMDType aType, bool aUseMainThreadOrientation);
+  explicit VRHMDInfo(VRHMDType aType);
   virtual ~VRHMDInfo();
 
   VRHMDConfiguration mConfiguration;
   VRDeviceInfo mDeviceInfo;
   VRDistortionMesh mDistortionMesh[VRDeviceInfo::NumEyes];
 };
 
 class VRHMDManager {
deleted file mode 100644
--- a/gfx/vr/gfxVRCardboard.cpp
+++ /dev/null
@@ -1,248 +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 <math.h>
-
-#include "prlink.h"
-#include "prmem.h"
-#include "prenv.h"
-#include "gfxPrefs.h"
-#include "nsString.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/Hal.h"
-
-#include "gfxVRCardboard.h"
-
-#include "nsServiceManagerUtils.h"
-#include "nsIScreenManager.h"
-
-using namespace mozilla::dom;
-using namespace mozilla::gfx;
-using namespace mozilla::gfx::impl;
-
-HMDInfoCardboard::HMDInfoCardboard()
-  : VRHMDInfo(VRHMDType::Cardboard, true)
-{
-  MOZ_ASSERT(sizeof(HMDInfoCardboard::DistortionVertex) == sizeof(VRDistortionVertex),
-             "HMDInfoCardboard::DistortionVertex must match the size of VRDistortionVertex");
-
-  MOZ_COUNT_CTOR_INHERITED(HMDInfoCardboard, VRHMDInfo);
-
-  mDeviceInfo.mDeviceName.AssignLiteral("Phone Sensor (Cardboard) HMD");
-
-  mDeviceInfo.mSupportedSensorBits = VRStateValidFlags::State_Orientation;
-
-  mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Left] = gfx::VRFieldOfView(45.0, 45.0, 45.0, 45.0);
-  mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Right] = gfx::VRFieldOfView(45.0, 45.0, 45.0, 45.0);
-
-  mDeviceInfo.mMaximumEyeFOV[VRDeviceInfo::Eye_Left] = gfx::VRFieldOfView(45.0, 45.0, 45.0, 45.0);
-  mDeviceInfo.mMaximumEyeFOV[VRDeviceInfo::Eye_Right] = gfx::VRFieldOfView(45.0, 45.0, 45.0, 45.0);
-
-  SetFOV(mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Left], mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Right], 0.01, 10000.0);
-
-  mDeviceInfo.mScreenRect.x = 0;
-  mDeviceInfo.mScreenRect.y = 0;
-  mDeviceInfo.mScreenRect.width = 1920;
-  mDeviceInfo.mScreenRect.height = 1080;
-  mDeviceInfo.mIsFakeScreen = true;
-}
-
-
-VRHMDSensorState
-HMDInfoCardboard::GetSensorState()
-{
-  // Actual sensor state is calculated on the main thread,
-  // within VRDeviceProxyOrientationFallBack
-  VRHMDSensorState result;
-  result.Clear();
-  return result;
-}
-
-VRHMDSensorState
-HMDInfoCardboard::GetImmediateSensorState()
-{
-  return GetSensorState();
-}
-
-
-void
-HMDInfoCardboard::ZeroSensor()
-{
-  MOZ_ASSERT(0, "HMDInfoCardboard::ZeroSensor not implemented.  "
-                "Should use VRDeviceProxyOrientationFallBack on main thread");
-}
-
-
-void
-HMDInfoCardboard::NotifyVsync(const TimeStamp& aVsyncTimestamp)
-{
-  // Nothing to do here for Cardboard VR
-}
-
-bool
-HMDInfoCardboard::KeepSensorTracking()
-{
-  // Nothing to do here for Cardboard VR
-  return true;
-}
-
-bool
-HMDInfoCardboard::SetFOV(const gfx::VRFieldOfView& aFOVLeft,
-                         const gfx::VRFieldOfView& aFOVRight,
-                         double zNear, double zFar)
-{
-  const float standardIPD = 0.064f;
-
-  for (uint32_t eye = 0; eye < VRDeviceInfo::NumEyes; eye++) {
-    mDeviceInfo.mEyeFOV[eye] = eye == VRDeviceInfo::Eye_Left ? aFOVLeft : aFOVRight;
-    mDeviceInfo.mEyeTranslation[eye] = Point3D(standardIPD * (eye == VRDeviceInfo::Eye_Left ? -1.0 : 1.0), 0.0, 0.0);
-    mDeviceInfo.mEyeProjectionMatrix[eye] = mDeviceInfo.mEyeFOV[eye].ConstructProjectionMatrix(zNear, zFar, true);
-
-    mDistortionMesh[eye].mVertices.SetLength(4);
-    mDistortionMesh[eye].mIndices.SetLength(6);
-
-    HMDInfoCardboard::DistortionVertex *destv = reinterpret_cast<HMDInfoCardboard::DistortionVertex*>(mDistortionMesh[eye].mVertices.Elements());
-    float xoffs = eye == VRDeviceInfo::Eye_Left ? 0.0f : 1.0f;
-    float txoffs = eye == VRDeviceInfo::Eye_Left ? 0.0f : 0.5f;
-    destv[0].pos[0] = -1.0 + xoffs;
-    destv[0].pos[1] = -1.0;
-    destv[0].texR[0] = destv[0].texG[0] = destv[0].texB[0] = 0.0 + txoffs;
-    destv[0].texR[1] = destv[0].texG[1] = destv[0].texB[1] = 1.0;
-    destv[0].padding[0] = 1.0; // vignette factor
-
-    destv[1].pos[0] = 0.0 + xoffs;
-    destv[1].pos[1] = -1.0;
-    destv[1].texR[0] = destv[1].texG[0] = destv[1].texB[0] = 0.5 + txoffs;
-    destv[1].texR[1] = destv[1].texG[1] = destv[1].texB[1] = 1.0;
-    destv[1].padding[0] = 1.0; // vignette factor
-
-    destv[2].pos[0] = 0.0 + xoffs;
-    destv[2].pos[1] = 1.0;
-    destv[2].texR[0] = destv[2].texG[0] = destv[2].texB[0] = 0.5 + txoffs;
-    destv[2].texR[1] = destv[2].texG[1] = destv[2].texB[1] = 0.0;
-    destv[2].padding[0] = 1.0; // vignette factor
-
-    destv[3].pos[0] = -1.0 + xoffs;
-    destv[3].pos[1] = 1.0;
-    destv[3].texR[0] = destv[3].texG[0] = destv[3].texB[0] = 0.0 + txoffs;
-    destv[3].texR[1] = destv[3].texG[1] = destv[3].texB[1] = 0.0;
-    destv[3].padding[0] = 1.0; // vignette factor
-
-    uint16_t *iv = mDistortionMesh[eye].mIndices.Elements();
-    iv[0] = 0; iv[1] = 1; iv[2] = 2;
-    iv[3] = 2; iv[4] = 3; iv[5] = 0;
-  }
-
-  // XXX find out the default screen size and use that
-  mDeviceInfo.mEyeResolution.width = 1920 / 2;
-  mDeviceInfo.mEyeResolution.height = 1080;
-
-  if (PR_GetEnv("FAKE_CARDBOARD_SCREEN")) {
-    // for testing, make the eye resolution 2x of the screen
-    mDeviceInfo.mEyeResolution.width *= 2;
-    mDeviceInfo.mEyeResolution.height *= 2;
-  }
-
-  mConfiguration.hmdType = mDeviceInfo.mType;
-  mConfiguration.value = 0;
-  mConfiguration.fov[0] = aFOVLeft;
-  mConfiguration.fov[1] = aFOVRight;
-
-  return true;
-}
-
-void
-HMDInfoCardboard::FillDistortionConstants(uint32_t whichEye,
-                                          const IntSize& textureSize, const IntRect& eyeViewport,
-                                          const Size& destViewport, const Rect& destRect,
-                                          VRDistortionConstants& values)
-{
-  // these modify the texture coordinates; texcoord * zw + xy
-  values.eyeToSourceScaleAndOffset[0] = 0.0;
-  values.eyeToSourceScaleAndOffset[1] = 0.0;
-  if (PR_GetEnv("FAKE_CARDBOARD_SCREEN")) {
-    values.eyeToSourceScaleAndOffset[2] = 2.0;
-    values.eyeToSourceScaleAndOffset[3] = 2.0;
-  } else {
-    values.eyeToSourceScaleAndOffset[2] = 1.0;
-    values.eyeToSourceScaleAndOffset[3] = 1.0;
-  }
-
-  // Our mesh positions are in the [-1..1] clip space; we give appropriate offset
-  // and scaling for the right viewport.  (In the 0..2 space for sanity)
-
-  // this is the destRect in clip space
-  float x0 = destRect.x / destViewport.width * 2.0 - 1.0;
-  float x1 = (destRect.x + destRect.width) / destViewport.width * 2.0 - 1.0;
-
-  float y0 = destRect.y / destViewport.height * 2.0 - 1.0;
-  float y1 = (destRect.y + destRect.height) / destViewport.height * 2.0 - 1.0;
-
-  // offset
-  values.destinationScaleAndOffset[0] = (x0+x1) / 2.0;
-  values.destinationScaleAndOffset[1] = (y0+y1) / 2.0;
-  // scale
-  values.destinationScaleAndOffset[2] = destRect.width / destViewport.width;
-  values.destinationScaleAndOffset[3] = destRect.height / destViewport.height;
-}
-
-void
-HMDInfoCardboard::Destroy()
-{
-}
-
-/*static*/ already_AddRefed<VRHMDManagerCardboard>
-VRHMDManagerCardboard::Create()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!gfxPrefs::VREnabled() || !gfxPrefs::VRCardboardEnabled())
-  {
-    return nullptr;
-  }
-
-  RefPtr<VRHMDManagerCardboard> manager = new VRHMDManagerCardboard();
-  return manager.forget();
-}
-
-bool
-VRHMDManagerCardboard::Init()
-{
-  if (mCardboardInitialized) {
-    return true;
-  }
-
-  RefPtr<HMDInfoCardboard> hmd = new HMDInfoCardboard();
-  mCardboardHMDs.AppendElement(hmd);
-
-  mCardboardInitialized = true;
-  return true;
-}
-
-void
-VRHMDManagerCardboard::Destroy()
-{
-  if (!mCardboardInitialized)
-    return;
-
-  for (size_t i = 0; i < mCardboardHMDs.Length(); ++i) {
-    mCardboardHMDs[i]->Destroy();
-  }
-
-  mCardboardHMDs.Clear();
-  mCardboardInitialized = false;
-}
-
-void
-VRHMDManagerCardboard::GetHMDs(nsTArray<RefPtr<VRHMDInfo>>& aHMDResult)
-{
-  if (!mCardboardInitialized) {
-    return;
-  }
-
-  for (size_t i = 0; i < mCardboardHMDs.Length(); ++i) {
-    aHMDResult.AppendElement(mCardboardHMDs[i]);
-  }
-}
deleted file mode 100644
--- a/gfx/vr/gfxVRCardboard.h
+++ /dev/null
@@ -1,78 +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/. */
-
-#ifndef GFX_VR_CARDBOARD_H
-#define GFX_VR_CARDBOARD_H
-
-#include "mozilla/gfx/2D.h"
-#include "mozilla/gfx/Quaternion.h"
-#include "mozilla/EnumeratedArray.h"
-
-#include "gfxVR.h"
-
-namespace mozilla {
-namespace gfx {
-namespace impl {
-
-class HMDInfoCardboard :
-    public VRHMDInfo
-{
-public:
-  explicit HMDInfoCardboard();
-
-  bool SetFOV(const VRFieldOfView& aFOVLeft, const VRFieldOfView& aFOVRight,
-              double zNear, double zFar) override;
-
-  virtual VRHMDSensorState GetSensorState() override;
-  virtual VRHMDSensorState GetImmediateSensorState() override;
-  void ZeroSensor() override;
-  bool KeepSensorTracking() override;
-  void NotifyVsync(const TimeStamp& aVsyncTimestamp) override;
-
-  void FillDistortionConstants(uint32_t whichEye,
-                               const IntSize& textureSize, const IntRect& eyeViewport,
-                               const Size& destViewport, const Rect& destRect,
-                               VRDistortionConstants& values) override;
-
-  void Destroy();
-
-protected:
-  virtual ~HMDInfoCardboard() {
-    MOZ_COUNT_DTOR_INHERITED(HMDInfoCardboard, VRHMDInfo);
-    Destroy();
-  }
-
-  // must match the size of VRDistortionVertex
-  struct DistortionVertex {
-    float pos[2];
-    float texR[2];
-    float texG[2];
-    float texB[2];
-    float padding[4];
-  };
-
-};
-
-} // namespace impl
-
-class VRHMDManagerCardboard : public VRHMDManager
-{
-public:
-  static already_AddRefed<VRHMDManagerCardboard> Create();
-  virtual bool Init() override;
-  virtual void Destroy() override;
-  virtual void GetHMDs(nsTArray<RefPtr<VRHMDInfo> >& aHMDResult) override;
-protected:
-  VRHMDManagerCardboard()
-    : mCardboardInitialized(false)
-  { }
-  nsTArray<RefPtr<impl::HMDInfoCardboard>> mCardboardHMDs;
-  bool mCardboardInitialized;
-};
-
-} // namespace gfx
-} // namespace mozilla
-
-#endif /* GFX_VR_CARDBOARD_H */
--- a/gfx/vr/gfxVROSVR.cpp
+++ b/gfx/vr/gfxVROSVR.cpp
@@ -198,17 +198,17 @@ SetFromTanRadians(double left, double ri
   fovInfo.upDegrees = atan(top) * 180.0 / M_PI;
   fovInfo.downDegrees = atan(bottom) * 180.0 / M_PI;
   return fovInfo;
 }
 
 HMDInfoOSVR::HMDInfoOSVR(OSVR_ClientContext* context,
                          OSVR_ClientInterface* iface,
                          OSVR_DisplayConfig* display)
-  : VRHMDInfo(VRHMDType::OSVR, false)
+  : VRHMDInfo(VRHMDType::OSVR)
   , m_ctx(context)
   , m_iface(iface)
   , m_display(display)
 {
 
   MOZ_COUNT_CTOR_INHERITED(HMDInfoOSVR, VRHMDInfo);
 
   mDeviceInfo.mDeviceName.AssignLiteral("OSVR HMD");
@@ -614,9 +614,9 @@ VRHMDManagerOSVR::GetHMDs(nsTArray<RefPt
     return;
   }
 
   mHMDInfo = new HMDInfoOSVR(&m_ctx, &m_iface, &m_display);
 
   if (mHMDInfo) {
     aHMDResult.AppendElement(mHMDInfo);
   }
-}
\ No newline at end of file
+}
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -288,17 +288,17 @@ FromFovPort(const ovrFovPort& aFOV)
   fovInfo.upDegrees = atan(aFOV.UpTan) * 180.0 / M_PI;
   fovInfo.downDegrees = atan(aFOV.DownTan) * 180.0 / M_PI;
   return fovInfo;
 }
 
 } // namespace
 
 HMDInfoOculus::HMDInfoOculus(ovrSession aSession)
-  : VRHMDInfo(VRHMDType::Oculus, false)
+  : VRHMDInfo(VRHMDType::Oculus)
   , mSession(aSession)
   , mInputFrameID(0)
 {
   MOZ_ASSERT(sizeof(HMDInfoOculus::DistortionVertex) == sizeof(VRDistortionVertex),
              "HMDInfoOculus::DistortionVertex must match the size of VRDistortionVertex");
 
   MOZ_COUNT_CTOR_INHERITED(HMDInfoOculus, VRHMDInfo);
 
--- a/gfx/vr/ipc/VRManagerChild.cpp
+++ b/gfx/vr/ipc/VRManagerChild.cpp
@@ -3,17 +3,16 @@
  */
 /* 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 "VRManagerChild.h"
 #include "VRManagerParent.h"
 #include "VRDeviceProxy.h"
-#include "VRDeviceProxyOrientationFallBack.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/layers/CompositorThread.h" // for CompositorThread
 #include "mozilla/dom/Navigator.h"
 
 namespace mozilla {
 namespace gfx {
 
 static StaticRefPtr<VRManagerChild> sVRManagerChildSingleton;
@@ -133,21 +132,17 @@ VRManagerChild::RecvUpdateDeviceInfo(nsT
       if (device->GetDeviceInfo().GetDeviceID() == deviceUpdate.mDeviceInfo.GetDeviceID()) {
         device->UpdateDeviceInfo(deviceUpdate);
         devices.AppendElement(device);
         isNewDevice = false;
         break;
       }
     }
     if (isNewDevice) {
-      if (deviceUpdate.mDeviceInfo.GetUseMainThreadOrientation()) {
-        devices.AppendElement(new VRDeviceProxyOrientationFallBack(deviceUpdate));
-      } else {
-        devices.AppendElement(new VRDeviceProxy(deviceUpdate));
-      }
+      devices.AppendElement(new VRDeviceProxy(deviceUpdate));
     }
   }
 
   mDevices = devices;
 
 
   for (auto& nav: mNavigatorCallbacks) {
     nav->NotifyVRDevicesUpdated();
--- a/gfx/vr/ipc/VRMessageUtils.h
+++ b/gfx/vr/ipc/VRMessageUtils.h
@@ -77,17 +77,16 @@ struct ParamTraits<mozilla::gfx::VRDevic
   {
     WriteParam(aMsg, aParam.mType);
     WriteParam(aMsg, aParam.mDeviceID);
     WriteParam(aMsg, aParam.mDeviceName);
     WriteParam(aMsg, aParam.mSupportedSensorBits);
     WriteParam(aMsg, aParam.mEyeResolution);
     WriteParam(aMsg, aParam.mScreenRect);
     WriteParam(aMsg, aParam.mIsFakeScreen);
-    WriteParam(aMsg, aParam.mUseMainThreadOrientation);
     for (int i = 0; i < mozilla::gfx::VRDeviceInfo::NumEyes; i++) {
       WriteParam(aMsg, aParam.mMaximumEyeFOV[i]);
       WriteParam(aMsg, aParam.mRecommendedEyeFOV[i]);
       WriteParam(aMsg, aParam.mEyeFOV[i]);
       WriteParam(aMsg, aParam.mEyeTranslation[i]);
       WriteParam(aMsg, aParam.mEyeProjectionMatrix[i]);
     }
   }
@@ -95,19 +94,17 @@ struct ParamTraits<mozilla::gfx::VRDevic
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
   {
     if (!ReadParam(aMsg, aIter, &(aResult->mType)) ||
         !ReadParam(aMsg, aIter, &(aResult->mDeviceID)) ||
         !ReadParam(aMsg, aIter, &(aResult->mDeviceName)) ||
         !ReadParam(aMsg, aIter, &(aResult->mSupportedSensorBits)) ||
         !ReadParam(aMsg, aIter, &(aResult->mEyeResolution)) ||
         !ReadParam(aMsg, aIter, &(aResult->mScreenRect)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mIsFakeScreen)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mUseMainThreadOrientation))
-        ) {
+        !ReadParam(aMsg, aIter, &(aResult->mIsFakeScreen))) {
       return false;
     }
     for (int i = 0; i < mozilla::gfx::VRDeviceInfo::NumEyes; i++) {
       if (!ReadParam(aMsg, aIter, &(aResult->mMaximumEyeFOV[i])) ||
           !ReadParam(aMsg, aIter, &(aResult->mRecommendedEyeFOV[i])) ||
           !ReadParam(aMsg, aIter, &(aResult->mEyeFOV[i])) ||
           !ReadParam(aMsg, aIter, &(aResult->mEyeTranslation[i])) ||
           !ReadParam(aMsg, aIter, &(aResult->mEyeProjectionMatrix[i]))) {
--- a/gfx/vr/moz.build
+++ b/gfx/vr/moz.build
@@ -14,23 +14,21 @@ EXPORTS += [
 ]
 
 LOCAL_INCLUDES += [
     '/gfx/thebes',
 ]
 
 UNIFIED_SOURCES += [
     'gfxVR.cpp',
-    'gfxVRCardboard.cpp',
     'gfxVROculus.cpp',
     'gfxVROSVR.cpp',
     'ipc/VRManagerChild.cpp',
     'ipc/VRManagerParent.cpp',
     'VRDeviceProxy.cpp',
-    'VRDeviceProxyOrientationFallBack.cpp',
     'VRManager.cpp',
 ]
 
 IPDL_SOURCES = [
     'ipc/PVRManager.ipdl',
 ]
 
 # For building with the real SDK instead of our local hack
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -873,19 +873,16 @@ pref("layout.accessiblecaret.extend_sele
 
 // Disable sending console to logcat on release builds.
 #ifdef RELEASE_BUILD
 pref("consoleservice.logcat", false);
 #else
 pref("consoleservice.logcat", true);
 #endif
 
-// Enable Cardboard VR on mobile, assuming VR at all is enabled
-pref("dom.vr.cardboard.enabled", true);
-
 #ifndef RELEASE_BUILD
 // Enable VR on mobile, making it enable by default.
 pref("dom.vr.enabled", true);
 #endif
 
 pref("browser.tabs.showAudioPlayingIcon", true);
 
 pref("dom.serviceWorkers.enabled", true);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4918,18 +4918,16 @@ pref("dom.placeholder.show_on_focus", tr
 
 // VR is disabled by default in release and enabled for nightly and aurora
 #ifdef RELEASE_BUILD
 pref("dom.vr.enabled", false);
 #else
 pref("dom.vr.enabled", true);
 #endif
 pref("dom.vr.oculus.enabled", true);
-// Cardboard VR device is disabled by default
-pref("dom.vr.cardboard.enabled", false);
 // OSVR device
 pref("dom.vr.osvr.enabled", false);
 // 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);
 // path to OSVR DLLs