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