Bug 629016 - Don't enable OpenGL on 10.6.x where x < 3, because updating subrects of textures sometimes puts the updated content in the wrong place on those OSes. r=jrmuizel,josh a=b
authorJoe Drew <joe@drew.ca>
Thu, 03 Feb 2011 16:12:33 -0500
changeset 61876 0ab68a939a4561e0674b9217ec5fae74c595c9a2
parent 61875 41258e566f2e5ccb14cee2c645635d9f811cc522
child 61877 c6993d965d0a373f8e0f1545e3144c761131728d
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel, josh, b
bugs629016
milestone2.0b12pre
Bug 629016 - Don't enable OpenGL on 10.6.x where x < 3, because updating subrects of textures sometimes puts the updated content in the wrong place on those OSes. r=jrmuizel,josh a=b
widget/src/xpwidgets/nsBaseWidget.cpp
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -788,16 +788,34 @@ nsBaseWidget::GetShouldAccelerate()
   PRBool forceAcceleration = PR_FALSE;
 #if defined(XP_WIN) || defined(ANDROID) || (MOZ_PLATFORM_MAEMO > 5)
   PRBool accelerateByDefault = PR_TRUE;
 #elif defined(XP_MACOSX)
 /* quickdraw plugins don't work with OpenGL so we need to avoid OpenGL when we want to support
  * them. e.g. 10.5 */
 # if defined(NP_NO_QUICKDRAW)
   PRBool accelerateByDefault = PR_TRUE;
+
+  // 10.6.2 and lower have a bug involving textures and pixel buffer objects
+  // that caused bug 629016, so we don't allow OpenGL-accelerated layers on
+  // those versions of the OS.
+  // This will still let full-screen video be accelerated on OpenGL, because
+  // that XUL widget opts in to acceleration, but that's probably OK.
+  SInt32 major, minor, bugfix;
+  OSErr err1 = ::Gestalt(gestaltSystemVersionMajor, &major);
+  OSErr err2 = ::Gestalt(gestaltSystemVersionMinor, &minor);
+  OSErr err3 = ::Gestalt(gestaltSystemVersionBugFix, &bugfix);
+  if (err1 == noErr && err2 == noErr && err3 == noErr) {
+    if (major == 10 && minor == 6) {
+      if (bugfix <= 2) {
+        accelerateByDefault = PR_FALSE;
+      }
+    }
+  }
+
 # else
   PRBool accelerateByDefault = PR_FALSE;
 # endif
 
 #else
   PRBool accelerateByDefault = PR_FALSE;
 #endif