b=927727; support OpenGL OMTC layers on Windows; r=bgirard
authorVladimir Vukicevic <vladimir@pobox.com>
Thu, 17 Oct 2013 00:16:40 -0400
changeset 165191 0abc9e2319ee31512fe90012ae84d0a391b3a7db
parent 165190 dd684eb0462bc09632da4c7e73a0c40303a6722b
child 165192 4d2eb79e83b32ce6f4774d456159da72448656a2
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs927727
milestone27.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
b=927727; support OpenGL OMTC layers on Windows; r=bgirard
gfx/gl/GLContextProviderWGL.cpp
gfx/gl/WGLLibrary.h
widget/windows/nsWindow.cpp
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -63,19 +63,17 @@ WGLLibrary::CreateDummyWindow(HDC *aWind
     HDC dc = GetDC(win);
     NS_ENSURE_TRUE(dc, nullptr);
 
     if (mWindowPixelFormat == 0) {
         PIXELFORMATDESCRIPTOR pfd;
         ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
         pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
         pfd.nVersion = 1;
-        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
-        if (mUseDoubleBufferedWindows)
-            pfd.dwFlags |= PFD_DOUBLEBUFFER;
+        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
         pfd.iPixelType = PFD_TYPE_RGBA;
         pfd.cColorBits = 24;
         pfd.cRedBits = 8;
         pfd.cGreenBits = 8;
         pfd.cBlueBits = 8;
         pfd.cAlphaBits = 8;
         pfd.cDepthBits = 0;
         pfd.iLayerType = PFD_MAIN_PLANE;
@@ -119,18 +117,16 @@ WGLLibrary::EnsureInitialized(bool aUseM
     if (!mOGLLibrary) {
         mOGLLibrary = PR_LoadLibrary(libGLFilename);
         if (!mOGLLibrary) {
             NS_WARNING("Couldn't load OpenGL library.");
             return false;
         }
     }
 
-    mUseDoubleBufferedWindows = PR_GetEnv("MOZ_WGL_DB") != nullptr;
-
     GLLibraryLoader::SymLoadStruct earlySymbols[] = {
         { (PRFuncPtr*) &fCreateContext, { "wglCreateContext", nullptr } },
         { (PRFuncPtr*) &fMakeCurrent, { "wglMakeCurrent", nullptr } },
         { (PRFuncPtr*) &fGetProcAddress, { "wglGetProcAddress", nullptr } },
         { (PRFuncPtr*) &fDeleteContext, { "wglDeleteContext", nullptr } },
         { (PRFuncPtr*) &fGetCurrentContext, { "wglGetCurrentContext", nullptr } },
         { (PRFuncPtr*) &fGetCurrentDC, { "wglGetCurrentDC", nullptr } },
         { (PRFuncPtr*) &fShareLists, { "wglShareLists", nullptr } },
@@ -507,17 +503,17 @@ GLContextProviderWGL::CreateForWindow(ns
                                                         false,
                                                         dc,
                                                         context,
                                                         libToUse);
     if (!glContext->Init()) {
         return nullptr;
     }
 
-    glContext->SetIsDoubleBuffered(sWGLLib[libToUse].UseDoubleBufferedWindows());
+    glContext->SetIsDoubleBuffered(true);
 
     return glContext.forget();
 }
 
 static already_AddRefed<GLContextWGL>
 CreatePBufferOffscreenContext(const gfxIntSize& aSize,
                               LibType aLibToUse)
 {
--- a/gfx/gl/WGLLibrary.h
+++ b/gfx/gl/WGLLibrary.h
@@ -15,17 +15,16 @@ public:
     WGLLibrary() 
       : mInitialized(false), 
         mOGLLibrary(nullptr),
         mHasRobustness(false), 
         mWindow (0),
         mWindowDC(0),
         mWindowGLContext(0),
         mWindowPixelFormat (0),
-        mUseDoubleBufferedWindows(false),
         mLibType(OPENGL_LIB)     
     {}
 
     enum LibraryType
     {
       OPENGL_LIB = 0,
       MESA_LLVMPIPE_LIB = 1,
       LIBS_MAX
@@ -73,30 +72,28 @@ public:
     HWND CreateDummyWindow(HDC *aWindowDC = nullptr);
 
     bool HasRobustness() const { return mHasRobustness; }
     bool IsInitialized() const { return mInitialized; }
     HWND GetWindow() const { return mWindow; }
     HDC GetWindowDC() const {return mWindowDC; }
     HGLRC GetWindowGLContext() const {return mWindowGLContext; }
     int GetWindowPixelFormat() const { return mWindowPixelFormat; }
-    bool UseDoubleBufferedWindows() const { return mUseDoubleBufferedWindows; }
     LibraryType GetLibraryType() const { return mLibType; }
     static LibraryType SelectLibrary(const ContextFlags& aFlags);
     
 private:
     bool mInitialized;
     PRLibrary *mOGLLibrary;
     bool mHasRobustness;
 
     HWND mWindow;
     HDC mWindowDC;
     HGLRC mWindowGLContext;
     int mWindowPixelFormat;
-    bool mUseDoubleBufferedWindows;
     LibraryType mLibType;
 
 };
 
 // a global WGLLibrary instance
 extern WGLLibrary sWGLLibrary[WGLLibrary::LIBS_MAX];
 
 } /* namespace gl */
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6642,16 +6642,19 @@ nsWindow::StartAllowingD3D9(bool aReinit
 
 void
 nsWindow::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
 {
   LayerManagerPrefs prefs;
   GetLayerManagerPrefs(&prefs);
 
   if (!prefs.mDisableAcceleration) {
+    if (prefs.mPreferOpenGL) {
+      aHints.AppendElement(LAYERS_OPENGL);
+    }
     if (!prefs.mPreferD3D9) {
       aHints.AppendElement(LAYERS_D3D11);
     }
     aHints.AppendElement(LAYERS_D3D9);
   }
   aHints.AppendElement(LAYERS_BASIC);
 }