зеркало из https://github.com/mozilla/pjs.git
Bug 678030. gfxinfo: Refactor id parsing. r=ajuma
This will make it easier to reuse when we parse subsystem ids.
This commit is contained in:
Родитель
7a1910e950
Коммит
b996f9738f
|
@ -306,7 +306,21 @@ typedef BOOL (WINAPI*SetupDiDestroyDeviceInfoListFunc)(
|
||||||
HDEVINFO DeviceInfoSet
|
HDEVINFO DeviceInfoSet
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// The device ID is a string like PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD
|
||||||
|
// this function is used to extract the id's out of it
|
||||||
|
PRUint32
|
||||||
|
ParseIDFromDeviceID(const nsAString &key, const char *prefix, int length)
|
||||||
|
{
|
||||||
|
nsAutoString id(key);
|
||||||
|
ToUpperCase(id);
|
||||||
|
PRInt32 start = id.Find(prefix);
|
||||||
|
if (start != -1) {
|
||||||
|
id.Cut(0, start + strlen(prefix));
|
||||||
|
id.Truncate(length);
|
||||||
|
}
|
||||||
|
nsresult err;
|
||||||
|
return id.ToInteger(&err, 16);
|
||||||
|
}
|
||||||
|
|
||||||
/* Other interesting places for info:
|
/* Other interesting places for info:
|
||||||
* IDXGIAdapter::GetDesc()
|
* IDXGIAdapter::GetDesc()
|
||||||
|
@ -457,42 +471,10 @@ GfxInfo::Init()
|
||||||
FreeLibrary(setupapi);
|
FreeLibrary(setupapi);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString vendor(mDeviceID);
|
mAdapterVendorID = ParseIDFromDeviceID(mDeviceID, "VEN_", 4);
|
||||||
ToUpperCase(vendor);
|
mAdapterVendorID2 = ParseIDFromDeviceID(mDeviceID2, "VEN_", 4);
|
||||||
PRInt32 start = vendor.Find(NS_LITERAL_CSTRING("VEN_"));
|
mAdapterDeviceID = ParseIDFromDeviceID(mDeviceID, "&DEV_", 4);
|
||||||
if (start != -1) {
|
mAdapterDeviceID2 = ParseIDFromDeviceID(mDeviceID2, "&DEV_", 4);
|
||||||
vendor.Cut(0, start + strlen("VEN_"));
|
|
||||||
vendor.Truncate(4);
|
|
||||||
}
|
|
||||||
nsresult err;
|
|
||||||
mAdapterVendorID = vendor.ToInteger(&err, 16);
|
|
||||||
|
|
||||||
vendor = mDeviceID2;
|
|
||||||
ToUpperCase(vendor);
|
|
||||||
start = vendor.Find(NS_LITERAL_CSTRING("VEN_"));
|
|
||||||
if (start != -1) {
|
|
||||||
vendor.Cut(0, start + strlen("VEN_"));
|
|
||||||
vendor.Truncate(4);
|
|
||||||
}
|
|
||||||
mAdapterVendorID2 = vendor.ToInteger(&err, 16);
|
|
||||||
|
|
||||||
nsAutoString device(mDeviceID);
|
|
||||||
ToUpperCase(device);
|
|
||||||
start = device.Find(NS_LITERAL_CSTRING("&DEV_"));
|
|
||||||
if (start != -1) {
|
|
||||||
device.Cut(0, start + strlen("&DEV_"));
|
|
||||||
device.Truncate(4);
|
|
||||||
}
|
|
||||||
mAdapterDeviceID = device.ToInteger(&err, 16);
|
|
||||||
|
|
||||||
device = mDeviceID2;
|
|
||||||
ToUpperCase(device);
|
|
||||||
start = device.Find(NS_LITERAL_CSTRING("&DEV_"));
|
|
||||||
if (start != -1) {
|
|
||||||
device.Cut(0, start + strlen("&DEV_"));
|
|
||||||
device.Truncate(4);
|
|
||||||
}
|
|
||||||
mAdapterDeviceID2 = device.ToInteger(&err, 16);
|
|
||||||
|
|
||||||
const char *spoofedDriverVersionString = PR_GetEnv("MOZ_GFX_SPOOF_DRIVER_VERSION");
|
const char *spoofedDriverVersionString = PR_GetEnv("MOZ_GFX_SPOOF_DRIVER_VERSION");
|
||||||
if (spoofedDriverVersionString) {
|
if (spoofedDriverVersionString) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче