aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro-integration/recipes-overlayed/firefox/firefox/fixes/Bug-696636-Block-OpenGL-1-drivers-explicitly-to-stee.patch
blob: 4f0ffc9704dd5e06c14f2234d3725547d4578779 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From: Benoit Jacob <bjacob@mozilla.com>
Date: Thu, 23 Feb 2012 17:21:30 -0500
Subject: Bug 696636 - Block OpenGL 1 drivers explicitly to steer clear of
 crashes - r=mattwoodrow

---
 widget/src/xpwidgets/GfxInfoX11.cpp |   14 +++++++++++++-
 widget/src/xpwidgets/GfxInfoX11.h   |    2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/widget/src/xpwidgets/GfxInfoX11.cpp b/widget/src/xpwidgets/GfxInfoX11.cpp
index 018b8fa..4974c5f 100644
--- a/widget/src/xpwidgets/GfxInfoX11.cpp
+++ b/widget/src/xpwidgets/GfxInfoX11.cpp
@@ -61,6 +61,7 @@ pid_t glxtest_pid = 0;
 nsresult
 GfxInfo::Init()
 {
+    mGLMajorVersion = 0;
     mMajorVersion = 0;
     mMinorVersion = 0;
     mRevisionVersion = 0;
@@ -195,6 +196,9 @@ GfxInfo::GetData()
     CrashReporter::AppendAppNotesToCrashReport(note);
 #endif
 
+    // determine the major OpenGL version. That's the first integer in the version string.
+    mGLMajorVersion = strtol(mVersion.get(), 0, 10);
+
     // determine driver type (vendor) and where in the version string
     // the actual driver version numbers should be expected to be found (whereToReadVersionNumbers)
     const char *whereToReadVersionNumbers = nsnull;
@@ -219,7 +223,7 @@ GfxInfo::GetData()
         whereToReadVersionNumbers = mVersion.get();
     }
 
-    // read major.minor version numbers
+    // read major.minor version numbers of the driver (not to be confused with the OpenGL version)
     if (whereToReadVersionNumbers) {
         // copy into writable buffer, for tokenization
         strncpy(buf, whereToReadVersionNumbers, buf_size);
@@ -275,6 +279,14 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
 
     OperatingSystem os = DRIVER_OS_LINUX;
 
+    if (mGLMajorVersion == 1) {
+        // We're on OpenGL 1. In most cases that indicates really old hardware.
+        // We better block them, rather than rely on them to fail gracefully, because they don't!
+        // see bug 696636
+        *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
+        return NS_OK;
+    }
+
     // Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance. 
     if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) {
         *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
diff --git a/widget/src/xpwidgets/GfxInfoX11.h b/widget/src/xpwidgets/GfxInfoX11.h
index 2525db0..03878ff 100644
--- a/widget/src/xpwidgets/GfxInfoX11.h
+++ b/widget/src/xpwidgets/GfxInfoX11.h
@@ -95,7 +95,7 @@ private:
   nsCString mAdapterDescription;
   bool mIsMesa, mIsNVIDIA, mIsFGLRX;
   bool mHasTextureFromPixmap;
-  int mMajorVersion, mMinorVersion, mRevisionVersion;
+  int mGLMajorVersion, mMajorVersion, mMinorVersion, mRevisionVersion;
 
   void AddCrashReportAnnotations();
 };