Backed out changeset 0a133d5fd155 (bug 1864534) for causing screenshot related failur...
[gecko.git] / widget / GfxDriverInfo.cpp
blob17a8d3bc20b61a7d73496a750a8a2ae4694ad0b6
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 "GfxDriverInfo.h"
8 #include "nsIGfxInfo.h"
9 #include "nsTArray.h"
10 #include "nsUnicharUtils.h"
12 using namespace mozilla::widget;
14 int32_t GfxDriverInfo::allFeatures = 0;
15 uint64_t GfxDriverInfo::allDriverVersions = ~(uint64_t(0));
17 GfxDeviceFamily*
18 GfxDriverInfo::sDeviceFamilies[static_cast<size_t>(DeviceFamily::Max)];
19 nsString*
20 GfxDriverInfo::sWindowProtocol[static_cast<size_t>(WindowProtocol::Max)];
21 nsString* GfxDriverInfo::sDeviceVendors[static_cast<size_t>(DeviceVendor::Max)];
22 nsString* GfxDriverInfo::sDriverVendors[static_cast<size_t>(DriverVendor::Max)];
24 GfxDriverInfo::GfxDriverInfo()
25 : mOperatingSystem(OperatingSystem::Unknown),
26 mOperatingSystemVersion(0),
27 mScreen(ScreenSizeStatus::All),
28 mBattery(BatteryStatus::All),
29 mWindowProtocol(GfxDriverInfo::GetWindowProtocol(WindowProtocol::All)),
30 mAdapterVendor(GfxDriverInfo::GetDeviceVendor(DeviceFamily::All)),
31 mDriverVendor(GfxDriverInfo::GetDriverVendor(DriverVendor::All)),
32 mDevices(GfxDriverInfo::GetDeviceFamily(DeviceFamily::All)),
33 mDeleteDevices(false),
34 mFeature(allFeatures),
35 mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK),
36 mComparisonOp(DRIVER_COMPARISON_IGNORED),
37 mDriverVersion(0),
38 mDriverVersionMax(0),
39 mSuggestedVersion(nullptr),
40 mRuleId(nullptr),
41 mGpu2(false) {}
43 GfxDriverInfo::GfxDriverInfo(
44 OperatingSystem os, ScreenSizeStatus screen, BatteryStatus battery,
45 const nsAString& windowProtocol, const nsAString& vendor,
46 const nsAString& driverVendor, GfxDeviceFamily* devices, int32_t feature,
47 int32_t featureStatus, VersionComparisonOp op, uint64_t driverVersion,
48 const char* ruleId, const char* suggestedVersion /* = nullptr */,
49 bool ownDevices /* = false */, bool gpu2 /* = false */)
50 : mOperatingSystem(os),
51 mOperatingSystemVersion(0),
52 mScreen(screen),
53 mBattery(battery),
54 mWindowProtocol(windowProtocol),
55 mAdapterVendor(vendor),
56 mDriverVendor(driverVendor),
57 mDevices(devices),
58 mDeleteDevices(ownDevices),
59 mFeature(feature),
60 mFeatureStatus(featureStatus),
61 mComparisonOp(op),
62 mDriverVersion(driverVersion),
63 mDriverVersionMax(0),
64 mSuggestedVersion(suggestedVersion),
65 mRuleId(ruleId),
66 mGpu2(gpu2) {}
68 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo& aOrig)
69 : mOperatingSystem(aOrig.mOperatingSystem),
70 mOperatingSystemVersion(aOrig.mOperatingSystemVersion),
71 mScreen(aOrig.mScreen),
72 mBattery(aOrig.mBattery),
73 mWindowProtocol(aOrig.mWindowProtocol),
74 mAdapterVendor(aOrig.mAdapterVendor),
75 mDriverVendor(aOrig.mDriverVendor),
76 mFeature(aOrig.mFeature),
77 mFeatureStatus(aOrig.mFeatureStatus),
78 mComparisonOp(aOrig.mComparisonOp),
79 mDriverVersion(aOrig.mDriverVersion),
80 mDriverVersionMax(aOrig.mDriverVersionMax),
81 mSuggestedVersion(aOrig.mSuggestedVersion),
82 mRuleId(aOrig.mRuleId),
83 mGpu2(aOrig.mGpu2) {
84 // If we're managing the lifetime of the device family, we have to make a
85 // copy of the original's device family.
86 if (aOrig.mDeleteDevices && aOrig.mDevices) {
87 GfxDeviceFamily* devices = new GfxDeviceFamily;
88 *devices = *aOrig.mDevices;
89 mDevices = devices;
90 } else {
91 mDevices = aOrig.mDevices;
94 mDeleteDevices = aOrig.mDeleteDevices;
97 GfxDriverInfo::~GfxDriverInfo() {
98 if (mDeleteDevices) {
99 delete mDevices;
103 void GfxDeviceFamily::Append(const nsAString& aDeviceId) {
104 mIds.AppendElement(aDeviceId);
107 void GfxDeviceFamily::AppendRange(int32_t aBeginDeviceId,
108 int32_t aEndDeviceId) {
109 mRanges.AppendElement(
110 GfxDeviceFamily::DeviceRange{aBeginDeviceId, aEndDeviceId});
113 nsresult GfxDeviceFamily::Contains(nsAString& aDeviceId) const {
114 for (const auto& id : mIds) {
115 if (id.Equals(aDeviceId, nsCaseInsensitiveStringComparator)) {
116 return NS_OK;
120 if (mRanges.IsEmpty()) {
121 return NS_ERROR_NOT_AVAILABLE;
124 nsresult valid = NS_OK;
125 int32_t deviceId = aDeviceId.ToInteger(&valid, 16);
126 if (valid != NS_OK) {
127 return NS_ERROR_INVALID_ARG;
130 for (const auto& range : mRanges) {
131 if (deviceId >= range.mBegin && deviceId <= range.mEnd) {
132 return NS_OK;
136 return NS_ERROR_NOT_AVAILABLE;
139 // Macros for appending a device to the DeviceFamily.
140 #define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
141 #define APPEND_DEVICE2(device) \
142 deviceFamily->Append(NS_LITERAL_STRING_FROM_CSTRING(device))
143 #define APPEND_RANGE(start, end) deviceFamily->AppendRange(start, end)
145 const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id) {
146 if (id >= DeviceFamily::Max) {
147 MOZ_ASSERT_UNREACHABLE("DeviceFamily id is out of range");
148 return nullptr;
151 // All of these have no specific device ID filtering.
152 switch (id) {
153 case DeviceFamily::All:
154 case DeviceFamily::IntelAll:
155 case DeviceFamily::NvidiaAll:
156 case DeviceFamily::AtiAll:
157 case DeviceFamily::MicrosoftAll:
158 case DeviceFamily::ParallelsAll:
159 case DeviceFamily::QualcommAll:
160 case DeviceFamily::AppleAll:
161 case DeviceFamily::AmazonAll:
162 return nullptr;
163 default:
164 break;
167 // If it already exists, we must have processed it once, so return it now.
168 auto idx = static_cast<size_t>(id);
169 if (sDeviceFamilies[idx]) {
170 return sDeviceFamilies[idx];
173 sDeviceFamilies[idx] = new GfxDeviceFamily;
174 GfxDeviceFamily* deviceFamily = sDeviceFamilies[idx];
176 switch (id) {
177 case DeviceFamily::IntelGMA500:
178 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
179 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
180 break;
181 case DeviceFamily::IntelGMA900:
182 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
183 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
184 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
185 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
186 break;
187 case DeviceFamily::IntelGMA950:
188 APPEND_DEVICE(0x2772); /* Intel945G_1 */
189 APPEND_DEVICE(0x2776); /* Intel945G_2 */
190 APPEND_DEVICE(0x27a2); /* Intel945_1 */
191 APPEND_DEVICE(0x27a6); /* Intel945_2 */
192 APPEND_DEVICE(0x27ae); /* Intel945_3 */
193 break;
194 case DeviceFamily::IntelGMA3150:
195 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
196 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
197 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
198 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
199 break;
200 case DeviceFamily::IntelGMAX3000:
201 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
202 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
203 APPEND_DEVICE(0x2982); /* IntelG35_1 */
204 APPEND_DEVICE(0x2983); /* IntelG35_2 */
205 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
206 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
207 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
208 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
209 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
210 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
211 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
212 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
213 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
214 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
215 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
216 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
217 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
218 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
219 break;
220 case DeviceFamily::IntelGMAX4500HD:
221 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
222 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
223 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
224 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
225 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
226 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
227 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
228 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
229 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
230 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
231 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
232 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
233 break;
234 case DeviceFamily::IntelHDGraphicsToIvyBridge:
235 APPEND_DEVICE(0x015A); /* IntelIvyBridge_GT1_1 (HD Graphics) */
236 // clang-format off
237 APPEND_DEVICE(0x0152); /* IntelIvyBridge_GT1_2 (HD Graphics 2500, desktop) */
238 APPEND_DEVICE(0x0162); /* IntelIvyBridge_GT2_1 (HD Graphics 4000, desktop) */
239 APPEND_DEVICE(0x0166); /* IntelIvyBridge_GT2_2 (HD Graphics 4000, mobile) */
240 APPEND_DEVICE(0x016A); /* IntelIvyBridge_GT2_3 (HD Graphics P4000, workstation) */
241 // clang-format on
242 [[fallthrough]];
243 case DeviceFamily::IntelHDGraphicsToSandyBridge:
244 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
245 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
246 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
247 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
248 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
249 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
250 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
251 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
252 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
253 break;
254 case DeviceFamily::IntelHaswell:
255 APPEND_DEVICE(0x0402); /* IntelHaswell_GT1_1 */
256 APPEND_DEVICE(0x0406); /* IntelHaswell_GT1_2 */
257 APPEND_DEVICE(0x040A); /* IntelHaswell_GT1_3 */
258 APPEND_DEVICE(0x040B); /* IntelHaswell_GT1_4 */
259 APPEND_DEVICE(0x040E); /* IntelHaswell_GT1_5 */
260 APPEND_DEVICE(0x0A02); /* IntelHaswell_GT1_6 */
261 APPEND_DEVICE(0x0A06); /* IntelHaswell_GT1_7 */
262 APPEND_DEVICE(0x0A0A); /* IntelHaswell_GT1_8 */
263 APPEND_DEVICE(0x0A0B); /* IntelHaswell_GT1_9 */
264 APPEND_DEVICE(0x0A0E); /* IntelHaswell_GT1_10 */
265 APPEND_DEVICE(0x0412); /* IntelHaswell_GT2_1 */
266 APPEND_DEVICE(0x0416); /* IntelHaswell_GT2_2 */
267 APPEND_DEVICE(0x041A); /* IntelHaswell_GT2_3 */
268 APPEND_DEVICE(0x041B); /* IntelHaswell_GT2_4 */
269 APPEND_DEVICE(0x041E); /* IntelHaswell_GT2_5 */
270 APPEND_DEVICE(0x0A12); /* IntelHaswell_GT2_6 */
271 APPEND_DEVICE(0x0A16); /* IntelHaswell_GT2_7 */
272 APPEND_DEVICE(0x0A1A); /* IntelHaswell_GT2_8 */
273 APPEND_DEVICE(0x0A1B); /* IntelHaswell_GT2_9 */
274 APPEND_DEVICE(0x0A1E); /* IntelHaswell_GT2_10 */
275 APPEND_DEVICE(0x0422); /* IntelHaswell_GT3_1 */
276 APPEND_DEVICE(0x0426); /* IntelHaswell_GT3_2 */
277 APPEND_DEVICE(0x042A); /* IntelHaswell_GT3_3 */
278 APPEND_DEVICE(0x042B); /* IntelHaswell_GT3_4 */
279 APPEND_DEVICE(0x042E); /* IntelHaswell_GT3_5 */
280 APPEND_DEVICE(0x0A22); /* IntelHaswell_GT3_6 */
281 APPEND_DEVICE(0x0A26); /* IntelHaswell_GT3_7 */
282 APPEND_DEVICE(0x0A2A); /* IntelHaswell_GT3_8 */
283 APPEND_DEVICE(0x0A2B); /* IntelHaswell_GT3_9 */
284 APPEND_DEVICE(0x0A2E); /* IntelHaswell_GT3_10 */
285 APPEND_DEVICE(0x0D22); /* IntelHaswell_GT3e_1 */
286 APPEND_DEVICE(0x0D26); /* IntelHaswell_GT3e_2 */
287 APPEND_DEVICE(0x0D2A); /* IntelHaswell_GT3e_3 */
288 APPEND_DEVICE(0x0D2B); /* IntelHaswell_GT3e_4 */
289 APPEND_DEVICE(0x0D2E); /* IntelHaswell_GT3e_5 */
290 break;
291 case DeviceFamily::IntelSandyBridge:
292 APPEND_DEVICE(0x0102);
293 APPEND_DEVICE(0x0106);
294 APPEND_DEVICE(0x010a);
295 APPEND_DEVICE(0x0112);
296 APPEND_DEVICE(0x0116);
297 APPEND_DEVICE(0x0122);
298 APPEND_DEVICE(0x0126);
299 break;
300 case DeviceFamily::IntelGen7Baytrail:
301 APPEND_DEVICE(0x0f30);
302 APPEND_DEVICE(0x0f31);
303 APPEND_DEVICE(0x0f33);
304 APPEND_DEVICE(0x0155);
305 APPEND_DEVICE(0x0157);
306 break;
307 case DeviceFamily::IntelSkylake:
308 APPEND_DEVICE(0x1902);
309 APPEND_DEVICE(0x1906);
310 APPEND_DEVICE(0x190a);
311 APPEND_DEVICE(0x190B);
312 APPEND_DEVICE(0x190e);
313 APPEND_DEVICE(0x1912);
314 APPEND_DEVICE(0x1913);
315 APPEND_DEVICE(0x1915);
316 APPEND_DEVICE(0x1916);
317 APPEND_DEVICE(0x1917);
318 APPEND_DEVICE(0x191a);
319 APPEND_DEVICE(0x191b);
320 APPEND_DEVICE(0x191d);
321 APPEND_DEVICE(0x191e);
322 APPEND_DEVICE(0x1921);
323 APPEND_DEVICE(0x1923);
324 APPEND_DEVICE(0x1926);
325 APPEND_DEVICE(0x1927);
326 APPEND_DEVICE(0x192a);
327 APPEND_DEVICE(0x192b);
328 APPEND_DEVICE(0x192d);
329 APPEND_DEVICE(0x1932);
330 APPEND_DEVICE(0x193a);
331 APPEND_DEVICE(0x193b);
332 APPEND_DEVICE(0x193d);
333 break;
334 case DeviceFamily::IntelKabyLake:
335 APPEND_DEVICE(0x5902);
336 APPEND_DEVICE(0x5906);
337 APPEND_DEVICE(0x5908);
338 APPEND_DEVICE(0x590A);
339 APPEND_DEVICE(0x590B);
340 APPEND_DEVICE(0x590E);
341 APPEND_DEVICE(0x5913);
342 APPEND_DEVICE(0x5915);
343 APPEND_DEVICE(0x5912);
344 APPEND_DEVICE(0x5916);
345 APPEND_DEVICE(0x5917);
346 APPEND_DEVICE(0x591A);
347 APPEND_DEVICE(0x591B);
348 APPEND_DEVICE(0x591D);
349 APPEND_DEVICE(0x591E);
350 APPEND_DEVICE(0x5921);
351 APPEND_DEVICE(0x5923);
352 APPEND_DEVICE(0x5926);
353 APPEND_DEVICE(0x5927);
354 APPEND_DEVICE(0x593B);
355 APPEND_DEVICE(0x591C);
356 APPEND_DEVICE(0x87C0);
357 break;
358 case DeviceFamily::IntelHD520:
359 APPEND_DEVICE(0x1916);
360 break;
361 case DeviceFamily::IntelMobileHDGraphics:
362 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
363 break;
364 case DeviceFamily::NvidiaBlockD3D9Layers:
365 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
366 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
367 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
368 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
369 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
370 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
371 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
372 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
373 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
374 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
375 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
376 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
377 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
378 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
379 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
380 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
381 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
382 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
383 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
384 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
385 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
386 break;
387 case DeviceFamily::RadeonX1000:
388 // This list is from the ATIRadeonX1000.kext Info.plist
389 APPEND_DEVICE(0x7187);
390 APPEND_DEVICE(0x7210);
391 APPEND_DEVICE(0x71de);
392 APPEND_DEVICE(0x7146);
393 APPEND_DEVICE(0x7142);
394 APPEND_DEVICE(0x7109);
395 APPEND_DEVICE(0x71c5);
396 APPEND_DEVICE(0x71c0);
397 APPEND_DEVICE(0x7240);
398 APPEND_DEVICE(0x7249);
399 APPEND_DEVICE(0x7291);
400 break;
401 case DeviceFamily::RadeonCaicos:
402 APPEND_DEVICE(0x6766);
403 APPEND_DEVICE(0x6767);
404 APPEND_DEVICE(0x6768);
405 APPEND_DEVICE(0x6770);
406 APPEND_DEVICE(0x6771);
407 APPEND_DEVICE(0x6772);
408 APPEND_DEVICE(0x6778);
409 APPEND_DEVICE(0x6779);
410 APPEND_DEVICE(0x677b);
411 break;
412 case DeviceFamily::RadeonBlockZeroVideoCopy:
413 // Stoney
414 APPEND_DEVICE(0x98e4);
415 // Carrizo
416 APPEND_RANGE(0x9870, 0x9877);
417 break;
418 case DeviceFamily::Geforce7300GT:
419 APPEND_DEVICE(0x0393);
420 break;
421 case DeviceFamily::Nvidia310M:
422 APPEND_DEVICE(0x0A70);
423 break;
424 case DeviceFamily::Nvidia8800GTS:
425 APPEND_DEVICE(0x0193);
426 break;
427 case DeviceFamily::Bug1137716:
428 APPEND_DEVICE(0x0a29);
429 APPEND_DEVICE(0x0a2b);
430 APPEND_DEVICE(0x0a2d);
431 APPEND_DEVICE(0x0a35);
432 APPEND_DEVICE(0x0a6c);
433 APPEND_DEVICE(0x0a70);
434 APPEND_DEVICE(0x0a72);
435 APPEND_DEVICE(0x0a7a);
436 APPEND_DEVICE(0x0caf);
437 APPEND_DEVICE(0x0dd2);
438 APPEND_DEVICE(0x0dd3);
439 // GF180M ids
440 APPEND_DEVICE(0x0de3);
441 APPEND_DEVICE(0x0de8);
442 APPEND_DEVICE(0x0de9);
443 APPEND_DEVICE(0x0dea);
444 APPEND_DEVICE(0x0deb);
445 APPEND_DEVICE(0x0dec);
446 APPEND_DEVICE(0x0ded);
447 APPEND_DEVICE(0x0dee);
448 APPEND_DEVICE(0x0def);
449 APPEND_DEVICE(0x0df0);
450 APPEND_DEVICE(0x0df1);
451 APPEND_DEVICE(0x0df2);
452 APPEND_DEVICE(0x0df3);
453 APPEND_DEVICE(0x0df4);
454 APPEND_DEVICE(0x0df5);
455 APPEND_DEVICE(0x0df6);
456 APPEND_DEVICE(0x0df7);
457 APPEND_DEVICE(0x1050);
458 APPEND_DEVICE(0x1051);
459 APPEND_DEVICE(0x1052);
460 APPEND_DEVICE(0x1054);
461 APPEND_DEVICE(0x1055);
462 break;
463 case DeviceFamily::Bug1116812:
464 APPEND_DEVICE(0x2e32);
465 APPEND_DEVICE(0x2a02);
466 break;
467 case DeviceFamily::Bug1155608:
468 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
469 break;
470 case DeviceFamily::Bug1447141:
471 APPEND_DEVICE(0x9991);
472 APPEND_DEVICE(0x9993);
473 APPEND_DEVICE(0x9996);
474 APPEND_DEVICE(0x9998);
475 APPEND_DEVICE(0x9901);
476 APPEND_DEVICE(0x990b);
477 break;
478 case DeviceFamily::Bug1207665:
479 APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
480 APPEND_DEVICE(0xa002);
481 APPEND_DEVICE(0xa011);
482 APPEND_DEVICE(0xa012);
483 break;
484 case DeviceFamily::AmdR600:
485 // AMD R600 generation GPUs
486 // R600
487 APPEND_RANGE(0x9400, 0x9403);
488 APPEND_DEVICE(0x9405);
489 APPEND_RANGE(0x940a, 0x940b);
490 APPEND_DEVICE(0x940f);
491 // RV610
492 APPEND_RANGE(0x94c0, 0x94c1);
493 APPEND_RANGE(0x94c3, 0x94c9);
494 APPEND_RANGE(0x94cb, 0x94cd);
495 // RV630
496 APPEND_RANGE(0x9580, 0x9581);
497 APPEND_DEVICE(0x9583);
498 APPEND_RANGE(0x9586, 0x958f);
499 // RV670
500 APPEND_RANGE(0x9500, 0x9501);
501 APPEND_RANGE(0x9504, 0x9509);
502 APPEND_DEVICE(0x950f);
503 APPEND_DEVICE(0x9511);
504 APPEND_DEVICE(0x9515);
505 APPEND_DEVICE(0x9517);
506 APPEND_DEVICE(0x9519);
507 // RV620
508 APPEND_DEVICE(0x95c0);
509 APPEND_DEVICE(0x95c2);
510 APPEND_RANGE(0x95c4, 0x95c7);
511 APPEND_DEVICE(0x95c9);
512 APPEND_RANGE(0x95cc, 0x95cf);
513 // RV635
514 APPEND_RANGE(0x9590, 0x9591);
515 APPEND_DEVICE(0x9593);
516 APPEND_RANGE(0x9595, 0x9599);
517 APPEND_DEVICE(0x959b);
518 // RS780
519 APPEND_RANGE(0x9610, 0x9616);
520 // RS880
521 APPEND_RANGE(0x9710, 0x9715);
522 break;
523 case DeviceFamily::NvidiaWebRenderBlocked:
524 APPEND_RANGE(0x0190, 0x019e); // early tesla
525 APPEND_RANGE(0x0500, 0x05df); // C67-C68
526 break;
527 case DeviceFamily::IntelWebRenderBlocked:
528 // powervr
529 // sgx535
530 APPEND_DEVICE(0x2e5b);
531 APPEND_DEVICE(0x8108);
532 APPEND_DEVICE(0x8109);
533 APPEND_DEVICE(0x4102);
534 // sgx545
535 APPEND_DEVICE(0x0be0);
536 APPEND_DEVICE(0x0be1);
537 APPEND_DEVICE(0x0be3);
538 APPEND_RANGE(0x08c7, 0x08cf);
540 // gen4
541 APPEND_DEVICE(0x2972);
542 APPEND_DEVICE(0x2973);
543 APPEND_DEVICE(0x2992);
544 APPEND_DEVICE(0x2993);
545 APPEND_DEVICE(0x29a2);
546 APPEND_DEVICE(0x29a3);
548 APPEND_DEVICE(0x2982);
549 APPEND_DEVICE(0x2983);
551 APPEND_DEVICE(0x2a02);
552 APPEND_DEVICE(0x2a03);
553 APPEND_DEVICE(0x2a12);
554 APPEND_DEVICE(0x2a13);
556 // gen4.5
557 APPEND_DEVICE(0x2e02);
558 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
559 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
560 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
561 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
562 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
563 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
564 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
565 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
566 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
568 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
569 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
570 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
572 // gen5 (ironlake)
573 APPEND_DEVICE(0x0042);
574 APPEND_DEVICE(0x0046);
575 break;
576 // This should never happen, but we get a warning if we don't handle this.
577 case DeviceFamily::Max:
578 case DeviceFamily::All:
579 case DeviceFamily::IntelAll:
580 case DeviceFamily::NvidiaAll:
581 case DeviceFamily::AtiAll:
582 case DeviceFamily::MicrosoftAll:
583 case DeviceFamily::ParallelsAll:
584 case DeviceFamily::QualcommAll:
585 case DeviceFamily::AppleAll:
586 case DeviceFamily::AmazonAll:
587 NS_WARNING("Invalid DeviceFamily id");
588 break;
591 return deviceFamily;
594 // Macro for assigning a window protocol id to a string.
595 #define DECLARE_WINDOW_PROTOCOL_ID(name, windowProtocolId) \
596 case WindowProtocol::name: \
597 sWindowProtocol[idx]->AssignLiteral(windowProtocolId); \
598 break;
600 const nsAString& GfxDriverInfo::GetWindowProtocol(WindowProtocol id) {
601 if (id >= WindowProtocol::Max) {
602 MOZ_ASSERT_UNREACHABLE("WindowProtocol id is out of range");
603 id = WindowProtocol::All;
606 auto idx = static_cast<size_t>(id);
607 if (sWindowProtocol[idx]) {
608 return *sWindowProtocol[idx];
611 sWindowProtocol[idx] = new nsString();
613 switch (id) {
614 DECLARE_WINDOW_PROTOCOL_ID(X11, "x11");
615 DECLARE_WINDOW_PROTOCOL_ID(XWayland, "xwayland");
616 DECLARE_WINDOW_PROTOCOL_ID(Wayland, "wayland");
617 DECLARE_WINDOW_PROTOCOL_ID(WaylandDRM, "wayland/drm");
618 DECLARE_WINDOW_PROTOCOL_ID(WaylandAll, "wayland/all");
619 DECLARE_WINDOW_PROTOCOL_ID(X11All, "x11/all");
620 case WindowProtocol::Max: // Suppress a warning.
621 DECLARE_WINDOW_PROTOCOL_ID(All, "");
624 return *sWindowProtocol[idx];
627 // Macro for assigning a device vendor id to a string.
628 #define DECLARE_VENDOR_ID(name, deviceId) \
629 case DeviceVendor::name: \
630 sDeviceVendors[idx]->AssignLiteral(deviceId); \
631 break;
633 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceFamily id) {
634 if (id >= DeviceFamily::Max) {
635 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
636 id = DeviceFamily::All;
639 DeviceVendor vendor = DeviceVendor::All;
640 switch (id) {
641 case DeviceFamily::IntelAll:
642 case DeviceFamily::IntelGMA500:
643 case DeviceFamily::IntelGMA900:
644 case DeviceFamily::IntelGMA950:
645 case DeviceFamily::IntelGMA3150:
646 case DeviceFamily::IntelGMAX3000:
647 case DeviceFamily::IntelGMAX4500HD:
648 case DeviceFamily::IntelHDGraphicsToIvyBridge:
649 case DeviceFamily::IntelHDGraphicsToSandyBridge:
650 case DeviceFamily::IntelHaswell:
651 case DeviceFamily::IntelSandyBridge:
652 case DeviceFamily::IntelGen7Baytrail:
653 case DeviceFamily::IntelSkylake:
654 case DeviceFamily::IntelKabyLake:
655 case DeviceFamily::IntelHD520:
656 case DeviceFamily::IntelMobileHDGraphics:
657 case DeviceFamily::IntelWebRenderBlocked:
658 case DeviceFamily::Bug1116812:
659 case DeviceFamily::Bug1155608:
660 case DeviceFamily::Bug1207665:
661 vendor = DeviceVendor::Intel;
662 break;
663 case DeviceFamily::NvidiaAll:
664 case DeviceFamily::NvidiaBlockD3D9Layers:
665 case DeviceFamily::NvidiaWebRenderBlocked:
666 case DeviceFamily::Geforce7300GT:
667 case DeviceFamily::Nvidia310M:
668 case DeviceFamily::Nvidia8800GTS:
669 case DeviceFamily::Bug1137716:
670 vendor = DeviceVendor::NVIDIA;
671 break;
672 case DeviceFamily::AtiAll:
673 case DeviceFamily::RadeonBlockZeroVideoCopy:
674 case DeviceFamily::RadeonCaicos:
675 case DeviceFamily::RadeonX1000:
676 case DeviceFamily::Bug1447141:
677 case DeviceFamily::AmdR600:
678 vendor = DeviceVendor::ATI;
679 break;
680 case DeviceFamily::MicrosoftAll:
681 vendor = DeviceVendor::Microsoft;
682 break;
683 case DeviceFamily::ParallelsAll:
684 vendor = DeviceVendor::Parallels;
685 break;
686 case DeviceFamily::AppleAll:
687 vendor = DeviceVendor::Apple;
688 break;
689 case DeviceFamily::AmazonAll:
690 vendor = DeviceVendor::Amazon;
691 break;
692 case DeviceFamily::QualcommAll:
693 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
694 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
695 vendor = DeviceVendor::Qualcomm;
696 break;
697 case DeviceFamily::All:
698 case DeviceFamily::Max:
699 break;
702 return GetDeviceVendor(vendor);
705 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id) {
706 if (id >= DeviceVendor::Max) {
707 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
708 id = DeviceVendor::All;
711 auto idx = static_cast<size_t>(id);
712 if (sDeviceVendors[idx]) {
713 return *sDeviceVendors[idx];
716 sDeviceVendors[idx] = new nsString();
718 switch (id) {
719 DECLARE_VENDOR_ID(Intel, "0x8086");
720 DECLARE_VENDOR_ID(NVIDIA, "0x10de");
721 DECLARE_VENDOR_ID(ATI, "0x1002");
722 // AMD has 0x1022 but continues to release GPU hardware under ATI.
723 DECLARE_VENDOR_ID(Microsoft, "0x1414");
724 DECLARE_VENDOR_ID(MicrosoftBasic, "0x00ba");
725 DECLARE_VENDOR_ID(MicrosoftHyperV, "0x000b");
726 DECLARE_VENDOR_ID(Parallels, "0x1ab8");
727 DECLARE_VENDOR_ID(VMWare, "0x15ad");
728 DECLARE_VENDOR_ID(VirtualBox, "0x80ee");
729 DECLARE_VENDOR_ID(Apple, "0x106b");
730 DECLARE_VENDOR_ID(Amazon, "0x1d0f");
731 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
732 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
733 DECLARE_VENDOR_ID(Qualcomm, "0x5143");
734 case DeviceVendor::Max: // Suppress a warning.
735 DECLARE_VENDOR_ID(All, "");
738 return *sDeviceVendors[idx];
741 // Macro for assigning a driver vendor id to a string.
742 #define DECLARE_DRIVER_VENDOR_ID(name, driverVendorId) \
743 case DriverVendor::name: \
744 sDriverVendors[idx]->AssignLiteral(driverVendorId); \
745 break;
747 const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) {
748 if (id >= DriverVendor::Max) {
749 MOZ_ASSERT_UNREACHABLE("DriverVendor id is out of range");
750 id = DriverVendor::All;
753 auto idx = static_cast<size_t>(id);
754 if (sDriverVendors[idx]) {
755 return *sDriverVendors[idx];
758 sDriverVendors[idx] = new nsString();
760 switch (id) {
761 DECLARE_DRIVER_VENDOR_ID(MesaAll, "mesa/all");
762 DECLARE_DRIVER_VENDOR_ID(MesaLLVMPipe, "mesa/llvmpipe");
763 DECLARE_DRIVER_VENDOR_ID(MesaSoftPipe, "mesa/softpipe");
764 DECLARE_DRIVER_VENDOR_ID(MesaSWRast, "mesa/swrast");
765 DECLARE_DRIVER_VENDOR_ID(MesaSWUnknown, "mesa/software-unknown");
766 DECLARE_DRIVER_VENDOR_ID(MesaUnknown, "mesa/unknown");
767 DECLARE_DRIVER_VENDOR_ID(MesaR600, "mesa/r600");
768 DECLARE_DRIVER_VENDOR_ID(MesaNouveau, "mesa/nouveau");
769 DECLARE_DRIVER_VENDOR_ID(NonMesaAll, "non-mesa/all");
770 DECLARE_DRIVER_VENDOR_ID(HardwareMesaAll, "mesa/hw-all");
771 DECLARE_DRIVER_VENDOR_ID(SoftwareMesaAll, "mesa/sw-all");
772 DECLARE_DRIVER_VENDOR_ID(MesaNonIntelNvidiaAtiAll,
773 "mesa/non-intel-nvidia-ati-all");
774 DECLARE_DRIVER_VENDOR_ID(MesaVM, "mesa/vmwgfx");
775 case DriverVendor::Max: // Suppress a warning.
776 DECLARE_DRIVER_VENDOR_ID(All, "");
779 return *sDriverVendors[idx];