Bug 1186608, [webvr] Add individual prefs to disable backends, set sane defaults; r=mstange
authorVladimir Vukicevic <vladimir@pobox.com>
Sun, 12 Apr 2015 23:05:36 -0400
changeset 286921 616cd074d5815f9ee4e126f2b17866fab5718d2a
parent 286920 5aa264987ee6646f457cfb9be9dc241669bb9cfa
child 286922 cef69a78f01614d31fdb7705816f7dc8fd807d62
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1186608
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1186608, [webvr] Add individual prefs to disable backends, set sane defaults; r=mstange
b2g/app/b2g.js
gfx/thebes/gfxPrefs.h
gfx/vr/gfxVR.cpp
gfx/vr/gfxVRCardboard.cpp
gfx/vr/gfxVROculus.cpp
gfx/vr/gfxVROculus050.cpp
mobile/android/app/mobile.js
modules/libpref/init/all.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -1155,10 +1155,13 @@ pref("dom.activities.developer_mode_only
 
 // mulet apparently loads firefox.js as well as b2g.js, so we have to explicitly
 // disable serviceworkers here to get them disabled in mulet.
 pref("dom.serviceWorkers.enabled", false);
 
 // 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);
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -183,16 +183,19 @@ private:
   DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier",           APZXSkateSizeMultiplier, float, 1.5f);
   DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier",      APZXStationarySizeMultiplier, float, 3.0f);
   DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier",           APZYSkateSizeMultiplier, float, 2.5f);
   DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier",      APZYStationarySizeMultiplier, float, 3.5f);
   DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms",        APZZoomAnimationDuration, int32_t, 250);
 
   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.oculus050.enabled",              VROculus050Enabled, bool, true);
+  DECL_GFX_PREF(Once, "dom.vr.cardboard.enabled",              VRCardboardEnabled, bool, false);
   DECL_GFX_PREF(Once, "dom.vr.add-test-devices",               VRAddTestDevices, int32_t, 1);
   DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled",        PointerEventsEnabled, bool, false);
 
   DECL_GFX_PREF(Live, "general.smoothScroll",                  SmoothScrollEnabled, bool, true);
   DECL_GFX_PREF(Live, "general.smoothScroll.durationToIntervalRatio",
                 SmoothScrollDurationToIntervalRatio, int32_t, 200);
   DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel",       WheelSmoothScrollEnabled, bool, true);
   DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMaxMS",
--- a/gfx/vr/gfxVR.cpp
+++ b/gfx/vr/gfxVR.cpp
@@ -104,17 +104,18 @@ VRHMDManager::ManagerInit()
   if (sManagers)
     return;
 
   sManagers = new VRHMDManagerArray();
 
   nsRefPtr<VRHMDManager> mgr;
 
   // we'll only load the 0.5.0 oculus runtime if
-  // the >= 0.6.0 one failed to load
+  // the >= 0.6.0 one failed to load; otherwise
+  // we might initialize oculus twice
   bool useOculus050 = true;
   unused << useOculus050;
 
 #if defined(XP_WIN)
   mgr = new VRHMDManagerOculus();
   if (mgr->PlatformInit()) {
     useOculus050 = false;
     sManagers->AppendElement(mgr);
--- a/gfx/vr/gfxVRCardboard.cpp
+++ b/gfx/vr/gfxVRCardboard.cpp
@@ -328,17 +328,17 @@ HMDInfoCardboard::Destroy()
 {
 }
 
 
 
 bool
 VRHMDManagerCardboard::PlatformInit()
 {
-  return true;
+  return gfxPrefs::VREnabled() && gfxPrefs::VRCardboardEnabled();
 }
 
 bool
 VRHMDManagerCardboard::Init()
 {
   if (mCardboardInitialized)
     return true;
 
--- a/gfx/vr/gfxVROculus.cpp
+++ b/gfx/vr/gfxVROculus.cpp
@@ -576,18 +576,21 @@ HMDInfoOculus::SubmitFrame(RenderTargetS
 }
 
 bool
 VRHMDManagerOculus::PlatformInit()
 {
   if (mOculusPlatformInitialized)
     return true;
 
-  if (!gfxPrefs::VREnabled())
+  if (!gfxPrefs::VREnabled() ||
+      !gfxPrefs::VROculusEnabled())
+  {
     return false;
+  }
 
   if (!InitializeOculusCAPI())
     return false;
 
   ovrInitParams params;
   params.Flags = ovrInit_RequestVersion;
   params.RequestedMinorVersion = OVR_MINOR_VERSION;
   params.LogCallback = nullptr;
--- a/gfx/vr/gfxVROculus050.cpp
+++ b/gfx/vr/gfxVROculus050.cpp
@@ -475,18 +475,21 @@ HMDInfoOculus050::GetSensorState(double 
 }
 
 bool
 VRHMDManagerOculus050::PlatformInit()
 {
   if (mOculusPlatformInitialized)
     return true;
 
-  if (!gfxPrefs::VREnabled())
+  if (!gfxPrefs::VREnabled() ||
+      !gfxPrefs::VROculus050Enabled())
+  {
     return false;
+  }
 
   if (!InitializeOculusCAPI())
     return false;
 
   ovrInitParams params;
   params.Flags = ovrInit_RequestVersion;
   params.RequestedMinorVersion = LIBOVR_MINOR_VERSION;
   params.LogCallback = nullptr;
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -927,8 +927,11 @@ pref("consoleservice.logcat", false);
 pref("consoleservice.logcat", true);
 #endif
 
 // Enable Service Workers for Android on non-release builds
 #ifndef RELEASE_BUILD
 pref("dom.serviceWorkers.enabled", true);
 pref("dom.serviceWorkers.interception.enabled", true);
 #endif
+
+// Enable Cardboard VR on mobile, assuming VR at all is enabled
+pref("dom.vr.cardboard.enabled", true);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4614,17 +4614,24 @@ pref("jsloader.reuseGlobal", false);
 
 // When we're asked to take a screenshot, don't wait more than 2000ms for the
 // event loop to become idle before actually taking the screenshot.
 pref("dom.browserElement.maxScreenshotDelayMS", 2000);
 
 // Whether we should show the placeholder when the element is focused but empty.
 pref("dom.placeholder.show_on_focus", true);
 
+// VR is disabled by default
 pref("dom.vr.enabled", false);
+// Oculus > 0.5
+pref("dom.vr.oculus.enabled", true);
+// Oculus <= 0.5; will only trigger if > 0.5 is not used or found
+pref("dom.vr.oculus050.enabled", true);
+// Cardboard VR device is disabled by default
+pref("dom.vr.cardboard.enabled", false);
 // 0 = never; 1 = only if real devices aren't there; 2 = always
 pref("dom.vr.add-test-devices", 1);
 // true = show the VR textures in our compositing output; false = don't.
 // true might have performance impact
 pref("gfx.vr.mirror-textures", false);
 
 // MMS UA Profile settings
 pref("wap.UAProf.url", "");