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"
11 using namespace mozilla::widget
;
13 int32_t GfxDriverInfo::allFeatures
= 0;
14 uint64_t GfxDriverInfo::allDriverVersions
= ~(uint64_t(0));
17 GfxDriverInfo::sDeviceFamilies
[static_cast<size_t>(DeviceFamily::Max
)];
18 nsAString
* GfxDriverInfo::sDesktopEnvironment
[static_cast<size_t>(
19 DesktopEnvironment::Max
)];
21 GfxDriverInfo::sWindowProtocol
[static_cast<size_t>(WindowProtocol::Max
)];
23 GfxDriverInfo::sDeviceVendors
[static_cast<size_t>(DeviceVendor::Max
)];
25 GfxDriverInfo::sDriverVendors
[static_cast<size_t>(DriverVendor::Max
)];
27 GfxDriverInfo::GfxDriverInfo()
28 : mOperatingSystem(OperatingSystem::Unknown
),
29 mOperatingSystemVersion(0),
30 mScreen(ScreenSizeStatus::All
),
31 mBattery(BatteryStatus::All
),
33 GfxDriverInfo::GetDesktopEnvironment(DesktopEnvironment::All
)),
34 mWindowProtocol(GfxDriverInfo::GetWindowProtocol(WindowProtocol::All
)),
35 mAdapterVendor(GfxDriverInfo::GetDeviceVendor(DeviceFamily::All
)),
36 mDriverVendor(GfxDriverInfo::GetDriverVendor(DriverVendor::All
)),
37 mDevices(GfxDriverInfo::GetDeviceFamily(DeviceFamily::All
)),
38 mDeleteDevices(false),
39 mFeature(allFeatures
),
40 mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK
),
41 mComparisonOp(DRIVER_COMPARISON_IGNORED
),
44 mSuggestedVersion(nullptr),
48 GfxDriverInfo::GfxDriverInfo(
49 OperatingSystem os
, ScreenSizeStatus screen
, BatteryStatus battery
,
50 const nsAString
& desktopEnv
, const nsAString
& windowProtocol
,
51 const nsAString
& vendor
, const nsAString
& driverVendor
,
52 GfxDeviceFamily
* devices
, int32_t feature
, int32_t featureStatus
,
53 VersionComparisonOp op
, uint64_t driverVersion
, const char* ruleId
,
54 const char* suggestedVersion
/* = nullptr */, bool ownDevices
/* = false */,
55 bool gpu2
/* = false */)
56 : mOperatingSystem(os
),
57 mOperatingSystemVersion(0),
60 mDesktopEnvironment(desktopEnv
),
61 mWindowProtocol(windowProtocol
),
62 mAdapterVendor(vendor
),
63 mDriverVendor(driverVendor
),
65 mDeleteDevices(ownDevices
),
67 mFeatureStatus(featureStatus
),
69 mDriverVersion(driverVersion
),
71 mSuggestedVersion(suggestedVersion
),
75 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo
& aOrig
)
76 : mOperatingSystem(aOrig
.mOperatingSystem
),
77 mOperatingSystemVersion(aOrig
.mOperatingSystemVersion
),
78 mScreen(aOrig
.mScreen
),
79 mBattery(aOrig
.mBattery
),
80 mDesktopEnvironment(aOrig
.mDesktopEnvironment
),
81 mWindowProtocol(aOrig
.mWindowProtocol
),
82 mAdapterVendor(aOrig
.mAdapterVendor
),
83 mDriverVendor(aOrig
.mDriverVendor
),
84 mFeature(aOrig
.mFeature
),
85 mFeatureStatus(aOrig
.mFeatureStatus
),
86 mComparisonOp(aOrig
.mComparisonOp
),
87 mDriverVersion(aOrig
.mDriverVersion
),
88 mDriverVersionMax(aOrig
.mDriverVersionMax
),
89 mSuggestedVersion(aOrig
.mSuggestedVersion
),
90 mRuleId(aOrig
.mRuleId
),
92 // If we're managing the lifetime of the device family, we have to make a
93 // copy of the original's device family.
94 if (aOrig
.mDeleteDevices
&& aOrig
.mDevices
) {
95 GfxDeviceFamily
* devices
= new GfxDeviceFamily
;
96 *devices
= *aOrig
.mDevices
;
99 mDevices
= aOrig
.mDevices
;
102 mDeleteDevices
= aOrig
.mDeleteDevices
;
105 GfxDriverInfo::~GfxDriverInfo() {
106 if (mDeleteDevices
) {
111 void GfxDeviceFamily::Append(const nsAString
& aDeviceId
) {
112 mIds
.AppendElement(aDeviceId
);
115 void GfxDeviceFamily::AppendRange(int32_t aBeginDeviceId
,
116 int32_t aEndDeviceId
) {
117 mRanges
.AppendElement(
118 GfxDeviceFamily::DeviceRange
{aBeginDeviceId
, aEndDeviceId
});
121 nsresult
GfxDeviceFamily::Contains(nsAString
& aDeviceId
) const {
122 for (const auto& id
: mIds
) {
123 if (id
.Equals(aDeviceId
, nsCaseInsensitiveStringComparator())) {
128 if (mRanges
.IsEmpty()) {
129 return NS_ERROR_NOT_AVAILABLE
;
132 nsresult valid
= NS_OK
;
133 int32_t deviceId
= aDeviceId
.ToInteger(&valid
, 16);
134 if (valid
!= NS_OK
) {
135 return NS_ERROR_INVALID_ARG
;
138 for (const auto& range
: mRanges
) {
139 if (deviceId
>= range
.mBegin
&& deviceId
<= range
.mEnd
) {
144 return NS_ERROR_NOT_AVAILABLE
;
147 // Macros for appending a device to the DeviceFamily.
148 #define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
149 #define APPEND_DEVICE2(device) deviceFamily->Append(NS_LITERAL_STRING(device))
150 #define APPEND_RANGE(start, end) deviceFamily->AppendRange(start, end)
152 const GfxDeviceFamily
* GfxDriverInfo::GetDeviceFamily(DeviceFamily id
) {
153 if (id
>= DeviceFamily::Max
) {
154 MOZ_ASSERT_UNREACHABLE("DeviceFamily id is out of range");
158 // All of these have no specific device ID filtering.
160 case DeviceFamily::All
:
161 case DeviceFamily::IntelAll
:
162 case DeviceFamily::NvidiaAll
:
163 case DeviceFamily::AtiAll
:
164 case DeviceFamily::MicrosoftAll
:
165 case DeviceFamily::ParallelsAll
:
166 case DeviceFamily::QualcommAll
:
172 // If it already exists, we must have processed it once, so return it now.
173 auto idx
= static_cast<size_t>(id
);
174 if (sDeviceFamilies
[idx
]) {
175 return sDeviceFamilies
[idx
];
178 sDeviceFamilies
[idx
] = new GfxDeviceFamily
;
179 GfxDeviceFamily
* deviceFamily
= sDeviceFamilies
[idx
];
182 case DeviceFamily::IntelGMA500
:
183 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
184 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
186 case DeviceFamily::IntelGMA900
:
187 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
188 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
189 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
190 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
192 case DeviceFamily::IntelGMA950
:
193 APPEND_DEVICE(0x2772); /* Intel945G_1 */
194 APPEND_DEVICE(0x2776); /* Intel945G_2 */
195 APPEND_DEVICE(0x27a2); /* Intel945_1 */
196 APPEND_DEVICE(0x27a6); /* Intel945_2 */
197 APPEND_DEVICE(0x27ae); /* Intel945_3 */
199 case DeviceFamily::IntelGMA3150
:
200 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
201 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
202 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
203 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
205 case DeviceFamily::IntelGMAX3000
:
206 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
207 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
208 APPEND_DEVICE(0x2982); /* IntelG35_1 */
209 APPEND_DEVICE(0x2983); /* IntelG35_2 */
210 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
211 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
212 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
213 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
214 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
215 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
216 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
217 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
218 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
219 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
220 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
221 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
222 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
223 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
225 case DeviceFamily::IntelGMAX4500HD
:
226 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
227 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
228 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
229 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
230 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
231 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
232 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
233 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
234 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
235 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
236 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
237 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
239 case DeviceFamily::IntelHDGraphicsToIvyBridge
:
240 APPEND_DEVICE(0x015A); /* IntelIvyBridge_GT1_1 (HD Graphics) */
242 APPEND_DEVICE(0x0152); /* IntelIvyBridge_GT1_2 (HD Graphics 2500, desktop) */
243 APPEND_DEVICE(0x0162); /* IntelIvyBridge_GT2_1 (HD Graphics 4000, desktop) */
244 APPEND_DEVICE(0x0166); /* IntelIvyBridge_GT2_2 (HD Graphics 4000, mobile) */
245 APPEND_DEVICE(0x016A); /* IntelIvyBridge_GT2_3 (HD Graphics P4000, workstation) */
248 case DeviceFamily::IntelHDGraphicsToSandyBridge
:
249 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
250 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
251 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
252 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
253 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
254 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
255 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
256 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
257 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
259 case DeviceFamily::IntelHDGraphicsToHaswell
:
260 APPEND_DEVICE(0x0402); /* IntelHaswell_GT1_1 */
261 APPEND_DEVICE(0x0406); /* IntelHaswell_GT1_2 */
262 APPEND_DEVICE(0x040A); /* IntelHaswell_GT1_3 */
263 APPEND_DEVICE(0x040B); /* IntelHaswell_GT1_4 */
264 APPEND_DEVICE(0x040E); /* IntelHaswell_GT1_5 */
265 APPEND_DEVICE(0x0A02); /* IntelHaswell_GT1_6 */
266 APPEND_DEVICE(0x0A06); /* IntelHaswell_GT1_7 */
267 APPEND_DEVICE(0x0A0A); /* IntelHaswell_GT1_8 */
268 APPEND_DEVICE(0x0A0B); /* IntelHaswell_GT1_9 */
269 APPEND_DEVICE(0x0A0E); /* IntelHaswell_GT1_10 */
270 APPEND_DEVICE(0x0412); /* IntelHaswell_GT2_1 */
271 APPEND_DEVICE(0x0416); /* IntelHaswell_GT2_2 */
272 APPEND_DEVICE(0x041A); /* IntelHaswell_GT2_3 */
273 APPEND_DEVICE(0x041B); /* IntelHaswell_GT2_4 */
274 APPEND_DEVICE(0x041E); /* IntelHaswell_GT2_5 */
275 APPEND_DEVICE(0x0A12); /* IntelHaswell_GT2_6 */
276 APPEND_DEVICE(0x0A16); /* IntelHaswell_GT2_7 */
277 APPEND_DEVICE(0x0A1A); /* IntelHaswell_GT2_8 */
278 APPEND_DEVICE(0x0A1B); /* IntelHaswell_GT2_9 */
279 APPEND_DEVICE(0x0A1E); /* IntelHaswell_GT2_10 */
280 APPEND_DEVICE(0x0422); /* IntelHaswell_GT3_1 */
281 APPEND_DEVICE(0x0426); /* IntelHaswell_GT3_2 */
282 APPEND_DEVICE(0x042A); /* IntelHaswell_GT3_3 */
283 APPEND_DEVICE(0x042B); /* IntelHaswell_GT3_4 */
284 APPEND_DEVICE(0x042E); /* IntelHaswell_GT3_5 */
285 APPEND_DEVICE(0x0A22); /* IntelHaswell_GT3_6 */
286 APPEND_DEVICE(0x0A26); /* IntelHaswell_GT3_7 */
287 APPEND_DEVICE(0x0A2A); /* IntelHaswell_GT3_8 */
288 APPEND_DEVICE(0x0A2B); /* IntelHaswell_GT3_9 */
289 APPEND_DEVICE(0x0A2E); /* IntelHaswell_GT3_10 */
290 APPEND_DEVICE(0x0D22); /* IntelHaswell_GT3e_1 */
291 APPEND_DEVICE(0x0D26); /* IntelHaswell_GT3e_2 */
292 APPEND_DEVICE(0x0D2A); /* IntelHaswell_GT3e_3 */
293 APPEND_DEVICE(0x0D2B); /* IntelHaswell_GT3e_4 */
294 APPEND_DEVICE(0x0D2E); /* IntelHaswell_GT3e_5 */
296 case DeviceFamily::IntelHD3000
:
297 APPEND_DEVICE(0x0126);
299 case DeviceFamily::IntelHD520
:
300 APPEND_DEVICE(0x1916);
302 case DeviceFamily::IntelMobileHDGraphics
:
303 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
305 case DeviceFamily::NvidiaBlockD3D9Layers
:
306 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
307 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
308 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
309 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
310 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
311 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
312 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
313 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
314 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
315 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
316 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
317 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
318 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
319 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
320 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
321 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
322 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
323 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
324 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
325 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
326 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
328 case DeviceFamily::RadeonX1000
:
329 // This list is from the ATIRadeonX1000.kext Info.plist
330 APPEND_DEVICE(0x7187);
331 APPEND_DEVICE(0x7210);
332 APPEND_DEVICE(0x71de);
333 APPEND_DEVICE(0x7146);
334 APPEND_DEVICE(0x7142);
335 APPEND_DEVICE(0x7109);
336 APPEND_DEVICE(0x71c5);
337 APPEND_DEVICE(0x71c0);
338 APPEND_DEVICE(0x7240);
339 APPEND_DEVICE(0x7249);
340 APPEND_DEVICE(0x7291);
342 case DeviceFamily::RadeonCaicos
:
343 APPEND_DEVICE(0x6766);
344 APPEND_DEVICE(0x6767);
345 APPEND_DEVICE(0x6768);
346 APPEND_DEVICE(0x6770);
347 APPEND_DEVICE(0x6771);
348 APPEND_DEVICE(0x6772);
349 APPEND_DEVICE(0x6778);
350 APPEND_DEVICE(0x6779);
351 APPEND_DEVICE(0x677b);
353 case DeviceFamily::Geforce7300GT
:
354 APPEND_DEVICE(0x0393);
356 case DeviceFamily::Nvidia310M
:
357 APPEND_DEVICE(0x0A70);
359 case DeviceFamily::Nvidia8800GTS
:
360 APPEND_DEVICE(0x0193);
362 case DeviceFamily::Bug1137716
:
363 APPEND_DEVICE(0x0a29);
364 APPEND_DEVICE(0x0a2b);
365 APPEND_DEVICE(0x0a2d);
366 APPEND_DEVICE(0x0a35);
367 APPEND_DEVICE(0x0a6c);
368 APPEND_DEVICE(0x0a70);
369 APPEND_DEVICE(0x0a72);
370 APPEND_DEVICE(0x0a7a);
371 APPEND_DEVICE(0x0caf);
372 APPEND_DEVICE(0x0dd2);
373 APPEND_DEVICE(0x0dd3);
375 APPEND_DEVICE(0x0de3);
376 APPEND_DEVICE(0x0de8);
377 APPEND_DEVICE(0x0de9);
378 APPEND_DEVICE(0x0dea);
379 APPEND_DEVICE(0x0deb);
380 APPEND_DEVICE(0x0dec);
381 APPEND_DEVICE(0x0ded);
382 APPEND_DEVICE(0x0dee);
383 APPEND_DEVICE(0x0def);
384 APPEND_DEVICE(0x0df0);
385 APPEND_DEVICE(0x0df1);
386 APPEND_DEVICE(0x0df2);
387 APPEND_DEVICE(0x0df3);
388 APPEND_DEVICE(0x0df4);
389 APPEND_DEVICE(0x0df5);
390 APPEND_DEVICE(0x0df6);
391 APPEND_DEVICE(0x0df7);
392 APPEND_DEVICE(0x1050);
393 APPEND_DEVICE(0x1051);
394 APPEND_DEVICE(0x1052);
395 APPEND_DEVICE(0x1054);
396 APPEND_DEVICE(0x1055);
398 case DeviceFamily::Bug1116812
:
399 APPEND_DEVICE(0x2e32);
400 APPEND_DEVICE(0x2a02);
402 case DeviceFamily::Bug1155608
:
403 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
405 case DeviceFamily::Bug1447141
:
406 APPEND_DEVICE(0x9991);
407 APPEND_DEVICE(0x9993);
408 APPEND_DEVICE(0x9996);
409 APPEND_DEVICE(0x9998);
410 APPEND_DEVICE(0x9901);
411 APPEND_DEVICE(0x990b);
413 case DeviceFamily::Bug1207665
:
414 APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
415 APPEND_DEVICE(0xa002);
416 APPEND_DEVICE(0xa011);
417 APPEND_DEVICE(0xa012);
419 case DeviceFamily::NvidiaBlockWebRender
:
421 APPEND_DEVICE(0x0a60);
422 APPEND_DEVICE(0x0a62);
423 APPEND_DEVICE(0x0a63);
424 APPEND_DEVICE(0x0a64);
425 APPEND_DEVICE(0x0a65);
426 APPEND_DEVICE(0x0a66);
427 APPEND_DEVICE(0x0a67);
428 APPEND_DEVICE(0x0a7b);
429 APPEND_DEVICE(0x10c0);
430 APPEND_DEVICE(0x10c3);
431 APPEND_DEVICE(0x10c5);
432 APPEND_DEVICE(0x10d8);
434 APPEND_DEVICE(0x0a68);
435 APPEND_DEVICE(0x0a69);
436 APPEND_DEVICE(0x0a6a);
437 APPEND_DEVICE(0x0a6c);
438 APPEND_DEVICE(0x0a6e);
439 APPEND_DEVICE(0x0a6f);
440 APPEND_DEVICE(0x0a70);
441 APPEND_DEVICE(0x0a71);
442 APPEND_DEVICE(0x0a72);
443 APPEND_DEVICE(0x0a73);
444 APPEND_DEVICE(0x0a74);
445 APPEND_DEVICE(0x0a75);
446 APPEND_DEVICE(0x0a76);
447 APPEND_DEVICE(0x0a7a);
449 APPEND_DEVICE(0x0a78);
451 APPEND_DEVICE(0x0a7c);
453 case DeviceFamily::NvidiaRolloutWebRender
:
454 APPEND_RANGE(0x06c0, INT32_MAX
);
456 case DeviceFamily::IntelRolloutWebRender
:
457 // broadwell gt2+ (gen8)
458 APPEND_DEVICE(0x1612);
459 APPEND_DEVICE(0x1616);
460 APPEND_DEVICE(0x161a);
461 APPEND_DEVICE(0x161b);
462 APPEND_DEVICE(0x161d);
463 APPEND_DEVICE(0x161e);
464 APPEND_DEVICE(0x1622);
465 APPEND_DEVICE(0x1626);
466 APPEND_DEVICE(0x162a);
467 APPEND_DEVICE(0x162b);
468 APPEND_DEVICE(0x162d);
469 APPEND_DEVICE(0x162e);
470 APPEND_DEVICE(0x1632);
471 APPEND_DEVICE(0x1636);
472 APPEND_DEVICE(0x163a);
473 APPEND_DEVICE(0x163b);
474 APPEND_DEVICE(0x163d);
475 APPEND_DEVICE(0x163e);
477 #ifdef MOZ_WIDGET_GTK
478 // Gen7.5 not allowed until bug 1576637 is resolved.
479 APPEND_DEVICE(0x0412);
480 APPEND_DEVICE(0x0416);
481 APPEND_DEVICE(0x041a);
482 APPEND_DEVICE(0x041b);
483 APPEND_DEVICE(0x041e);
484 APPEND_DEVICE(0x0a12);
485 APPEND_DEVICE(0x0a16);
486 APPEND_DEVICE(0x0a1a);
487 APPEND_DEVICE(0x0a1b);
488 APPEND_DEVICE(0x0a1e);
491 case DeviceFamily::IntelModernRolloutWebRender
:
493 APPEND_DEVICE(0x1912);
494 APPEND_DEVICE(0x1913);
495 APPEND_DEVICE(0x1915);
496 APPEND_DEVICE(0x1916);
497 APPEND_DEVICE(0x1917);
498 APPEND_DEVICE(0x191a);
499 APPEND_DEVICE(0x191b);
500 APPEND_DEVICE(0x191d);
501 APPEND_DEVICE(0x191e);
502 APPEND_DEVICE(0x1921);
503 APPEND_DEVICE(0x1923);
504 APPEND_DEVICE(0x1926);
505 APPEND_DEVICE(0x1927);
506 APPEND_DEVICE(0x192b);
507 APPEND_DEVICE(0x1932);
508 APPEND_DEVICE(0x193b);
509 APPEND_DEVICE(0x193d);
512 APPEND_DEVICE(0x5912);
513 APPEND_DEVICE(0x5916);
514 APPEND_DEVICE(0x5917);
515 APPEND_DEVICE(0x591a);
516 APPEND_DEVICE(0x591b);
517 APPEND_DEVICE(0x591c);
518 APPEND_DEVICE(0x591d);
519 APPEND_DEVICE(0x591e);
520 APPEND_DEVICE(0x5921);
521 APPEND_DEVICE(0x5926);
522 APPEND_DEVICE(0x5923);
523 APPEND_DEVICE(0x5927);
524 APPEND_DEVICE(0x593b);
527 APPEND_RANGE(0x3e91, 0x3e92);
528 APPEND_DEVICE(0x3e94);
529 APPEND_DEVICE(0x3e96);
530 APPEND_DEVICE(0x3e98);
531 APPEND_RANGE(0x3e9a, 0x3e9b);
532 APPEND_DEVICE(0x3ea0);
533 APPEND_DEVICE(0x3ea2);
534 APPEND_RANGE(0x3ea5, 0x3ea9);
535 APPEND_DEVICE(0x87ca);
536 APPEND_DEVICE(0x9b41);
537 APPEND_DEVICE(0x9bc0);
538 APPEND_DEVICE(0x9bc2);
539 APPEND_RANGE(0x9bc4, 0x9bc5);
540 APPEND_DEVICE(0x9bc8);
541 APPEND_RANGE(0x9bca, 0x9bcc);
544 case DeviceFamily::AtiRolloutWebRender
:
545 APPEND_RANGE(0x6600, 0x66af);
546 APPEND_RANGE(0x6700, 0x671f);
547 APPEND_RANGE(0x6780, 0x683f);
548 APPEND_RANGE(0x6860, 0x687f);
549 APPEND_RANGE(0x6900, 0x69ff);
550 APPEND_DEVICE(0x7300);
551 APPEND_RANGE(0x7310, 0x731f);
552 APPEND_RANGE(0x9830, 0x986f);
553 APPEND_RANGE(0x9900, 0x99ff);
555 // This should never happen, but we get a warning if we don't handle this.
556 case DeviceFamily::Max
:
557 case DeviceFamily::All
:
558 case DeviceFamily::IntelAll
:
559 case DeviceFamily::NvidiaAll
:
560 case DeviceFamily::AtiAll
:
561 case DeviceFamily::MicrosoftAll
:
562 case DeviceFamily::ParallelsAll
:
563 case DeviceFamily::QualcommAll
:
564 NS_WARNING("Invalid DeviceFamily id");
571 // Macro for assigning a desktop environment to a string.
572 #define DECLARE_DESKTOP_ENVIRONMENT_ID(name, desktopEnvId) \
573 case DesktopEnvironment::name: \
574 sDesktopEnvironment[idx]->AssignLiteral(desktopEnvId); \
577 const nsAString
& GfxDriverInfo::GetDesktopEnvironment(DesktopEnvironment id
) {
578 if (id
>= DesktopEnvironment::Max
) {
579 MOZ_ASSERT_UNREACHABLE("DesktopEnvironment id is out of range");
580 id
= DesktopEnvironment::All
;
583 auto idx
= static_cast<size_t>(id
);
584 if (sDesktopEnvironment
[idx
]) {
585 return *sDesktopEnvironment
[idx
];
588 sDesktopEnvironment
[idx
] = new nsString();
591 DECLARE_DESKTOP_ENVIRONMENT_ID(GNOME
, "gnome");
592 DECLARE_DESKTOP_ENVIRONMENT_ID(KDE
, "kde");
593 DECLARE_DESKTOP_ENVIRONMENT_ID(XFCE
, "xfce");
594 DECLARE_DESKTOP_ENVIRONMENT_ID(Cinnamon
, "cinnamon");
595 DECLARE_DESKTOP_ENVIRONMENT_ID(Enlightenment
, "enlightment");
596 DECLARE_DESKTOP_ENVIRONMENT_ID(LXDE
, "lxde");
597 DECLARE_DESKTOP_ENVIRONMENT_ID(Openbox
, "openbox");
598 DECLARE_DESKTOP_ENVIRONMENT_ID(i3
, "i3");
599 DECLARE_DESKTOP_ENVIRONMENT_ID(Mate
, "mate");
600 DECLARE_DESKTOP_ENVIRONMENT_ID(Unity
, "unity");
601 DECLARE_DESKTOP_ENVIRONMENT_ID(Pantheon
, "pantheon");
602 DECLARE_DESKTOP_ENVIRONMENT_ID(LXQT
, "lxqt");
603 DECLARE_DESKTOP_ENVIRONMENT_ID(Deepin
, "deepin");
604 DECLARE_DESKTOP_ENVIRONMENT_ID(Unknown
, "unknown");
605 case DesktopEnvironment::Max
: // Suppress a warning.
606 DECLARE_DESKTOP_ENVIRONMENT_ID(All
, "");
609 return *sDesktopEnvironment
[idx
];
612 // Macro for assigning a window protocol id to a string.
613 #define DECLARE_WINDOW_PROTOCOL_ID(name, windowProtocolId) \
614 case WindowProtocol::name: \
615 sWindowProtocol[idx]->AssignLiteral(windowProtocolId); \
618 const nsAString
& GfxDriverInfo::GetWindowProtocol(WindowProtocol id
) {
619 if (id
>= WindowProtocol::Max
) {
620 MOZ_ASSERT_UNREACHABLE("WindowProtocol id is out of range");
621 id
= WindowProtocol::All
;
624 auto idx
= static_cast<size_t>(id
);
625 if (sWindowProtocol
[idx
]) {
626 return *sWindowProtocol
[idx
];
629 sWindowProtocol
[idx
] = new nsString();
632 DECLARE_WINDOW_PROTOCOL_ID(X11
, "x11");
633 DECLARE_WINDOW_PROTOCOL_ID(Wayland
, "wayland");
634 DECLARE_WINDOW_PROTOCOL_ID(WaylandDRM
, "wayland/drm");
635 DECLARE_WINDOW_PROTOCOL_ID(WaylandAll
, "wayland/all");
636 case WindowProtocol::Max
: // Suppress a warning.
637 DECLARE_WINDOW_PROTOCOL_ID(All
, "");
640 return *sWindowProtocol
[idx
];
643 // Macro for assigning a device vendor id to a string.
644 #define DECLARE_VENDOR_ID(name, deviceId) \
645 case DeviceVendor::name: \
646 sDeviceVendors[idx]->AssignLiteral(deviceId); \
649 const nsAString
& GfxDriverInfo::GetDeviceVendor(DeviceFamily id
) {
650 if (id
>= DeviceFamily::Max
) {
651 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
652 id
= DeviceFamily::All
;
655 DeviceVendor vendor
= DeviceVendor::All
;
657 case DeviceFamily::IntelAll
:
658 case DeviceFamily::IntelGMA500
:
659 case DeviceFamily::IntelGMA900
:
660 case DeviceFamily::IntelGMA950
:
661 case DeviceFamily::IntelGMA3150
:
662 case DeviceFamily::IntelGMAX3000
:
663 case DeviceFamily::IntelGMAX4500HD
:
664 case DeviceFamily::IntelHDGraphicsToIvyBridge
:
665 case DeviceFamily::IntelHDGraphicsToSandyBridge
:
666 case DeviceFamily::IntelHDGraphicsToHaswell
:
667 case DeviceFamily::IntelHD3000
:
668 case DeviceFamily::IntelHD520
:
669 case DeviceFamily::IntelMobileHDGraphics
:
670 case DeviceFamily::IntelRolloutWebRender
:
671 case DeviceFamily::IntelModernRolloutWebRender
:
672 case DeviceFamily::Bug1116812
:
673 case DeviceFamily::Bug1155608
:
674 case DeviceFamily::Bug1207665
:
675 vendor
= DeviceVendor::Intel
;
677 case DeviceFamily::NvidiaAll
:
678 case DeviceFamily::NvidiaBlockD3D9Layers
:
679 case DeviceFamily::NvidiaBlockWebRender
:
680 case DeviceFamily::NvidiaRolloutWebRender
:
681 case DeviceFamily::Geforce7300GT
:
682 case DeviceFamily::Nvidia310M
:
683 case DeviceFamily::Nvidia8800GTS
:
684 case DeviceFamily::Bug1137716
:
685 vendor
= DeviceVendor::NVIDIA
;
687 case DeviceFamily::AtiAll
:
688 case DeviceFamily::RadeonCaicos
:
689 case DeviceFamily::RadeonX1000
:
690 case DeviceFamily::Bug1447141
:
691 case DeviceFamily::AtiRolloutWebRender
:
692 vendor
= DeviceVendor::ATI
;
694 case DeviceFamily::MicrosoftAll
:
695 vendor
= DeviceVendor::Microsoft
;
697 case DeviceFamily::ParallelsAll
:
698 vendor
= DeviceVendor::Parallels
;
700 case DeviceFamily::QualcommAll
:
701 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
702 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
703 vendor
= DeviceVendor::Qualcomm
;
705 case DeviceFamily::All
:
706 case DeviceFamily::Max
:
710 return GetDeviceVendor(vendor
);
713 const nsAString
& GfxDriverInfo::GetDeviceVendor(DeviceVendor id
) {
714 if (id
>= DeviceVendor::Max
) {
715 MOZ_ASSERT_UNREACHABLE("DeviceVendor id is out of range");
716 id
= DeviceVendor::All
;
719 auto idx
= static_cast<size_t>(id
);
720 if (sDeviceVendors
[idx
]) {
721 return *sDeviceVendors
[idx
];
724 sDeviceVendors
[idx
] = new nsString();
727 DECLARE_VENDOR_ID(Intel
, "0x8086");
728 DECLARE_VENDOR_ID(NVIDIA
, "0x10de");
729 DECLARE_VENDOR_ID(ATI
, "0x1002");
730 // AMD has 0x1022 but continues to release GPU hardware under ATI.
731 DECLARE_VENDOR_ID(Microsoft
, "0x1414");
732 DECLARE_VENDOR_ID(Parallels
, "0x1ab8");
733 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
734 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
735 DECLARE_VENDOR_ID(Qualcomm
, "0x5143");
736 case DeviceVendor::Max
: // Suppress a warning.
737 DECLARE_VENDOR_ID(All
, "");
740 return *sDeviceVendors
[idx
];
743 // Macro for assigning a driver vendor id to a string.
744 #define DECLARE_DRIVER_VENDOR_ID(name, driverVendorId) \
745 case DriverVendor::name: \
746 sDriverVendors[idx]->AssignLiteral(driverVendorId); \
749 const nsAString
& GfxDriverInfo::GetDriverVendor(DriverVendor id
) {
750 if (id
>= DriverVendor::Max
) {
751 MOZ_ASSERT_UNREACHABLE("DriverVendor id is out of range");
752 id
= DriverVendor::All
;
755 auto idx
= static_cast<size_t>(id
);
756 if (sDriverVendors
[idx
]) {
757 return *sDriverVendors
[idx
];
760 sDriverVendors
[idx
] = new nsString();
763 DECLARE_DRIVER_VENDOR_ID(MesaAll
, "mesa/all");
764 DECLARE_DRIVER_VENDOR_ID(MesaLLVMPipe
, "mesa/llvmpipe");
765 DECLARE_DRIVER_VENDOR_ID(MesaSoftPipe
, "mesa/softpipe");
766 DECLARE_DRIVER_VENDOR_ID(MesaSWRast
, "mesa/swrast");
767 DECLARE_DRIVER_VENDOR_ID(MesaUnknown
, "mesa/unknown");
768 DECLARE_DRIVER_VENDOR_ID(NonMesaAll
, "non-mesa/all");
769 case DriverVendor::Max
: // Suppress a warning.
770 DECLARE_DRIVER_VENDOR_ID(All
, "");
773 return *sDriverVendors
[idx
];