Bug 1193015 - Require MOZ_GLX_USE_SURFACE_SHARING to enable WebGL surface sharing on GLX. r=jgilbert, a=sylvestre
authorAndrew Comminos <acomminos@mozilla.com>
Thu, 24 Sep 2015 13:05:45 -0700
changeset 289396 785f6c974d925c650d45f5e141e30f69214cf57b
parent 289395 56ae581cc67a76d07bfe7cc1d8f6a7cc363076ba
child 289397 19a4ecd6db1ff083e702ba43dd1366de37c76d58
child 289399 8d2800c276d5fc177c4cd73b0324ed5b7357c242
child 289400 96206a82e0ad2e45a6c7e60c9619b4b821a6e0f3
push id5105
push usercbook@mozilla.com
push dateMon, 28 Sep 2015 12:00:03 +0000
treeherdermozilla-beta@785f6c974d92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, sylvestre
bugs1193015
milestone42.0
Bug 1193015 - Require MOZ_GLX_USE_SURFACE_SHARING to enable WebGL surface sharing on GLX. r=jgilbert, a=sylvestre
gfx/gl/GLXLibrary.h
gfx/layers/client/ClientCanvasLayer.cpp
--- a/gfx/gl/GLXLibrary.h
+++ b/gfx/gl/GLXLibrary.h
@@ -16,16 +16,17 @@ typedef XID GLXPixmap;
 typedef XID GLXDrawable;
 /* GLX 1.3 and later */
 typedef struct __GLXFBConfigRec *GLXFBConfig;
 typedef XID GLXFBConfigID;
 typedef XID GLXContextID;
 typedef XID GLXWindow;
 typedef XID GLXPbuffer;
 // end of stuff from glx.h
+#include "prenv.h"
 
 struct PRLibrary;
 class gfxASurface;
 
 namespace mozilla {
 namespace gl {
 
 class GLXLibrary
@@ -103,16 +104,22 @@ public:
     void ReleaseTexImage(Display* aDisplay, GLXPixmap aPixmap);
     void UpdateTexImage(Display* aDisplay, GLXPixmap aPixmap);
 
     bool UseTextureFromPixmap() { return mUseTextureFromPixmap; }
     bool HasRobustness() { return mHasRobustness; }
     bool SupportsTextureFromPixmap(gfxASurface* aSurface);
     bool IsATI() { return mIsATI; }
     bool GLXVersionCheck(int aMajor, int aMinor);
+    bool UseSurfaceSharing() {
+      // Disable surface sharing due to issues with compatible FBConfigs on
+      // NVIDIA drivers as described in bug 1193015.
+      static bool useSharing = PR_GetEnv("MOZ_GLX_USE_SURFACE_SHARING");
+      return mUseTextureFromPixmap && useSharing;
+    }
 
 private:
     
     typedef void (GLAPIENTRY * PFNGLXDESTROYCONTEXTPROC) (Display*,
                                                           GLXContext);
     PFNGLXDESTROYCONTEXTPROC xDestroyContextInternal;
     typedef Bool (GLAPIENTRY * PFNGLXMAKECURRENTPROC) (Display*,
                                                        GLXDrawable,
--- a/gfx/layers/client/ClientCanvasLayer.cpp
+++ b/gfx/layers/client/ClientCanvasLayer.cpp
@@ -87,17 +87,17 @@ ClientCanvasLayer::Initialize(const Data
   if (!gfxPrefs::WebGLForceLayersReadback()) {
     switch (forwarder->GetCompositorBackendType()) {
       case mozilla::layers::LayersBackend::LAYERS_OPENGL: {
 #if defined(XP_MACOSX)
         factory = SurfaceFactory_IOSurface::Create(mGLContext, caps, forwarder, mFlags);
 #elif defined(MOZ_WIDGET_GONK)
         factory = MakeUnique<SurfaceFactory_Gralloc>(mGLContext, caps, forwarder, mFlags);
 #elif defined(GL_PROVIDER_GLX)
-        if (sGLXLibrary.UseTextureFromPixmap())
+        if (sGLXLibrary.UseSurfaceSharing())
           factory = SurfaceFactory_GLXDrawable::Create(mGLContext, caps, forwarder, mFlags);
 #else
         if (mGLContext->GetContextType() == GLContextType::EGL) {
           if (XRE_IsParentProcess()) {
             factory = SurfaceFactory_EGLImage::Create(mGLContext, caps, forwarder,
                                                       mFlags);
           }
         }