Bug 1316279 - Part 1: Fix gfxPrefs support for WebVR in out-of-process compositing; r?kip draft
authorDaosheng Mu <daoshengmu@gmail.com>
Wed, 23 Nov 2016 09:40:54 +0800
changeset 443860 b1c2ca33eff22ef8f0613e6f25e0ed1b16e57977
parent 443602 bad312aefb42982f492ad2cf36f4c6c3d698f4f7
child 443861 79577bf92ac41cc0a9581b294c7c2daac8f284a5
child 444901 bb80f110b764820df8cc8e1edb73aa949c7ef423
push id37117
push userbmo:dmu@mozilla.com
push dateFri, 25 Nov 2016 09:05:43 +0000
reviewerskip
bugs1316279
milestone53.0a1
Bug 1316279 - Part 1: Fix gfxPrefs support for WebVR in out-of-process compositing; r?kip MozReview-Commit-ID: 13tPgT0uDDi
gfx/ipc/GPUParent.cpp
gfx/thebes/gfxPrefs.h
gfx/vr/gfxVROpenVR.cpp
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -101,17 +101,16 @@ GPUParent::Init(base::ProcessId aParentP
 
   if (NS_FAILED(NS_InitMinimalXPCOM())) {
     return false;
   }
 
   CompositorThreadHolder::Start();
   APZThreadUtils::SetControllerThread(CompositorThreadHolder::Loop());
   APZCTreeManager::InitializeGlobalState();
-  VRManager::ManagerInit();
   LayerTreeOwnerTracker::Initialize();
   mozilla::ipc::SetThisProcessName("GPU Process");
 #ifdef XP_WIN
   wmf::MFStartup();
 #endif
   return true;
 }
 
@@ -181,16 +180,17 @@ GPUParent::RecvInit(nsTArray<GfxPrefSett
     };
     char** argvp = argv;
     gtk_init(&argc, &argvp);
   } else {
     gtk_init(nullptr, nullptr);
   }
 #endif
 
+  VRManager::ManagerInit();
   // Send a message to the UI process that we're done.
   GPUDeviceData data;
   RecvGetDeviceStatus(&data);
   Unused << SendInitComplete(data);
 
   return IPC_OK();
 }
 
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -411,16 +411,17 @@ 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.openvr-runtime",                 VROpenVRRuntime, std::string, "");
   DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms",   CollectScrollTransforms, bool, false);
   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);
 
   DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist",       IgnoreDXInterop2Blacklist, bool, false);
   DECL_GFX_PREF(Live, "gl.msaa-level",                         MSAALevel, uint32_t, 2);
--- a/gfx/vr/gfxVROpenVR.cpp
+++ b/gfx/vr/gfxVROpenVR.cpp
@@ -95,22 +95,22 @@ const uint32_t gOpenVRAxes[] = {
 const uint32_t gNumOpenVRAxis = sizeof(gOpenVRAxes) /
                                 sizeof(uint32_t);
 
 
 bool
 LoadOpenVRRuntime()
 {
   static PRLibrary *openvrLib = nullptr;
+  std::string openvrPath = gfxPrefs::VROpenVRRuntime();
 
-  nsAdoptingCString openvrPath = Preferences::GetCString("gfx.vr.openvr-runtime");
-  if (!openvrPath)
+  if (!openvrPath.c_str())
     return false;
 
-  openvrLib = PR_LoadLibrary(openvrPath.BeginReading());
+  openvrLib = PR_LoadLibrary(openvrPath.c_str());
   if (!openvrLib)
     return false;
 
 #define REQUIRE_FUNCTION(_x) do {                                       \
     *(void **)&vr_##_x = (void *) PR_FindSymbol(openvrLib, "VR_" #_x);  \
     if (!vr_##_x) { printf_stderr("VR_" #_x " symbol missing\n"); return false; } \
   } while (0)