Bug 668004 - generalized GPU blocklist to all platforms - r=bjacob

Refactored Windows-specific code for blocklisting GPUs to GfxInfoBase so that it
could be re-used by every platform. Also enabled all downloaded blocklist code on X11 (Linux) and Cocoa (Mac)
but not yet on Android.
This commit is contained in:
Doug Sherk 2011-11-03 10:50:40 -04:00
parent 3160e12587
commit 086371f121
13 changed files with 488 additions and 274 deletions

View File

@ -45,6 +45,7 @@
#define MAC_OS_X_VERSION_10_4_HEX 0x00001040 #define MAC_OS_X_VERSION_10_4_HEX 0x00001040
#define MAC_OS_X_VERSION_10_5_HEX 0x00001050 #define MAC_OS_X_VERSION_10_5_HEX 0x00001050
#define MAC_OS_X_VERSION_10_6_HEX 0x00001060 #define MAC_OS_X_VERSION_10_6_HEX 0x00001060
#define MAC_OS_X_VERSION_10_7_HEX 0x00001070
#define MAC_OS_X_MAJOR_VERSION_MASK 0xFFFFFFF0U #define MAC_OS_X_MAJOR_VERSION_MASK 0xFFFFFFF0U

View File

@ -39,6 +39,7 @@
#include "prenv.h" #include "prenv.h"
#include "prprf.h" #include "prprf.h"
#include "EGLUtils.h" #include "EGLUtils.h"
#include "nsHashKeys.h"
#include "AndroidBridge.h" #include "AndroidBridge.h"
@ -187,6 +188,12 @@ GfxInfo::GetAdapterDriverDate2(nsAString & aAdapterDriverDate)
NS_IMETHODIMP NS_IMETHODIMP
GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID) GfxInfo::GetAdapterVendorID(PRUint32 *aAdapterVendorID)
{ {
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) {
*aAdapterVendorID = HashString(str);
return NS_OK;
}
*aAdapterVendorID = 0; *aAdapterVendorID = 0;
return NS_OK; return NS_OK;
} }
@ -202,6 +209,12 @@ GfxInfo::GetAdapterVendorID2(PRUint32 *aAdapterVendorID)
NS_IMETHODIMP NS_IMETHODIMP
GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID) GfxInfo::GetAdapterDeviceID(PRUint32 *aAdapterDeviceID)
{ {
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", str)) {
*aAdapterDeviceID = HashString(str);
return NS_OK;
}
*aAdapterDeviceID = 0; *aAdapterDeviceID = 0;
return NS_OK; return NS_OK;
} }
@ -254,9 +267,22 @@ GfxInfo::AddOpenGLCrashReportAnnotations()
#endif #endif
} }
static GfxDriverInfo gDriverInfo[] = {
GfxDriverInfo()
};
const GfxDriverInfo*
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
}
nsresult nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
GfxDriverInfo* aDriverInfo /* = nsnull */) PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
{ {
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO; PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
@ -268,6 +294,8 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
return NS_OK; return NS_OK;
} }
OperatingSystem os = DRIVER_OS_ANDROID;
if (aFeature == FEATURE_OPENGL_LAYERS) { if (aFeature == FEATURE_OPENGL_LAYERS) {
if (!mSetCrashReportAnnotations) { if (!mSetCrashReportAnnotations) {
AddOpenGLCrashReportAnnotations(); AddOpenGLCrashReportAnnotations();
@ -287,5 +315,8 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
} }
*aStatus = status; *aStatus = status;
return NS_OK; if (aOS)
*aOS = os;
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
} }

View File

@ -80,7 +80,12 @@ public:
protected: protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo = nsnull); virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
private: private:

View File

@ -82,7 +82,12 @@ public:
protected: protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo = nsnull); virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
private: private:
@ -100,6 +105,8 @@ private:
PRUint32 mAdapterDeviceID; PRUint32 mAdapterDeviceID;
PRUint32 mRendererIDs[16]; PRUint32 mRendererIDs[16];
PRUint32 mOSXVersion;
}; };
} // namespace widget } // namespace widget

View File

@ -49,6 +49,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <IOKit/IOKitLib.h> #import <IOKit/IOKitLib.h>
#import <Cocoa/Cocoa.h>
#if defined(MOZ_CRASHREPORTER) #if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h" #include "nsExceptionHandler.h"
@ -56,6 +57,13 @@
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1" #define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
#endif #endif
#define MAC_OS_X_VERSION_MASK 0x0000FFFF
#define MAC_OS_X_VERSION_MAJOR_MASK 0x0000FFF0
#define MAC_OS_X_VERSION_10_4_HEX 0x00001040 // Not supported
#define MAC_OS_X_VERSION_10_5_HEX 0x00001050
#define MAC_OS_X_VERSION_10_6_HEX 0x00001060
#define MAC_OS_X_VERSION_10_7_HEX 0x00001070
using namespace mozilla; using namespace mozilla;
using namespace mozilla::widget; using namespace mozilla::widget;
@ -339,10 +347,47 @@ GfxInfo::AddCrashReportAnnotations()
#endif #endif
} }
static GfxDriverInfo gDriverInfo[] = {
// We don't support checking driver versions on Mac.
#define IMPLEMENT_MAC_DRIVER_BLOCKLIST(os, vendor, device, features, blockOn) \
GfxDriverInfo(os, vendor, device, features, blockOn, \
DRIVER_UNKNOWN_COMPARISON, V(0,0,0,0), ""),
// Example use of macro.
//IMPLEMENT_MAC_DRIVER_BLOCKLIST(DRIVER_OS_OS_X_10_7,
// GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
// GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION)
GfxDriverInfo()
};
const GfxDriverInfo*
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
}
static OperatingSystem
OSXVersionToOperatingSystem(PRUint32 aOSXVersion)
{
switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
case MAC_OS_X_VERSION_10_5_HEX:
return DRIVER_OS_OS_X_10_5;
case MAC_OS_X_VERSION_10_6_HEX:
return DRIVER_OS_OS_X_10_6;
case MAC_OS_X_VERSION_10_7_HEX:
return DRIVER_OS_OS_X_10_7;
}
return DRIVER_OS_UNKNOWN;
}
nsresult nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus, GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32* aStatus,
nsAString& aSuggestedDriverVersion, nsAString& aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */) GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
{ {
NS_ENSURE_ARG_POINTER(aStatus); NS_ENSURE_ARG_POINTER(aStatus);
@ -350,11 +395,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus,
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO; PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
// For now, we don't implement the downloaded blacklist. OperatingSystem os = OSXVersionToOperatingSystem(nsToolkit::OSXVersion());
if (aDriverInfo) {
*aStatus = status;
return NS_OK;
}
// Many WebGL issues on 10.5, especially: // Many WebGL issues on 10.5, especially:
// * bug 631258: WebGL shader paints using textures belonging to other processes on Mac OS 10.5 // * bug 631258: WebGL shader paints using textures belonging to other processes on Mac OS 10.5
@ -425,6 +466,9 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus,
status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; status = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
} }
if (aOS)
*aOS = os;
*aStatus = status; *aStatus = status;
return NS_OK;
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
} }

View File

@ -64,14 +64,6 @@ NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif #endif
static const PRUint32 allWindowsVersions = 0xffffffff; static const PRUint32 allWindowsVersions = 0xffffffff;
static const PRUint64 allDriverVersions = 0xffffffffffffffffULL;
static const PRUint32 vendorIntel = 0x8086;
static const PRUint32 vendorNVIDIA = 0x10de;
static const PRUint32 vendorAMD = 0x1022;
static const PRUint32 vendorATI = 0x1002;
#define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d) #define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
@ -491,7 +483,7 @@ GfxInfo::Init()
} }
mHasDriverVersionMismatch = false; mHasDriverVersionMismatch = false;
if (mAdapterVendorID == vendorIntel) { if (mAdapterVendorID == GfxDriverInfo::vendorIntel) {
// we've had big crashers (bugs 590373 and 595364) apparently correlated // we've had big crashers (bugs 590373 and 595364) apparently correlated
// with bad Intel driver installations where the DriverVersion reported // with bad Intel driver installations where the DriverVersion reported
// by the registry was not the version of the DLL. // by the registry was not the version of the DLL.
@ -731,112 +723,6 @@ GfxInfo::AddCrashReportAnnotations()
#endif #endif
} }
#define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
static const PRUint32 deviceFamilyIntelGMA500[] = {
0x8108, /* IntelGMA500_1 */
0x8109, /* IntelGMA500_2 */
0
};
static const PRUint32 deviceFamilyIntelGMA900[] = {
0x2582, /* IntelGMA900_1 */
0x2782, /* IntelGMA900_2 */
0x2592, /* IntelGMA900_3 */
0x2792, /* IntelGMA900_4 */
0
};
static const PRUint32 deviceFamilyIntelGMA950[] = {
0x2772, /* Intel945G_1 */
0x2776, /* Intel945G_2 */
0x27A2, /* Intel945_1 */
0x27A6, /* Intel945_2 */
0x27AE, /* Intel945_3 */
0
};
static const PRUint32 deviceFamilyIntelGMA3150[] = {
0xA001, /* IntelGMA3150_Nettop_1 */
0xA002, /* IntelGMA3150_Nettop_2 */
0xA011, /* IntelGMA3150_Netbook_1 */
0xA012, /* IntelGMA3150_Netbook_2 */
0
};
static const PRUint32 deviceFamilyIntelGMAX3000[] = {
0x2972, /* Intel946GZ_1 */
0x2973, /* Intel946GZ_2 */
0x2982, /* IntelG35_1 */
0x2983, /* IntelG35_2 */
0x2992, /* IntelQ965_1 */
0x2993, /* IntelQ965_2 */
0x29A2, /* IntelG965_1 */
0x29A3, /* IntelG965_2 */
0x29B2, /* IntelQ35_1 */
0x29B3, /* IntelQ35_2 */
0x29C2, /* IntelG33_1 */
0x29C3, /* IntelG33_2 */
0x29D2, /* IntelQ33_1 */
0x29D3, /* IntelQ33_2 */
0x2A02, /* IntelGL960_1 */
0x2A03, /* IntelGL960_2 */
0x2A12, /* IntelGM965_1 */
0x2A13, /* IntelGM965_2 */
0
};
static const PRUint32 deviceFamilyIntelGMAX4500HD[] = {
0x2A42, /* IntelGMA4500MHD_1 */
0x2A43, /* IntelGMA4500MHD_2 */
0x2E42, /* IntelB43_1 */
0x2E43, /* IntelB43_2 */
0x2E92, /* IntelB43_3 */
0x2E93, /* IntelB43_4 */
0x2E32, /* IntelG41_1 */
0x2E33, /* IntelG41_2 */
0x2E22, /* IntelG45_1 */
0x2E23, /* IntelG45_2 */
0x2E12, /* IntelQ45_1 */
0x2E13, /* IntelQ45_2 */
0x0042, /* IntelHDGraphics */
0x0046, /* IntelMobileHDGraphics */
0x0102, /* IntelSandyBridge_1 */
0x0106, /* IntelSandyBridge_2 */
0x0112, /* IntelSandyBridge_3 */
0x0116, /* IntelSandyBridge_4 */
0x0122, /* IntelSandyBridge_5 */
0x0126, /* IntelSandyBridge_6 */
0x010A, /* IntelSandyBridge_7 */
0x0080, /* IntelIvyBridge */
0
};
// Glitches whilst scrolling (see bugs 612007, 644787, 645872)
static const PRUint32 deviceFamilyNvidiaBlockD3D9Layers[] = {
0x00f3, /* NV43 [GeForce 6200 (TM)] */
0x0146, /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
0x014f, /* NV43 [GeForce 6200 (TM)] */
0x0161, /* NV44 [GeForce 6200 TurboCache (TM)] */
0x0162, /* NV44 [GeForce 6200SE TurboCache (TM)] */
0x0163, /* NV44 [GeForce 6200 LE (TM)] */
0x0164, /* NV44 [GeForce Go 6200 (TM)] */
0x0167, /* NV43 [GeForce Go 6200/6400 (TM)] */
0x0168, /* NV43 [GeForce Go 6200/6400 (TM)] */
0x0169, /* NV44 [GeForce 6250 (TM)] */
0x0222, /* NV44 [GeForce 6200 A-LE (TM)] */
0x0240, /* C51PV [GeForce 6150 (TM)] */
0x0241, /* C51 [GeForce 6150 LE (TM)] */
0x0244, /* C51 [Geforce Go 6150 (TM)] */
0x0245, /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
0x0247, /* C51 [GeForce Go 6100 (TM)] */
0x03d0, /* C61 [GeForce 6150SE nForce 430 (TM)] */
0x03d1, /* C61 [GeForce 6100 nForce 405 (TM)] */
0x03d2, /* C61 [GeForce 6100 nForce 400 (TM)] */
0x03d5, /* C61 [GeForce 6100 nForce 420 (TM)] */
0
};
static const GfxDriverInfo gDriverInfo[] = { static const GfxDriverInfo gDriverInfo[] = {
/* /*
* Notice that the first match defines the result. So always implement special cases firsts and general case last. * Notice that the first match defines the result. So always implement special cases firsts and general case last.
@ -846,15 +732,15 @@ static const GfxDriverInfo gDriverInfo[] = {
* NVIDIA entries * NVIDIA entries
*/ */
GfxDriverInfo( DRIVER_OS_WINDOWS_XP, GfxDriverInfo( DRIVER_OS_WINDOWS_XP,
vendorNVIDIA, GfxDriverInfo::allDevices, GfxDriverInfo::vendorNVIDIA, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(6,14,12,5721), "257.21" ), DRIVER_LESS_THAN, V(6,14,12,5721), "257.21" ),
GfxDriverInfo( DRIVER_OS_WINDOWS_VISTA, GfxDriverInfo( DRIVER_OS_WINDOWS_VISTA,
vendorNVIDIA, GfxDriverInfo::allDevices, GfxDriverInfo::vendorNVIDIA, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ), DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ),
GfxDriverInfo( DRIVER_OS_WINDOWS_7, GfxDriverInfo( DRIVER_OS_WINDOWS_7,
vendorNVIDIA, GfxDriverInfo::allDevices, GfxDriverInfo::vendorNVIDIA, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ), DRIVER_LESS_THAN, V(8,17,12,5721), "257.21" ),
@ -862,19 +748,19 @@ static const GfxDriverInfo gDriverInfo[] = {
* whilst scrolling. See bugs: 612007, 644787 & 645872. * whilst scrolling. See bugs: 612007, 644787 & 645872.
*/ */
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorNVIDIA, (GfxDeviceFamily) deviceFamilyNvidiaBlockD3D9Layers, GfxDriverInfo::vendorNVIDIA, (GfxDeviceFamily) deviceFamilyNvidiaBlockD3D9Layers,
nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE, nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
/* /*
* AMD/ATI entries * AMD/ATI entries
*/ */
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorATI, GfxDriverInfo::allDevices, GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ), DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ),
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorAMD, GfxDriverInfo::allDevices, GfxDriverInfo::vendorAMD, GfxDriverInfo::allDevices,
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ), DRIVER_LESS_THAN, V(8,741,0,0), "10.6" ),
@ -885,21 +771,21 @@ static const GfxDriverInfo gDriverInfo[] = {
* + many complaints about incorrect rendering * + many complaints about incorrect rendering
*/ */
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorATI, GfxDriverInfo::allDevices, GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED, nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorATI, GfxDriverInfo::allDevices, GfxDriverInfo::vendorATI, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED, nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorAMD, GfxDriverInfo::allDevices, GfxDriverInfo::vendorAMD, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED, nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorAMD, GfxDriverInfo::allDevices, GfxDriverInfo::vendorAMD, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED, nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
/* /*
* Intel entries * Intel entries
@ -909,11 +795,11 @@ static const GfxDriverInfo gDriverInfo[] = {
* Block all features on any drivers before this, as there's a crash when a MS Hotfix is installed. * Block all features on any drivers before this, as there's a crash when a MS Hotfix is installed.
* The crash itself is Direct2D-related, but for safety we block all features. * The crash itself is Direct2D-related, but for safety we block all features.
*/ */
#define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \ #define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer) \
GfxDriverInfo( winVer, \ GfxDriverInfo( winVer, \
vendorIntel, (GfxDeviceFamily) devFamily, \ GfxDriverInfo::vendorIntel, (GfxDeviceFamily) devFamily, \
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \ GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
DRIVER_LESS_THAN, driverVer ), DRIVER_LESS_THAN, driverVer ),
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA500, V(6,14,11,1018)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA500, V(6,14,11,1018))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA900, V(6,14,10,4764)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA900, V(6,14,10,4764))
@ -923,28 +809,28 @@ static const GfxDriverInfo gDriverInfo[] = {
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMAX4500HD, V(6,14,10,5284)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMAX4500HD, V(6,14,10,5284))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA500, V(7,14,10,1006)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA500, V(7,14,10,1006))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA900, allDriverVersions) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA900, GfxDriverInfo::allDriverVersions)
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA950, V(7,14,10,1504)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA950, V(7,14,10,1504))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA3150, V(7,14,10,2124)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA3150, V(7,14,10,2124))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX3000, V(7,15,10,1666)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX3000, V(7,15,10,1666))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA500, V(5,0,0,2026)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA500, V(5,0,0,2026))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA900, allDriverVersions) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA900, GfxDriverInfo::allDriverVersions)
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA950, V(8,15,10,1930)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA950, V(8,15,10,1930))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA3150, V(8,14,10,2117)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA3150, V(8,14,10,2117))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX3000, V(8,15,10,1930)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX3000, V(8,15,10,1930))
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202)) IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
/* OpenGL on any Intel hardware is discouraged */ /* OpenGL on any Intel hardware is discouraged */
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorIntel, GfxDriverInfo::allDevices, GfxDriverInfo::vendorIntel, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED, nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo( DRIVER_OS_ALL, GfxDriverInfo( DRIVER_OS_ALL,
vendorIntel, GfxDriverInfo::allDevices, GfxDriverInfo::vendorIntel, GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED, nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
DRIVER_LESS_THAN, allDriverVersions ), DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions ),
GfxDriverInfo() GfxDriverInfo()
}; };
@ -969,8 +855,18 @@ WindowsVersionToOperatingSystem(PRInt32 aWindowsVersion)
}; };
} }
const GfxDriverInfo*
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
}
nsresult nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo /* = nsnull */) GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
{ {
*aStatus = nsIGfxInfo::FEATURE_NO_INFO; *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
aSuggestedDriverVersion.SetIsVoid(true); aSuggestedDriverVersion.SetIsVoid(true);
@ -987,10 +883,10 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
if (adapterVendor != vendorIntel && if (adapterVendor != GfxDriverInfo::vendorIntel &&
adapterVendor != vendorNVIDIA && adapterVendor != GfxDriverInfo::vendorNVIDIA &&
adapterVendor != vendorAMD && adapterVendor != GfxDriverInfo::vendorAMD &&
adapterVendor != vendorATI && adapterVendor != GfxDriverInfo::vendorATI &&
// FIXME - these special hex values are currently used in xpcshell tests introduced by // FIXME - these special hex values are currently used in xpcshell tests introduced by
// bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting // bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
// intel/ati/nvidia. // intel/ati/nvidia.
@ -1047,111 +943,11 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
} }
} }
// special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
// whitelist them, actually we do know that this combination of device and driver version
// works well.
if (os == DRIVER_OS_WINDOWS_XP &&
adapterVendor == vendorNVIDIA &&
adapterDeviceID == 0x0861 && // GeForce 9400
driverVersion == V(6,14,11,7756))
{
return NS_OK;
}
while (info->mOperatingSystem) {
if (info->mOperatingSystem != DRIVER_OS_ALL &&
info->mOperatingSystem != os)
{
info++;
continue;
}
if (info->mAdapterVendor != GfxDriverInfo::allAdapterVendors &&
info->mAdapterVendor != adapterVendor) {
info++;
continue;
}
if (info->mDevices != GfxDriverInfo::allDevices) {
bool deviceMatches = false;
for (const PRUint32 *devices = info->mDevices; *devices; ++devices) {
if (*devices == adapterDeviceID) {
deviceMatches = true;
break;
}
}
if (!deviceMatches) {
info++;
continue;
}
}
bool match = false;
switch (info->mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info->mDriverVersion;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info->mDriverVersion;
break;
case DRIVER_GREATER_THAN:
match = driverVersion > info->mDriverVersion;
break;
case DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= info->mDriverVersion;
break;
case DRIVER_EQUAL:
match = driverVersion == info->mDriverVersion;
break;
case DRIVER_NOT_EQUAL:
match = driverVersion != info->mDriverVersion;
break;
case DRIVER_BETWEEN_EXCLUSIVE:
match = driverVersion > info->mDriverVersion && driverVersion < info->mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE:
match = driverVersion >= info->mDriverVersion && driverVersion <= info->mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= info->mDriverVersion && driverVersion < info->mDriverVersionMax;
break;
default:
NS_WARNING("Bogus op in GfxDriverInfo");
break;
}
if (match) {
if (info->mFeature == GfxDriverInfo::allFeatures ||
info->mFeature == aFeature)
{
status = info->mFeatureStatus;
break;
}
}
info++;
}
*aStatus = status; *aStatus = status;
if (aOS)
*aOS = os;
if (status == FEATURE_BLOCKED_DRIVER_VERSION) { return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
if (info->mSuggestedVersion) {
aSuggestedDriverVersion.AppendPrintf("%s", info->mSuggestedVersion);
} else if (info->mComparisonOp == DRIVER_LESS_THAN &&
info->mDriverVersion != allDriverVersions)
{
aSuggestedDriverVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(info->mDriverVersion & 0xffff000000000000) >> 48,
(info->mDriverVersion & 0x0000ffff00000000) >> 32,
(info->mDriverVersion & 0x00000000ffff0000) >> 16,
(info->mDriverVersion & 0x000000000000ffff));
}
}
return NS_OK;
} }
#ifdef DEBUG #ifdef DEBUG

View File

@ -89,7 +89,12 @@ public:
protected: protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo = nsnull); virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
private: private:

View File

@ -42,6 +42,13 @@ using namespace mozilla::widget;
PRUint32 GfxDriverInfo::allAdapterVendors = 0; PRUint32 GfxDriverInfo::allAdapterVendors = 0;
PRInt32 GfxDriverInfo::allFeatures = 0; PRInt32 GfxDriverInfo::allFeatures = 0;
PRUint64 GfxDriverInfo::allDriverVersions = ~(PRUint64(0));
PRUint32 GfxDriverInfo::vendorIntel = 0x8086;
PRUint32 GfxDriverInfo::vendorNVIDIA = 0x10de;
PRUint32 GfxDriverInfo::vendorAMD = 0x1022;
PRUint32 GfxDriverInfo::vendorATI = 0x1002;
GfxDeviceFamily GfxDriverInfo::allDevices = nsnull; GfxDeviceFamily GfxDriverInfo::allDevices = nsnull;
GfxDriverInfo::GfxDriverInfo() GfxDriverInfo::GfxDriverInfo()

View File

@ -41,6 +41,8 @@
#ifndef __mozilla_widget_GfxDriverInfo_h__ #ifndef __mozilla_widget_GfxDriverInfo_h__
#define __mozilla_widget_GfxDriverInfo_h__ #define __mozilla_widget_GfxDriverInfo_h__
#define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
namespace mozilla { namespace mozilla {
namespace widget { namespace widget {
@ -54,6 +56,8 @@ enum OperatingSystem {
DRIVER_OS_LINUX, DRIVER_OS_LINUX,
DRIVER_OS_OS_X_10_5, DRIVER_OS_OS_X_10_5,
DRIVER_OS_OS_X_10_6, DRIVER_OS_OS_X_10_6,
DRIVER_OS_OS_X_10_7,
DRIVER_OS_ANDROID,
DRIVER_OS_ALL DRIVER_OS_ALL
}; };
@ -70,6 +74,110 @@ enum VersionComparisonOp {
DRIVER_UNKNOWN_COMPARISON DRIVER_UNKNOWN_COMPARISON
}; };
static const PRUint32 deviceFamilyIntelGMA500[] = {
0x8108, /* IntelGMA500_1 */
0x8109, /* IntelGMA500_2 */
0
};
static const PRUint32 deviceFamilyIntelGMA900[] = {
0x2582, /* IntelGMA900_1 */
0x2782, /* IntelGMA900_2 */
0x2592, /* IntelGMA900_3 */
0x2792, /* IntelGMA900_4 */
0
};
static const PRUint32 deviceFamilyIntelGMA950[] = {
0x2772, /* Intel945G_1 */
0x2776, /* Intel945G_2 */
0x27A2, /* Intel945_1 */
0x27A6, /* Intel945_2 */
0x27AE, /* Intel945_3 */
0
};
static const PRUint32 deviceFamilyIntelGMA3150[] = {
0xA001, /* IntelGMA3150_Nettop_1 */
0xA002, /* IntelGMA3150_Nettop_2 */
0xA011, /* IntelGMA3150_Netbook_1 */
0xA012, /* IntelGMA3150_Netbook_2 */
0
};
static const PRUint32 deviceFamilyIntelGMAX3000[] = {
0x2972, /* Intel946GZ_1 */
0x2973, /* Intel946GZ_2 */
0x2982, /* IntelG35_1 */
0x2983, /* IntelG35_2 */
0x2992, /* IntelQ965_1 */
0x2993, /* IntelQ965_2 */
0x29A2, /* IntelG965_1 */
0x29A3, /* IntelG965_2 */
0x29B2, /* IntelQ35_1 */
0x29B3, /* IntelQ35_2 */
0x29C2, /* IntelG33_1 */
0x29C3, /* IntelG33_2 */
0x29D2, /* IntelQ33_1 */
0x29D3, /* IntelQ33_2 */
0x2A02, /* IntelGL960_1 */
0x2A03, /* IntelGL960_2 */
0x2A12, /* IntelGM965_1 */
0x2A13, /* IntelGM965_2 */
0
};
static const PRUint32 deviceFamilyIntelGMAX4500HD[] = {
0x2A42, /* IntelGMA4500MHD_1 */
0x2A43, /* IntelGMA4500MHD_2 */
0x2E42, /* IntelB43_1 */
0x2E43, /* IntelB43_2 */
0x2E92, /* IntelB43_3 */
0x2E93, /* IntelB43_4 */
0x2E32, /* IntelG41_1 */
0x2E33, /* IntelG41_2 */
0x2E22, /* IntelG45_1 */
0x2E23, /* IntelG45_2 */
0x2E12, /* IntelQ45_1 */
0x2E13, /* IntelQ45_2 */
0x0042, /* IntelHDGraphics */
0x0046, /* IntelMobileHDGraphics */
0x0102, /* IntelSandyBridge_1 */
0x0106, /* IntelSandyBridge_2 */
0x0112, /* IntelSandyBridge_3 */
0x0116, /* IntelSandyBridge_4 */
0x0122, /* IntelSandyBridge_5 */
0x0126, /* IntelSandyBridge_6 */
0x010A, /* IntelSandyBridge_7 */
0x0080, /* IntelIvyBridge */
0
};
// Glitches whilst scrolling (see bugs 612007, 644787, 645872)
static const PRUint32 deviceFamilyNvidiaBlockD3D9Layers[] = {
0x00f3, /* NV43 [GeForce 6200 (TM)] */
0x0146, /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
0x014f, /* NV43 [GeForce 6200 (TM)] */
0x0161, /* NV44 [GeForce 6200 TurboCache (TM)] */
0x0162, /* NV44 [GeForce 6200SE TurboCache (TM)] */
0x0163, /* NV44 [GeForce 6200 LE (TM)] */
0x0164, /* NV44 [GeForce Go 6200 (TM)] */
0x0167, /* NV43 [GeForce Go 6200/6400 (TM)] */
0x0168, /* NV43 [GeForce Go 6200/6400 (TM)] */
0x0169, /* NV44 [GeForce 6250 (TM)] */
0x0222, /* NV44 [GeForce 6200 A-LE (TM)] */
0x0240, /* C51PV [GeForce 6150 (TM)] */
0x0241, /* C51 [GeForce 6150 LE (TM)] */
0x0244, /* C51 [Geforce Go 6150 (TM)] */
0x0245, /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
0x0247, /* C51 [GeForce Go 6100 (TM)] */
0x03d0, /* C61 [GeForce 6150SE nForce 430 (TM)] */
0x03d1, /* C61 [GeForce 6100 nForce 405 (TM)] */
0x03d2, /* C61 [GeForce 6100 nForce 400 (TM)] */
0x03d5, /* C61 [GeForce 6100 nForce 420 (TM)] */
0
};
/* A zero-terminated array of devices to match, or all devices */ /* A zero-terminated array of devices to match, or all devices */
typedef PRUint32 *GfxDeviceFamily; typedef PRUint32 *GfxDeviceFamily;
@ -110,6 +218,12 @@ struct GfxDriverInfo
/* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */ /* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
PRUint64 mDriverVersion; PRUint64 mDriverVersion;
PRUint64 mDriverVersionMax; PRUint64 mDriverVersionMax;
static PRUint64 allDriverVersions;
static PRUint32 vendorIntel;
static PRUint32 vendorNVIDIA;
static PRUint32 vendorAMD;
static PRUint32 vendorATI;
const char *mSuggestedVersion; const char *mSuggestedVersion;
}; };

View File

@ -249,6 +249,10 @@ BlacklistOSToOperatingSystem(const nsAString& os)
return DRIVER_OS_OS_X_10_5; return DRIVER_OS_OS_X_10_5;
else if (os == NS_LITERAL_STRING("Darwin 10")) else if (os == NS_LITERAL_STRING("Darwin 10"))
return DRIVER_OS_OS_X_10_6; return DRIVER_OS_OS_X_10_6;
else if (os == NS_LITERAL_STRING("Darwin 11"))
return DRIVER_OS_OS_X_10_7;
else if (os == NS_LITERAL_STRING("Android"))
return DRIVER_OS_ANDROID;
else if (os == NS_LITERAL_STRING("All")) else if (os == NS_LITERAL_STRING("All"))
return DRIVER_OS_ALL; return DRIVER_OS_ALL;
@ -549,6 +553,12 @@ GfxInfoBase::Init()
return NS_OK; return NS_OK;
} }
static const GfxDriverInfo gDriverInfo[] = {
// No combinations that cause a crash on every OS.
GfxDriverInfo()
};
NS_IMETHODIMP NS_IMETHODIMP
GfxInfoBase::GetFeatureStatus(PRInt32 aFeature, PRInt32* aStatus NS_OUTPARAM) GfxInfoBase::GetFeatureStatus(PRInt32 aFeature, PRInt32* aStatus NS_OUTPARAM)
{ {
@ -559,6 +569,175 @@ GfxInfoBase::GetFeatureStatus(PRInt32 aFeature, PRInt32* aStatus NS_OUTPARAM)
return GetFeatureStatusImpl(aFeature, aStatus, version); return GetFeatureStatusImpl(aFeature, aStatus, version);
} }
nsresult
GfxInfoBase::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32* aStatus,
nsAString& aVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
{
if (*aStatus != nsIGfxInfo::FEATURE_NO_INFO) {
// Terminate now with the status determined by the derived type (OS-specific
// code).
return NS_OK;
}
OperatingSystem os = DRIVER_OS_UNKNOWN;
if (aOS)
os = *aOS;
PRUint32 adapterVendorID = 0;
PRUint32 adapterDeviceID = 0;
nsAutoString adapterDriverVersionString;
if (NS_FAILED(GetAdapterVendorID(&adapterVendorID)) ||
NS_FAILED(GetAdapterDeviceID(&adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return NS_ERROR_FAILURE;
}
PRUint64 driverVersion;
if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
#if !defined(XP_MACOSX)
return NS_ERROR_FAILURE;
#endif
}
// special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
// whitelist them, actually we do know that this combination of device and driver version
// works well.
if (os == DRIVER_OS_WINDOWS_XP &&
adapterVendorID == GfxDriverInfo::vendorNVIDIA &&
adapterDeviceID == 0x0861 && // GeForce 9400
driverVersion == V(6,14,11,7756))
{
return NS_OK;
}
PRInt32 status = *aStatus;
const GfxDriverInfo* info = aDriverInfo ? aDriverInfo : &gDriverInfo[0];
// This code will operate in two modes:
// It first loops over the driver tuples stored locally in gDriverInfo,
// then loops over it a second time for the OS's specific list to check for
// all combinations that can lead to disabling a feature.
bool loopingOverOS = false;
while (true) {
if (!info->mOperatingSystem) {
if (loopingOverOS)
break;
else
{
// Mark us as looping over the OS driver tuples.
loopingOverOS = true;
// Get the GfxDriverInfo table from the OS subclass.
info = GetGfxDriverInfo();
}
}
if (info->mOperatingSystem != DRIVER_OS_ALL &&
info->mOperatingSystem != os)
{
info++;
continue;
}
if (info->mAdapterVendor != GfxDriverInfo::allAdapterVendors &&
info->mAdapterVendor != adapterVendorID) {
info++;
continue;
}
if (info->mDevices != GfxDriverInfo::allDevices) {
bool deviceMatches = false;
for (const PRUint32 *devices = info->mDevices; *devices; ++devices) {
if (*devices == adapterDeviceID) {
deviceMatches = true;
break;
}
}
if (!deviceMatches) {
info++;
continue;
}
}
bool match = false;
#if !defined(XP_MACOSX)
switch (info->mComparisonOp) {
case DRIVER_LESS_THAN:
match = driverVersion < info->mDriverVersion;
break;
case DRIVER_LESS_THAN_OR_EQUAL:
match = driverVersion <= info->mDriverVersion;
break;
case DRIVER_GREATER_THAN:
match = driverVersion > info->mDriverVersion;
break;
case DRIVER_GREATER_THAN_OR_EQUAL:
match = driverVersion >= info->mDriverVersion;
break;
case DRIVER_EQUAL:
match = driverVersion == info->mDriverVersion;
break;
case DRIVER_NOT_EQUAL:
match = driverVersion != info->mDriverVersion;
break;
case DRIVER_BETWEEN_EXCLUSIVE:
match = driverVersion > info->mDriverVersion && driverVersion < info->mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE:
match = driverVersion >= info->mDriverVersion && driverVersion <= info->mDriverVersionMax;
break;
case DRIVER_BETWEEN_INCLUSIVE_START:
match = driverVersion >= info->mDriverVersion && driverVersion < info->mDriverVersionMax;
break;
default:
NS_WARNING("Bogus op in GfxDriverInfo");
break;
}
#else
// We don't care what driver version it was. We only check OS version and if
// the device matches.
match = true;
#endif
if (match) {
if (info->mFeature == GfxDriverInfo::allFeatures ||
info->mFeature == aFeature)
{
status = info->mFeatureStatus;
break;
}
}
info++;
}
*aStatus = status;
// Depends on Windows driver versioning. We don't pass a GfxDriverInfo object
// back to the Windows handler, so we must handle this here.
#if defined(XP_WIN)
if (status == FEATURE_BLOCKED_DRIVER_VERSION) {
if (info->mSuggestedVersion) {
aVersion.AppendPrintf("%s", info->mSuggestedVersion);
} else if (info->mComparisonOp == DRIVER_LESS_THAN &&
info->mDriverVersion != GfxDriverInfo::allDriverVersions)
{
aVersion.AppendPrintf("%lld.%lld.%lld.%lld",
(info->mDriverVersion & 0xffff000000000000) >> 48,
(info->mDriverVersion & 0x0000ffff00000000) >> 32,
(info->mDriverVersion & 0x00000000ffff0000) >> 16,
(info->mDriverVersion & 0x000000000000ffff));
}
}
#endif
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
GfxInfoBase::GetFeatureSuggestedDriverVersion(PRInt32 aFeature, GfxInfoBase::GetFeatureSuggestedDriverVersion(PRInt32 aFeature,
nsAString& aVersion NS_OUTPARAM) nsAString& aVersion NS_OUTPARAM)

View File

@ -85,6 +85,10 @@ public:
// NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return. // NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
virtual nsresult Init(); virtual nsresult Init();
// Gets the driver info table. Used by GfxInfoBase to check for general cases
// (while subclasses check for more specific ones).
virtual const GfxDriverInfo* GetGfxDriverInfo() = 0;
// only useful on X11 // only useful on X11
NS_IMETHOD_(void) GetData() { } NS_IMETHOD_(void) GetData() { }
@ -92,7 +96,8 @@ protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus, virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32* aStatus,
nsAString& aSuggestedDriverVersion, nsAString& aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull) = 0; GfxDriverInfo* aDriverInfo = nsnull,
OperatingSystem* aOS = nsnull);
private: private:

View File

@ -246,24 +246,35 @@ static inline PRUint64 version(PRUint32 major, PRUint32 minor, PRUint32 revision
return (PRUint64(major) << 32) + (PRUint64(minor) << 16) + PRUint64(revision); return (PRUint64(major) << 32) + (PRUint64(minor) << 16) + PRUint64(revision);
} }
static GfxDriverInfo gDriverInfo[] = {
GfxDriverInfo()
};
const GfxDriverInfo*
GfxInfo::GetGfxDriverInfo()
{
return &gDriverInfo[0];
}
nsresult nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo /* = nsnull */) GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
{ {
GetData(); GetData();
*aStatus = nsIGfxInfo::FEATURE_NO_INFO; *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
aSuggestedDriverVersion.SetIsVoid(true); aSuggestedDriverVersion.SetIsVoid(true);
if (aDriverInfo) {
// We don't implement the downloaded blacklist yet. Don't evaluate
// anything.
return NS_OK;
}
#ifdef MOZ_PLATFORM_MAEMO #ifdef MOZ_PLATFORM_MAEMO
// on Maemo, the glxtest probe doesn't build, and we don't really need GfxInfo anyway // on Maemo, the glxtest probe doesn't build, and we don't really need GfxInfo anyway
return NS_OK; return NS_OK;
#endif #endif
OperatingSystem os = DRIVER_OS_LINUX;
// Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance. // Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) { if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION; *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
@ -304,7 +315,11 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
// Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed. // Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
} }
return NS_OK;
if (aOS)
*aOS = os;
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
} }

View File

@ -81,7 +81,12 @@ public:
protected: protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo = nsnull); virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo = nsnull,
OperatingSystem* aOS = nsnull);
virtual const GfxDriverInfo* GetGfxDriverInfo();
private: private:
nsCString mVendor; nsCString mVendor;