From 3b89d87219e44f294aba8a13fb67bb1d82c69b88 Mon Sep 17 00:00:00 2001 From: Doug Sherk Date: Tue, 21 Feb 2012 14:49:06 -0500 Subject: [PATCH] Bug 711656: potentially fixed devices not being caught by blocklist, r=joe This doesn't necessarily fix the bug, but I think the problem was that the device IDs were in upper case but we store them statically in lower case, all the while using case-sensitive comparators. This patch switches all comparators that I could find to use case-insensitive instead, hopefully solving this. --- widget/cocoa/GfxInfo.mm | 2 +- widget/windows/GfxInfo.cpp | 10 +++++----- widget/xpwidgets/GfxInfoBase.cpp | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/widget/cocoa/GfxInfo.mm b/widget/cocoa/GfxInfo.mm index 73d579e23e2..86ab4cea1aa 100644 --- a/widget/cocoa/GfxInfo.mm +++ b/widget/cocoa/GfxInfo.mm @@ -450,7 +450,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) { // Blacklist all ATI cards on OSX, except for // 0x6760 and 0x9488 - if (mAdapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorATI) && + if (mAdapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) && (mAdapterDeviceID.LowerCaseEqualsLiteral("0x6760") || mAdapterDeviceID.LowerCaseEqualsLiteral("0x9488"))) { *aStatus = nsIGfxInfo::FEATURE_NO_INFO; diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 10d281d6690..8d273210069 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -963,10 +963,10 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, return NS_ERROR_FAILURE; } - if (adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorIntel) && - adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) && - adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorAMD) && - adapterVendorID != GfxDriverInfo::GetDeviceVendor(VendorATI) && + if (!adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorIntel), nsCaseInsensitiveStringComparator()) && + !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) && + !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorAMD), nsCaseInsensitiveStringComparator()) && + !adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorATI), nsCaseInsensitiveStringComparator()) && // 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 // intel/ati/nvidia. @@ -988,7 +988,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, // whitelist them, actually we do know that this combination of device and driver version // works well. if (mWindowsVersion == gfxWindowsPlatform::kWindowsXP && - adapterVendorID == GfxDriverInfo::GetDeviceVendor(VendorNVIDIA) && + adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), nsCaseInsensitiveStringComparator()) && adapterDeviceID.LowerCaseEqualsLiteral("0x0861") && // GeForce 9400 driverVersion == V(6,14,11,7756)) { diff --git a/widget/xpwidgets/GfxInfoBase.cpp b/widget/xpwidgets/GfxInfoBase.cpp index 376e8bc9a36..e8b35c2aa5c 100644 --- a/widget/xpwidgets/GfxInfoBase.cpp +++ b/widget/xpwidgets/GfxInfoBase.cpp @@ -47,6 +47,7 @@ #include "nsCOMArray.h" #include "nsAutoPtr.h" #include "nsString.h" +#include "nsUnicharUtils.h" #include "mozilla/Services.h" #include "mozilla/Observer.h" #include "nsIObserver.h" @@ -643,15 +644,15 @@ GfxInfoBase::FindBlocklistedDeviceInList(const nsTArray& info, continue; } - if (info[i].mAdapterVendor != GfxDriverInfo::GetDeviceVendor(VendorAll) && - info[i].mAdapterVendor != adapterVendorID) { + if (!info[i].mAdapterVendor.Equals(GfxDriverInfo::GetDeviceVendor(VendorAll), nsCaseInsensitiveStringComparator()) && + !info[i].mAdapterVendor.Equals(adapterVendorID, nsCaseInsensitiveStringComparator())) { continue; } if (info[i].mDevices != GfxDriverInfo::allDevices && info[i].mDevices->Length()) { bool deviceMatches = false; for (PRUint32 j = 0; j < info[i].mDevices->Length(); j++) { - if ((*info[i].mDevices)[j] == adapterDeviceID) { + if ((*info[i].mDevices)[j].Equals(adapterDeviceID, nsCaseInsensitiveStringComparator())) { deviceMatches = true; break; }