2011-01-19 17:21:07 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-01-19 17:21:07 -08:00
|
|
|
|
|
|
|
#include "prtypes.h"
|
2011-07-20 19:37:31 -07:00
|
|
|
#include "nsString.h"
|
2011-01-19 17:21:07 -08:00
|
|
|
|
|
|
|
#ifndef __mozilla_widget_GfxDriverInfo_h__
|
|
|
|
#define __mozilla_widget_GfxDriverInfo_h__
|
|
|
|
|
2011-11-03 07:50:40 -07:00
|
|
|
#define V(a,b,c,d) GFX_DRIVER_VERSION(a,b,c,d)
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
// Macros for adding a blocklist item to the static list.
|
2011-12-14 21:02:59 -08:00
|
|
|
#define APPEND_TO_DRIVER_BLOCKLIST(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion, suggestedVersion) \
|
|
|
|
mDriverInfo->AppendElement(GfxDriverInfo(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion, suggestedVersion))
|
|
|
|
#define APPEND_TO_DRIVER_BLOCKLIST2(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion) \
|
|
|
|
mDriverInfo->AppendElement(GfxDriverInfo(os, vendor, devices, feature, featureStatus, driverComparator, driverVersion))
|
|
|
|
|
2011-01-19 17:21:07 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
|
|
|
enum OperatingSystem {
|
|
|
|
DRIVER_OS_UNKNOWN = 0,
|
|
|
|
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,
|
2011-11-03 07:50:40 -07:00
|
|
|
DRIVER_OS_OS_X_10_7,
|
|
|
|
DRIVER_OS_ANDROID,
|
2011-01-19 17:21:07 -08:00
|
|
|
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
|
2012-05-04 12:33:59 -07:00
|
|
|
DRIVER_COMPARISON_IGNORED
|
2011-01-19 17:21:07 -08:00
|
|
|
};
|
|
|
|
|
2011-12-14 21:02:59 -08:00
|
|
|
enum DeviceFamily {
|
|
|
|
IntelGMA500,
|
|
|
|
IntelGMA900,
|
|
|
|
IntelGMA950,
|
|
|
|
IntelGMA3150,
|
|
|
|
IntelGMAX3000,
|
|
|
|
IntelGMAX4500HD,
|
2011-12-14 21:03:01 -08:00
|
|
|
NvidiaBlockD3D9Layers,
|
2011-12-14 21:03:06 -08:00
|
|
|
RadeonX1000,
|
|
|
|
Geforce7300GT,
|
2011-12-14 21:03:01 -08:00
|
|
|
DeviceFamilyMax
|
2011-11-03 07:50:40 -07:00
|
|
|
};
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
enum DeviceVendor {
|
|
|
|
VendorAll,
|
|
|
|
VendorIntel,
|
|
|
|
VendorNVIDIA,
|
|
|
|
VendorAMD,
|
|
|
|
VendorATI,
|
|
|
|
DeviceVendorMax
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Array of devices to match, or an empty array for all devices */
|
|
|
|
typedef nsTArray<nsString> GfxDeviceFamily;
|
2011-01-19 17:21:07 -08:00
|
|
|
|
|
|
|
struct GfxDriverInfo
|
|
|
|
{
|
2011-01-19 17:33:51 -08:00
|
|
|
// If |ownDevices| is true, you are transferring ownership of the devices
|
|
|
|
// array, and it will be deleted when this GfxDriverInfo is destroyed.
|
2011-12-14 21:03:01 -08:00
|
|
|
GfxDriverInfo(OperatingSystem os, nsAString& vendor, GfxDeviceFamily* devices,
|
2011-01-19 17:33:51 -08:00
|
|
|
PRInt32 feature, PRInt32 featureStatus, VersionComparisonOp op,
|
2011-01-28 18:12:25 -08:00
|
|
|
PRUint64 driverVersion, const char *suggestedVersion = nsnull,
|
|
|
|
bool ownDevices = false);
|
2011-01-19 17:33:51 -08:00
|
|
|
|
|
|
|
GfxDriverInfo();
|
|
|
|
GfxDriverInfo(const GfxDriverInfo&);
|
|
|
|
~GfxDriverInfo();
|
|
|
|
|
2011-01-19 17:21:07 -08:00
|
|
|
OperatingSystem mOperatingSystem;
|
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
nsString mAdapterVendor;
|
2011-01-19 17:21:07 -08:00
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
static GfxDeviceFamily* const allDevices;
|
|
|
|
GfxDeviceFamily* mDevices;
|
2011-01-19 17:21:07 -08:00
|
|
|
|
2011-01-19 17:33:51 -08:00
|
|
|
// Whether the mDevices array should be deleted when this structure is
|
|
|
|
// deallocated. False by default.
|
|
|
|
bool mDeleteDevices;
|
|
|
|
|
2011-01-19 17:21:07 -08:00
|
|
|
/* 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;
|
2011-11-03 07:50:40 -07:00
|
|
|
static PRUint64 allDriverVersions;
|
|
|
|
|
2011-01-28 18:12:25 -08:00
|
|
|
const char *mSuggestedVersion;
|
2011-12-14 21:02:59 -08:00
|
|
|
|
2011-12-14 21:03:01 -08:00
|
|
|
static const GfxDeviceFamily* GetDeviceFamily(DeviceFamily id);
|
|
|
|
static GfxDeviceFamily* mDeviceFamilies[DeviceFamilyMax];
|
|
|
|
|
|
|
|
static const nsAString& GetDeviceVendor(DeviceVendor id);
|
|
|
|
static nsAString* mDeviceVendors[DeviceVendorMax];
|
2011-01-19 17:21:07 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
#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)
|
|
|
|
{
|
2011-12-14 21:03:03 -08:00
|
|
|
#if defined(XP_WIN)
|
2011-01-19 17:21:07 -08:00
|
|
|
int a, b, c, d;
|
|
|
|
/* honestly, why do I even bother */
|
2011-06-22 13:52:09 -07:00
|
|
|
if (sscanf(NS_LossyConvertUTF16toASCII(aVersion).get(),
|
2011-01-19 17:21:07 -08:00
|
|
|
"%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);
|
2011-12-14 21:03:03 -08:00
|
|
|
#elif defined(ANDROID)
|
|
|
|
// Can't use aVersion.ToInteger() because that's not compiled into our code
|
|
|
|
// unless we have XPCOM_GLUE_AVOID_NSPR disabled.
|
|
|
|
*aNumericVersion = atoi(NS_LossyConvertUTF16toASCII(aVersion).get());
|
|
|
|
#endif
|
2011-01-19 17:21:07 -08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-01-20 00:38:05 -08:00
|
|
|
}
|
|
|
|
}
|
2011-01-19 17:21:07 -08:00
|
|
|
|
|
|
|
#endif /*__mozilla_widget_GfxDriverInfo_h__ */
|