Bug 1066139 - Put stereo video behind a pref (off by default). r=Bas, a=sledru
authorNicolas Silva <nsilva@mozilla.com>
Tue, 23 Sep 2014 17:57:14 -0400
changeset 216847 e60e089a7904
parent 216846 f2933e32b654
child 216848 09dcf9d94d33
push id3940
push userryanvm@gmail.com
push date2014-09-25 16:25 +0000
treeherdermozilla-beta@09dcf9d94d33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, sledru
bugs1066139
milestone33.0
Bug 1066139 - Put stereo video behind a pref (off by default). r=Bas, a=sledru
gfx/layers/d3d9/DeviceManagerD3D9.cpp
gfx/thebes/gfxPrefs.h
--- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp
@@ -12,16 +12,17 @@
 #include "Nv3DVUtils.h"
 #include "plstr.h"
 #include <algorithm>
 #include "gfx2DGlue.h"
 #include "gfxPlatform.h"
 #include "gfxWindowsPlatform.h"
 #include "TextureD3D9.h"
 #include "mozilla/gfx/Point.h"
+#include "gfxPrefs.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
 const LPCWSTR kClassName       = L"D3D9WindowClass";
 
@@ -196,28 +197,30 @@ DeviceManagerD3D9::Init()
                               CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr,
                               nullptr, GetModuleHandle(nullptr), nullptr);
 
   if (!mFocusWnd) {
     NS_WARNING("Failed to create DeviceManagerD3D9 Window.");
     return false;
   }
 
-  /* Create an Nv3DVUtils instance */ 
-  if (!mNv3DVUtils) { 
-    mNv3DVUtils = new Nv3DVUtils(); 
-    if (!mNv3DVUtils) { 
-      NS_WARNING("Could not create a new instance of Nv3DVUtils.\n"); 
-    } 
-  } 
+  if (gfxPrefs::StereoVideoEnabled()) {
+    /* Create an Nv3DVUtils instance */
+    if (!mNv3DVUtils) {
+      mNv3DVUtils = new Nv3DVUtils();
+      if (!mNv3DVUtils) {
+        NS_WARNING("Could not create a new instance of Nv3DVUtils.\n");
+      }
+    }
 
-  /* Initialize the Nv3DVUtils object */ 
-  if (mNv3DVUtils) { 
-    mNv3DVUtils->Initialize(); 
-  } 
+    /* Initialize the Nv3DVUtils object */
+    if (mNv3DVUtils) {
+      mNv3DVUtils->Initialize();
+    }
+  }
 
   HMODULE d3d9 = LoadLibraryW(L"d3d9.dll");
   decltype(Direct3DCreate9)* d3d9Create = (decltype(Direct3DCreate9)*)
     GetProcAddress(d3d9, "Direct3DCreate9");
   decltype(Direct3DCreate9Ex)* d3d9CreateEx = (decltype(Direct3DCreate9Ex)*)
     GetProcAddress(d3d9, "Direct3DCreate9Ex");
 
 #ifdef USE_D3D9EX
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -253,16 +253,17 @@ private:
   DECL_GFX_PREF(Once, "layout.paint_rects_separately",         LayoutPaintRectsSeparately, bool, true);
 
   DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
 
   DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay",     UiClickHoldContextMenusDelay, int32_t, 500);
 
   DECL_GFX_PREF(Once, "webgl.force-layers-readback",           WebGLForceLayersReadback, bool, false);
 
+  DECL_GFX_PREF(Once, "layers.stereo-video.enabled",           StereoVideoEnabled, bool, false);
 public:
   // Manage the singleton:
   static gfxPrefs& GetSingleton()
   {
     MOZ_ASSERT(!sInstanceHasBeenDestroyed, "Should never recreate a gfxPrefs instance!");
     if (!sInstance) {
       sInstance = new gfxPrefs;
     }