Skip to content

Commit

Permalink
Bug 1644579 - Allow VR backends to be enabled and disabled without re…
Browse files Browse the repository at this point in the history
…starting. Ensure that all other backends are disabled when the VR puppet is enabled. r=daoshengmu

Differential Revision: https://phabricator.services.mozilla.com/D78993
  • Loading branch information
kearwood committed Jun 10, 2020
1 parent b6a12ae commit 36a3391
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
6 changes: 5 additions & 1 deletion gfx/vr/service/OSVRSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ OSVRSession::~OSVRSession() { Shutdown(); }

bool OSVRSession::Initialize(mozilla::gfx::VRSystemState& aSystemState,
bool aDetectRuntimesOnly) {
if (StaticPrefs::dom_vr_puppet_enabled()) {
// Ensure that tests using the VR Puppet do not find real hardware
return false;
}
if (!StaticPrefs::dom_vr_enabled() ||
!StaticPrefs::dom_vr_osvr_enabled_AtStartup()) {
!StaticPrefs::dom_vr_osvr_enabled()) {
return false;
}
if (mOSVRInitialized) {
Expand Down
7 changes: 5 additions & 2 deletions gfx/vr/service/OculusSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,11 @@ OculusSession::~OculusSession() { Shutdown(); }

bool OculusSession::Initialize(mozilla::gfx::VRSystemState& aSystemState,
bool aDetectRuntimesOnly) {
if (!StaticPrefs::dom_vr_enabled() ||
!StaticPrefs::dom_vr_oculus_enabled_AtStartup()) {
if (StaticPrefs::dom_vr_puppet_enabled()) {
// Ensure that tests using the VR Puppet do not find real hardware
return false;
}
if (!StaticPrefs::dom_vr_enabled() || !StaticPrefs::dom_vr_oculus_enabled()) {
return false;
}

Expand Down
7 changes: 5 additions & 2 deletions gfx/vr/service/OpenVRSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ OpenVRSession::~OpenVRSession() {

bool OpenVRSession::Initialize(mozilla::gfx::VRSystemState& aSystemState,
bool aDetectRuntimesOnly) {
if (!StaticPrefs::dom_vr_enabled() ||
!StaticPrefs::dom_vr_openvr_enabled_AtStartup()) {
if (StaticPrefs::dom_vr_puppet_enabled()) {
// Ensure that tests using the VR Puppet do not find real hardware
return false;
}
if (!StaticPrefs::dom_vr_enabled() || !StaticPrefs::dom_vr_openvr_enabled()) {
return false;
}
if (mVRSystem != nullptr) {
Expand Down
12 changes: 6 additions & 6 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3013,15 +3013,15 @@

# Oculus device
- name: dom.vr.oculus.enabled
type: bool
type: RelaxedAtomicBool
#if defined(HAVE_64BIT_BUILD) && !defined(ANDROID)
# We are only enabling WebVR by default on 64-bit builds (Bug 1384459).
value: true
#else
# On Android, this pref is irrelevant.
value: false
#endif
mirror: once
mirror: always

# When enabled, Oculus sessions may be created with the ovrInit_Invisible
# flag if a page is using tracking but not presenting. When a page
Expand Down Expand Up @@ -3049,7 +3049,7 @@

# OpenVR device
- name: dom.vr.openvr.enabled
type: bool
type: RelaxedAtomicBool
#if !defined(HAVE_64BIT_BUILD) && !defined(ANDROID)
# We are only enabling WebVR by default on 64-bit builds (Bug 1384459).
value: false
Expand All @@ -3060,13 +3060,13 @@
# See Bug 1310663 (Linux). On Android, this pref is irrelevant.
value: false
#endif
mirror: once
mirror: always

# OSVR device
- name: dom.vr.osvr.enabled
type: bool
type: RelaxedAtomicBool
value: false
mirror: once
mirror: always

# Pose prediction reduces latency effects by returning future predicted HMD
# poses to callers of the WebVR API. This currently only has an effect for
Expand Down

0 comments on commit 36a3391

Please sign in to comment.