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