Bug 724640 - Block FGLRX driver on Linux 2.6.32 kernel version - r=glandium
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 02 Apr 2012 09:02:00 -0400
changeset 90824 5a12884290a8f5d1ff60cf98c793e4822f90bdb5
parent 90823 16a7a0838a28a15a0bac4df8379c7d4fec2605ae
child 90825 dc449362ea686e813ea4341d98b049c5771f1eae
push id7863
push userbjacob@mozilla.com
push dateMon, 02 Apr 2012 13:02:13 +0000
treeherdermozilla-inbound@5a12884290a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs724640
milestone14.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
Bug 724640 - Block FGLRX driver on Linux 2.6.32 kernel version - r=glandium
widget/xpwidgets/GfxInfoX11.cpp
widget/xpwidgets/GfxInfoX11.h
--- a/widget/xpwidgets/GfxInfoX11.cpp
+++ b/widget/xpwidgets/GfxInfoX11.cpp
@@ -36,16 +36,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <errno.h>
+#include <sys/utsname.h>
 #include "nsCRTGlue.h"
 #include "prenv.h"
 
 #include "GfxInfoX11.h"
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #include "nsICrashReporter.h"
@@ -155,30 +156,47 @@ GfxInfo::GetData()
             else if(!strcmp(line, "TFP"))
                 stringToFill = &textureFromPixmap;
         }
     }
 
     if (!strcmp(textureFromPixmap.get(), "TRUE"))
         mHasTextureFromPixmap = true;
 
+    // only useful for Linux kernel version check for FGLRX driver.
+    // assumes X client == X server, which is sad.
+    utsname unameobj;
+    if (!uname(&unameobj))
+    {
+      mOS.Assign(unameobj.sysname);
+      mOSRelease.Assign(unameobj.release);
+    }
+
     const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_GL_VENDOR");
     if (spoofedVendor)
         mVendor.Assign(spoofedVendor);
     const char *spoofedRenderer = PR_GetEnv("MOZ_GFX_SPOOF_GL_RENDERER");
     if (spoofedRenderer)
         mRenderer.Assign(spoofedRenderer);
     const char *spoofedVersion = PR_GetEnv("MOZ_GFX_SPOOF_GL_VERSION");
     if (spoofedVersion)
         mVersion.Assign(spoofedVersion);
+    const char *spoofedOS = PR_GetEnv("MOZ_GFX_SPOOF_OS");
+    if (spoofedOS)
+        mOS.Assign(spoofedOS);
+    const char *spoofedOSRelease = PR_GetEnv("MOZ_GFX_SPOOF_OS_RELEASE");
+    if (spoofedOSRelease)
+        mOSRelease.Assign(spoofedOSRelease);
 
     if (error ||
         mVendor.IsEmpty() ||
         mRenderer.IsEmpty() ||
-        mVersion.IsEmpty())
+        mVersion.IsEmpty() ||
+        mOS.IsEmpty() ||
+        mOSRelease.IsEmpty())
     {
         mAdapterDescription.AppendLiteral("GLXtest process failed");
         if (waiting_for_glxtest_process_failed)
             mAdapterDescription.AppendPrintf(" (waitpid failed with errno=%d for pid %d)", waitpid_errno, glxtest_pid);
         if (exited_with_error_code)
             mAdapterDescription.AppendPrintf(" (exited with status %d)", WEXITSTATUS(glxtest_status));
         if (received_signal)
             mAdapterDescription.AppendPrintf(" (received signal %d)", WTERMSIG(glxtest_status));
@@ -346,16 +364,24 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aF
           *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
           aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21");
         }
       } else if (mIsFGLRX) {
         // FGLRX does not report a driver version number, so we have the OpenGL version instead.
         // by requiring OpenGL 3, we effectively require recent drivers.
         if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(3, 0)) {
           *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
+          aSuggestedDriverVersion.AssignLiteral("<Something recent>");
+        }
+        // Bug 724640: FGLRX + Linux 2.6.32 is a crashy combo
+        bool unknownOS = mOS.IsEmpty() || mOSRelease.IsEmpty();
+        bool badOS = mOS.Find("Linux", true) != -1 &&
+                     mOSRelease.Find("2.6.32") != -1;
+        if (unknownOS || badOS) {
+          *aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
         }
       } else {
         // like on windows, let's block unknown vendors. Think of virtual machines.
         // Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
       }
     }
   }
--- a/widget/xpwidgets/GfxInfoX11.h
+++ b/widget/xpwidgets/GfxInfoX11.h
@@ -93,16 +93,18 @@ protected:
                                         OperatingSystem* aOS = nsnull);
   virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo();
 
 private:
   nsCString mVendor;
   nsCString mRenderer;
   nsCString mVersion;
   nsCString mAdapterDescription;
+  nsCString mOS;
+  nsCString mOSRelease;
   bool mIsMesa, mIsNVIDIA, mIsFGLRX, mIsNouveau;
   bool mHasTextureFromPixmap;
   int mGLMajorVersion, mMajorVersion, mMinorVersion, mRevisionVersion;
 
   void AddCrashReportAnnotations();
 };
 
 } // namespace widget