Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / widget / windows / GfxInfo.cpp
blob63e520881feed02b4ef023754d4632717f089666
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "GfxInfo.h"
8 #include "gfxConfig.h"
9 #include "GfxDriverInfo.h"
10 #include "gfxWindowsPlatform.h"
11 #include "jsapi.h"
12 #include "js/PropertyAndElement.h" // JS_SetElement, JS_SetProperty
13 #include "nsExceptionHandler.h"
14 #include "nsPrintfCString.h"
15 #include "nsUnicharUtils.h"
16 #include "prenv.h"
17 #include "prprf.h"
18 #include "xpcpublic.h"
20 #include "mozilla/Components.h"
21 #include "mozilla/Preferences.h"
22 #include "mozilla/gfx/DeviceManagerDx.h"
23 #include "mozilla/gfx/Logging.h"
24 #include "mozilla/SSE.h"
25 #include "mozilla/ArrayUtils.h"
26 #include "mozilla/Unused.h"
27 #include "mozilla/WindowsProcessMitigations.h"
29 #include <intrin.h>
30 #include <windows.h>
31 #include <devguid.h> // for GUID_DEVCLASS_BATTERY
32 #include <setupapi.h> // for SetupDi*
33 #include <winioctl.h> // for IOCTL_*
34 #include <batclass.h> // for BATTERY_*
36 using namespace mozilla;
37 using namespace mozilla::gfx;
38 using namespace mozilla::widget;
40 #ifdef DEBUG
41 NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
42 #endif
44 static void AssertNotWin32kLockdown() {
45 // Check that we are not in Win32k lockdown
46 MOZ_DIAGNOSTIC_ASSERT(!IsWin32kLockedDown(),
47 "Invalid Windows GfxInfo API with Win32k lockdown");
50 /* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after
51 * gfxPlatform initialization has occurred because they depend on it for
52 * information. (See bug 591561) */
53 nsresult GfxInfo::GetD2DEnabled(bool* aEnabled) {
54 // Telemetry queries this during XPCOM initialization, and there's no
55 // gfxPlatform by then. Just bail out if gfxPlatform isn't initialized.
56 if (!gfxPlatform::Initialized()) {
57 *aEnabled = false;
58 return NS_OK;
61 // We check gfxConfig rather than the actual render mode, since the UI
62 // process does not use Direct2D if the GPU process is enabled. However,
63 // content processes can still use Direct2D.
64 *aEnabled = gfx::gfxConfig::IsEnabled(gfx::Feature::DIRECT2D);
65 return NS_OK;
68 nsresult GfxInfo::GetDWriteEnabled(bool* aEnabled) {
69 *aEnabled = gfxWindowsPlatform::GetPlatform()->DWriteEnabled();
70 return NS_OK;
73 NS_IMETHODIMP
74 GfxInfo::GetDWriteVersion(nsAString& aDwriteVersion) {
75 gfxWindowsPlatform::GetDLLVersion(L"dwrite.dll", aDwriteVersion);
76 return NS_OK;
79 NS_IMETHODIMP
80 GfxInfo::GetHasBattery(bool* aHasBattery) {
81 AssertNotWin32kLockdown();
83 *aHasBattery = mHasBattery;
84 return NS_OK;
87 NS_IMETHODIMP
88 GfxInfo::GetEmbeddedInFirefoxReality(bool* aEmbeddedInFirefoxReality) {
89 *aEmbeddedInFirefoxReality = gfxVars::FxREmbedded();
90 return NS_OK;
93 #define PIXEL_STRUCT_RGB 1
94 #define PIXEL_STRUCT_BGR 2
96 NS_IMETHODIMP
97 GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
98 nsTArray<ClearTypeParameterInfo> clearTypeParams;
100 gfxWindowsPlatform::GetPlatform()->GetCleartypeParams(clearTypeParams);
101 uint32_t d, numDisplays = clearTypeParams.Length();
102 bool displayNames = (numDisplays > 1);
103 bool foundData = false;
104 nsString outStr;
106 for (d = 0; d < numDisplays; d++) {
107 ClearTypeParameterInfo& params = clearTypeParams[d];
109 if (displayNames) {
110 outStr.AppendPrintf("%S [ ", params.displayName.getW());
113 if (params.gamma >= 0) {
114 foundData = true;
115 outStr.AppendPrintf("Gamma: %.4g ", params.gamma / 1000.0);
118 if (params.pixelStructure >= 0) {
119 foundData = true;
120 if (params.pixelStructure == PIXEL_STRUCT_RGB ||
121 params.pixelStructure == PIXEL_STRUCT_BGR) {
122 outStr.AppendPrintf(
123 "Pixel Structure: %s ",
124 (params.pixelStructure == PIXEL_STRUCT_RGB ? "RGB" : "BGR"));
125 } else {
126 outStr.AppendPrintf("Pixel Structure: %d ", params.pixelStructure);
130 if (params.clearTypeLevel >= 0) {
131 foundData = true;
132 outStr.AppendPrintf("ClearType Level: %d ", params.clearTypeLevel);
135 if (params.enhancedContrast >= 0) {
136 foundData = true;
137 outStr.AppendPrintf("Enhanced Contrast: %d ", params.enhancedContrast);
140 if (displayNames) {
141 outStr.Append(u"] ");
145 if (foundData) {
146 aCleartypeParams.Assign(outStr);
147 return NS_OK;
149 return NS_ERROR_FAILURE;
152 NS_IMETHODIMP
153 GfxInfo::GetWindowProtocol(nsAString& aWindowProtocol) {
154 return NS_ERROR_NOT_IMPLEMENTED;
157 NS_IMETHODIMP
158 GfxInfo::GetTestType(nsAString& aTestType) { return NS_ERROR_NOT_IMPLEMENTED; }
160 static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
161 uint32_t& destValue, int type) {
162 MOZ_ASSERT(type == REG_DWORD || type == REG_QWORD);
163 HKEY key;
164 DWORD dwcbData;
165 DWORD dValue;
166 DWORD resultType;
167 LONG result;
168 nsresult retval = NS_OK;
170 result =
171 RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyLocation, 0, KEY_QUERY_VALUE, &key);
172 if (result != ERROR_SUCCESS) {
173 return NS_ERROR_FAILURE;
176 switch (type) {
177 case REG_DWORD: {
178 // We only use this for vram size
179 dwcbData = sizeof(dValue);
180 result = RegQueryValueExW(key, keyName, nullptr, &resultType,
181 (LPBYTE)&dValue, &dwcbData);
182 if (result == ERROR_SUCCESS && resultType == REG_DWORD) {
183 destValue = (uint32_t)(dValue / 1024 / 1024);
184 } else {
185 retval = NS_ERROR_FAILURE;
187 break;
189 case REG_QWORD: {
190 // We only use this for vram size
191 LONGLONG qValue;
192 dwcbData = sizeof(qValue);
193 result = RegQueryValueExW(key, keyName, nullptr, &resultType,
194 (LPBYTE)&qValue, &dwcbData);
195 if (result == ERROR_SUCCESS && resultType == REG_QWORD) {
196 destValue = (uint32_t)(qValue / 1024 / 1024);
197 } else {
198 retval = NS_ERROR_FAILURE;
200 break;
203 RegCloseKey(key);
205 return retval;
208 static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName,
209 nsAString& destString, int type) {
210 MOZ_ASSERT(type == REG_MULTI_SZ);
212 HKEY key;
213 DWORD dwcbData;
214 DWORD resultType;
215 LONG result;
216 nsresult retval = NS_OK;
218 result =
219 RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyLocation, 0, KEY_QUERY_VALUE, &key);
220 if (result != ERROR_SUCCESS) {
221 return NS_ERROR_FAILURE;
224 // A chain of null-separated strings; we convert the nulls to spaces
225 WCHAR wCharValue[1024];
226 dwcbData = sizeof(wCharValue);
228 result = RegQueryValueExW(key, keyName, nullptr, &resultType,
229 (LPBYTE)wCharValue, &dwcbData);
230 if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ) {
231 // This bit here could probably be cleaner.
232 bool isValid = false;
234 DWORD strLen = dwcbData / sizeof(wCharValue[0]);
235 for (DWORD i = 0; i < strLen; i++) {
236 if (wCharValue[i] == '\0') {
237 if (i < strLen - 1 && wCharValue[i + 1] == '\0') {
238 isValid = true;
239 break;
240 } else {
241 wCharValue[i] = ' ';
246 // ensure wCharValue is null terminated
247 wCharValue[strLen - 1] = '\0';
249 if (isValid) destString = wCharValue;
251 } else {
252 retval = NS_ERROR_FAILURE;
255 RegCloseKey(key);
257 return retval;
260 static nsresult GetKeyValues(const WCHAR* keyLocation, const WCHAR* keyName,
261 nsTArray<nsString>& destStrings) {
262 // First ask for the size of the value
263 DWORD size;
264 LONG rv = RegGetValueW(HKEY_LOCAL_MACHINE, keyLocation, keyName,
265 RRF_RT_REG_MULTI_SZ, nullptr, nullptr, &size);
266 if (rv != ERROR_SUCCESS) {
267 return NS_ERROR_FAILURE;
270 // Create a buffer with the proper size and retrieve the value
271 WCHAR* wCharValue = new WCHAR[size / sizeof(WCHAR)];
272 rv = RegGetValueW(HKEY_LOCAL_MACHINE, keyLocation, keyName,
273 RRF_RT_REG_MULTI_SZ, nullptr, (LPBYTE)wCharValue, &size);
274 if (rv != ERROR_SUCCESS) {
275 delete[] wCharValue;
276 return NS_ERROR_FAILURE;
279 // The value is a sequence of null-terminated strings, usually terminated by
280 // an empty string (\0). RegGetValue ensures that the value is properly
281 // terminated with a null character.
282 DWORD i = 0;
283 DWORD strLen = size / sizeof(WCHAR);
284 while (i < strLen) {
285 nsString value(wCharValue + i);
286 if (!value.IsEmpty()) {
287 destStrings.AppendElement(value);
289 i += value.Length() + 1;
291 delete[] wCharValue;
293 return NS_OK;
296 // The device ID is a string like PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD
297 // this function is used to extract the id's out of it
298 uint32_t ParseIDFromDeviceID(const nsAString& key, const nsAString& prefix,
299 int length) {
300 nsAutoString id(key);
301 ToUpperCase(id);
302 int32_t start = id.Find(prefix);
303 if (start != -1) {
304 id.Cut(0, start + prefix.Length());
305 id.Truncate(length);
307 if (id.Equals(L"QCOM", nsCaseInsensitiveStringComparator)) {
308 // String format assumptions are broken, so use a Qualcomm PCI Vendor ID
309 // for now. See also GfxDriverInfo::GetDeviceVendor.
310 return 0x5143;
312 nsresult err;
313 return id.ToUnsignedInteger(&err, 16);
316 // OS version in 16.16 major/minor form
317 // based on http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx
318 enum {
319 kWindowsUnknown = 0,
320 kWindows7 = 0x60001,
321 kWindows8 = 0x60002,
322 kWindows8_1 = 0x60003,
323 kWindows10 = 0xA0000
326 static bool HasBattery() {
327 // Helper classes to manage lifetimes of Windows structs.
328 class MOZ_STACK_CLASS HDevInfoHolder final {
329 public:
330 explicit HDevInfoHolder(HDEVINFO aHandle) : mHandle(aHandle) {}
332 ~HDevInfoHolder() { ::SetupDiDestroyDeviceInfoList(mHandle); }
334 private:
335 HDEVINFO mHandle;
338 class MOZ_STACK_CLASS HandleHolder final {
339 public:
340 explicit HandleHolder(HANDLE aHandle) : mHandle(aHandle) {}
342 ~HandleHolder() { ::CloseHandle(mHandle); }
344 private:
345 HANDLE mHandle;
348 HDEVINFO hdev =
349 ::SetupDiGetClassDevs(&GUID_DEVCLASS_BATTERY, nullptr, nullptr,
350 DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
351 if (hdev == INVALID_HANDLE_VALUE) {
352 return true;
355 HDevInfoHolder hdevHolder(hdev);
357 DWORD i = 0;
358 SP_DEVICE_INTERFACE_DATA did = {0};
359 did.cbSize = sizeof(did);
361 while (::SetupDiEnumDeviceInterfaces(hdev, nullptr, &GUID_DEVCLASS_BATTERY, i,
362 &did)) {
363 DWORD bufferSize = 0;
364 ::SetupDiGetDeviceInterfaceDetail(hdev, &did, nullptr, 0, &bufferSize,
365 nullptr);
366 if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
367 return true;
370 UniquePtr<uint8_t[]> buffer(new (std::nothrow) uint8_t[bufferSize]);
371 if (!buffer) {
372 return true;
375 PSP_DEVICE_INTERFACE_DETAIL_DATA pdidd =
376 reinterpret_cast<PSP_DEVICE_INTERFACE_DETAIL_DATA>(buffer.get());
377 pdidd->cbSize = sizeof(*pdidd);
378 if (!::SetupDiGetDeviceInterfaceDetail(hdev, &did, pdidd, bufferSize,
379 &bufferSize, nullptr)) {
380 return true;
383 HANDLE hbat = ::CreateFile(pdidd->DevicePath, GENERIC_READ | GENERIC_WRITE,
384 FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
385 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
386 if (hbat == INVALID_HANDLE_VALUE) {
387 return true;
390 HandleHolder hbatHolder(hbat);
392 BATTERY_QUERY_INFORMATION bqi = {0};
393 DWORD dwWait = 0;
394 DWORD dwOut;
396 // We need the tag to query the information below.
397 if (!::DeviceIoControl(hbat, IOCTL_BATTERY_QUERY_TAG, &dwWait,
398 sizeof(dwWait), &bqi.BatteryTag,
399 sizeof(bqi.BatteryTag), &dwOut, nullptr) ||
400 !bqi.BatteryTag) {
401 return true;
404 BATTERY_INFORMATION bi = {0};
405 bqi.InformationLevel = BatteryInformation;
407 if (!::DeviceIoControl(hbat, IOCTL_BATTERY_QUERY_INFORMATION, &bqi,
408 sizeof(bqi), &bi, sizeof(bi), &dwOut, nullptr)) {
409 return true;
412 // If a battery intended for general use (i.e. system use) is not a UPS
413 // (i.e. short term), then we know for certain we have a battery.
414 if ((bi.Capabilities & BATTERY_SYSTEM_BATTERY) &&
415 !(bi.Capabilities & BATTERY_IS_SHORT_TERM)) {
416 return true;
419 // Otherwise we check the next battery.
420 ++i;
423 // If we fail to enumerate because there are no more batteries to check, then
424 // we can safely say there are indeed no system batteries.
425 return ::GetLastError() != ERROR_NO_MORE_ITEMS;
428 /* Other interesting places for info:
429 * IDXGIAdapter::GetDesc()
430 * IDirectDraw7::GetAvailableVidMem()
431 * e->GetAvailableTextureMem()
432 * */
434 #define DEVICE_KEY_PREFIX L"\\Registry\\Machine\\"
435 nsresult GfxInfo::Init() {
436 nsresult rv = GfxInfoBase::Init();
438 // If we are locked down in a content process, we can't call any of the
439 // Win32k APIs below. Any method that accesses members of this class should
440 // assert that it's not used in content
441 if (IsWin32kLockedDown()) {
442 return rv;
445 mHasBattery = HasBattery();
447 DISPLAY_DEVICEW displayDevice;
448 displayDevice.cb = sizeof(displayDevice);
449 int deviceIndex = 0;
451 const char* spoofedWindowsVersion =
452 PR_GetEnv("MOZ_GFX_SPOOF_WINDOWS_VERSION");
453 if (spoofedWindowsVersion) {
454 Unused << PR_sscanf(spoofedWindowsVersion, "%x,%u", &mWindowsVersion,
455 &mWindowsBuildNumber);
456 } else {
457 OSVERSIONINFO vinfo;
458 vinfo.dwOSVersionInfoSize = sizeof(vinfo);
459 #ifdef _MSC_VER
460 # pragma warning(push)
461 # pragma warning(disable : 4996)
462 #endif
463 if (!GetVersionEx(&vinfo)) {
464 #ifdef _MSC_VER
465 # pragma warning(pop)
466 #endif
467 mWindowsVersion = kWindowsUnknown;
468 } else {
469 mWindowsVersion =
470 int32_t(vinfo.dwMajorVersion << 16) + vinfo.dwMinorVersion;
471 mWindowsBuildNumber = vinfo.dwBuildNumber;
475 mDeviceKeyDebug = u"PrimarySearch"_ns;
477 while (EnumDisplayDevicesW(nullptr, deviceIndex, &displayDevice, 0)) {
478 if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
479 mDeviceKeyDebug = u"NullSearch"_ns;
480 break;
482 deviceIndex++;
485 // make sure the string is nullptr terminated
486 if (wcsnlen(displayDevice.DeviceKey, std::size(displayDevice.DeviceKey)) ==
487 std::size(displayDevice.DeviceKey)) {
488 // we did not find a nullptr
489 return rv;
492 mDeviceKeyDebug = displayDevice.DeviceKey;
494 /* DeviceKey is "reserved" according to MSDN so we'll be careful with it */
495 /* check that DeviceKey begins with DEVICE_KEY_PREFIX */
496 /* some systems have a DeviceKey starting with \REGISTRY\Machine\ so we need
497 * to compare case insenstively */
498 /* If the device key is empty, we are most likely in a remote desktop
499 * environment. In this case we set the devicekey to an empty string so
500 * it can be handled later.
502 if (displayDevice.DeviceKey[0] != '\0') {
503 if (_wcsnicmp(displayDevice.DeviceKey, DEVICE_KEY_PREFIX,
504 std::size(DEVICE_KEY_PREFIX) - 1) != 0) {
505 return rv;
508 // chop off DEVICE_KEY_PREFIX
509 mDeviceKey[0] = displayDevice.DeviceKey + std::size(DEVICE_KEY_PREFIX) - 1;
510 } else {
511 mDeviceKey[0].Truncate();
514 mDeviceID[0] = displayDevice.DeviceID;
515 mDeviceString[0] = displayDevice.DeviceString;
517 // On Windows 8 and Server 2012 hosts, we want to not block RDP
518 // sessions from attempting hardware acceleration. RemoteFX
519 // provides features and functionaltiy that can give a good D3D10 +
520 // D2D + DirectWrite experience emulated via a software GPU.
522 // Unfortunately, the Device ID is nullptr, and we can't enumerate
523 // it using the setup infrastructure (SetupDiGetClassDevsW below
524 // will return INVALID_HANDLE_VALUE).
525 UINT flags = DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES;
526 if (mWindowsVersion >= kWindows8 && mDeviceID[0].Length() == 0 &&
527 mDeviceString[0].EqualsLiteral("RDPUDD Chained DD")) {
528 WCHAR sysdir[255];
529 UINT len = GetSystemDirectory(sysdir, sizeof(sysdir));
530 if (len < sizeof(sysdir)) {
531 nsString rdpudd(sysdir);
532 rdpudd.AppendLiteral("\\rdpudd.dll");
533 gfxWindowsPlatform::GetDLLVersion(rdpudd.BeginReading(),
534 mDriverVersion[0]);
535 mDriverDate[0].AssignLiteral("01-01-1970");
537 // 0x1414 is Microsoft; 0xfefe is an invented (and unused) code
538 mDeviceID[0].AssignLiteral("PCI\\VEN_1414&DEV_FEFE&SUBSYS_00000000");
539 flags |= DIGCF_DEVICEINTERFACE;
543 /* create a device information set composed of the current display device */
544 HDEVINFO devinfo =
545 SetupDiGetClassDevsW(nullptr, mDeviceID[0].get(), nullptr, flags);
547 if (devinfo != INVALID_HANDLE_VALUE) {
548 HKEY key;
549 LONG result;
550 WCHAR value[255];
551 DWORD dwcbData;
552 SP_DEVINFO_DATA devinfoData;
553 DWORD memberIndex = 0;
555 devinfoData.cbSize = sizeof(devinfoData);
556 constexpr auto driverKeyPre =
557 u"System\\CurrentControlSet\\Control\\Class\\"_ns;
558 /* enumerate device information elements in the device information set */
559 while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
560 /* get a string that identifies the device's driver key */
561 if (SetupDiGetDeviceRegistryPropertyW(devinfo, &devinfoData, SPDRP_DRIVER,
562 nullptr, (PBYTE)value,
563 sizeof(value), nullptr)) {
564 nsAutoString driverKey(driverKeyPre);
565 driverKey += value;
566 result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.get(), 0,
567 KEY_QUERY_VALUE, &key);
568 if (result == ERROR_SUCCESS) {
569 /* we've found the driver we're looking for */
570 dwcbData = sizeof(value);
571 result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
572 (LPBYTE)value, &dwcbData);
573 if (result == ERROR_SUCCESS) {
574 mDriverVersion[0] = value;
575 } else {
576 // If the entry wasn't found, assume the worst (0.0.0.0).
577 mDriverVersion[0].AssignLiteral("0.0.0.0");
579 dwcbData = sizeof(value);
580 result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
581 (LPBYTE)value, &dwcbData);
582 if (result == ERROR_SUCCESS) {
583 mDriverDate[0] = value;
584 } else {
585 // Again, assume the worst
586 mDriverDate[0].AssignLiteral("01-01-1970");
588 RegCloseKey(key);
589 break;
594 SetupDiDestroyDeviceInfoList(devinfo);
597 // It is convenient to have these as integers
598 uint32_t adapterVendorID[2] = {0, 0};
599 uint32_t adapterDeviceID[2] = {0, 0};
600 uint32_t adapterSubsysID[2] = {0, 0};
602 adapterVendorID[0] = ParseIDFromDeviceID(mDeviceID[0], u"VEN_"_ns, 4);
603 adapterDeviceID[0] = ParseIDFromDeviceID(mDeviceID[0], u"&DEV_"_ns, 4);
604 adapterSubsysID[0] = ParseIDFromDeviceID(mDeviceID[0], u"&SUBSYS_"_ns, 8);
606 // Sometimes we don't get the valid device using this method. For now,
607 // allow zero vendor or device as valid, as long as the other value is
608 // non-zero.
609 bool foundValidDevice = (adapterVendorID[0] != 0 || adapterDeviceID[0] != 0);
611 // We now check for second display adapter. If we didn't find the valid
612 // device using the original approach, we will try the alternative.
614 // Device interface class for display adapters.
615 CLSID GUID_DISPLAY_DEVICE_ARRIVAL;
616 HRESULT hresult = CLSIDFromString(L"{1CA05180-A699-450A-9A0C-DE4FBE3DDD89}",
617 &GUID_DISPLAY_DEVICE_ARRIVAL);
618 if (hresult == NOERROR) {
619 devinfo =
620 SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL, nullptr, nullptr,
621 DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
623 if (devinfo != INVALID_HANDLE_VALUE) {
624 HKEY key;
625 LONG result;
626 WCHAR value[255];
627 DWORD dwcbData;
628 SP_DEVINFO_DATA devinfoData;
629 DWORD memberIndex = 0;
630 devinfoData.cbSize = sizeof(devinfoData);
632 nsAutoString adapterDriver2;
633 nsAutoString deviceID2;
634 nsAutoString driverVersion2;
635 nsAutoString driverDate2;
637 constexpr auto driverKeyPre =
638 u"System\\CurrentControlSet\\Control\\Class\\"_ns;
639 /* enumerate device information elements in the device information set */
640 while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
641 /* get a string that identifies the device's driver key */
642 if (SetupDiGetDeviceRegistryPropertyW(
643 devinfo, &devinfoData, SPDRP_DRIVER, nullptr, (PBYTE)value,
644 sizeof(value), nullptr)) {
645 nsAutoString driverKey2(driverKeyPre);
646 driverKey2 += value;
647 result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey2.get(), 0,
648 KEY_QUERY_VALUE, &key);
649 if (result == ERROR_SUCCESS) {
650 dwcbData = sizeof(value);
651 result = RegQueryValueExW(key, L"MatchingDeviceId", nullptr,
652 nullptr, (LPBYTE)value, &dwcbData);
653 if (result != ERROR_SUCCESS) {
654 continue;
656 deviceID2 = value;
657 adapterVendorID[1] = ParseIDFromDeviceID(deviceID2, u"VEN_"_ns, 4);
658 adapterDeviceID[1] = ParseIDFromDeviceID(deviceID2, u"&DEV_"_ns, 4);
659 // Skip the devices we already considered, as well as any
660 // "zero" ones.
661 if ((adapterVendorID[0] == adapterVendorID[1] &&
662 adapterDeviceID[0] == adapterDeviceID[1]) ||
663 (adapterVendorID[1] == 0 && adapterDeviceID[1] == 0)) {
664 RegCloseKey(key);
665 continue;
668 // If this device is missing driver information, it is unlikely to
669 // be a real display adapter.
670 if (NS_FAILED(GetKeyValue(driverKey2.get(),
671 L"InstalledDisplayDrivers",
672 adapterDriver2, REG_MULTI_SZ))) {
673 RegCloseKey(key);
674 continue;
676 dwcbData = sizeof(value);
677 result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
678 (LPBYTE)value, &dwcbData);
679 if (result != ERROR_SUCCESS) {
680 RegCloseKey(key);
681 continue;
683 driverVersion2 = value;
684 dwcbData = sizeof(value);
685 result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
686 (LPBYTE)value, &dwcbData);
687 if (result != ERROR_SUCCESS) {
688 RegCloseKey(key);
689 continue;
691 driverDate2 = value;
692 dwcbData = sizeof(value);
693 result = RegQueryValueExW(key, L"Device Description", nullptr,
694 nullptr, (LPBYTE)value, &dwcbData);
695 if (result != ERROR_SUCCESS) {
696 dwcbData = sizeof(value);
697 result = RegQueryValueExW(key, L"DriverDesc", nullptr, nullptr,
698 (LPBYTE)value, &dwcbData);
700 RegCloseKey(key);
701 if (result == ERROR_SUCCESS) {
702 // If we didn't find a valid device with the original method
703 // take this one, and continue looking for the second GPU.
704 if (!foundValidDevice) {
705 foundValidDevice = true;
706 adapterVendorID[0] = adapterVendorID[1];
707 adapterDeviceID[0] = adapterDeviceID[1];
708 mDeviceString[0] = value;
709 mDeviceID[0] = deviceID2;
710 mDeviceKey[0] = driverKey2;
711 mDriverVersion[0] = driverVersion2;
712 mDriverDate[0] = driverDate2;
713 adapterSubsysID[0] =
714 ParseIDFromDeviceID(mDeviceID[0], u"&SUBSYS_"_ns, 8);
715 continue;
718 mHasDualGPU = true;
719 mDeviceString[1] = value;
720 mDeviceID[1] = deviceID2;
721 mDeviceKey[1] = driverKey2;
722 mDriverVersion[1] = driverVersion2;
723 mDriverDate[1] = driverDate2;
724 adapterSubsysID[1] =
725 ParseIDFromDeviceID(mDeviceID[1], u"&SUBSYS_"_ns, 8);
726 mAdapterVendorID[1].AppendPrintf("0x%04x", adapterVendorID[1]);
727 mAdapterDeviceID[1].AppendPrintf("0x%04x", adapterDeviceID[1]);
728 mAdapterSubsysID[1].AppendPrintf("%08x", adapterSubsysID[1]);
729 break;
735 SetupDiDestroyDeviceInfoList(devinfo);
739 mAdapterVendorID[0].AppendPrintf("0x%04x", adapterVendorID[0]);
740 mAdapterDeviceID[0].AppendPrintf("0x%04x", adapterDeviceID[0]);
741 mAdapterSubsysID[0].AppendPrintf("%08x", adapterSubsysID[0]);
743 // Sometimes, the enumeration is not quite right and the two adapters
744 // end up being swapped. Actually enumerate the adapters that come
745 // back from the DXGI factory to check, and tag the second as active
746 // if found.
747 if (mHasDualGPU) {
748 nsModuleHandle dxgiModule(LoadLibrarySystem32(L"dxgi.dll"));
749 decltype(CreateDXGIFactory)* createDXGIFactory =
750 (decltype(CreateDXGIFactory)*)GetProcAddress(dxgiModule,
751 "CreateDXGIFactory");
753 if (createDXGIFactory) {
754 RefPtr<IDXGIFactory> factory = nullptr;
755 createDXGIFactory(__uuidof(IDXGIFactory), (void**)(&factory));
756 if (factory) {
757 RefPtr<IDXGIAdapter> adapter;
758 if (SUCCEEDED(factory->EnumAdapters(0, getter_AddRefs(adapter)))) {
759 DXGI_ADAPTER_DESC desc;
760 PodZero(&desc);
761 if (SUCCEEDED(adapter->GetDesc(&desc))) {
762 if (desc.VendorId != adapterVendorID[0] &&
763 desc.DeviceId != adapterDeviceID[0] &&
764 desc.VendorId == adapterVendorID[1] &&
765 desc.DeviceId == adapterDeviceID[1]) {
766 mActiveGPUIndex = 1;
774 mHasDriverVersionMismatch = false;
775 if (mAdapterVendorID[mActiveGPUIndex] ==
776 GfxDriverInfo::GetDeviceVendor(DeviceVendor::Intel)) {
777 // we've had big crashers (bugs 590373 and 595364) apparently correlated
778 // with bad Intel driver installations where the DriverVersion reported
779 // by the registry was not the version of the DLL.
781 // Note that these start without the .dll extension but eventually gain it.
782 bool is64bitApp = sizeof(void*) == 8;
783 nsAutoString dllFileName(is64bitApp ? u"igd10umd64" : u"igd10umd32");
784 nsAutoString dllFileName2(is64bitApp ? u"igd10iumd64" : u"igd10iumd32");
786 nsString dllVersion, dllVersion2;
787 uint64_t dllNumericVersion = 0, dllNumericVersion2 = 0,
788 driverNumericVersion = 0, knownSafeMismatchVersion = 0;
790 // Only parse the DLL version for those found in the driver list
791 nsAutoString eligibleDLLs;
792 if (NS_SUCCEEDED(GetAdapterDriver(eligibleDLLs))) {
793 if (FindInReadable(dllFileName, eligibleDLLs)) {
794 dllFileName += u".dll"_ns;
795 gfxWindowsPlatform::GetDLLVersion(dllFileName.get(), dllVersion);
796 ParseDriverVersion(dllVersion, &dllNumericVersion);
798 if (FindInReadable(dllFileName2, eligibleDLLs)) {
799 dllFileName2 += u".dll"_ns;
800 gfxWindowsPlatform::GetDLLVersion(dllFileName2.get(), dllVersion2);
801 ParseDriverVersion(dllVersion2, &dllNumericVersion2);
805 // Sometimes the DLL is not in the System32 nor SysWOW64 directories. But
806 // UserModeDriverName (or UserModeDriverNameWow, if available) might provide
807 // the full path to the DLL in some DriverStore FileRepository.
808 if (dllNumericVersion == 0 && dllNumericVersion2 == 0) {
809 nsTArray<nsString> eligibleDLLpaths;
810 const WCHAR* keyLocation = mDeviceKey[mActiveGPUIndex].get();
811 GetKeyValues(keyLocation, L"UserModeDriverName", eligibleDLLpaths);
812 GetKeyValues(keyLocation, L"UserModeDriverNameWow", eligibleDLLpaths);
813 size_t length = eligibleDLLpaths.Length();
814 for (size_t i = 0;
815 i < length && dllNumericVersion == 0 && dllNumericVersion2 == 0;
816 ++i) {
817 if (FindInReadable(dllFileName, eligibleDLLpaths[i])) {
818 gfxWindowsPlatform::GetDLLVersion(eligibleDLLpaths[i].get(),
819 dllVersion);
820 ParseDriverVersion(dllVersion, &dllNumericVersion);
821 } else if (FindInReadable(dllFileName2, eligibleDLLpaths[i])) {
822 gfxWindowsPlatform::GetDLLVersion(eligibleDLLpaths[i].get(),
823 dllVersion2);
824 ParseDriverVersion(dllVersion2, &dllNumericVersion2);
829 ParseDriverVersion(mDriverVersion[mActiveGPUIndex], &driverNumericVersion);
830 ParseDriverVersion(u"9.17.10.0"_ns, &knownSafeMismatchVersion);
832 // If there's a driver version mismatch, consider this harmful only when
833 // the driver version is less than knownSafeMismatchVersion. See the
834 // above comment about crashes with old mismatches. If the GetDllVersion
835 // call fails, we are not calling it a mismatch.
836 if ((dllNumericVersion != 0 && dllNumericVersion != driverNumericVersion) ||
837 (dllNumericVersion2 != 0 &&
838 dllNumericVersion2 != driverNumericVersion)) {
839 if (driverNumericVersion < knownSafeMismatchVersion ||
840 std::max(dllNumericVersion, dllNumericVersion2) <
841 knownSafeMismatchVersion) {
842 mHasDriverVersionMismatch = true;
843 gfxCriticalNoteOnce
844 << "Mismatched driver versions between the registry "
845 << NS_ConvertUTF16toUTF8(mDriverVersion[mActiveGPUIndex]).get()
846 << " and DLL(s) " << NS_ConvertUTF16toUTF8(dllVersion).get() << ", "
847 << NS_ConvertUTF16toUTF8(dllVersion2).get() << " reported.";
849 } else if (dllNumericVersion == 0 && dllNumericVersion2 == 0) {
850 // Leave it as an asserting error for now, to see if we can find
851 // a system that exhibits this kind of a problem internally.
852 gfxCriticalErrorOnce()
853 << "Potential driver version mismatch ignored due to missing DLLs "
854 << NS_ConvertUTF16toUTF8(dllFileName).get()
855 << " v=" << NS_ConvertUTF16toUTF8(dllVersion).get() << " and "
856 << NS_ConvertUTF16toUTF8(dllFileName2).get()
857 << " v=" << NS_ConvertUTF16toUTF8(dllVersion2).get();
861 const char* spoofedDriverVersionString =
862 PR_GetEnv("MOZ_GFX_SPOOF_DRIVER_VERSION");
863 if (spoofedDriverVersionString) {
864 mDriverVersion[mActiveGPUIndex].AssignASCII(spoofedDriverVersionString);
867 const char* spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_VENDOR_ID");
868 if (spoofedVendor) {
869 mAdapterVendorID[mActiveGPUIndex].AssignASCII(spoofedVendor);
872 const char* spoofedDevice = PR_GetEnv("MOZ_GFX_SPOOF_DEVICE_ID");
873 if (spoofedDevice) {
874 mAdapterDeviceID[mActiveGPUIndex].AssignASCII(spoofedDevice);
877 AddCrashReportAnnotations();
879 return rv;
882 NS_IMETHODIMP
883 GfxInfo::GetAdapterDescription(nsAString& aAdapterDescription) {
884 AssertNotWin32kLockdown();
886 aAdapterDescription = mDeviceString[mActiveGPUIndex];
887 return NS_OK;
890 NS_IMETHODIMP
891 GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
892 AssertNotWin32kLockdown();
894 aAdapterDescription = mDeviceString[1 - mActiveGPUIndex];
895 return NS_OK;
898 NS_IMETHODIMP
899 GfxInfo::GetAdapterRAM(uint32_t* aAdapterRAM) {
900 AssertNotWin32kLockdown();
902 uint32_t result = 0;
903 if (NS_FAILED(GetKeyValue(mDeviceKey[mActiveGPUIndex].get(),
904 L"HardwareInformation.qwMemorySize", result,
905 REG_QWORD)) ||
906 result == 0) {
907 if (NS_FAILED(GetKeyValue(mDeviceKey[mActiveGPUIndex].get(),
908 L"HardwareInformation.MemorySize", result,
909 REG_DWORD))) {
910 result = 0;
913 *aAdapterRAM = result;
914 return NS_OK;
917 NS_IMETHODIMP
918 GfxInfo::GetAdapterRAM2(uint32_t* aAdapterRAM) {
919 AssertNotWin32kLockdown();
921 uint32_t result = 0;
922 if (mHasDualGPU) {
923 if (NS_FAILED(GetKeyValue(mDeviceKey[1 - mActiveGPUIndex].get(),
924 L"HardwareInformation.qwMemorySize", result,
925 REG_QWORD)) ||
926 result == 0) {
927 if (NS_FAILED(GetKeyValue(mDeviceKey[1 - mActiveGPUIndex].get(),
928 L"HardwareInformation.MemorySize", result,
929 REG_DWORD))) {
930 result = 0;
934 *aAdapterRAM = result;
935 return NS_OK;
938 NS_IMETHODIMP
939 GfxInfo::GetAdapterDriver(nsAString& aAdapterDriver) {
940 AssertNotWin32kLockdown();
942 if (NS_FAILED(GetKeyValue(mDeviceKey[mActiveGPUIndex].get(),
943 L"InstalledDisplayDrivers", aAdapterDriver,
944 REG_MULTI_SZ)))
945 aAdapterDriver = L"Unknown";
946 return NS_OK;
949 NS_IMETHODIMP
950 GfxInfo::GetAdapterDriver2(nsAString& aAdapterDriver) {
951 AssertNotWin32kLockdown();
953 if (!mHasDualGPU) {
954 aAdapterDriver.Truncate();
955 } else if (NS_FAILED(GetKeyValue(mDeviceKey[1 - mActiveGPUIndex].get(),
956 L"InstalledDisplayDrivers", aAdapterDriver,
957 REG_MULTI_SZ))) {
958 aAdapterDriver = L"Unknown";
960 return NS_OK;
963 NS_IMETHODIMP
964 GfxInfo::GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) {
965 aAdapterDriverVendor.Truncate();
966 return NS_OK;
969 NS_IMETHODIMP
970 GfxInfo::GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) {
971 AssertNotWin32kLockdown();
973 aAdapterDriverVersion = mDriverVersion[mActiveGPUIndex];
974 return NS_OK;
977 NS_IMETHODIMP
978 GfxInfo::GetAdapterDriverDate(nsAString& aAdapterDriverDate) {
979 AssertNotWin32kLockdown();
981 aAdapterDriverDate = mDriverDate[mActiveGPUIndex];
982 return NS_OK;
985 NS_IMETHODIMP
986 GfxInfo::GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) {
987 aAdapterDriverVendor.Truncate();
988 return NS_OK;
991 NS_IMETHODIMP
992 GfxInfo::GetAdapterDriverVersion2(nsAString& aAdapterDriverVersion) {
993 AssertNotWin32kLockdown();
995 aAdapterDriverVersion = mDriverVersion[1 - mActiveGPUIndex];
996 return NS_OK;
999 NS_IMETHODIMP
1000 GfxInfo::GetAdapterDriverDate2(nsAString& aAdapterDriverDate) {
1001 AssertNotWin32kLockdown();
1003 aAdapterDriverDate = mDriverDate[1 - mActiveGPUIndex];
1004 return NS_OK;
1007 NS_IMETHODIMP
1008 GfxInfo::GetAdapterVendorID(nsAString& aAdapterVendorID) {
1009 AssertNotWin32kLockdown();
1011 aAdapterVendorID = mAdapterVendorID[mActiveGPUIndex];
1012 return NS_OK;
1015 NS_IMETHODIMP
1016 GfxInfo::GetAdapterVendorID2(nsAString& aAdapterVendorID) {
1017 AssertNotWin32kLockdown();
1019 aAdapterVendorID = mAdapterVendorID[1 - mActiveGPUIndex];
1020 return NS_OK;
1023 NS_IMETHODIMP
1024 GfxInfo::GetAdapterDeviceID(nsAString& aAdapterDeviceID) {
1025 AssertNotWin32kLockdown();
1027 aAdapterDeviceID = mAdapterDeviceID[mActiveGPUIndex];
1028 return NS_OK;
1031 NS_IMETHODIMP
1032 GfxInfo::GetAdapterDeviceID2(nsAString& aAdapterDeviceID) {
1033 AssertNotWin32kLockdown();
1035 aAdapterDeviceID = mAdapterDeviceID[1 - mActiveGPUIndex];
1036 return NS_OK;
1039 NS_IMETHODIMP
1040 GfxInfo::GetAdapterSubsysID(nsAString& aAdapterSubsysID) {
1041 AssertNotWin32kLockdown();
1043 aAdapterSubsysID = mAdapterSubsysID[mActiveGPUIndex];
1044 return NS_OK;
1047 NS_IMETHODIMP
1048 GfxInfo::GetAdapterSubsysID2(nsAString& aAdapterSubsysID) {
1049 AssertNotWin32kLockdown();
1051 aAdapterSubsysID = mAdapterSubsysID[1 - mActiveGPUIndex];
1052 return NS_OK;
1055 NS_IMETHODIMP
1056 GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) {
1057 // This is never the case, as the active GPU ends up being
1058 // the first one. It should probably be removed.
1059 *aIsGPU2Active = false;
1060 return NS_OK;
1063 NS_IMETHODIMP
1064 GfxInfo::GetDrmRenderDevice(nsACString& aDrmRenderDevice) {
1065 return NS_ERROR_NOT_IMPLEMENTED;
1068 /* Cisco's VPN software can cause corruption of the floating point state.
1069 * Make a note of this in our crash reports so that some weird crashes
1070 * make more sense */
1071 static void CheckForCiscoVPN() {
1072 LONG result;
1073 HKEY key;
1074 /* This will give false positives, but hopefully no false negatives */
1075 result =
1076 RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Cisco Systems\\VPN Client",
1077 0, KEY_QUERY_VALUE, &key);
1078 if (result == ERROR_SUCCESS) {
1079 RegCloseKey(key);
1080 CrashReporter::AppendAppNotesToCrashReport("Cisco VPN\n"_ns);
1084 void GfxInfo::AddCrashReportAnnotations() {
1085 AssertNotWin32kLockdown();
1087 CheckForCiscoVPN();
1089 if (mHasDriverVersionMismatch) {
1090 CrashReporter::AppendAppNotesToCrashReport("DriverVersionMismatch\n"_ns);
1093 nsString deviceID, vendorID, driverVersion, subsysID;
1095 GetAdapterDeviceID(deviceID);
1096 GetAdapterVendorID(vendorID);
1097 GetAdapterDriverVersion(driverVersion);
1098 GetAdapterSubsysID(subsysID);
1100 CrashReporter::RecordAnnotationNSString(
1101 CrashReporter::Annotation::AdapterVendorID, vendorID);
1102 CrashReporter::RecordAnnotationNSString(
1103 CrashReporter::Annotation::AdapterDeviceID, deviceID);
1104 CrashReporter::RecordAnnotationNSString(
1105 CrashReporter::Annotation::AdapterDriverVersion, driverVersion);
1106 CrashReporter::RecordAnnotationNSString(
1107 CrashReporter::Annotation::AdapterSubsysID, subsysID);
1109 /* Add an App Note, this contains extra information. */
1110 nsAutoCString note;
1112 // TODO: We should probably convert this into a proper annotation
1113 if (vendorID == GfxDriverInfo::GetDeviceVendor(DeviceVendor::All)) {
1114 /* if we didn't find a valid vendorID lets append the mDeviceID string to
1115 * try to find out why */
1116 LossyAppendUTF16toASCII(mDeviceID[mActiveGPUIndex], note);
1117 note.AppendLiteral(", ");
1118 LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
1120 note.AppendLiteral("\n");
1122 if (mHasDualGPU) {
1123 nsString deviceID2, vendorID2, subsysID2;
1124 nsAutoString adapterDriverVersionString2;
1125 nsCString narrowDeviceID2, narrowVendorID2, narrowSubsysID2;
1127 // Make a slight difference between the two cases so that we
1128 // can see it in the crash reports. It may come in handy.
1129 if (mActiveGPUIndex == 1) {
1130 note.AppendLiteral("Has dual GPUs. GPU-#2: ");
1131 } else {
1132 note.AppendLiteral("Has dual GPUs. GPU #2: ");
1134 GetAdapterDeviceID2(deviceID2);
1135 CopyUTF16toUTF8(deviceID2, narrowDeviceID2);
1136 GetAdapterVendorID2(vendorID2);
1137 CopyUTF16toUTF8(vendorID2, narrowVendorID2);
1138 GetAdapterDriverVersion2(adapterDriverVersionString2);
1139 GetAdapterSubsysID(subsysID2);
1140 CopyUTF16toUTF8(subsysID2, narrowSubsysID2);
1141 note.AppendLiteral("AdapterVendorID2: ");
1142 note.Append(narrowVendorID2);
1143 note.AppendLiteral(", AdapterDeviceID2: ");
1144 note.Append(narrowDeviceID2);
1145 note.AppendLiteral(", AdapterSubsysID2: ");
1146 note.Append(narrowSubsysID2);
1147 note.AppendLiteral(", AdapterDriverVersion2: ");
1148 note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2));
1150 CrashReporter::AppendAppNotesToCrashReport(note);
1153 static OperatingSystem WindowsVersionToOperatingSystem(
1154 int32_t aWindowsVersion) {
1155 switch (aWindowsVersion) {
1156 case kWindows7:
1157 return OperatingSystem::Windows7;
1158 case kWindows8:
1159 return OperatingSystem::Windows8;
1160 case kWindows8_1:
1161 return OperatingSystem::Windows8_1;
1162 case kWindows10:
1163 return OperatingSystem::Windows10;
1164 case kWindowsUnknown:
1165 default:
1166 return OperatingSystem::Unknown;
1170 // Return true if the CPU supports AVX, but the operating system does not.
1171 #if defined(_M_X64)
1172 static inline bool DetectBrokenAVX() {
1173 int regs[4];
1174 __cpuid(regs, 0);
1175 if (regs[0] == 0) {
1176 // Level not supported.
1177 return false;
1180 __cpuid(regs, 1);
1182 const unsigned AVX = 1u << 28;
1183 const unsigned XSAVE = 1u << 26;
1184 if ((regs[2] & (AVX | XSAVE)) != (AVX | XSAVE)) {
1185 // AVX is not supported on this CPU.
1186 return false;
1189 const unsigned OSXSAVE = 1u << 27;
1190 if ((regs[2] & OSXSAVE) != OSXSAVE) {
1191 // AVX is supported, but the OS didn't enable it.
1192 // This can be forced via bcdedit /set xsavedisable 1.
1193 return true;
1196 const unsigned AVX_CTRL_BITS = (1 << 1) | (1 << 2);
1197 return (xgetbv(0) & AVX_CTRL_BITS) != AVX_CTRL_BITS;
1199 #endif
1201 const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
1202 if (!sDriverInfo->Length()) {
1204 * It should be noted here that more specialized rules on certain features
1205 * should be inserted -before- more generalized restriction. As the first
1206 * match for feature/OS/device found in the list will be used for the final
1207 * blocklisting call.
1211 * NVIDIA entries
1214 * The last 5 digit of the NVIDIA driver version maps to the version that
1215 * NVIDIA uses. The minor version (15, 16, 17) corresponds roughtly to the
1216 * OS (Vista, Win7, Win7) but they show up in smaller numbers across all
1217 * OS versions (perhaps due to OS upgrades). So we want to support
1218 * October 2009+ drivers across all these minor versions.
1220 * 187.45 (late October 2009) and earlier contain a bug which can cause us
1221 * to crash on shutdown.
1223 APPEND_TO_DRIVER_BLOCKLIST(
1224 OperatingSystem::Windows7, DeviceFamily::NvidiaAll,
1225 GfxDriverInfo::optionalFeatures,
1226 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN_OR_EQUAL,
1227 V(8, 15, 11, 8745), "FEATURE_FAILURE_NV_W7_15",
1228 "nVidia driver > 187.45");
1229 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1230 OperatingSystem::Windows7, DeviceFamily::NvidiaAll,
1231 GfxDriverInfo::optionalFeatures,
1232 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1233 DRIVER_BETWEEN_INCLUSIVE_START, V(8, 16, 10, 0000), V(8, 16, 11, 8745),
1234 "FEATURE_FAILURE_NV_W7_16", "nVidia driver > 187.45");
1235 // Telemetry doesn't show any driver in this range so it might not even be
1236 // required.
1237 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1238 OperatingSystem::Windows7, DeviceFamily::NvidiaAll,
1239 GfxDriverInfo::optionalFeatures,
1240 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1241 DRIVER_BETWEEN_INCLUSIVE_START, V(8, 17, 10, 0000), V(8, 17, 11, 8745),
1242 "FEATURE_FAILURE_NV_W7_17", "nVidia driver > 187.45");
1245 * AMD/ATI entries. 8.56.1.15 is the driver that shipped with Windows 7 RTM
1247 APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Windows, DeviceFamily::AtiAll,
1248 GfxDriverInfo::optionalFeatures,
1249 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1250 DRIVER_LESS_THAN, V(8, 56, 1, 15),
1251 "FEATURE_FAILURE_AMD1", "8.56.1.15");
1253 // Bug 1099252
1254 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows7, DeviceFamily::AtiAll,
1255 GfxDriverInfo::optionalFeatures,
1256 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1257 DRIVER_EQUAL, V(8, 832, 0, 0),
1258 "FEATURE_FAILURE_BUG_1099252");
1260 // Bug 1118695
1261 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows7, DeviceFamily::AtiAll,
1262 GfxDriverInfo::optionalFeatures,
1263 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1264 DRIVER_EQUAL, V(8, 783, 2, 2000),
1265 "FEATURE_FAILURE_BUG_1118695");
1267 // Bug 1587155
1269 // There are a several reports of strange rendering corruptions with this
1270 // driver version, with and without webrender. We weren't able to
1271 // reproduce these problems, but the users were able to update their
1272 // drivers and it went away. So just to be safe, let's blocklist all
1273 // gpu use with this particular (very old) driver, restricted
1274 // to Win10 since we only have reports from that platform.
1275 APPEND_TO_DRIVER_BLOCKLIST2(
1276 OperatingSystem::Windows10, DeviceFamily::AtiAll,
1277 GfxDriverInfo::optionalFeatures,
1278 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_EQUAL,
1279 V(22, 19, 162, 4), "FEATURE_FAILURE_BUG_1587155");
1281 // Bug 1829487 - Work around a gen6 driver bug that miscompiles shaders
1282 // resulting
1283 // in black squares. Disabling shader optimization pass
1284 // appears to work around this for now.
1285 APPEND_TO_DRIVER_BLOCKLIST2(
1286 OperatingSystem::Windows, DeviceFamily::IntelSandyBridge,
1287 nsIGfxInfo::FEATURE_WEBRENDER_OPTIMIZED_SHADERS,
1288 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_LESS_THAN,
1289 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1829487");
1291 // Bug 1198815
1292 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1293 OperatingSystem::Windows, DeviceFamily::AtiAll,
1294 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1295 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1296 V(15, 200, 0, 0), V(15, 200, 1062, 1004), "FEATURE_FAILURE_BUG_1198815",
1297 "15.200.0.0-15.200.1062.1004");
1299 // Bug 1267970
1300 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1301 OperatingSystem::Windows10, DeviceFamily::AtiAll,
1302 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1303 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1304 V(15, 200, 0, 0), V(15, 301, 2301, 1002), "FEATURE_FAILURE_BUG_1267970",
1305 "15.200.0.0-15.301.2301.1002");
1306 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1307 OperatingSystem::Windows10, DeviceFamily::AtiAll,
1308 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1309 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1310 V(16, 100, 0, 0), V(16, 300, 2311, 0), "FEATURE_FAILURE_BUG_1267970",
1311 "16.100.0.0-16.300.2311.0");
1314 * Bug 783517 - crashes in AMD driver on Windows 8
1316 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1317 OperatingSystem::Windows8, DeviceFamily::AtiAll,
1318 GfxDriverInfo::optionalFeatures,
1319 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1320 DRIVER_BETWEEN_INCLUSIVE_START, V(8, 982, 0, 0), V(8, 983, 0, 0),
1321 "FEATURE_FAILURE_BUG_783517_AMD", "!= 8.982.*.*");
1324 * Bug 1599981 - crashes in AMD driver on Windows 10
1326 APPEND_TO_DRIVER_BLOCKLIST2(
1327 OperatingSystem::Windows10, DeviceFamily::RadeonCaicos,
1328 nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
1329 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1330 V(15, 301, 1901, 0), "FEATURE_FAILURE_BUG_1599981");
1332 /* OpenGL on any ATI/AMD hardware is discouraged
1333 * See:
1334 * bug 619773 - WebGL: Crash with blue screen : "NMI: Parity Check / Memory
1335 * Parity Error" bugs 584403, 584404, 620924 - crashes in atioglxx
1336 * + many complaints about incorrect rendering
1338 APPEND_TO_DRIVER_BLOCKLIST2(
1339 OperatingSystem::Windows, DeviceFamily::AtiAll,
1340 nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
1341 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1342 "FEATURE_FAILURE_OGL_ATI_DIS");
1345 * Intel entries
1348 /* The driver versions used here come from bug 594877. They might not
1349 * be particularly relevant anymore.
1351 #define IMPLEMENT_INTEL_DRIVER_BLOCKLIST(winVer, devFamily, driverVer, ruleId) \
1352 APPEND_TO_DRIVER_BLOCKLIST2(winVer, devFamily, \
1353 GfxDriverInfo::optionalFeatures, \
1354 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
1355 DRIVER_LESS_THAN, driverVer, ruleId)
1357 #define IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(winVer, devFamily, driverVer, \
1358 ruleId) \
1359 APPEND_TO_DRIVER_BLOCKLIST2(winVer, devFamily, nsIGfxInfo::FEATURE_DIRECT2D, \
1360 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, \
1361 DRIVER_BUILD_ID_LESS_THAN, driverVer, ruleId)
1363 IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7,
1364 DeviceFamily::IntelGMA500, 2026,
1365 "FEATURE_FAILURE_594877_7");
1366 IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(
1367 OperatingSystem::Windows7, DeviceFamily::IntelGMA900,
1368 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_594877_8");
1369 IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7,
1370 DeviceFamily::IntelGMA950, 1930,
1371 "FEATURE_FAILURE_594877_9");
1372 IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7,
1373 DeviceFamily::IntelGMA3150, 2117,
1374 "FEATURE_FAILURE_594877_10");
1375 IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(OperatingSystem::Windows7,
1376 DeviceFamily::IntelGMAX3000, 1930,
1377 "FEATURE_FAILURE_594877_11");
1378 IMPLEMENT_INTEL_DRIVER_BLOCKLIST_D2D(
1379 OperatingSystem::Windows7, DeviceFamily::IntelHDGraphicsToSandyBridge,
1380 2202, "FEATURE_FAILURE_594877_12");
1382 /* Disable Direct2D on Intel GMAX4500 devices because of rendering
1383 * corruption discovered in bug 1180379. These seems to affect even the most
1384 * recent drivers. We're black listing all of the devices to be safe even
1385 * though we've only confirmed the issue on the G45
1387 APPEND_TO_DRIVER_BLOCKLIST2(
1388 OperatingSystem::Windows, DeviceFamily::IntelGMAX4500HD,
1389 nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1390 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1391 "FEATURE_FAILURE_1180379");
1393 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1394 OperatingSystem::Windows7, DeviceFamily::IntelGMA500, V(5, 0, 0, 2026),
1395 "FEATURE_FAILURE_INTEL_16");
1396 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1397 OperatingSystem::Windows7, DeviceFamily::IntelGMA900,
1398 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_INTEL_17");
1399 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1400 OperatingSystem::Windows7, DeviceFamily::IntelGMA950,
1401 V(8, 15, 10, 1930), "FEATURE_FAILURE_INTEL_18");
1402 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1403 OperatingSystem::Windows7, DeviceFamily::IntelGMA3150,
1404 V(8, 14, 10, 1972), "FEATURE_FAILURE_INTEL_19");
1405 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1406 OperatingSystem::Windows7, DeviceFamily::IntelGMAX3000,
1407 V(7, 15, 10, 1666), "FEATURE_FAILURE_INTEL_20");
1408 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1409 OperatingSystem::Windows7, DeviceFamily::IntelGMAX4500HD,
1410 V(7, 15, 10, 1666), "FEATURE_FAILURE_INTEL_21");
1411 IMPLEMENT_INTEL_DRIVER_BLOCKLIST(
1412 OperatingSystem::Windows7, DeviceFamily::IntelHDGraphicsToSandyBridge,
1413 V(7, 15, 10, 1666), "FEATURE_FAILURE_INTEL_22");
1415 // Bug 1074378
1416 APPEND_TO_DRIVER_BLOCKLIST(
1417 OperatingSystem::Windows7, DeviceFamily::IntelGMAX4500HD,
1418 GfxDriverInfo::optionalFeatures,
1419 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_EQUAL,
1420 V(8, 15, 10, 1749), "FEATURE_FAILURE_BUG_1074378_1", "8.15.10.2342");
1421 APPEND_TO_DRIVER_BLOCKLIST(
1422 OperatingSystem::Windows7, DeviceFamily::IntelHDGraphicsToSandyBridge,
1423 GfxDriverInfo::optionalFeatures,
1424 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_EQUAL,
1425 V(8, 15, 10, 1749), "FEATURE_FAILURE_BUG_1074378_2", "8.15.10.2342");
1427 /* OpenGL on any Intel hardware is discouraged */
1428 APPEND_TO_DRIVER_BLOCKLIST2(
1429 OperatingSystem::Windows, DeviceFamily::IntelAll,
1430 nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_DISCOURAGED,
1431 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1432 "FEATURE_FAILURE_INTEL_OGL_DIS");
1435 * Disable acceleration on Intel HD 3000 for graphics drivers
1436 * <= 8.15.10.2321. See bug 1018278 and bug 1060736.
1438 APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Windows,
1439 DeviceFamily::IntelSandyBridge,
1440 GfxDriverInfo::optionalFeatures,
1441 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1442 DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL, 2321,
1443 "FEATURE_FAILURE_BUG_1018278", "X.X.X.2342");
1446 * Disable D2D on Win7 on Intel Haswell for graphics drivers build id <=
1447 * 4578. See bug 1432610
1449 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows7,
1450 DeviceFamily::IntelHaswell,
1451 nsIGfxInfo::FEATURE_DIRECT2D,
1452 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1453 DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL, 4578,
1454 "FEATURE_FAILURE_BUG_1432610");
1456 * Disable VP8 HW decoding on Windows 8.1 on Intel Haswel and a certain
1457 * driver version. See bug 1760464 comment 6 and bug 1761332.
1459 APPEND_TO_DRIVER_BLOCKLIST2(
1460 OperatingSystem::Windows8_1, DeviceFamily::IntelHaswell,
1461 nsIGfxInfo::FEATURE_VP8_HW_DECODE, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1462 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1463 "FEATURE_FAILURE_BUG_1760464");
1465 APPEND_TO_DRIVER_BLOCKLIST2(
1466 OperatingSystem::Windows8_1, DeviceFamily::IntelAll,
1467 nsIGfxInfo::FEATURE_VP8_HW_DECODE, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1468 DRIVER_EQUAL, V(10, 18, 14, 4264), "FEATURE_FAILURE_BUG_1761332");
1470 /* Disable D2D on Win7 on Intel HD Graphics on driver <= 8.15.10.2302
1471 * See bug 806786
1473 APPEND_TO_DRIVER_BLOCKLIST2(
1474 OperatingSystem::Windows7, DeviceFamily::IntelMobileHDGraphics,
1475 nsIGfxInfo::FEATURE_DIRECT2D,
1476 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN_OR_EQUAL,
1477 V(8, 15, 10, 2302), "FEATURE_FAILURE_BUG_806786");
1479 /* Disable D2D on Win8 on Intel HD Graphics on driver <= 8.15.10.2302
1480 * See bug 804144 and 863683
1482 APPEND_TO_DRIVER_BLOCKLIST2(
1483 OperatingSystem::Windows8, DeviceFamily::IntelMobileHDGraphics,
1484 nsIGfxInfo::FEATURE_DIRECT2D,
1485 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN_OR_EQUAL,
1486 V(8, 15, 10, 2302), "FEATURE_FAILURE_BUG_804144");
1488 /* Disable D2D on Win7 on Intel HD Graphics on driver == 8.15.10.2418
1489 * See bug 1433790
1491 APPEND_TO_DRIVER_BLOCKLIST2(
1492 OperatingSystem::Windows7, DeviceFamily::IntelHDGraphicsToSandyBridge,
1493 nsIGfxInfo::FEATURE_DIRECT2D,
1494 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_EQUAL,
1495 V(8, 15, 10, 2418), "FEATURE_FAILURE_BUG_1433790");
1497 /* Disable D3D11 layers on Intel G41 express graphics and Intel GM965, Intel
1498 * X3100, for causing device resets. See bug 1116812.
1500 APPEND_TO_DRIVER_BLOCKLIST2(
1501 OperatingSystem::Windows, DeviceFamily::Bug1116812,
1502 nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
1503 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_LESS_THAN,
1504 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1116812");
1506 /* Disable D3D11 layers on Intel GMA 3150 for failing to allocate a shared
1507 * handle for textures. See bug 1207665. Additionally block D2D so we don't
1508 * accidentally use WARP.
1510 APPEND_TO_DRIVER_BLOCKLIST2(
1511 OperatingSystem::Windows, DeviceFamily::Bug1207665,
1512 nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
1513 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_LESS_THAN,
1514 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1207665_1");
1515 APPEND_TO_DRIVER_BLOCKLIST2(
1516 OperatingSystem::Windows, DeviceFamily::Bug1207665,
1517 nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1518 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1519 "FEATURE_FAILURE_BUG_1207665_2");
1521 APPEND_TO_DRIVER_BLOCKLIST2(
1522 OperatingSystem::Windows10, DeviceFamily::QualcommAll,
1523 nsIGfxInfo::FEATURE_DIRECT2D,
1524 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1525 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_QUALCOMM");
1527 // Bug 1548410. Disable hardware accelerated video decoding on
1528 // Qualcomm drivers used on Windows on ARM64 which are known to
1529 // cause BSOD's and output suprious green frames while decoding video.
1530 // Bug 1592826 expands the blocklist.
1531 APPEND_TO_DRIVER_BLOCKLIST2(
1532 OperatingSystem::Windows10, DeviceFamily::QualcommAll,
1533 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1534 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN_OR_EQUAL,
1535 V(25, 18, 10440, 0), "FEATURE_FAILURE_BUG_1592826");
1537 /* Disable D2D on AMD Catalyst 14.4 until 14.6
1538 * See bug 984488
1540 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1541 OperatingSystem::Windows, DeviceFamily::AtiAll,
1542 nsIGfxInfo::FEATURE_DIRECT2D,
1543 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1544 DRIVER_BETWEEN_INCLUSIVE_START, V(14, 1, 0, 0), V(14, 2, 0, 0),
1545 "FEATURE_FAILURE_BUG_984488_1", "ATI Catalyst 14.6+");
1547 /* Disable D3D9 layers on NVIDIA 6100/6150/6200 series due to glitches
1548 * whilst scrolling. See bugs: 612007, 644787 & 645872.
1550 APPEND_TO_DRIVER_BLOCKLIST2(
1551 OperatingSystem::Windows, DeviceFamily::NvidiaBlockD3D9Layers,
1552 nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS,
1553 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_LESS_THAN,
1554 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_612007");
1556 /* Microsoft RemoteFX; blocked less than 6.2.0.0 */
1557 APPEND_TO_DRIVER_BLOCKLIST(
1558 OperatingSystem::Windows, DeviceFamily::MicrosoftAll,
1559 GfxDriverInfo::optionalFeatures,
1560 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1561 V(6, 2, 0, 0), "< 6.2.0.0", "FEATURE_FAILURE_REMOTE_FX");
1563 /* Bug 1008759: Optimus (NVidia) crash. Disable D2D on NV 310M. */
1564 APPEND_TO_DRIVER_BLOCKLIST2(
1565 OperatingSystem::Windows, DeviceFamily::Nvidia310M,
1566 nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1567 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1568 "FEATURE_FAILURE_BUG_1008759");
1570 /* Bug 1139503: DXVA crashes with ATI cards on windows 10. */
1571 APPEND_TO_DRIVER_BLOCKLIST2(
1572 OperatingSystem::Windows10, DeviceFamily::AtiAll,
1573 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1574 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_EQUAL,
1575 V(15, 200, 1006, 0), "FEATURE_FAILURE_BUG_1139503");
1577 /* Bug 1213107: D3D9 crashes with ATI cards on Windows 7. */
1578 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1579 OperatingSystem::Windows7, DeviceFamily::AtiAll,
1580 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1581 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1582 V(8, 861, 0, 0), V(8, 862, 6, 5000), "FEATURE_FAILURE_BUG_1213107_1",
1583 "Radeon driver > 8.862.6.5000");
1584 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1585 OperatingSystem::Windows7, DeviceFamily::AtiAll,
1586 nsIGfxInfo::FEATURE_WEBGL_ANGLE,
1587 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1588 V(8, 861, 0, 0), V(8, 862, 6, 5000), "FEATURE_FAILURE_BUG_1213107_2",
1589 "Radeon driver > 8.862.6.5000");
1591 /* This may not be needed at all */
1592 APPEND_TO_DRIVER_BLOCKLIST2(
1593 OperatingSystem::Windows7, DeviceFamily::Bug1155608,
1594 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1595 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1596 V(8, 15, 10, 2869), "FEATURE_FAILURE_INTEL_W7_HW_DECODING");
1598 /* Bug 1203199/1092166: DXVA startup crashes on some intel drivers. */
1599 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1600 OperatingSystem::Windows, DeviceFamily::IntelAll,
1601 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1602 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1603 V(9, 17, 10, 0), V(9, 17, 10, 2849), "FEATURE_FAILURE_BUG_1203199_1",
1604 "Intel driver > 9.17.10.2849");
1606 APPEND_TO_DRIVER_BLOCKLIST2(
1607 OperatingSystem::Windows, DeviceFamily::Nvidia8800GTS,
1608 nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
1609 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_EQUAL,
1610 V(9, 18, 13, 4052), "FEATURE_FAILURE_BUG_1203199_2");
1612 /* Bug 1137716: XXX this should really check for the matching Intel piece as
1613 * well. Unfortunately, we don't have the infrastructure to do that */
1614 APPEND_TO_DRIVER_BLOCKLIST_RANGE_GPU2(
1615 OperatingSystem::Windows7, DeviceFamily::Bug1137716,
1616 GfxDriverInfo::optionalFeatures,
1617 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1618 V(8, 17, 12, 5730), V(8, 17, 12, 6901), "FEATURE_FAILURE_BUG_1137716",
1619 "Nvidia driver > 8.17.12.6901");
1621 /* Bug 1304360: Graphical artifacts with D3D9 on Windows 7. */
1622 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows7,
1623 DeviceFamily::IntelGMAX3000,
1624 nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS,
1625 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1626 DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL, 1749,
1627 "FEATURE_FAILURE_INTEL_W7_D3D9_LAYERS");
1629 /* Bug 1717519/1717911: Crashes while drawing with swgl.
1630 * Reproducible but not investigated yet.*/
1631 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1632 OperatingSystem::Windows, DeviceFamily::IntelAll,
1633 nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
1634 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1635 V(8, 15, 10, 2125), V(8, 15, 10, 2141), "FEATURE_FAILURE_BUG_1717911",
1636 "Intel driver > 8.15.10.2141");
1638 #if defined(_M_X64)
1639 if (DetectBrokenAVX()) {
1640 APPEND_TO_DRIVER_BLOCKLIST2(
1641 OperatingSystem::Windows7, DeviceFamily::IntelAll,
1642 nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
1643 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1644 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1403353");
1646 #endif
1648 ////////////////////////////////////
1649 // WebGL
1651 // Older than 5-15-2016
1652 APPEND_TO_DRIVER_BLOCKLIST2(
1653 OperatingSystem::Windows, DeviceFamily::AtiAll,
1654 nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
1655 DRIVER_LESS_THAN, V(16, 200, 1010, 1002), "WEBGL_NATIVE_GL_OLD_AMD");
1657 // Older than 11-18-2015
1658 APPEND_TO_DRIVER_BLOCKLIST2(
1659 OperatingSystem::Windows, DeviceFamily::IntelAll,
1660 nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
1661 DRIVER_BUILD_ID_LESS_THAN, 4331, "WEBGL_NATIVE_GL_OLD_INTEL");
1663 // Older than 2-23-2016
1664 APPEND_TO_DRIVER_BLOCKLIST2(
1665 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1666 nsIGfxInfo::FEATURE_WEBGL_OPENGL, nsIGfxInfo::FEATURE_DISCOURAGED,
1667 DRIVER_LESS_THAN, V(10, 18, 13, 6200), "WEBGL_NATIVE_GL_OLD_NVIDIA");
1669 ////////////////////////////////////
1670 // FEATURE_DX_INTEROP2
1672 // All AMD.
1673 APPEND_TO_DRIVER_BLOCKLIST2(
1674 OperatingSystem::Windows, DeviceFamily::AtiAll,
1675 nsIGfxInfo::FEATURE_DX_INTEROP2,
1676 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1677 GfxDriverInfo::allDriverVersions, "DX_INTEROP2_AMD_CRASH");
1679 ////////////////////////////////////
1680 // FEATURE_D3D11_KEYED_MUTEX
1682 // bug 1359416
1683 APPEND_TO_DRIVER_BLOCKLIST2(
1684 OperatingSystem::Windows, DeviceFamily::IntelHDGraphicsToSandyBridge,
1685 nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX,
1686 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_LESS_THAN,
1687 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1359416");
1689 // Bug 1447141, for causing device creation crashes.
1690 APPEND_TO_DRIVER_BLOCKLIST2(
1691 OperatingSystem::Windows7, DeviceFamily::Bug1447141,
1692 GfxDriverInfo::optionalFeatures, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1693 DRIVER_EQUAL, V(15, 201, 2201, 0), "FEATURE_FAILURE_BUG_1447141_1");
1694 APPEND_TO_DRIVER_BLOCKLIST2(
1695 OperatingSystem::Windows7, DeviceFamily::Bug1447141,
1696 GfxDriverInfo::optionalFeatures, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1697 DRIVER_EQUAL, V(15, 201, 1701, 0), "FEATURE_FAILURE_BUG_1447141_1");
1699 // bug 1457758
1700 APPEND_TO_DRIVER_BLOCKLIST2(
1701 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1702 GfxDriverInfo::optionalFeatures, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1703 DRIVER_EQUAL, V(24, 21, 13, 9731), "FEATURE_FAILURE_BUG_1457758");
1705 ////////////////////////////////////
1706 // FEATURE_DX_NV12
1708 // Bug 1437334
1709 APPEND_TO_DRIVER_BLOCKLIST2(
1710 OperatingSystem::Windows, DeviceFamily::IntelHDGraphicsToSandyBridge,
1711 nsIGfxInfo::FEATURE_DX_NV12, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1712 DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL, 4459,
1713 "FEATURE_BLOCKED_DRIVER_VERSION");
1715 ////////////////////////////////////
1716 // FEATURE_DX_P010
1718 APPEND_TO_DRIVER_BLOCKLIST2(
1719 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1720 nsIGfxInfo::FEATURE_DX_P010, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1721 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1722 "FEATURE_UNQUALIFIED_P010_NVIDIA");
1724 ////////////////////////////////////
1725 // FEATURE_HW_DECODED_VIDEO_ZERO_COPY
1727 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1728 OperatingSystem::Windows10, DeviceFamily::IntelSkylake,
1729 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1730 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1731 V(20, 19, 15, 4285), V(20, 19, 15, 4390), "FEATURE_FAILURE_BUG_1763280",
1732 "Intel driver 20.19.15.*");
1734 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1735 OperatingSystem::Windows10, DeviceFamily::IntelSkylake,
1736 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1737 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1738 V(10, 18, 15, 4256), V(10, 18, 15, 4293), "FEATURE_FAILURE_BUG_1763280",
1739 "Intel driver 10.18.15.*");
1741 APPEND_TO_DRIVER_BLOCKLIST2(
1742 OperatingSystem::Windows10, DeviceFamily::IntelKabyLake,
1743 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1744 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1745 GfxDriverInfo::allDriverVersions, "FEATURE_FAILURE_BUG_1802357");
1747 APPEND_TO_DRIVER_BLOCKLIST2(
1748 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1749 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1750 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1751 V(21, 21, 13, 7576), "FEATURE_FAILURE_BUG_1767212");
1753 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, DeviceFamily::AtiAll,
1754 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1755 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1756 DRIVER_LESS_THAN, V(23, 20, 826, 5120),
1757 "FEATURE_FAILURE_BUG_1767212");
1759 APPEND_TO_DRIVER_BLOCKLIST2(
1760 OperatingSystem::Windows, DeviceFamily::RadeonBlockZeroVideoCopy,
1761 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1762 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
1763 V(26, 20, 15000, 37), "FEATURE_FAILURE_BUG_1767212");
1765 ////////////////////////////////////
1766 // FEATURE_HW_DECODED_VIDEO_ZERO_COPY - ALLOWLIST
1767 #ifdef EARLY_BETA_OR_EARLIER
1768 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, DeviceFamily::All,
1769 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1770 nsIGfxInfo::FEATURE_ALLOW_ALWAYS,
1771 DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
1772 "FEATURE_ROLLOUT_ALL");
1773 #endif
1774 APPEND_TO_DRIVER_BLOCKLIST2(
1775 OperatingSystem::Windows, DeviceFamily::IntelAll,
1776 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1777 nsIGfxInfo::FEATURE_ALLOW_ALWAYS, DRIVER_COMPARISON_IGNORED,
1778 V(0, 0, 0, 0), "FEATURE_ROLLOUT_ALL");
1780 APPEND_TO_DRIVER_BLOCKLIST2(
1781 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1782 nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
1783 nsIGfxInfo::FEATURE_ALLOW_ALWAYS, DRIVER_COMPARISON_IGNORED,
1784 V(0, 0, 0, 0), "FEATURE_ROLLOUT_ALL");
1786 ////////////////////////////////////
1787 // FEATURE_REUSE_DECODER_DEVICE
1789 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1790 OperatingSystem::Windows10, DeviceFamily::IntelSkylake,
1791 nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
1792 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1793 V(20, 19, 15, 4285), V(20, 19, 15, 4390), "FEATURE_FAILURE_BUG_1833809",
1794 "Intel driver 20.19.15.*");
1796 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1797 OperatingSystem::Windows10, DeviceFamily::IntelSkylake,
1798 nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
1799 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1800 V(10, 18, 15, 4256), V(10, 18, 15, 4293), "FEATURE_FAILURE_BUG_1833809",
1801 "Intel driver 10.18.15.*");
1803 APPEND_TO_DRIVER_BLOCKLIST2(
1804 OperatingSystem::Windows, DeviceFamily::IntelGen12,
1805 nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
1806 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
1807 V(0, 0, 0, 0), "FEATURE_FAILURE_BUG_1896823");
1809 APPEND_TO_DRIVER_BLOCKLIST2(
1810 OperatingSystem::Windows, DeviceFamily::IntelMeteorLake,
1811 nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
1812 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_GREATER_THAN,
1813 V(32, 0, 101, 5972), "FEATURE_FAILURE_BUG_1933755");
1815 APPEND_TO_DRIVER_BLOCKLIST2(
1816 OperatingSystem::Windows, DeviceFamily::IntelArrowlake,
1817 nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
1818 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_GREATER_THAN,
1819 V(32, 0, 101, 5972), "FEATURE_FAILURE_BUG_1933755");
1821 ////////////////////////////////////
1822 // FEATURE_OVERLAY_VP_AUTO_HDR
1824 APPEND_TO_DRIVER_BLOCKLIST(
1825 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1826 nsIGfxInfo::FEATURE_OVERLAY_VP_AUTO_HDR,
1827 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN_OR_EQUAL,
1828 V(31, 0, 15, 5050), "FEATURE_FAILURE_VP_AUTO_HDR",
1829 "nVidia driver > 550.50");
1831 ////////////////////////////////////
1832 // FEATURE_OVERLAY_VP_SUPER_RESOLUTION
1834 APPEND_TO_DRIVER_BLOCKLIST(
1835 OperatingSystem::Windows, DeviceFamily::NvidiaAll,
1836 nsIGfxInfo::FEATURE_OVERLAY_VP_SUPER_RESOLUTION,
1837 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN_OR_EQUAL,
1838 V(31, 0, 15, 3000), "FEATURE_FAILURE_VP_AUTO_HDR",
1839 "nVidia driver > 530.00");
1841 ////////////////////////////////////
1842 // FEATURE_WEBRENDER
1843 // Block 8.56.1.15/16
1844 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, DeviceFamily::AtiAll,
1845 nsIGfxInfo::FEATURE_WEBRENDER,
1846 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
1847 DRIVER_LESS_THAN_OR_EQUAL, V(8, 56, 1, 16),
1848 "CRASHY_DRIVERS_BUG_1678808");
1850 // Shader compilation startup crashes with WebRender on Windows 7.
1851 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1852 OperatingSystem::Windows7, DeviceFamily::NvidiaAll,
1853 nsIGfxInfo::FEATURE_WEBRENDER,
1854 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_INCLUSIVE,
1855 V(8, 17, 12, 8019), V(8, 17, 12, 8026), "FEATURE_FAILURE_BUG_1709629",
1856 "nVidia driver > 280.26");
1858 APPEND_TO_DRIVER_BLOCKLIST2(
1859 OperatingSystem::Windows, DeviceFamily::IntelWebRenderBlocked,
1860 nsIGfxInfo::FEATURE_WEBRENDER, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1861 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions,
1862 "INTEL_DEVICE_GEN5_OR_OLDER");
1864 APPEND_TO_DRIVER_BLOCKLIST2(
1865 OperatingSystem::Windows, DeviceFamily::NvidiaWebRenderBlocked,
1866 nsIGfxInfo::FEATURE_WEBRENDER, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1867 DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions, "EARLY_NVIDIA");
1869 ////////////////////////////////////
1870 // FEATURE_WEBRENDER_COMPOSITOR
1872 #ifndef EARLY_BETA_OR_EARLIER
1873 // See also bug 1616874
1874 APPEND_TO_DRIVER_BLOCKLIST2(
1875 OperatingSystem::Windows, DeviceFamily::IntelAll,
1876 nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR,
1877 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_EQUAL, V(24, 20, 100, 6293),
1878 "FEATURE_FAILURE_BUG_1602511");
1880 APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, DeviceFamily::AtiAll,
1881 nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR,
1882 nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
1883 DRIVER_LESS_THAN_OR_EQUAL, V(8, 17, 10, 1129),
1884 "FEATURE_FAILURE_CHROME_BUG_800950");
1885 #endif
1887 APPEND_TO_DRIVER_BLOCKLIST2(
1888 OperatingSystem::Windows10, DeviceFamily::NvidiaPascal,
1889 nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR,
1890 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
1891 V(0, 0, 0, 0), "FEATURE_FAILURE_BUG_1923697");
1893 // WebRender is unable to use scissored clears in some cases
1894 APPEND_TO_DRIVER_BLOCKLIST2(
1895 OperatingSystem::Windows, DeviceFamily::IntelAll,
1896 nsIGfxInfo::FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS,
1897 nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
1898 V(0, 0, 0, 0), "FEATURE_FAILURE_BUG_1603515");
1900 ////////////////////////////////////
1901 // FEATURE_BACKDROP_FILTER
1903 // Backdrop filter crashes the driver. See bug 1785366 and bug 1784093.
1904 APPEND_TO_DRIVER_BLOCKLIST_RANGE(
1905 OperatingSystem::Windows, DeviceFamily::IntelHDGraphicsToIvyBridge,
1906 nsIGfxInfo::FEATURE_BACKDROP_FILTER,
1907 nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_BETWEEN_EXCLUSIVE,
1908 V(8, 15, 10, 2879), V(10, 18, 10, 4425), "FEATURE_FAILURE_BUG_1785366",
1909 "Intel driver >= 10.18.10.4425");
1911 return *sDriverInfo;
1914 OperatingSystem GfxInfo::GetOperatingSystem() {
1915 return WindowsVersionToOperatingSystem(mWindowsVersion);
1918 nsresult GfxInfo::GetFeatureStatusImpl(
1919 int32_t aFeature, int32_t* aStatus, nsAString& aSuggestedDriverVersion,
1920 const nsTArray<GfxDriverInfo>& aDriverInfo, nsACString& aFailureId,
1921 OperatingSystem* aOS /* = nullptr */) {
1922 AssertNotWin32kLockdown();
1924 NS_ENSURE_ARG_POINTER(aStatus);
1925 aSuggestedDriverVersion.SetIsVoid(true);
1926 OperatingSystem os = WindowsVersionToOperatingSystem(mWindowsVersion);
1927 *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
1928 if (aOS) *aOS = os;
1930 if (sShutdownOccurred) {
1931 return NS_OK;
1934 // Don't evaluate special cases if we're checking the downloaded blocklist.
1935 if (!aDriverInfo.Length()) {
1936 nsAutoString adapterVendorID;
1937 nsAutoString adapterDeviceID;
1938 nsAutoString adapterDriverVersionString;
1939 if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
1940 NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
1941 NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString))) {
1942 if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
1943 aFailureId = "FEATURE_FAILURE_GET_ADAPTER";
1944 *aStatus = FEATURE_BLOCKED_DEVICE;
1945 } else {
1946 *aStatus = FEATURE_STATUS_OK;
1948 return NS_OK;
1951 if (OnlyAllowFeatureOnKnownConfig(aFeature) &&
1952 !adapterVendorID.Equals(
1953 GfxDriverInfo::GetDeviceVendor(DeviceVendor::Intel),
1954 nsCaseInsensitiveStringComparator) &&
1955 !adapterVendorID.Equals(
1956 GfxDriverInfo::GetDeviceVendor(DeviceVendor::NVIDIA),
1957 nsCaseInsensitiveStringComparator) &&
1958 !adapterVendorID.Equals(
1959 GfxDriverInfo::GetDeviceVendor(DeviceVendor::ATI),
1960 nsCaseInsensitiveStringComparator) &&
1961 !adapterVendorID.Equals(
1962 GfxDriverInfo::GetDeviceVendor(DeviceVendor::Microsoft),
1963 nsCaseInsensitiveStringComparator) &&
1964 !adapterVendorID.Equals(
1965 GfxDriverInfo::GetDeviceVendor(DeviceVendor::Parallels),
1966 nsCaseInsensitiveStringComparator) &&
1967 !adapterVendorID.Equals(
1968 GfxDriverInfo::GetDeviceVendor(DeviceVendor::Qualcomm),
1969 nsCaseInsensitiveStringComparator) &&
1970 // FIXME - these special hex values are currently used in xpcshell tests
1971 // introduced by bug 625160 patch 8/8. Maybe these tests need to be
1972 // adjusted now that we're only whitelisting intel/ati/nvidia.
1973 !adapterVendorID.LowerCaseEqualsLiteral("0xabcd") &&
1974 !adapterVendorID.LowerCaseEqualsLiteral("0xdcba") &&
1975 !adapterVendorID.LowerCaseEqualsLiteral("0xabab") &&
1976 !adapterVendorID.LowerCaseEqualsLiteral("0xdcdc")) {
1977 if (adapterVendorID.Equals(
1978 GfxDriverInfo::GetDeviceVendor(DeviceVendor::MicrosoftHyperV),
1979 nsCaseInsensitiveStringComparator) ||
1980 adapterVendorID.Equals(
1981 GfxDriverInfo::GetDeviceVendor(DeviceVendor::VMWare),
1982 nsCaseInsensitiveStringComparator) ||
1983 adapterVendorID.Equals(
1984 GfxDriverInfo::GetDeviceVendor(DeviceVendor::VirtualBox),
1985 nsCaseInsensitiveStringComparator)) {
1986 aFailureId = "FEATURE_FAILURE_VM_VENDOR";
1987 } else if (adapterVendorID.Equals(GfxDriverInfo::GetDeviceVendor(
1988 DeviceVendor::MicrosoftBasic),
1989 nsCaseInsensitiveStringComparator)) {
1990 aFailureId = "FEATURE_FAILURE_MICROSOFT_BASIC_VENDOR";
1991 } else if (adapterVendorID.IsEmpty()) {
1992 aFailureId = "FEATURE_FAILURE_EMPTY_DEVICE_VENDOR";
1993 } else {
1994 aFailureId = "FEATURE_FAILURE_UNKNOWN_DEVICE_VENDOR";
1996 *aStatus = FEATURE_BLOCKED_DEVICE;
1997 return NS_OK;
2000 if (adapterDriverVersionString.Length() == 0) {
2001 if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
2002 aFailureId = "FEATURE_FAILURE_EMPTY_DRIVER_VERSION";
2003 *aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
2004 } else {
2005 *aStatus = FEATURE_STATUS_OK;
2007 return NS_OK;
2010 uint64_t driverVersion;
2011 if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
2012 if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
2013 aFailureId = "FEATURE_FAILURE_PARSE_DRIVER";
2014 *aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
2015 } else {
2016 *aStatus = FEATURE_STATUS_OK;
2018 return NS_OK;
2022 return GfxInfoBase::GetFeatureStatusImpl(
2023 aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aFailureId, &os);
2026 void GfxInfo::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj) {
2027 // Add the platform neutral features
2028 GfxInfoBase::DescribeFeatures(aCx, aObj);
2030 JS::Rooted<JSObject*> obj(aCx);
2032 gfx::FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);
2033 if (!InitFeatureObject(aCx, aObj, "d3d11", d3d11, &obj)) {
2034 return;
2036 if (d3d11.GetValue() == gfx::FeatureStatus::Available) {
2037 DeviceManagerDx* dm = DeviceManagerDx::Get();
2038 JS::Rooted<JS::Value> val(aCx,
2039 JS::Int32Value(dm->GetCompositorFeatureLevel()));
2040 JS_SetProperty(aCx, obj, "version", val);
2042 val = JS::BooleanValue(dm->IsWARP());
2043 JS_SetProperty(aCx, obj, "warp", val);
2045 val = JS::BooleanValue(dm->TextureSharingWorks());
2046 JS_SetProperty(aCx, obj, "textureSharing", val);
2048 bool blocklisted = false;
2049 if (nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service()) {
2050 int32_t status;
2051 nsCString discardFailureId;
2052 if (SUCCEEDED(
2053 gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
2054 discardFailureId, &status))) {
2055 blocklisted = (status != nsIGfxInfo::FEATURE_STATUS_OK);
2059 val = JS::BooleanValue(blocklisted);
2060 JS_SetProperty(aCx, obj, "blocklisted", val);
2063 gfx::FeatureState& d2d = gfxConfig::GetFeature(Feature::DIRECT2D);
2064 if (!InitFeatureObject(aCx, aObj, "d2d", d2d, &obj)) {
2065 return;
2068 const char* version = "1.1";
2069 JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, version));
2070 JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
2071 JS_SetProperty(aCx, obj, "version", val);
2075 #ifdef DEBUG
2077 // Implement nsIGfxInfoDebug
2079 NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString& aVendorID) {
2080 mAdapterVendorID[mActiveGPUIndex] = aVendorID;
2081 return NS_OK;
2084 NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString& aDeviceID) {
2085 mAdapterDeviceID[mActiveGPUIndex] = aDeviceID;
2086 return NS_OK;
2089 NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString& aDriverVersion) {
2090 mDriverVersion[mActiveGPUIndex] = aDriverVersion;
2091 return NS_OK;
2094 NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion) {
2095 mWindowsVersion = aVersion;
2096 return NS_OK;
2099 #endif