Bug 1652470 [wpt PR 24579] - Update mozrunner to 8.0.0, a=testonly
[gecko.git] / widget / GfxDriverInfo.cpp
blobd52a01cc1df32250f8b0adeaa9b410304c22f90a
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 return nullptr;
170 default:
171 break;
174 // If it already exists, we must have processed it once, so return it now.
175 auto idx = static_cast<size_t>(id);
176 if (sDeviceFamilies[idx]) {
177 return sDeviceFamilies[idx];
180 sDeviceFamilies[idx] = new GfxDeviceFamily;
181 GfxDeviceFamily* deviceFamily = sDeviceFamilies[idx];
183 switch (id) {
184 case DeviceFamily::IntelGMA500:
185 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
186 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
187 break;
188 case DeviceFamily::IntelGMA900:
189 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
190 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
191 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
192 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
193 break;
194 case DeviceFamily::IntelGMA950:
195 APPEND_DEVICE(0x2772); /* Intel945G_1 */
196 APPEND_DEVICE(0x2776); /* Intel945G_2 */
197 APPEND_DEVICE(0x27a2); /* Intel945_1 */
198 APPEND_DEVICE(0x27a6); /* Intel945_2 */
199 APPEND_DEVICE(0x27ae); /* Intel945_3 */
200 break;
201 case DeviceFamily::IntelGMA3150:
202 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
203 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
204 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
205 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
206 break;
207 case DeviceFamily::IntelGMAX3000:
208 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
209 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
210 APPEND_DEVICE(0x2982); /* IntelG35_1 */
211 APPEND_DEVICE(0x2983); /* IntelG35_2 */
212 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
213 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
214 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
215 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
216 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
217 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
218 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
219 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
220 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
221 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
222 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
223 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
224 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
225 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
226 break;
227 case DeviceFamily::IntelGMAX4500HD:
228 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
229 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
230 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
231 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
232 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
233 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
234 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
235 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
236 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
237 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
238 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
239 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
240 break;
241 case DeviceFamily::IntelHDGraphicsToIvyBridge:
242 APPEND_DEVICE(0x015A); /* IntelIvyBridge_GT1_1 (HD Graphics) */
243 // clang-format off
244 APPEND_DEVICE(0x0152); /* IntelIvyBridge_GT1_2 (HD Graphics 2500, desktop) */
245 APPEND_DEVICE(0x0162); /* IntelIvyBridge_GT2_1 (HD Graphics 4000, desktop) */
246 APPEND_DEVICE(0x0166); /* IntelIvyBridge_GT2_2 (HD Graphics 4000, mobile) */
247 APPEND_DEVICE(0x016A); /* IntelIvyBridge_GT2_3 (HD Graphics P4000, workstation) */
248 // clang-format on
249 [[fallthrough]];
250 case DeviceFamily::IntelHDGraphicsToSandyBridge:
251 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
252 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
253 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
254 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
255 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
256 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
257 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
258 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
259 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
260 break;
261 case DeviceFamily::IntelHaswell:
262 APPEND_DEVICE(0x0402); /* IntelHaswell_GT1_1 */
263 APPEND_DEVICE(0x0406); /* IntelHaswell_GT1_2 */
264 APPEND_DEVICE(0x040A); /* IntelHaswell_GT1_3 */
265 APPEND_DEVICE(0x040B); /* IntelHaswell_GT1_4 */
266 APPEND_DEVICE(0x040E); /* IntelHaswell_GT1_5 */
267 APPEND_DEVICE(0x0A02); /* IntelHaswell_GT1_6 */
268 APPEND_DEVICE(0x0A06); /* IntelHaswell_GT1_7 */
269 APPEND_DEVICE(0x0A0A); /* IntelHaswell_GT1_8 */
270 APPEND_DEVICE(0x0A0B); /* IntelHaswell_GT1_9 */
271 APPEND_DEVICE(0x0A0E); /* IntelHaswell_GT1_10 */
272 APPEND_DEVICE(0x0412); /* IntelHaswell_GT2_1 */
273 APPEND_DEVICE(0x0416); /* IntelHaswell_GT2_2 */
274 APPEND_DEVICE(0x041A); /* IntelHaswell_GT2_3 */
275 APPEND_DEVICE(0x041B); /* IntelHaswell_GT2_4 */
276 APPEND_DEVICE(0x041E); /* IntelHaswell_GT2_5 */
277 APPEND_DEVICE(0x0A12); /* IntelHaswell_GT2_6 */
278 APPEND_DEVICE(0x0A16); /* IntelHaswell_GT2_7 */
279 APPEND_DEVICE(0x0A1A); /* IntelHaswell_GT2_8 */
280 APPEND_DEVICE(0x0A1B); /* IntelHaswell_GT2_9 */
281 APPEND_DEVICE(0x0A1E); /* IntelHaswell_GT2_10 */
282 APPEND_DEVICE(0x0422); /* IntelHaswell_GT3_1 */
283 APPEND_DEVICE(0x0426); /* IntelHaswell_GT3_2 */
284 APPEND_DEVICE(0x042A); /* IntelHaswell_GT3_3 */
285 APPEND_DEVICE(0x042B); /* IntelHaswell_GT3_4 */
286 APPEND_DEVICE(0x042E); /* IntelHaswell_GT3_5 */
287 APPEND_DEVICE(0x0A22); /* IntelHaswell_GT3_6 */
288 APPEND_DEVICE(0x0A26); /* IntelHaswell_GT3_7 */
289 APPEND_DEVICE(0x0A2A); /* IntelHaswell_GT3_8 */
290 APPEND_DEVICE(0x0A2B); /* IntelHaswell_GT3_9 */
291 APPEND_DEVICE(0x0A2E); /* IntelHaswell_GT3_10 */
292 APPEND_DEVICE(0x0D22); /* IntelHaswell_GT3e_1 */
293 APPEND_DEVICE(0x0D26); /* IntelHaswell_GT3e_2 */
294 APPEND_DEVICE(0x0D2A); /* IntelHaswell_GT3e_3 */
295 APPEND_DEVICE(0x0D2B); /* IntelHaswell_GT3e_4 */
296 APPEND_DEVICE(0x0D2E); /* IntelHaswell_GT3e_5 */
297 break;
298 case DeviceFamily::IntelHD3000:
299 APPEND_DEVICE(0x0126);
300 break;
301 case DeviceFamily::IntelHD520:
302 APPEND_DEVICE(0x1916);
303 break;
304 case DeviceFamily::IntelMobileHDGraphics:
305 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
306 break;
307 case DeviceFamily::NvidiaBlockD3D9Layers:
308 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
309 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
310 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
311 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
312 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
313 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
314 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
315 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
316 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
317 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
318 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
319 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
320 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
321 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
322 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
323 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
324 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
325 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
326 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
327 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
328 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
329 break;
330 case DeviceFamily::RadeonX1000:
331 // This list is from the ATIRadeonX1000.kext Info.plist
332 APPEND_DEVICE(0x7187);
333 APPEND_DEVICE(0x7210);
334 APPEND_DEVICE(0x71de);
335 APPEND_DEVICE(0x7146);
336 APPEND_DEVICE(0x7142);
337 APPEND_DEVICE(0x7109);
338 APPEND_DEVICE(0x71c5);
339 APPEND_DEVICE(0x71c0);
340 APPEND_DEVICE(0x7240);
341 APPEND_DEVICE(0x7249);
342 APPEND_DEVICE(0x7291);
343 break;
344 case DeviceFamily::RadeonCaicos:
345 APPEND_DEVICE(0x6766);
346 APPEND_DEVICE(0x6767);
347 APPEND_DEVICE(0x6768);
348 APPEND_DEVICE(0x6770);
349 APPEND_DEVICE(0x6771);
350 APPEND_DEVICE(0x6772);
351 APPEND_DEVICE(0x6778);
352 APPEND_DEVICE(0x6779);
353 APPEND_DEVICE(0x677b);
354 break;
355 case DeviceFamily::Geforce7300GT:
356 APPEND_DEVICE(0x0393);
357 break;
358 case DeviceFamily::Nvidia310M:
359 APPEND_DEVICE(0x0A70);
360 break;
361 case DeviceFamily::Nvidia8800GTS:
362 APPEND_DEVICE(0x0193);
363 break;
364 case DeviceFamily::Bug1137716:
365 APPEND_DEVICE(0x0a29);
366 APPEND_DEVICE(0x0a2b);
367 APPEND_DEVICE(0x0a2d);
368 APPEND_DEVICE(0x0a35);
369 APPEND_DEVICE(0x0a6c);
370 APPEND_DEVICE(0x0a70);
371 APPEND_DEVICE(0x0a72);
372 APPEND_DEVICE(0x0a7a);
373 APPEND_DEVICE(0x0caf);
374 APPEND_DEVICE(0x0dd2);
375 APPEND_DEVICE(0x0dd3);
376 // GF180M ids
377 APPEND_DEVICE(0x0de3);
378 APPEND_DEVICE(0x0de8);
379 APPEND_DEVICE(0x0de9);
380 APPEND_DEVICE(0x0dea);
381 APPEND_DEVICE(0x0deb);
382 APPEND_DEVICE(0x0dec);
383 APPEND_DEVICE(0x0ded);
384 APPEND_DEVICE(0x0dee);
385 APPEND_DEVICE(0x0def);
386 APPEND_DEVICE(0x0df0);
387 APPEND_DEVICE(0x0df1);
388 APPEND_DEVICE(0x0df2);
389 APPEND_DEVICE(0x0df3);
390 APPEND_DEVICE(0x0df4);
391 APPEND_DEVICE(0x0df5);
392 APPEND_DEVICE(0x0df6);
393 APPEND_DEVICE(0x0df7);
394 APPEND_DEVICE(0x1050);
395 APPEND_DEVICE(0x1051);
396 APPEND_DEVICE(0x1052);
397 APPEND_DEVICE(0x1054);
398 APPEND_DEVICE(0x1055);
399 break;
400 case DeviceFamily::Bug1116812:
401 APPEND_DEVICE(0x2e32);
402 APPEND_DEVICE(0x2a02);
403 break;
404 case DeviceFamily::Bug1155608:
405 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
406 break;
407 case DeviceFamily::Bug1447141:
408 APPEND_DEVICE(0x9991);
409 APPEND_DEVICE(0x9993);
410 APPEND_DEVICE(0x9996);
411 APPEND_DEVICE(0x9998);
412 APPEND_DEVICE(0x9901);
413 APPEND_DEVICE(0x990b);
414 break;
415 case DeviceFamily::Bug1207665:
416 APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
417 APPEND_DEVICE(0xa002);
418 APPEND_DEVICE(0xa011);
419 APPEND_DEVICE(0xa012);
420 break;
421 case DeviceFamily::NvidiaBlockWebRender:
422 /* GT218 */
423 APPEND_DEVICE(0x0a60);
424 APPEND_DEVICE(0x0a62);
425 APPEND_DEVICE(0x0a63);
426 APPEND_DEVICE(0x0a64);
427 APPEND_DEVICE(0x0a65);
428 APPEND_DEVICE(0x0a66);
429 APPEND_DEVICE(0x0a67);
430 APPEND_DEVICE(0x0a7b);
431 APPEND_DEVICE(0x10c0);
432 APPEND_DEVICE(0x10c3);
433 APPEND_DEVICE(0x10c5);
434 APPEND_DEVICE(0x10d8);
435 /* GT218M */
436 APPEND_DEVICE(0x0a68);
437 APPEND_DEVICE(0x0a69);
438 APPEND_DEVICE(0x0a6a);
439 APPEND_DEVICE(0x0a6c);
440 APPEND_DEVICE(0x0a6e);
441 APPEND_DEVICE(0x0a6f);
442 APPEND_DEVICE(0x0a70);
443 APPEND_DEVICE(0x0a71);
444 APPEND_DEVICE(0x0a72);
445 APPEND_DEVICE(0x0a73);
446 APPEND_DEVICE(0x0a74);
447 APPEND_DEVICE(0x0a75);
448 APPEND_DEVICE(0x0a76);
449 APPEND_DEVICE(0x0a7a);
450 /* GT218GL */
451 APPEND_DEVICE(0x0a78);
452 /* GT218GLM */
453 APPEND_DEVICE(0x0a7c);
454 break;
455 case DeviceFamily::NvidiaRolloutWebRender:
456 APPEND_RANGE(0x06c0, INT32_MAX);
457 break;
458 case DeviceFamily::IntelRolloutWebRender:
459 // broadwell gt1 (gen8)
460 APPEND_DEVICE(0x1602);
461 APPEND_DEVICE(0x1606);
462 APPEND_DEVICE(0x160a);
463 APPEND_DEVICE(0x160b);
464 APPEND_DEVICE(0x160d);
465 APPEND_DEVICE(0x160e);
467 // gen7.5 gt2
468 APPEND_DEVICE(0x0412);
469 APPEND_DEVICE(0x0416);
470 APPEND_DEVICE(0x041a);
471 APPEND_DEVICE(0x041b);
472 APPEND_DEVICE(0x041e);
473 APPEND_DEVICE(0x0a12);
474 APPEND_DEVICE(0x0a16);
475 APPEND_DEVICE(0x0a1a);
476 APPEND_DEVICE(0x0a1b);
477 APPEND_DEVICE(0x0a1e);
479 // gen7.5 gt3
480 APPEND_DEVICE(0x0422);
481 APPEND_DEVICE(0x0426);
482 APPEND_DEVICE(0x042a);
483 APPEND_DEVICE(0x042b);
484 APPEND_DEVICE(0x042e);
485 APPEND_DEVICE(0x0a22);
486 APPEND_DEVICE(0x0a26);
487 APPEND_DEVICE(0x0a0a);
488 APPEND_DEVICE(0x0a1a);
489 APPEND_DEVICE(0x0a2a);
490 APPEND_DEVICE(0x0a2b);
491 APPEND_DEVICE(0x0a2e);
492 APPEND_DEVICE(0x0c22);
493 APPEND_DEVICE(0x0c26);
494 APPEND_DEVICE(0x0c2c);
495 APPEND_DEVICE(0x0c2b);
496 APPEND_DEVICE(0x0c2e);
497 APPEND_DEVICE(0x0d22);
498 APPEND_DEVICE(0x0d26);
499 APPEND_DEVICE(0x0d2b);
500 APPEND_DEVICE(0x0d2e);
502 #ifdef EARLY_BETA_OR_EARLIER
503 // gen7 gt2
504 APPEND_DEVICE(0x0162);
505 APPEND_DEVICE(0x0166);
506 APPEND_DEVICE(0x016a);
508 // gen6 gt2
509 APPEND_DEVICE(0x0112);
510 APPEND_DEVICE(0x0116);
511 APPEND_DEVICE(0x0122);
512 APPEND_DEVICE(0x0126);
513 #endif
515 #if defined(MOZ_WIDGET_GTK) || defined(NIGHTLY_BUILD)
516 // Gen7.5 not allowed until bug 1576637 is resolved.
517 // gen7.5 gt1
518 APPEND_DEVICE(0x0402);
519 APPEND_DEVICE(0x0406);
520 APPEND_DEVICE(0x040a);
521 APPEND_DEVICE(0x040b);
522 APPEND_DEVICE(0x040e);
523 APPEND_DEVICE(0x0a02);
524 APPEND_DEVICE(0x0a06);
525 APPEND_DEVICE(0x0a0a);
526 APPEND_DEVICE(0x0a0b);
527 APPEND_DEVICE(0x0a0e);
528 APPEND_DEVICE(0x0c02);
529 APPEND_DEVICE(0x0c06);
530 APPEND_DEVICE(0x0c0c);
531 APPEND_DEVICE(0x0c0b);
532 APPEND_DEVICE(0x0c0e);
533 APPEND_DEVICE(0x0d02);
534 APPEND_DEVICE(0x0d06);
535 APPEND_DEVICE(0x0d0a);
536 APPEND_DEVICE(0x0d0b);
537 APPEND_DEVICE(0x0d0e);
539 // gen7 gt1
540 APPEND_DEVICE(0x0152);
541 APPEND_DEVICE(0x0156);
542 APPEND_DEVICE(0x015a);
543 #endif
544 [[fallthrough]];
545 case DeviceFamily::IntelModernRolloutWebRender:
546 #ifdef NIGHTLY_BUILD
547 // broxton (apollolake)
548 APPEND_DEVICE(0x0a84);
549 APPEND_DEVICE(0x1a84);
550 APPEND_DEVICE(0x1a85);
551 APPEND_DEVICE(0x5a84);
552 APPEND_DEVICE(0x5a85);
554 // geminilake
555 APPEND_DEVICE(0x3184);
556 APPEND_DEVICE(0x3185);
557 #endif
558 // broadwell gt2+ (gen8)
559 APPEND_DEVICE(0x1612);
560 APPEND_DEVICE(0x1616);
561 APPEND_DEVICE(0x161a);
562 APPEND_DEVICE(0x161b);
563 APPEND_DEVICE(0x161d);
564 APPEND_DEVICE(0x161e);
565 APPEND_DEVICE(0x1622);
566 APPEND_DEVICE(0x1626);
567 APPEND_DEVICE(0x162a);
568 APPEND_DEVICE(0x162b);
569 APPEND_DEVICE(0x162d);
570 APPEND_DEVICE(0x162e);
571 APPEND_DEVICE(0x1632);
572 APPEND_DEVICE(0x1636);
573 APPEND_DEVICE(0x163a);
574 APPEND_DEVICE(0x163b);
575 APPEND_DEVICE(0x163d);
576 APPEND_DEVICE(0x163e);
578 // skylake gt1
579 APPEND_DEVICE(0x1902);
580 APPEND_DEVICE(0x1906);
581 APPEND_DEVICE(0x190a);
582 APPEND_DEVICE(0x190e);
584 // skylake gt2+
585 APPEND_DEVICE(0x1912);
586 APPEND_DEVICE(0x1913);
587 APPEND_DEVICE(0x1915);
588 APPEND_DEVICE(0x1916);
589 APPEND_DEVICE(0x1917);
590 APPEND_DEVICE(0x191a);
591 APPEND_DEVICE(0x191b);
592 APPEND_DEVICE(0x191d);
593 APPEND_DEVICE(0x191e);
594 APPEND_DEVICE(0x1921);
595 APPEND_DEVICE(0x1923);
596 APPEND_DEVICE(0x1926);
597 APPEND_DEVICE(0x1927);
598 APPEND_DEVICE(0x192b);
599 APPEND_DEVICE(0x1932);
600 APPEND_DEVICE(0x193b);
601 APPEND_DEVICE(0x193d);
603 // kabylake gt1
604 APPEND_DEVICE(0x5902);
605 APPEND_DEVICE(0x5906);
606 APPEND_DEVICE(0x5908);
607 APPEND_DEVICE(0x590a);
608 APPEND_DEVICE(0x590b);
609 APPEND_DEVICE(0x590e);
611 // kabylake gt1.5
612 APPEND_DEVICE(0x5913);
613 APPEND_DEVICE(0x5915);
614 APPEND_DEVICE(0x5917);
616 // kabylake gt2
617 APPEND_DEVICE(0x5912);
618 APPEND_DEVICE(0x5916);
619 APPEND_DEVICE(0x591a);
620 APPEND_DEVICE(0x591b);
621 APPEND_DEVICE(0x591c);
622 APPEND_DEVICE(0x591d);
623 APPEND_DEVICE(0x591e);
624 APPEND_DEVICE(0x5921);
625 APPEND_DEVICE(0x5926);
626 APPEND_DEVICE(0x5923);
627 APPEND_DEVICE(0x5927);
628 APPEND_DEVICE(0x593b);
630 // coffeelake gt1
631 APPEND_DEVICE(0x3e90);
632 APPEND_DEVICE(0x3e93);
633 APPEND_DEVICE(0x3e99);
634 APPEND_DEVICE(0x3e9c);
635 APPEND_DEVICE(0x3ea1);
636 APPEND_DEVICE(0x3ea4);
637 APPEND_DEVICE(0x9b21);
638 APPEND_DEVICE(0x9ba0);
639 APPEND_DEVICE(0x9ba2);
640 APPEND_DEVICE(0x9ba4);
641 APPEND_DEVICE(0x9ba5);
642 APPEND_DEVICE(0x9ba8);
643 APPEND_DEVICE(0x9baa);
644 APPEND_DEVICE(0x9bab);
645 APPEND_DEVICE(0x9bac);
647 // coffeelake gt2+
648 APPEND_RANGE(0x3e91, 0x3e92);
649 APPEND_DEVICE(0x3e94);
650 APPEND_DEVICE(0x3e96);
651 APPEND_DEVICE(0x3e98);
652 APPEND_RANGE(0x3e9a, 0x3e9b);
653 APPEND_DEVICE(0x3ea0);
654 APPEND_DEVICE(0x3ea2);
655 APPEND_RANGE(0x3ea5, 0x3ea9);
656 APPEND_DEVICE(0x87ca);
657 APPEND_DEVICE(0x9b41);
658 APPEND_DEVICE(0x9bc0);
659 APPEND_DEVICE(0x9bc2);
660 APPEND_RANGE(0x9bc4, 0x9bc5);
661 APPEND_DEVICE(0x9bc8);
662 APPEND_RANGE(0x9bca, 0x9bcc);
664 // icelake gt1,gt1.5,gt2
665 APPEND_RANGE(0x8a50, 0x8a5d);
666 break;
667 case DeviceFamily::AtiRolloutWebRender:
668 APPEND_RANGE(0x6600, 0x66af);
669 APPEND_RANGE(0x6700, 0x671f);
670 APPEND_RANGE(0x6780, 0x683f);
671 APPEND_RANGE(0x6860, 0x687f);
672 APPEND_RANGE(0x6900, 0x69ff);
673 APPEND_DEVICE(0x7300);
674 APPEND_RANGE(0x7310, 0x738e);
675 APPEND_RANGE(0x9830, 0x986f);
676 APPEND_RANGE(0x9900, 0x99ff);
677 // Raven
678 APPEND_DEVICE(0x15dd);
679 APPEND_DEVICE(0x15d8);
680 // Renoir
681 APPEND_DEVICE(0x1636);
683 #ifdef EARLY_BETA_OR_EARLIER
684 // Stoney
685 APPEND_DEVICE(0x98e4);
686 #endif
688 #if defined(NIGHTLY_BUILD)
689 // Evergreen
690 APPEND_RANGE(0x6840, 0x684b);
691 APPEND_RANGE(0x6850, 0x685f);
692 APPEND_RANGE(0x6880, 0x68ff);
693 APPEND_RANGE(0x9800, 0x980a);
694 APPEND_RANGE(0x9640, 0x964f);
695 APPEND_RANGE(0x6720, 0x677f);
696 #endif
698 break;
699 // This should never happen, but we get a warning if we don't handle this.
700 case DeviceFamily::Max:
701 case DeviceFamily::All:
702 case DeviceFamily::IntelAll:
703 case DeviceFamily::NvidiaAll:
704 case DeviceFamily::AtiAll:
705 case DeviceFamily::MicrosoftAll:
706 case DeviceFamily::ParallelsAll:
707 case DeviceFamily::QualcommAll:
708 NS_WARNING("Invalid DeviceFamily id");
709 break;
712 return deviceFamily;
715 // Macro for assigning a desktop environment to a string.
716 #define DECLARE_DESKTOP_ENVIRONMENT_ID(name, desktopEnvId) \
717 case DesktopEnvironment::name: \
718 sDesktopEnvironment[idx]->AssignLiteral(desktopEnvId); \
719 break;
721 const nsAString& GfxDriverInfo::GetDesktopEnvironment(DesktopEnvironment id) {
722 if (id >= DesktopEnvironment::Max) {
723 MOZ_ASSERT_UNREACHABLE("DesktopEnvironment id is out of range");
724 id = DesktopEnvironment::All;
727 auto idx = static_cast<size_t>(id);
728 if (sDesktopEnvironment[idx]) {
729 return *sDesktopEnvironment[idx];
732 sDesktopEnvironment[idx] = new nsString();
734 switch (id) {
735 DECLARE_DESKTOP_ENVIRONMENT_ID(GNOME, "gnome");
736 DECLARE_DESKTOP_ENVIRONMENT_ID(KDE, "kde");
737 DECLARE_DESKTOP_ENVIRONMENT_ID(XFCE, "xfce");
738 DECLARE_DESKTOP_ENVIRONMENT_ID(Cinnamon, "cinnamon");
739 DECLARE_DESKTOP_ENVIRONMENT_ID(Enlightenment, "enlightment");
740 DECLARE_DESKTOP_ENVIRONMENT_ID(LXDE, "lxde");
741 DECLARE_DESKTOP_ENVIRONMENT_ID(Openbox, "openbox");
742 DECLARE_DESKTOP_ENVIRONMENT_ID(i3, "i3");
743 DECLARE_DESKTOP_ENVIRONMENT_ID(Mate, "mate");
744 DECLARE_DESKTOP_ENVIRONMENT_ID(Unity, "unity");
745 DECLARE_DESKTOP_ENVIRONMENT_ID(Pantheon, "pantheon");
746 DECLARE_DESKTOP_ENVIRONMENT_ID(LXQT, "lxqt");
747 DECLARE_DESKTOP_ENVIRONMENT_ID(Deepin, "deepin");
748 DECLARE_DESKTOP_ENVIRONMENT_ID(Dwm, "dwm");
749 DECLARE_DESKTOP_ENVIRONMENT_ID(Budgie, "budgie");
750 DECLARE_DESKTOP_ENVIRONMENT_ID(Unknown, "unknown");
751 case DesktopEnvironment::Max: // Suppress a warning.
752 DECLARE_DESKTOP_ENVIRONMENT_ID(All, "");
755 return *sDesktopEnvironment[idx];
758 // Macro for assigning a window protocol id to a string.
759 #define DECLARE_WINDOW_PROTOCOL_ID(name, windowProtocolId) \
760 case WindowProtocol::name: \
761 sWindowProtocol[idx]->AssignLiteral(windowProtocolId); \
762 break;
764 const nsAString& GfxDriverInfo::GetWindowProtocol(WindowProtocol id) {
765 if (id >= WindowProtocol::Max) {
766 MOZ_ASSERT_UNREACHABLE("WindowProtocol id is out of range");
767 id = WindowProtocol::All;
770 auto idx = static_cast<size_t>(id);
771 if (sWindowProtocol[idx]) {
772 return *sWindowProtocol[idx];
775 sWindowProtocol[idx] = new nsString();
777 switch (id) {
778 DECLARE_WINDOW_PROTOCOL_ID(X11, "x11");
779 DECLARE_WINDOW_PROTOCOL_ID(XWayland, "xwayland");
780 DECLARE_WINDOW_PROTOCOL_ID(Wayland, "wayland");
781 DECLARE_WINDOW_PROTOCOL_ID(WaylandDRM, "wayland/drm");
782 DECLARE_WINDOW_PROTOCOL_ID(WaylandAll, "wayland/all");
783 DECLARE_WINDOW_PROTOCOL_ID(X11All, "x11/all");
784 case WindowProtocol::Max: // Suppress a warning.
785 DECLARE_WINDOW_PROTOCOL_ID(All, "");
788 return *sWindowProtocol[idx];
791 // Macro for assigning a device vendor id to a string.
792 #define DECLARE_VENDOR_ID(name, deviceId) \
793 case DeviceVendor::name: \
794 sDeviceVendors[idx]->AssignLiteral(deviceId); \
795 break;
797 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceFamily id) {
798 if (id >= DeviceFamily::Max) {
799 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
800 id = DeviceFamily::All;
803 DeviceVendor vendor = DeviceVendor::All;
804 switch (id) {
805 case DeviceFamily::IntelAll:
806 case DeviceFamily::IntelGMA500:
807 case DeviceFamily::IntelGMA900:
808 case DeviceFamily::IntelGMA950:
809 case DeviceFamily::IntelGMA3150:
810 case DeviceFamily::IntelGMAX3000:
811 case DeviceFamily::IntelGMAX4500HD:
812 case DeviceFamily::IntelHDGraphicsToIvyBridge:
813 case DeviceFamily::IntelHDGraphicsToSandyBridge:
814 case DeviceFamily::IntelHaswell:
815 case DeviceFamily::IntelHD3000:
816 case DeviceFamily::IntelHD520:
817 case DeviceFamily::IntelMobileHDGraphics:
818 case DeviceFamily::IntelRolloutWebRender:
819 case DeviceFamily::IntelModernRolloutWebRender:
820 case DeviceFamily::Bug1116812:
821 case DeviceFamily::Bug1155608:
822 case DeviceFamily::Bug1207665:
823 vendor = DeviceVendor::Intel;
824 break;
825 case DeviceFamily::NvidiaAll:
826 case DeviceFamily::NvidiaBlockD3D9Layers:
827 case DeviceFamily::NvidiaBlockWebRender:
828 case DeviceFamily::NvidiaRolloutWebRender:
829 case DeviceFamily::Geforce7300GT:
830 case DeviceFamily::Nvidia310M:
831 case DeviceFamily::Nvidia8800GTS:
832 case DeviceFamily::Bug1137716:
833 vendor = DeviceVendor::NVIDIA;
834 break;
835 case DeviceFamily::AtiAll:
836 case DeviceFamily::RadeonCaicos:
837 case DeviceFamily::RadeonX1000:
838 case DeviceFamily::Bug1447141:
839 case DeviceFamily::AtiRolloutWebRender:
840 vendor = DeviceVendor::ATI;
841 break;
842 case DeviceFamily::MicrosoftAll:
843 vendor = DeviceVendor::Microsoft;
844 break;
845 case DeviceFamily::ParallelsAll:
846 vendor = DeviceVendor::Parallels;
847 break;
848 case DeviceFamily::QualcommAll:
849 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
850 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
851 vendor = DeviceVendor::Qualcomm;
852 break;
853 case DeviceFamily::All:
854 case DeviceFamily::Max:
855 break;
858 return GetDeviceVendor(vendor);
861 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id) {
862 if (id >= DeviceVendor::Max) {
863 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
864 id = DeviceVendor::All;
867 auto idx = static_cast<size_t>(id);
868 if (sDeviceVendors[idx]) {
869 return *sDeviceVendors[idx];
872 sDeviceVendors[idx] = new nsString();
874 switch (id) {
875 DECLARE_VENDOR_ID(Intel, "0x8086");
876 DECLARE_VENDOR_ID(NVIDIA, "0x10de");
877 DECLARE_VENDOR_ID(ATI, "0x1002");
878 // AMD has 0x1022 but continues to release GPU hardware under ATI.
879 DECLARE_VENDOR_ID(Microsoft, "0x1414");
880 DECLARE_VENDOR_ID(MicrosoftBasic, "0x00ba");
881 DECLARE_VENDOR_ID(MicrosoftHyperV, "0x000b");
882 DECLARE_VENDOR_ID(Parallels, "0x1ab8");
883 DECLARE_VENDOR_ID(VMWare, "0x15ad");
884 DECLARE_VENDOR_ID(VirtualBox, "0x80ee");
885 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
886 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
887 DECLARE_VENDOR_ID(Qualcomm, "0x5143");
888 case DeviceVendor::Max: // Suppress a warning.
889 DECLARE_VENDOR_ID(All, "");
892 return *sDeviceVendors[idx];
895 // Macro for assigning a driver vendor id to a string.
896 #define DECLARE_DRIVER_VENDOR_ID(name, driverVendorId) \
897 case DriverVendor::name: \
898 sDriverVendors[idx]->AssignLiteral(driverVendorId); \
899 break;
901 const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) {
902 if (id >= DriverVendor::Max) {
903 MOZ_ASSERT_UNREACHABLE("DriverVendor id is out of range");
904 id = DriverVendor::All;
907 auto idx = static_cast<size_t>(id);
908 if (sDriverVendors[idx]) {
909 return *sDriverVendors[idx];
912 sDriverVendors[idx] = new nsString();
914 switch (id) {
915 DECLARE_DRIVER_VENDOR_ID(MesaAll, "mesa/all");
916 DECLARE_DRIVER_VENDOR_ID(MesaLLVMPipe, "mesa/llvmpipe");
917 DECLARE_DRIVER_VENDOR_ID(MesaSoftPipe, "mesa/softpipe");
918 DECLARE_DRIVER_VENDOR_ID(MesaSWRast, "mesa/swrast");
919 DECLARE_DRIVER_VENDOR_ID(MesaUnknown, "mesa/unknown");
920 DECLARE_DRIVER_VENDOR_ID(NonMesaAll, "non-mesa/all");
921 case DriverVendor::Max: // Suppress a warning.
922 DECLARE_DRIVER_VENDOR_ID(All, "");
925 return *sDriverVendors[idx];