Bug 1770047 [wpt PR 34117] - Update wpt metadata, a=testonly
[gecko.git] / widget / GfxDriverInfo.cpp
blob58aba31d11063441f8a7fe8c8d265c3fd106c840
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 nsAString* GfxDriverInfo::sDesktopEnvironment[static_cast<size_t>(
20 DesktopEnvironment::Max)];
21 nsAString*
22 GfxDriverInfo::sWindowProtocol[static_cast<size_t>(WindowProtocol::Max)];
23 nsAString*
24 GfxDriverInfo::sDeviceVendors[static_cast<size_t>(DeviceVendor::Max)];
25 nsAString*
26 GfxDriverInfo::sDriverVendors[static_cast<size_t>(DriverVendor::Max)];
28 GfxDriverInfo::GfxDriverInfo()
29 : mOperatingSystem(OperatingSystem::Unknown),
30 mOperatingSystemVersion(0),
31 mScreen(ScreenSizeStatus::All),
32 mBattery(BatteryStatus::All),
33 mDesktopEnvironment(
34 GfxDriverInfo::GetDesktopEnvironment(DesktopEnvironment::All)),
35 mWindowProtocol(GfxDriverInfo::GetWindowProtocol(WindowProtocol::All)),
36 mAdapterVendor(GfxDriverInfo::GetDeviceVendor(DeviceFamily::All)),
37 mDriverVendor(GfxDriverInfo::GetDriverVendor(DriverVendor::All)),
38 mDevices(GfxDriverInfo::GetDeviceFamily(DeviceFamily::All)),
39 mDeleteDevices(false),
40 mFeature(allFeatures),
41 mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK),
42 mComparisonOp(DRIVER_COMPARISON_IGNORED),
43 mDriverVersion(0),
44 mDriverVersionMax(0),
45 mSuggestedVersion(nullptr),
46 mRuleId(nullptr),
47 mGpu2(false) {}
49 GfxDriverInfo::GfxDriverInfo(
50 OperatingSystem os, ScreenSizeStatus screen, BatteryStatus battery,
51 const nsAString& desktopEnv, const nsAString& windowProtocol,
52 const nsAString& vendor, const nsAString& driverVendor,
53 GfxDeviceFamily* devices, int32_t feature, int32_t featureStatus,
54 VersionComparisonOp op, uint64_t driverVersion, const char* ruleId,
55 const char* suggestedVersion /* = nullptr */, bool ownDevices /* = false */,
56 bool gpu2 /* = false */)
57 : mOperatingSystem(os),
58 mOperatingSystemVersion(0),
59 mScreen(screen),
60 mBattery(battery),
61 mDesktopEnvironment(desktopEnv),
62 mWindowProtocol(windowProtocol),
63 mAdapterVendor(vendor),
64 mDriverVendor(driverVendor),
65 mDevices(devices),
66 mDeleteDevices(ownDevices),
67 mFeature(feature),
68 mFeatureStatus(featureStatus),
69 mComparisonOp(op),
70 mDriverVersion(driverVersion),
71 mDriverVersionMax(0),
72 mSuggestedVersion(suggestedVersion),
73 mRuleId(ruleId),
74 mGpu2(gpu2) {}
76 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo& aOrig)
77 : mOperatingSystem(aOrig.mOperatingSystem),
78 mOperatingSystemVersion(aOrig.mOperatingSystemVersion),
79 mScreen(aOrig.mScreen),
80 mBattery(aOrig.mBattery),
81 mDesktopEnvironment(aOrig.mDesktopEnvironment),
82 mWindowProtocol(aOrig.mWindowProtocol),
83 mAdapterVendor(aOrig.mAdapterVendor),
84 mDriverVendor(aOrig.mDriverVendor),
85 mFeature(aOrig.mFeature),
86 mFeatureStatus(aOrig.mFeatureStatus),
87 mComparisonOp(aOrig.mComparisonOp),
88 mDriverVersion(aOrig.mDriverVersion),
89 mDriverVersionMax(aOrig.mDriverVersionMax),
90 mSuggestedVersion(aOrig.mSuggestedVersion),
91 mRuleId(aOrig.mRuleId),
92 mGpu2(aOrig.mGpu2) {
93 // If we're managing the lifetime of the device family, we have to make a
94 // copy of the original's device family.
95 if (aOrig.mDeleteDevices && aOrig.mDevices) {
96 GfxDeviceFamily* devices = new GfxDeviceFamily;
97 *devices = *aOrig.mDevices;
98 mDevices = devices;
99 } else {
100 mDevices = aOrig.mDevices;
103 mDeleteDevices = aOrig.mDeleteDevices;
106 GfxDriverInfo::~GfxDriverInfo() {
107 if (mDeleteDevices) {
108 delete mDevices;
112 void GfxDeviceFamily::Append(const nsAString& aDeviceId) {
113 mIds.AppendElement(aDeviceId);
116 void GfxDeviceFamily::AppendRange(int32_t aBeginDeviceId,
117 int32_t aEndDeviceId) {
118 mRanges.AppendElement(
119 GfxDeviceFamily::DeviceRange{aBeginDeviceId, aEndDeviceId});
122 nsresult GfxDeviceFamily::Contains(nsAString& aDeviceId) const {
123 for (const auto& id : mIds) {
124 if (id.Equals(aDeviceId, nsCaseInsensitiveStringComparator)) {
125 return NS_OK;
129 if (mRanges.IsEmpty()) {
130 return NS_ERROR_NOT_AVAILABLE;
133 nsresult valid = NS_OK;
134 int32_t deviceId = aDeviceId.ToInteger(&valid, 16);
135 if (valid != NS_OK) {
136 return NS_ERROR_INVALID_ARG;
139 for (const auto& range : mRanges) {
140 if (deviceId >= range.mBegin && deviceId <= range.mEnd) {
141 return NS_OK;
145 return NS_ERROR_NOT_AVAILABLE;
148 // Macros for appending a device to the DeviceFamily.
149 #define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
150 #define APPEND_DEVICE2(device) \
151 deviceFamily->Append(NS_LITERAL_STRING_FROM_CSTRING(device))
152 #define APPEND_RANGE(start, end) deviceFamily->AppendRange(start, end)
154 const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id) {
155 if (id >= DeviceFamily::Max) {
156 MOZ_ASSERT_UNREACHABLE("DeviceFamily id is out of range");
157 return nullptr;
160 // All of these have no specific device ID filtering.
161 switch (id) {
162 case DeviceFamily::All:
163 case DeviceFamily::IntelAll:
164 case DeviceFamily::NvidiaAll:
165 case DeviceFamily::AtiAll:
166 case DeviceFamily::MicrosoftAll:
167 case DeviceFamily::ParallelsAll:
168 case DeviceFamily::QualcommAll:
169 case DeviceFamily::AppleAll:
170 case DeviceFamily::AmazonAll:
171 return nullptr;
172 default:
173 break;
176 // If it already exists, we must have processed it once, so return it now.
177 auto idx = static_cast<size_t>(id);
178 if (sDeviceFamilies[idx]) {
179 return sDeviceFamilies[idx];
182 sDeviceFamilies[idx] = new GfxDeviceFamily;
183 GfxDeviceFamily* deviceFamily = sDeviceFamilies[idx];
185 switch (id) {
186 case DeviceFamily::IntelGMA500:
187 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
188 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
189 break;
190 case DeviceFamily::IntelGMA900:
191 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
192 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
193 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
194 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
195 break;
196 case DeviceFamily::IntelGMA950:
197 APPEND_DEVICE(0x2772); /* Intel945G_1 */
198 APPEND_DEVICE(0x2776); /* Intel945G_2 */
199 APPEND_DEVICE(0x27a2); /* Intel945_1 */
200 APPEND_DEVICE(0x27a6); /* Intel945_2 */
201 APPEND_DEVICE(0x27ae); /* Intel945_3 */
202 break;
203 case DeviceFamily::IntelGMA3150:
204 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
205 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
206 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
207 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
208 break;
209 case DeviceFamily::IntelGMAX3000:
210 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
211 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
212 APPEND_DEVICE(0x2982); /* IntelG35_1 */
213 APPEND_DEVICE(0x2983); /* IntelG35_2 */
214 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
215 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
216 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
217 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
218 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
219 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
220 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
221 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
222 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
223 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
224 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
225 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
226 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
227 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
228 break;
229 case DeviceFamily::IntelGMAX4500HD:
230 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
231 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
232 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
233 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
234 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
235 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
236 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
237 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
238 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
239 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
240 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
241 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
242 break;
243 case DeviceFamily::IntelHDGraphicsToIvyBridge:
244 APPEND_DEVICE(0x015A); /* IntelIvyBridge_GT1_1 (HD Graphics) */
245 // clang-format off
246 APPEND_DEVICE(0x0152); /* IntelIvyBridge_GT1_2 (HD Graphics 2500, desktop) */
247 APPEND_DEVICE(0x0162); /* IntelIvyBridge_GT2_1 (HD Graphics 4000, desktop) */
248 APPEND_DEVICE(0x0166); /* IntelIvyBridge_GT2_2 (HD Graphics 4000, mobile) */
249 APPEND_DEVICE(0x016A); /* IntelIvyBridge_GT2_3 (HD Graphics P4000, workstation) */
250 // clang-format on
251 [[fallthrough]];
252 case DeviceFamily::IntelHDGraphicsToSandyBridge:
253 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
254 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
255 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
256 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
257 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
258 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
259 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
260 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
261 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
262 break;
263 case DeviceFamily::IntelHaswell:
264 APPEND_DEVICE(0x0402); /* IntelHaswell_GT1_1 */
265 APPEND_DEVICE(0x0406); /* IntelHaswell_GT1_2 */
266 APPEND_DEVICE(0x040A); /* IntelHaswell_GT1_3 */
267 APPEND_DEVICE(0x040B); /* IntelHaswell_GT1_4 */
268 APPEND_DEVICE(0x040E); /* IntelHaswell_GT1_5 */
269 APPEND_DEVICE(0x0A02); /* IntelHaswell_GT1_6 */
270 APPEND_DEVICE(0x0A06); /* IntelHaswell_GT1_7 */
271 APPEND_DEVICE(0x0A0A); /* IntelHaswell_GT1_8 */
272 APPEND_DEVICE(0x0A0B); /* IntelHaswell_GT1_9 */
273 APPEND_DEVICE(0x0A0E); /* IntelHaswell_GT1_10 */
274 APPEND_DEVICE(0x0412); /* IntelHaswell_GT2_1 */
275 APPEND_DEVICE(0x0416); /* IntelHaswell_GT2_2 */
276 APPEND_DEVICE(0x041A); /* IntelHaswell_GT2_3 */
277 APPEND_DEVICE(0x041B); /* IntelHaswell_GT2_4 */
278 APPEND_DEVICE(0x041E); /* IntelHaswell_GT2_5 */
279 APPEND_DEVICE(0x0A12); /* IntelHaswell_GT2_6 */
280 APPEND_DEVICE(0x0A16); /* IntelHaswell_GT2_7 */
281 APPEND_DEVICE(0x0A1A); /* IntelHaswell_GT2_8 */
282 APPEND_DEVICE(0x0A1B); /* IntelHaswell_GT2_9 */
283 APPEND_DEVICE(0x0A1E); /* IntelHaswell_GT2_10 */
284 APPEND_DEVICE(0x0422); /* IntelHaswell_GT3_1 */
285 APPEND_DEVICE(0x0426); /* IntelHaswell_GT3_2 */
286 APPEND_DEVICE(0x042A); /* IntelHaswell_GT3_3 */
287 APPEND_DEVICE(0x042B); /* IntelHaswell_GT3_4 */
288 APPEND_DEVICE(0x042E); /* IntelHaswell_GT3_5 */
289 APPEND_DEVICE(0x0A22); /* IntelHaswell_GT3_6 */
290 APPEND_DEVICE(0x0A26); /* IntelHaswell_GT3_7 */
291 APPEND_DEVICE(0x0A2A); /* IntelHaswell_GT3_8 */
292 APPEND_DEVICE(0x0A2B); /* IntelHaswell_GT3_9 */
293 APPEND_DEVICE(0x0A2E); /* IntelHaswell_GT3_10 */
294 APPEND_DEVICE(0x0D22); /* IntelHaswell_GT3e_1 */
295 APPEND_DEVICE(0x0D26); /* IntelHaswell_GT3e_2 */
296 APPEND_DEVICE(0x0D2A); /* IntelHaswell_GT3e_3 */
297 APPEND_DEVICE(0x0D2B); /* IntelHaswell_GT3e_4 */
298 APPEND_DEVICE(0x0D2E); /* IntelHaswell_GT3e_5 */
299 break;
300 case DeviceFamily::IntelSandyBridge:
301 APPEND_DEVICE(0x0102);
302 APPEND_DEVICE(0x0106);
303 APPEND_DEVICE(0x010a);
304 APPEND_DEVICE(0x0112);
305 APPEND_DEVICE(0x0116);
306 APPEND_DEVICE(0x0122);
307 APPEND_DEVICE(0x0126);
308 break;
309 case DeviceFamily::IntelGen7Baytrail:
310 APPEND_DEVICE(0x0f30);
311 APPEND_DEVICE(0x0f31);
312 APPEND_DEVICE(0x0f33);
313 APPEND_DEVICE(0x0155);
314 APPEND_DEVICE(0x0157);
315 break;
316 case DeviceFamily::IntelSkylake:
317 APPEND_DEVICE(0x1902);
318 APPEND_DEVICE(0x1906);
319 APPEND_DEVICE(0x190a);
320 APPEND_DEVICE(0x190B);
321 APPEND_DEVICE(0x190e);
322 APPEND_DEVICE(0x1912);
323 APPEND_DEVICE(0x1913);
324 APPEND_DEVICE(0x1915);
325 APPEND_DEVICE(0x1916);
326 APPEND_DEVICE(0x1917);
327 APPEND_DEVICE(0x191a);
328 APPEND_DEVICE(0x191b);
329 APPEND_DEVICE(0x191d);
330 APPEND_DEVICE(0x191e);
331 APPEND_DEVICE(0x1921);
332 APPEND_DEVICE(0x1923);
333 APPEND_DEVICE(0x1926);
334 APPEND_DEVICE(0x1927);
335 APPEND_DEVICE(0x192a);
336 APPEND_DEVICE(0x192b);
337 APPEND_DEVICE(0x192d);
338 APPEND_DEVICE(0x1932);
339 APPEND_DEVICE(0x193a);
340 APPEND_DEVICE(0x193b);
341 APPEND_DEVICE(0x193d);
342 break;
343 case DeviceFamily::IntelHD520:
344 APPEND_DEVICE(0x1916);
345 break;
346 case DeviceFamily::IntelMobileHDGraphics:
347 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
348 break;
349 case DeviceFamily::NvidiaBlockD3D9Layers:
350 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
351 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
352 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
353 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
354 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
355 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
356 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
357 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
358 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
359 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
360 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
361 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
362 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
363 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
364 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
365 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
366 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
367 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
368 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
369 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
370 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
371 break;
372 case DeviceFamily::RadeonX1000:
373 // This list is from the ATIRadeonX1000.kext Info.plist
374 APPEND_DEVICE(0x7187);
375 APPEND_DEVICE(0x7210);
376 APPEND_DEVICE(0x71de);
377 APPEND_DEVICE(0x7146);
378 APPEND_DEVICE(0x7142);
379 APPEND_DEVICE(0x7109);
380 APPEND_DEVICE(0x71c5);
381 APPEND_DEVICE(0x71c0);
382 APPEND_DEVICE(0x7240);
383 APPEND_DEVICE(0x7249);
384 APPEND_DEVICE(0x7291);
385 break;
386 case DeviceFamily::RadeonCaicos:
387 APPEND_DEVICE(0x6766);
388 APPEND_DEVICE(0x6767);
389 APPEND_DEVICE(0x6768);
390 APPEND_DEVICE(0x6770);
391 APPEND_DEVICE(0x6771);
392 APPEND_DEVICE(0x6772);
393 APPEND_DEVICE(0x6778);
394 APPEND_DEVICE(0x6779);
395 APPEND_DEVICE(0x677b);
396 break;
397 case DeviceFamily::RadeonBlockNoVideoCopy:
398 // Stoney
399 APPEND_DEVICE(0x98e4);
400 // Carrizo
401 APPEND_RANGE(0x9870, 0x9877);
402 break;
403 case DeviceFamily::Geforce7300GT:
404 APPEND_DEVICE(0x0393);
405 break;
406 case DeviceFamily::Nvidia310M:
407 APPEND_DEVICE(0x0A70);
408 break;
409 case DeviceFamily::Nvidia8800GTS:
410 APPEND_DEVICE(0x0193);
411 break;
412 case DeviceFamily::Bug1137716:
413 APPEND_DEVICE(0x0a29);
414 APPEND_DEVICE(0x0a2b);
415 APPEND_DEVICE(0x0a2d);
416 APPEND_DEVICE(0x0a35);
417 APPEND_DEVICE(0x0a6c);
418 APPEND_DEVICE(0x0a70);
419 APPEND_DEVICE(0x0a72);
420 APPEND_DEVICE(0x0a7a);
421 APPEND_DEVICE(0x0caf);
422 APPEND_DEVICE(0x0dd2);
423 APPEND_DEVICE(0x0dd3);
424 // GF180M ids
425 APPEND_DEVICE(0x0de3);
426 APPEND_DEVICE(0x0de8);
427 APPEND_DEVICE(0x0de9);
428 APPEND_DEVICE(0x0dea);
429 APPEND_DEVICE(0x0deb);
430 APPEND_DEVICE(0x0dec);
431 APPEND_DEVICE(0x0ded);
432 APPEND_DEVICE(0x0dee);
433 APPEND_DEVICE(0x0def);
434 APPEND_DEVICE(0x0df0);
435 APPEND_DEVICE(0x0df1);
436 APPEND_DEVICE(0x0df2);
437 APPEND_DEVICE(0x0df3);
438 APPEND_DEVICE(0x0df4);
439 APPEND_DEVICE(0x0df5);
440 APPEND_DEVICE(0x0df6);
441 APPEND_DEVICE(0x0df7);
442 APPEND_DEVICE(0x1050);
443 APPEND_DEVICE(0x1051);
444 APPEND_DEVICE(0x1052);
445 APPEND_DEVICE(0x1054);
446 APPEND_DEVICE(0x1055);
447 break;
448 case DeviceFamily::Bug1116812:
449 APPEND_DEVICE(0x2e32);
450 APPEND_DEVICE(0x2a02);
451 break;
452 case DeviceFamily::Bug1155608:
453 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
454 break;
455 case DeviceFamily::Bug1447141:
456 APPEND_DEVICE(0x9991);
457 APPEND_DEVICE(0x9993);
458 APPEND_DEVICE(0x9996);
459 APPEND_DEVICE(0x9998);
460 APPEND_DEVICE(0x9901);
461 APPEND_DEVICE(0x990b);
462 break;
463 case DeviceFamily::Bug1207665:
464 APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
465 APPEND_DEVICE(0xa002);
466 APPEND_DEVICE(0xa011);
467 APPEND_DEVICE(0xa012);
468 break;
469 case DeviceFamily::AmdR600:
470 // AMD R600 generation GPUs
471 // R600
472 APPEND_RANGE(0x9400, 0x9403);
473 APPEND_DEVICE(0x9405);
474 APPEND_RANGE(0x940a, 0x940b);
475 APPEND_DEVICE(0x940f);
476 // RV610
477 APPEND_RANGE(0x94c0, 0x94c1);
478 APPEND_RANGE(0x94c3, 0x94c9);
479 APPEND_RANGE(0x94cb, 0x94cd);
480 // RV630
481 APPEND_RANGE(0x9580, 0x9581);
482 APPEND_DEVICE(0x9583);
483 APPEND_RANGE(0x9586, 0x958f);
484 // RV670
485 APPEND_RANGE(0x9500, 0x9501);
486 APPEND_RANGE(0x9504, 0x9509);
487 APPEND_DEVICE(0x950f);
488 APPEND_DEVICE(0x9511);
489 APPEND_DEVICE(0x9515);
490 APPEND_DEVICE(0x9517);
491 APPEND_DEVICE(0x9519);
492 // RV620
493 APPEND_DEVICE(0x95c0);
494 APPEND_DEVICE(0x95c2);
495 APPEND_RANGE(0x95c4, 0x95c7);
496 APPEND_DEVICE(0x95c9);
497 APPEND_RANGE(0x95cc, 0x95cf);
498 // RV635
499 APPEND_RANGE(0x9590, 0x9591);
500 APPEND_DEVICE(0x9593);
501 APPEND_RANGE(0x9595, 0x9599);
502 APPEND_DEVICE(0x959b);
503 // RS780
504 APPEND_RANGE(0x9610, 0x9616);
505 // RS880
506 APPEND_RANGE(0x9710, 0x9715);
507 break;
508 case DeviceFamily::NvidiaWebRenderBlocked:
509 APPEND_RANGE(0x0190, 0x019e); // early tesla
510 APPEND_RANGE(0x0500, 0x05df); // C67-C68
511 break;
512 case DeviceFamily::NvidiaRolloutWebRender:
513 APPEND_RANGE(0x0400, 0x04ff);
514 APPEND_RANGE(0x05e0, 0x05ff);
515 APPEND_RANGE(0x0600, INT32_MAX);
516 APPEND_RANGE(0x06c0, INT32_MAX);
517 break;
518 case DeviceFamily::IntelWebRenderBlocked:
519 // powervr
520 // sgx535
521 APPEND_DEVICE(0x2e5b);
522 APPEND_DEVICE(0x8108);
523 APPEND_DEVICE(0x8109);
524 APPEND_DEVICE(0x4102);
525 // sgx545
526 APPEND_DEVICE(0x0be0);
527 APPEND_DEVICE(0x0be1);
528 APPEND_DEVICE(0x0be3);
529 APPEND_RANGE(0x08c7, 0x08cf);
531 // gen4
532 APPEND_DEVICE(0x2972);
533 APPEND_DEVICE(0x2973);
534 APPEND_DEVICE(0x2992);
535 APPEND_DEVICE(0x2993);
536 APPEND_DEVICE(0x29a2);
537 APPEND_DEVICE(0x29a3);
539 APPEND_DEVICE(0x2982);
540 APPEND_DEVICE(0x2983);
542 APPEND_DEVICE(0x2a02);
543 APPEND_DEVICE(0x2a03);
544 APPEND_DEVICE(0x2a12);
545 APPEND_DEVICE(0x2a13);
547 // gen4.5
548 APPEND_DEVICE(0x2e02);
549 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
550 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
551 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
552 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
553 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
554 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
555 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
556 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
557 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
559 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
560 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
561 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
563 // gen5 (ironlake)
564 APPEND_DEVICE(0x0042);
565 APPEND_DEVICE(0x0046);
566 break;
567 case DeviceFamily::IntelRolloutWebRender:
568 // Disable WebRender on these devices for now
569 // to match what's going out into release
570 #if 0
571 // gen4.5 - G45
572 APPEND_DEVICE(0x2e22);
574 // gen5 (ironlake)
575 APPEND_DEVICE(0x0042);
576 APPEND_DEVICE(0x0046);
577 #endif
579 // cherryview
580 APPEND_DEVICE(0x22b0);
581 APPEND_DEVICE(0x22b1);
582 APPEND_DEVICE(0x22b2);
583 APPEND_DEVICE(0x22b3);
585 [[fallthrough]];
586 case DeviceFamily::IntelModernRolloutWebRender:
587 // Temporarily disable WebRender on gen6 to get more sw-wr+D3D11 testing
588 #ifndef NIGHTLY_BUILD
589 // sandybridge gen6 gt1
590 APPEND_DEVICE(0x0102);
591 APPEND_DEVICE(0x0106);
592 APPEND_DEVICE(0x010a);
594 // sandybridge gen6 gt2
595 APPEND_DEVICE(0x0112);
596 APPEND_DEVICE(0x0116);
597 APPEND_DEVICE(0x0122);
598 APPEND_DEVICE(0x0126);
599 #endif
601 // ivybridge gen7 baytrail
602 APPEND_DEVICE(0x0f30);
603 APPEND_DEVICE(0x0f31);
604 APPEND_DEVICE(0x0f33);
605 APPEND_DEVICE(0x0155);
606 APPEND_DEVICE(0x0157);
608 // ivybridge gen7 gt1
609 APPEND_DEVICE(0x0152);
610 APPEND_DEVICE(0x0156);
611 APPEND_DEVICE(0x015a);
613 // ivybridge gen7 gt2
614 APPEND_DEVICE(0x0162);
615 APPEND_DEVICE(0x0166);
616 APPEND_DEVICE(0x016a);
618 // haswell gen7.5 gt1
619 APPEND_DEVICE(0x0402);
620 APPEND_DEVICE(0x0406);
621 APPEND_DEVICE(0x040a);
622 APPEND_DEVICE(0x040b);
623 APPEND_DEVICE(0x040e);
624 APPEND_DEVICE(0x0a02);
625 APPEND_DEVICE(0x0a06);
626 APPEND_DEVICE(0x0a0a);
627 APPEND_DEVICE(0x0a0b);
628 APPEND_DEVICE(0x0a0e);
629 APPEND_DEVICE(0x0c02);
630 APPEND_DEVICE(0x0c06);
631 APPEND_DEVICE(0x0c0c);
632 APPEND_DEVICE(0x0c0b);
633 APPEND_DEVICE(0x0c0e);
634 APPEND_DEVICE(0x0d02);
635 APPEND_DEVICE(0x0d06);
636 APPEND_DEVICE(0x0d0a);
637 APPEND_DEVICE(0x0d0b);
638 APPEND_DEVICE(0x0d0e);
640 // haswell gen7.5 gt2
641 APPEND_DEVICE(0x0412);
642 APPEND_DEVICE(0x0416);
643 APPEND_DEVICE(0x041a);
644 APPEND_DEVICE(0x041b);
645 APPEND_DEVICE(0x041e);
646 APPEND_DEVICE(0x0a12);
647 APPEND_DEVICE(0x0a16);
648 APPEND_DEVICE(0x0a1a);
649 APPEND_DEVICE(0x0a1b);
650 APPEND_DEVICE(0x0a1e);
652 // haswell gen7.5 gt3
653 APPEND_DEVICE(0x0422);
654 APPEND_DEVICE(0x0426);
655 APPEND_DEVICE(0x042a);
656 APPEND_DEVICE(0x042b);
657 APPEND_DEVICE(0x042e);
658 APPEND_DEVICE(0x0a22);
659 APPEND_DEVICE(0x0a26);
660 APPEND_DEVICE(0x0a0a);
661 APPEND_DEVICE(0x0a1a);
662 APPEND_DEVICE(0x0a2a);
663 APPEND_DEVICE(0x0a2b);
664 APPEND_DEVICE(0x0a2e);
665 APPEND_DEVICE(0x0c22);
666 APPEND_DEVICE(0x0c26);
667 APPEND_DEVICE(0x0c2c);
668 APPEND_DEVICE(0x0c2b);
669 APPEND_DEVICE(0x0c2e);
670 APPEND_DEVICE(0x0d22);
671 APPEND_DEVICE(0x0d26);
672 APPEND_DEVICE(0x0d2b);
673 APPEND_DEVICE(0x0d2e);
675 // broxton (apollolake)
676 APPEND_DEVICE(0x0a84);
677 APPEND_DEVICE(0x1a84);
678 APPEND_DEVICE(0x1a85);
679 APPEND_DEVICE(0x5a84);
680 APPEND_DEVICE(0x5a85);
682 // geminilake
683 APPEND_DEVICE(0x3184);
684 APPEND_DEVICE(0x3185);
686 // broadwell gt1 (gen8)
687 APPEND_DEVICE(0x1602);
688 APPEND_DEVICE(0x1606);
689 APPEND_DEVICE(0x160a);
690 APPEND_DEVICE(0x160b);
691 APPEND_DEVICE(0x160d);
692 APPEND_DEVICE(0x160e);
694 // broadwell gt2+ (gen8)
695 APPEND_DEVICE(0x1612);
696 APPEND_DEVICE(0x1616);
697 APPEND_DEVICE(0x161a);
698 APPEND_DEVICE(0x161b);
699 APPEND_DEVICE(0x161d);
700 APPEND_DEVICE(0x161e);
701 APPEND_DEVICE(0x1622);
702 APPEND_DEVICE(0x1626);
703 APPEND_DEVICE(0x162a);
704 APPEND_DEVICE(0x162b);
705 APPEND_DEVICE(0x162d);
706 APPEND_DEVICE(0x162e);
707 APPEND_DEVICE(0x1632);
708 APPEND_DEVICE(0x1636);
709 APPEND_DEVICE(0x163a);
710 APPEND_DEVICE(0x163b);
711 APPEND_DEVICE(0x163d);
712 APPEND_DEVICE(0x163e);
714 // skylake gt1
715 APPEND_DEVICE(0x1902);
716 APPEND_DEVICE(0x1906);
717 APPEND_DEVICE(0x190a);
718 APPEND_DEVICE(0x190e);
720 // skylake gt2
721 APPEND_DEVICE(0x1912);
722 APPEND_DEVICE(0x1913);
723 APPEND_DEVICE(0x1915);
724 APPEND_DEVICE(0x1916);
725 APPEND_DEVICE(0x1917);
726 APPEND_DEVICE(0x191a);
727 APPEND_DEVICE(0x191b);
728 APPEND_DEVICE(0x191d);
729 APPEND_DEVICE(0x191e);
730 APPEND_DEVICE(0x1921);
732 // skylake gt3
733 APPEND_DEVICE(0x1923);
734 APPEND_DEVICE(0x1926);
735 APPEND_DEVICE(0x1927);
736 APPEND_DEVICE(0x192b);
738 // skylake gt4
739 APPEND_DEVICE(0x1932);
740 APPEND_DEVICE(0x193a);
741 APPEND_DEVICE(0x193b);
742 APPEND_DEVICE(0x193d);
744 // kabylake gt1
745 APPEND_DEVICE(0x5902);
746 APPEND_DEVICE(0x5906);
747 APPEND_DEVICE(0x5908);
748 APPEND_DEVICE(0x590a);
749 APPEND_DEVICE(0x590b);
750 APPEND_DEVICE(0x590e);
752 // kabylake gt1.5
753 APPEND_DEVICE(0x5913);
754 APPEND_DEVICE(0x5915);
755 APPEND_DEVICE(0x5917);
757 // kabylake gt2
758 APPEND_DEVICE(0x5912);
759 APPEND_DEVICE(0x5916);
760 APPEND_DEVICE(0x591a);
761 APPEND_DEVICE(0x591b);
762 APPEND_DEVICE(0x591c);
763 APPEND_DEVICE(0x591d);
764 APPEND_DEVICE(0x591e);
765 APPEND_DEVICE(0x5921);
766 APPEND_DEVICE(0x5926);
767 APPEND_DEVICE(0x5923);
768 APPEND_DEVICE(0x5927);
769 APPEND_DEVICE(0x593b);
770 APPEND_DEVICE(0x87c0);
772 // coffeelake gt1
773 APPEND_DEVICE(0x3e90);
774 APPEND_DEVICE(0x3e93);
775 APPEND_DEVICE(0x3e99);
776 APPEND_DEVICE(0x3e9c);
777 APPEND_DEVICE(0x3ea1);
778 APPEND_DEVICE(0x3ea4);
779 APPEND_DEVICE(0x9b21);
780 APPEND_DEVICE(0x9ba0);
781 APPEND_DEVICE(0x9ba2);
782 APPEND_DEVICE(0x9ba4);
783 APPEND_DEVICE(0x9ba5);
784 APPEND_DEVICE(0x9ba8);
785 APPEND_DEVICE(0x9baa);
786 APPEND_DEVICE(0x9bab);
787 APPEND_DEVICE(0x9bac);
789 // coffeelake gt2+
790 APPEND_RANGE(0x3e91, 0x3e92);
791 APPEND_DEVICE(0x3e94);
792 APPEND_DEVICE(0x3e96);
793 APPEND_DEVICE(0x3e98);
794 APPEND_RANGE(0x3e9a, 0x3e9b);
795 APPEND_DEVICE(0x3ea0);
796 APPEND_DEVICE(0x3ea2);
797 APPEND_RANGE(0x3ea5, 0x3ea9);
798 APPEND_DEVICE(0x87ca);
799 APPEND_DEVICE(0x9b41);
800 APPEND_DEVICE(0x9bc0);
801 APPEND_DEVICE(0x9bc2);
802 APPEND_RANGE(0x9bc4, 0x9bf6);
804 // icelake gt1,gt1.5,gt2
805 APPEND_RANGE(0x8a50, 0x8a5d);
807 // rocketlake
808 APPEND_RANGE(0x4c8a, 0x4c9a);
810 // tigerlake
811 APPEND_RANGE(0x9a40, 0x9af8);
812 break;
813 case DeviceFamily::AtiRolloutWebRender:
814 APPEND_RANGE(0x6600, 0x66af);
815 APPEND_RANGE(0x6700, 0x671f);
816 APPEND_RANGE(0x6780, 0x683f);
817 APPEND_RANGE(0x6860, 0x687f);
818 APPEND_RANGE(0x6900, 0x69ff);
819 APPEND_DEVICE(0x6fdf);
820 APPEND_DEVICE(0x7300);
821 APPEND_RANGE(0x7310, 0x73ff);
822 APPEND_RANGE(0x9830, 0x986f);
823 APPEND_RANGE(0x9900, 0x99ff);
824 // Raven
825 APPEND_DEVICE(0x15dd);
826 APPEND_DEVICE(0x15d8);
827 // Renoir
828 APPEND_DEVICE(0x1636);
829 // Cezanne
830 APPEND_DEVICE(0x1638);
831 // Lucienne
832 APPEND_DEVICE(0x164c);
834 // Evergreen
835 APPEND_RANGE(0x6840, 0x684b);
836 APPEND_RANGE(0x6850, 0x685f);
837 APPEND_RANGE(0x6880, 0x68ff);
838 APPEND_RANGE(0x9800, 0x980a);
839 APPEND_RANGE(0x9640, 0x964f);
840 APPEND_RANGE(0x6720, 0x677f);
842 // Stoney
843 APPEND_DEVICE(0x98e4);
845 // Carrizo
846 APPEND_RANGE(0x9870, 0x9877);
848 // Kaveri
849 APPEND_RANGE(0x1304, 0x131d);
851 // R700
852 APPEND_RANGE(0x9440, 0x949f);
853 APPEND_RANGE(0x94a0, 0x94b9);
854 APPEND_RANGE(0x9540, 0x955f);
856 break;
857 // This should never happen, but we get a warning if we don't handle this.
858 case DeviceFamily::Max:
859 case DeviceFamily::All:
860 case DeviceFamily::IntelAll:
861 case DeviceFamily::NvidiaAll:
862 case DeviceFamily::AtiAll:
863 case DeviceFamily::MicrosoftAll:
864 case DeviceFamily::ParallelsAll:
865 case DeviceFamily::QualcommAll:
866 case DeviceFamily::AppleAll:
867 case DeviceFamily::AmazonAll:
868 NS_WARNING("Invalid DeviceFamily id");
869 break;
872 return deviceFamily;
875 // Macro for assigning a desktop environment to a string.
876 #define DECLARE_DESKTOP_ENVIRONMENT_ID(name, desktopEnvId) \
877 case DesktopEnvironment::name: \
878 sDesktopEnvironment[idx]->AssignLiteral(desktopEnvId); \
879 break;
881 const nsAString& GfxDriverInfo::GetDesktopEnvironment(DesktopEnvironment id) {
882 if (id >= DesktopEnvironment::Max) {
883 MOZ_ASSERT_UNREACHABLE("DesktopEnvironment id is out of range");
884 id = DesktopEnvironment::All;
887 auto idx = static_cast<size_t>(id);
888 if (sDesktopEnvironment[idx]) {
889 return *sDesktopEnvironment[idx];
892 sDesktopEnvironment[idx] = new nsString();
894 switch (id) {
895 DECLARE_DESKTOP_ENVIRONMENT_ID(GNOME, "gnome");
896 DECLARE_DESKTOP_ENVIRONMENT_ID(KDE, "kde");
897 DECLARE_DESKTOP_ENVIRONMENT_ID(XFCE, "xfce");
898 DECLARE_DESKTOP_ENVIRONMENT_ID(Cinnamon, "cinnamon");
899 DECLARE_DESKTOP_ENVIRONMENT_ID(Enlightenment, "enlightment");
900 DECLARE_DESKTOP_ENVIRONMENT_ID(LXDE, "lxde");
901 DECLARE_DESKTOP_ENVIRONMENT_ID(Openbox, "openbox");
902 DECLARE_DESKTOP_ENVIRONMENT_ID(i3, "i3");
903 DECLARE_DESKTOP_ENVIRONMENT_ID(Sway, "sway");
904 DECLARE_DESKTOP_ENVIRONMENT_ID(Mate, "mate");
905 DECLARE_DESKTOP_ENVIRONMENT_ID(Unity, "unity");
906 DECLARE_DESKTOP_ENVIRONMENT_ID(Pantheon, "pantheon");
907 DECLARE_DESKTOP_ENVIRONMENT_ID(LXQT, "lxqt");
908 DECLARE_DESKTOP_ENVIRONMENT_ID(Deepin, "deepin");
909 DECLARE_DESKTOP_ENVIRONMENT_ID(Dwm, "dwm");
910 DECLARE_DESKTOP_ENVIRONMENT_ID(Budgie, "budgie");
911 DECLARE_DESKTOP_ENVIRONMENT_ID(Unknown, "unknown");
912 case DesktopEnvironment::Max: // Suppress a warning.
913 DECLARE_DESKTOP_ENVIRONMENT_ID(All, "");
916 return *sDesktopEnvironment[idx];
919 // Macro for assigning a window protocol id to a string.
920 #define DECLARE_WINDOW_PROTOCOL_ID(name, windowProtocolId) \
921 case WindowProtocol::name: \
922 sWindowProtocol[idx]->AssignLiteral(windowProtocolId); \
923 break;
925 const nsAString& GfxDriverInfo::GetWindowProtocol(WindowProtocol id) {
926 if (id >= WindowProtocol::Max) {
927 MOZ_ASSERT_UNREACHABLE("WindowProtocol id is out of range");
928 id = WindowProtocol::All;
931 auto idx = static_cast<size_t>(id);
932 if (sWindowProtocol[idx]) {
933 return *sWindowProtocol[idx];
936 sWindowProtocol[idx] = new nsString();
938 switch (id) {
939 DECLARE_WINDOW_PROTOCOL_ID(X11, "x11");
940 DECLARE_WINDOW_PROTOCOL_ID(XWayland, "xwayland");
941 DECLARE_WINDOW_PROTOCOL_ID(Wayland, "wayland");
942 DECLARE_WINDOW_PROTOCOL_ID(WaylandDRM, "wayland/drm");
943 DECLARE_WINDOW_PROTOCOL_ID(WaylandAll, "wayland/all");
944 DECLARE_WINDOW_PROTOCOL_ID(X11All, "x11/all");
945 case WindowProtocol::Max: // Suppress a warning.
946 DECLARE_WINDOW_PROTOCOL_ID(All, "");
949 return *sWindowProtocol[idx];
952 // Macro for assigning a device vendor id to a string.
953 #define DECLARE_VENDOR_ID(name, deviceId) \
954 case DeviceVendor::name: \
955 sDeviceVendors[idx]->AssignLiteral(deviceId); \
956 break;
958 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceFamily id) {
959 if (id >= DeviceFamily::Max) {
960 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
961 id = DeviceFamily::All;
964 DeviceVendor vendor = DeviceVendor::All;
965 switch (id) {
966 case DeviceFamily::IntelAll:
967 case DeviceFamily::IntelGMA500:
968 case DeviceFamily::IntelGMA900:
969 case DeviceFamily::IntelGMA950:
970 case DeviceFamily::IntelGMA3150:
971 case DeviceFamily::IntelGMAX3000:
972 case DeviceFamily::IntelGMAX4500HD:
973 case DeviceFamily::IntelHDGraphicsToIvyBridge:
974 case DeviceFamily::IntelHDGraphicsToSandyBridge:
975 case DeviceFamily::IntelHaswell:
976 case DeviceFamily::IntelSandyBridge:
977 case DeviceFamily::IntelGen7Baytrail:
978 case DeviceFamily::IntelSkylake:
979 case DeviceFamily::IntelHD520:
980 case DeviceFamily::IntelMobileHDGraphics:
981 case DeviceFamily::IntelRolloutWebRender:
982 case DeviceFamily::IntelModernRolloutWebRender:
983 case DeviceFamily::IntelWebRenderBlocked:
984 case DeviceFamily::Bug1116812:
985 case DeviceFamily::Bug1155608:
986 case DeviceFamily::Bug1207665:
987 vendor = DeviceVendor::Intel;
988 break;
989 case DeviceFamily::NvidiaAll:
990 case DeviceFamily::NvidiaBlockD3D9Layers:
991 case DeviceFamily::NvidiaRolloutWebRender:
992 case DeviceFamily::NvidiaWebRenderBlocked:
993 case DeviceFamily::Geforce7300GT:
994 case DeviceFamily::Nvidia310M:
995 case DeviceFamily::Nvidia8800GTS:
996 case DeviceFamily::Bug1137716:
997 vendor = DeviceVendor::NVIDIA;
998 break;
999 case DeviceFamily::AtiAll:
1000 case DeviceFamily::RadeonBlockNoVideoCopy:
1001 case DeviceFamily::RadeonCaicos:
1002 case DeviceFamily::RadeonX1000:
1003 case DeviceFamily::Bug1447141:
1004 case DeviceFamily::AmdR600:
1005 case DeviceFamily::AtiRolloutWebRender:
1006 vendor = DeviceVendor::ATI;
1007 break;
1008 case DeviceFamily::MicrosoftAll:
1009 vendor = DeviceVendor::Microsoft;
1010 break;
1011 case DeviceFamily::ParallelsAll:
1012 vendor = DeviceVendor::Parallels;
1013 break;
1014 case DeviceFamily::AppleAll:
1015 vendor = DeviceVendor::Apple;
1016 break;
1017 case DeviceFamily::AmazonAll:
1018 vendor = DeviceVendor::Amazon;
1019 break;
1020 case DeviceFamily::QualcommAll:
1021 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
1022 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
1023 vendor = DeviceVendor::Qualcomm;
1024 break;
1025 case DeviceFamily::All:
1026 case DeviceFamily::Max:
1027 break;
1030 return GetDeviceVendor(vendor);
1033 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id) {
1034 if (id >= DeviceVendor::Max) {
1035 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
1036 id = DeviceVendor::All;
1039 auto idx = static_cast<size_t>(id);
1040 if (sDeviceVendors[idx]) {
1041 return *sDeviceVendors[idx];
1044 sDeviceVendors[idx] = new nsString();
1046 switch (id) {
1047 DECLARE_VENDOR_ID(Intel, "0x8086");
1048 DECLARE_VENDOR_ID(NVIDIA, "0x10de");
1049 DECLARE_VENDOR_ID(ATI, "0x1002");
1050 // AMD has 0x1022 but continues to release GPU hardware under ATI.
1051 DECLARE_VENDOR_ID(Microsoft, "0x1414");
1052 DECLARE_VENDOR_ID(MicrosoftBasic, "0x00ba");
1053 DECLARE_VENDOR_ID(MicrosoftHyperV, "0x000b");
1054 DECLARE_VENDOR_ID(Parallels, "0x1ab8");
1055 DECLARE_VENDOR_ID(VMWare, "0x15ad");
1056 DECLARE_VENDOR_ID(VirtualBox, "0x80ee");
1057 DECLARE_VENDOR_ID(Apple, "0x106b");
1058 DECLARE_VENDOR_ID(Amazon, "0x1d0f");
1059 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
1060 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
1061 DECLARE_VENDOR_ID(Qualcomm, "0x5143");
1062 case DeviceVendor::Max: // Suppress a warning.
1063 DECLARE_VENDOR_ID(All, "");
1066 return *sDeviceVendors[idx];
1069 // Macro for assigning a driver vendor id to a string.
1070 #define DECLARE_DRIVER_VENDOR_ID(name, driverVendorId) \
1071 case DriverVendor::name: \
1072 sDriverVendors[idx]->AssignLiteral(driverVendorId); \
1073 break;
1075 const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) {
1076 if (id >= DriverVendor::Max) {
1077 MOZ_ASSERT_UNREACHABLE("DriverVendor id is out of range");
1078 id = DriverVendor::All;
1081 auto idx = static_cast<size_t>(id);
1082 if (sDriverVendors[idx]) {
1083 return *sDriverVendors[idx];
1086 sDriverVendors[idx] = new nsString();
1088 switch (id) {
1089 DECLARE_DRIVER_VENDOR_ID(MesaAll, "mesa/all");
1090 DECLARE_DRIVER_VENDOR_ID(MesaLLVMPipe, "mesa/llvmpipe");
1091 DECLARE_DRIVER_VENDOR_ID(MesaSoftPipe, "mesa/softpipe");
1092 DECLARE_DRIVER_VENDOR_ID(MesaSWRast, "mesa/swrast");
1093 DECLARE_DRIVER_VENDOR_ID(MesaSWUnknown, "mesa/software-unknown");
1094 DECLARE_DRIVER_VENDOR_ID(MesaUnknown, "mesa/unknown");
1095 DECLARE_DRIVER_VENDOR_ID(MesaR600, "mesa/r600");
1096 DECLARE_DRIVER_VENDOR_ID(MesaNouveau, "mesa/nouveau");
1097 DECLARE_DRIVER_VENDOR_ID(NonMesaAll, "non-mesa/all");
1098 DECLARE_DRIVER_VENDOR_ID(HardwareMesaAll, "mesa/hw-all");
1099 DECLARE_DRIVER_VENDOR_ID(SoftwareMesaAll, "mesa/sw-all");
1100 case DriverVendor::Max: // Suppress a warning.
1101 DECLARE_DRIVER_VENDOR_ID(All, "");
1104 return *sDriverVendors[idx];