зеркало из https://github.com/mozilla/pjs.git
Bug 625160 - Part 1 - Split out the DriverInfo structure into a separate file. r=jrmuizel
This commit is contained in:
Родитель
7ac7527920
Коммит
927ca0277f
|
@ -45,6 +45,7 @@
|
||||||
#include "mozilla/FunctionTimer.h"
|
#include "mozilla/FunctionTimer.h"
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
|
#include "GfxDriverInfo.h"
|
||||||
|
|
||||||
#if defined(MOZ_CRASHREPORTER) && defined(MOZ_ENABLE_LIBXUL)
|
#if defined(MOZ_CRASHREPORTER) && defined(MOZ_ENABLE_LIBXUL)
|
||||||
#include "nsExceptionHandler.h"
|
#include "nsExceptionHandler.h"
|
||||||
|
@ -395,39 +396,8 @@ GfxInfo::AddCrashReportAnnotations()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
enum VersionComparisonOp {
|
|
||||||
DRIVER_LESS_THAN, // driver < version
|
|
||||||
DRIVER_LESS_THAN_OR_EQUAL, // driver <= version
|
|
||||||
DRIVER_GREATER_THAN, // driver > version
|
|
||||||
DRIVER_GREATER_THAN_OR_EQUAL, // driver >= version
|
|
||||||
DRIVER_EQUAL, // driver == version
|
|
||||||
DRIVER_NOT_EQUAL, // driver != version
|
|
||||||
DRIVER_BETWEEN_EXCLUSIVE, // driver > version && driver < versionMax
|
|
||||||
DRIVER_BETWEEN_INCLUSIVE, // driver >= version && driver <= versionMax
|
|
||||||
DRIVER_BETWEEN_INCLUSIVE_START // driver >= version && driver < versionMax
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef const PRUint32 *GfxDeviceFamily;
|
|
||||||
|
|
||||||
struct GfxDriverInfo {
|
|
||||||
PRUint32 windowsVersion;
|
|
||||||
|
|
||||||
PRUint32 vendor;
|
|
||||||
GfxDeviceFamily devices;
|
|
||||||
|
|
||||||
PRInt32 feature;
|
|
||||||
PRInt32 featureStatus;
|
|
||||||
|
|
||||||
VersionComparisonOp op;
|
|
||||||
|
|
||||||
/* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
|
|
||||||
PRUint64 version;
|
|
||||||
PRUint64 versionMax;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const PRUint32 allWindowsVersions = 0xffffffff;
|
static const PRUint32 allWindowsVersions = 0xffffffff;
|
||||||
static const PRInt32 allFeatures = -1;
|
static const PRInt32 allFeatures = -1;
|
||||||
static const PRUint32 *allDevices = (PRUint32*) nsnull;
|
|
||||||
static const PRUint64 allDriverVersions = 0xffffffffffffffffULL;
|
static const PRUint64 allDriverVersions = 0xffffffffffffffffULL;
|
||||||
|
|
||||||
/* Intel vendor and device IDs */
|
/* Intel vendor and device IDs */
|
||||||
|
@ -437,7 +407,7 @@ static const PRUint32 vendorIntel = 0x8086;
|
||||||
|
|
||||||
/* AMD vendor and device IDs */
|
/* AMD vendor and device IDs */
|
||||||
|
|
||||||
#define V(a,b,c,d) ((PRUint64(a)<<48) | (PRUint64(b)<<32) | (PRUint64(c)<<16) | PRUint64(d))
|
#define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
|
||||||
|
|
||||||
static const PRUint32 deviceFamilyIntelGMA500[] = {
|
static const PRUint32 deviceFamilyIntelGMA500[] = {
|
||||||
0x8108, /* IntelGMA500_1 */
|
0x8108, /* IntelGMA500_1 */
|
||||||
|
@ -541,7 +511,7 @@ static const GfxDriverInfo driverInfo[] = {
|
||||||
/*
|
/*
|
||||||
* Implement special Direct2D blocklist from bug 595364
|
* Implement special Direct2D blocklist from bug 595364
|
||||||
*/
|
*/
|
||||||
{ allWindowsVersions,
|
{ DRIVER_OS_ALL,
|
||||||
vendorIntel, deviceFamilyIntelBlockDirect2D,
|
vendorIntel, deviceFamilyIntelBlockDirect2D,
|
||||||
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
|
nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
|
||||||
DRIVER_LESS_THAN, allDriverVersions },
|
DRIVER_LESS_THAN, allDriverVersions },
|
||||||
|
@ -556,34 +526,34 @@ static const GfxDriverInfo driverInfo[] = {
|
||||||
allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
|
allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
|
||||||
DRIVER_LESS_THAN, driverVer },
|
DRIVER_LESS_THAN, driverVer },
|
||||||
|
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMA500, V(6,14,11,1018))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA500, V(6,14,11,1018))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMA900, V(6,14,10,4764))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA900, V(6,14,10,4764))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMA950, V(6,14,10,4926))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA950, V(6,14,10,4926))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMA3150, V(6,14,10,5260))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMA3150, V(6,14,10,5260))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMAX3000, V(6,14,10,5218))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMAX3000, V(6,14,10,5218))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsXP, deviceFamilyIntelGMAX4500HD, V(6,14,10,5284))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_XP, deviceFamilyIntelGMAX4500HD, V(6,14,10,5284))
|
||||||
|
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsVista, deviceFamilyIntelGMA500, V(7,14,10,1006))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA500, V(7,14,10,1006))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsVista, deviceFamilyIntelGMA900, allDriverVersions)
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA900, allDriverVersions)
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsVista, deviceFamilyIntelGMA950, V(7,14,10,1504))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA950, V(7,14,10,1504))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsVista, deviceFamilyIntelGMA3150, V(7,14,10,2124))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMA3150, V(7,14,10,2124))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsVista, deviceFamilyIntelGMAX3000, V(7,15,10,1666))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX3000, V(7,15,10,1666))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindowsVista, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_VISTA, deviceFamilyIntelGMAX4500HD, V(8,15,10,2202))
|
||||||
|
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMA500, V(5,0,0,2026))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA500, V(5,0,0,2026))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMA900, allDriverVersions)
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA900, allDriverVersions)
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMA950, V(8,15,10,1930))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA950, V(8,15,10,1930))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMA3150, V(8,14,10,2117))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMA3150, V(8,14,10,2117))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, deviceFamilyIntelGMAX3000, V(8,15,10,1930))
|
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(DRIVER_OS_WINDOWS_7, deviceFamilyIntelGMAX3000, V(8,15,10,1930))
|
||||||
IMPLEMENT_INTEL_DRIVER_BLOCKLIST(gfxWindowsPlatform::kWindows7, 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 */
|
||||||
{ allWindowsVersions,
|
{ DRIVER_OS_ALL,
|
||||||
vendorIntel, allDevices,
|
vendorIntel, nsnull,
|
||||||
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
|
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
|
||||||
DRIVER_LESS_THAN, allDriverVersions },
|
DRIVER_LESS_THAN, allDriverVersions },
|
||||||
{ allWindowsVersions,
|
{ DRIVER_OS_ALL,
|
||||||
vendorIntel, allDevices,
|
vendorIntel, nsnull,
|
||||||
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
|
nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
|
||||||
DRIVER_LESS_THAN, allDriverVersions },
|
DRIVER_LESS_THAN, allDriverVersions },
|
||||||
|
|
||||||
|
@ -595,24 +565,27 @@ static const GfxDriverInfo driverInfo[] = {
|
||||||
* AMD entries
|
* AMD entries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{ 0, 0, allDevices, 0 }
|
{ (OperatingSystem)0, 0, nsnull, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static OperatingSystem
|
||||||
ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
|
WindowsVersionToOperatingSystem(PRInt32 aWindowsVersion)
|
||||||
{
|
{
|
||||||
int a, b, c, d;
|
switch(aWindowsVersion) {
|
||||||
/* honestly, why do I even bother */
|
case gfxWindowsPlatform::kWindows2000:
|
||||||
if (sscanf(nsPromiseFlatCString(NS_LossyConvertUTF16toASCII(aVersion)).get(),
|
return DRIVER_OS_WINDOWS_2000;
|
||||||
"%d.%d.%d.%d", &a, &b, &c, &d) != 4)
|
case gfxWindowsPlatform::kWindowsXP:
|
||||||
return false;
|
return DRIVER_OS_WINDOWS_XP;
|
||||||
if (a < 0 || a > 0xffff) return false;
|
case gfxWindowsPlatform::kWindowsServer2003:
|
||||||
if (b < 0 || b > 0xffff) return false;
|
return DRIVER_OS_WINDOWS_SERVER_2003;
|
||||||
if (c < 0 || c > 0xffff) return false;
|
case gfxWindowsPlatform::kWindowsVista:
|
||||||
if (d < 0 || d > 0xffff) return false;
|
return DRIVER_OS_WINDOWS_VISTA;
|
||||||
|
case gfxWindowsPlatform::kWindows7:
|
||||||
*aNumericVersion = V(a, b, c, d);
|
return DRIVER_OS_WINDOWS_7;
|
||||||
return true;
|
case gfxWindowsPlatform::kWindowsUnknown:
|
||||||
|
default:
|
||||||
|
return DRIVER_OS_UNKNOWN;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -656,24 +629,27 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GfxDriverInfo *info = &driverInfo[0];
|
OperatingSystem os = WindowsVersionToOperatingSystem(windowsVersion);
|
||||||
while (info->windowsVersion) {
|
|
||||||
|
|
||||||
if (info->windowsVersion != allWindowsVersions &&
|
const GfxDriverInfo *info = &driverInfo[0];
|
||||||
info->windowsVersion != windowsVersion)
|
while (info->mOperatingSystem) {
|
||||||
|
|
||||||
|
if (info->mOperatingSystem != DRIVER_OS_ALL &&
|
||||||
|
info->mOperatingSystem != os)
|
||||||
{
|
{
|
||||||
info++;
|
info++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->vendor != adapterVendor) {
|
if (info->mAdapterVendor != GfxDriverInfo::allAdapterVendors &&
|
||||||
|
info->mAdapterVendor != adapterVendor) {
|
||||||
info++;
|
info++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->devices != allDevices) {
|
if (info->mDevices != GfxDriverInfo::allDevices) {
|
||||||
bool deviceMatches = false;
|
bool deviceMatches = false;
|
||||||
for (const PRUint32 *devices = info->devices; *devices; ++devices) {
|
for (const PRUint32 *devices = info->mDevices; *devices; ++devices) {
|
||||||
if (*devices == adapterDeviceID) {
|
if (*devices == adapterDeviceID) {
|
||||||
deviceMatches = true;
|
deviceMatches = true;
|
||||||
break;
|
break;
|
||||||
|
@ -688,34 +664,34 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
|
||||||
|
|
||||||
bool match = false;
|
bool match = false;
|
||||||
|
|
||||||
switch (info->op) {
|
switch (info->mComparisonOp) {
|
||||||
case DRIVER_LESS_THAN:
|
case DRIVER_LESS_THAN:
|
||||||
match = driverVersion < info->version;
|
match = driverVersion < info->mDriverVersion;
|
||||||
suggestedDriverVersion = info->version;
|
suggestedDriverVersion = info->mDriverVersion;
|
||||||
break;
|
break;
|
||||||
case DRIVER_LESS_THAN_OR_EQUAL:
|
case DRIVER_LESS_THAN_OR_EQUAL:
|
||||||
match = driverVersion <= info->version;
|
match = driverVersion <= info->mDriverVersion;
|
||||||
break;
|
break;
|
||||||
case DRIVER_GREATER_THAN:
|
case DRIVER_GREATER_THAN:
|
||||||
match = driverVersion > info->version;
|
match = driverVersion > info->mDriverVersion;
|
||||||
break;
|
break;
|
||||||
case DRIVER_GREATER_THAN_OR_EQUAL:
|
case DRIVER_GREATER_THAN_OR_EQUAL:
|
||||||
match = driverVersion >= info->version;
|
match = driverVersion >= info->mDriverVersion;
|
||||||
break;
|
break;
|
||||||
case DRIVER_EQUAL:
|
case DRIVER_EQUAL:
|
||||||
match = driverVersion == info->version;
|
match = driverVersion == info->mDriverVersion;
|
||||||
break;
|
break;
|
||||||
case DRIVER_NOT_EQUAL:
|
case DRIVER_NOT_EQUAL:
|
||||||
match = driverVersion != info->version;
|
match = driverVersion != info->mDriverVersion;
|
||||||
break;
|
break;
|
||||||
case DRIVER_BETWEEN_EXCLUSIVE:
|
case DRIVER_BETWEEN_EXCLUSIVE:
|
||||||
match = driverVersion > info->version && driverVersion < info->versionMax;
|
match = driverVersion > info->mDriverVersion && driverVersion < info->mDriverVersionMax;
|
||||||
break;
|
break;
|
||||||
case DRIVER_BETWEEN_INCLUSIVE:
|
case DRIVER_BETWEEN_INCLUSIVE:
|
||||||
match = driverVersion >= info->version && driverVersion <= info->versionMax;
|
match = driverVersion >= info->mDriverVersion && driverVersion <= info->mDriverVersionMax;
|
||||||
break;
|
break;
|
||||||
case DRIVER_BETWEEN_INCLUSIVE_START:
|
case DRIVER_BETWEEN_INCLUSIVE_START:
|
||||||
match = driverVersion >= info->version && driverVersion < info->versionMax;
|
match = driverVersion >= info->mDriverVersion && driverVersion < info->mDriverVersionMax;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_WARNING("Bogus op in GfxDriverInfo");
|
NS_WARNING("Bogus op in GfxDriverInfo");
|
||||||
|
@ -723,10 +699,10 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
if (info->feature == allFeatures ||
|
if (info->mFeature == GfxDriverInfo::allFeatures ||
|
||||||
info->feature == aFeature)
|
info->mFeature == aFeature)
|
||||||
{
|
{
|
||||||
status = info->featureStatus;
|
status = info->mFeatureStatus;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Mozilla Foundation.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#include "GfxDriverInfo.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace widget {
|
||||||
|
|
||||||
|
PRUint32 GfxDriverInfo::allAdapterVendors = 0;
|
||||||
|
PRInt32 GfxDriverInfo::allFeatures = 0;
|
||||||
|
GfxDeviceFamily GfxDriverInfo::allDevices = nsnull;
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,123 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Mozilla Foundation.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#include "prtypes.h"
|
||||||
|
#include "nsPrintfCString.h"
|
||||||
|
|
||||||
|
#ifndef __mozilla_widget_GfxDriverInfo_h__
|
||||||
|
#define __mozilla_widget_GfxDriverInfo_h__
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace widget {
|
||||||
|
|
||||||
|
enum OperatingSystem {
|
||||||
|
DRIVER_OS_UNKNOWN = 0,
|
||||||
|
DRIVER_OS_WINDOWS_2000,
|
||||||
|
DRIVER_OS_WINDOWS_XP,
|
||||||
|
DRIVER_OS_WINDOWS_SERVER_2003,
|
||||||
|
DRIVER_OS_WINDOWS_VISTA,
|
||||||
|
DRIVER_OS_WINDOWS_7,
|
||||||
|
DRIVER_OS_LINUX,
|
||||||
|
DRIVER_OS_OS_X_10_5,
|
||||||
|
DRIVER_OS_OS_X_10_6,
|
||||||
|
DRIVER_OS_ALL
|
||||||
|
};
|
||||||
|
|
||||||
|
enum VersionComparisonOp {
|
||||||
|
DRIVER_LESS_THAN, // driver < version
|
||||||
|
DRIVER_LESS_THAN_OR_EQUAL, // driver <= version
|
||||||
|
DRIVER_GREATER_THAN, // driver > version
|
||||||
|
DRIVER_GREATER_THAN_OR_EQUAL, // driver >= version
|
||||||
|
DRIVER_EQUAL, // driver == version
|
||||||
|
DRIVER_NOT_EQUAL, // driver != version
|
||||||
|
DRIVER_BETWEEN_EXCLUSIVE, // driver > version && driver < versionMax
|
||||||
|
DRIVER_BETWEEN_INCLUSIVE, // driver >= version && driver <= versionMax
|
||||||
|
DRIVER_BETWEEN_INCLUSIVE_START, // driver >= version && driver < versionMax
|
||||||
|
DRIVER_UNKNOWN_COMPARISON
|
||||||
|
};
|
||||||
|
|
||||||
|
/* A zero-terminated array of devices to match, or all devices */
|
||||||
|
typedef const PRUint32 *GfxDeviceFamily;
|
||||||
|
|
||||||
|
struct GfxDriverInfo
|
||||||
|
{
|
||||||
|
OperatingSystem mOperatingSystem;
|
||||||
|
|
||||||
|
PRUint32 mAdapterVendor;
|
||||||
|
static PRUint32 allAdapterVendors;
|
||||||
|
|
||||||
|
GfxDeviceFamily mDevices;
|
||||||
|
static GfxDeviceFamily allDevices;
|
||||||
|
|
||||||
|
/* A feature from nsIGfxInfo, or all features */
|
||||||
|
PRInt32 mFeature;
|
||||||
|
static PRInt32 allFeatures;
|
||||||
|
|
||||||
|
/* A feature status from nsIGfxInfo */
|
||||||
|
PRInt32 mFeatureStatus;
|
||||||
|
|
||||||
|
VersionComparisonOp mComparisonOp;
|
||||||
|
|
||||||
|
/* versions are assumed to be A.B.C.D packed as 0xAAAABBBBCCCCDDDD */
|
||||||
|
PRUint64 mDriverVersion;
|
||||||
|
PRUint64 mDriverVersionMax;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define GFX_DRIVER_VERSION(a,b,c,d) \
|
||||||
|
((PRUint64(a)<<48) | (PRUint64(b)<<32) | (PRUint64(c)<<16) | PRUint64(d))
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
ParseDriverVersion(nsAString& aVersion, PRUint64 *aNumericVersion)
|
||||||
|
{
|
||||||
|
int a, b, c, d;
|
||||||
|
/* honestly, why do I even bother */
|
||||||
|
if (sscanf(nsPromiseFlatCString(NS_LossyConvertUTF16toASCII(aVersion)).get(),
|
||||||
|
"%d.%d.%d.%d", &a, &b, &c, &d) != 4)
|
||||||
|
return false;
|
||||||
|
if (a < 0 || a > 0xffff) return false;
|
||||||
|
if (b < 0 || b > 0xffff) return false;
|
||||||
|
if (c < 0 || c > 0xffff) return false;
|
||||||
|
if (d < 0 || d > 0xffff) return false;
|
||||||
|
|
||||||
|
*aNumericVersion = GFX_DRIVER_VERSION(a, b, c, d);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*__mozilla_widget_GfxDriverInfo_h__ */
|
|
@ -69,6 +69,7 @@ CPPSRCS = \
|
||||||
nsIdleService.cpp \
|
nsIdleService.cpp \
|
||||||
nsClipboardPrivacyHandler.cpp \
|
nsClipboardPrivacyHandler.cpp \
|
||||||
GfxInfoWebGL.cpp \
|
GfxInfoWebGL.cpp \
|
||||||
|
GfxDriverInfo.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifdef MOZ_IPC
|
ifdef MOZ_IPC
|
||||||
|
|
Загрузка…
Ссылка в новой задаче