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));
15 GfxDeviceFamily
* const GfxDriverInfo::allDevices
= nullptr;
17 GfxDeviceFamily
* GfxDriverInfo::sDeviceFamilies
[DeviceFamilyMax
];
18 nsAString
* GfxDriverInfo::sDeviceVendors
[DeviceVendorMax
];
19 nsAString
* GfxDriverInfo::sDriverVendors
[DriverVendorMax
];
21 GfxDriverInfo::GfxDriverInfo()
22 : mOperatingSystem(OperatingSystem::Unknown
),
23 mOperatingSystemVersion(0),
24 mAdapterVendor(GfxDriverInfo::GetDeviceVendor(VendorAll
)),
25 mDriverVendor(GfxDriverInfo::GetDriverVendor(DriverVendorAll
)),
27 mDeleteDevices(false),
28 mFeature(allFeatures
),
29 mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK
),
30 mComparisonOp(DRIVER_COMPARISON_IGNORED
),
33 mSuggestedVersion(nullptr),
37 GfxDriverInfo::GfxDriverInfo(OperatingSystem os
, const nsAString
& vendor
,
38 const nsAString
& driverVendor
,
39 GfxDeviceFamily
* devices
, int32_t feature
,
40 int32_t featureStatus
, VersionComparisonOp op
,
41 uint64_t driverVersion
, const char* ruleId
,
42 const char* suggestedVersion
/* = nullptr */,
43 bool ownDevices
/* = false */,
44 bool gpu2
/* = false */)
45 : mOperatingSystem(os
),
46 mOperatingSystemVersion(0),
47 mAdapterVendor(vendor
),
48 mDriverVendor(driverVendor
),
50 mDeleteDevices(ownDevices
),
52 mFeatureStatus(featureStatus
),
54 mDriverVersion(driverVersion
),
56 mSuggestedVersion(suggestedVersion
),
60 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo
& aOrig
)
61 : mOperatingSystem(aOrig
.mOperatingSystem
),
62 mOperatingSystemVersion(aOrig
.mOperatingSystemVersion
),
63 mAdapterVendor(aOrig
.mAdapterVendor
),
64 mDriverVendor(aOrig
.mDriverVendor
),
65 mFeature(aOrig
.mFeature
),
66 mFeatureStatus(aOrig
.mFeatureStatus
),
67 mComparisonOp(aOrig
.mComparisonOp
),
68 mDriverVersion(aOrig
.mDriverVersion
),
69 mDriverVersionMax(aOrig
.mDriverVersionMax
),
70 mSuggestedVersion(aOrig
.mSuggestedVersion
),
71 mRuleId(aOrig
.mRuleId
),
73 // If we're managing the lifetime of the device family, we have to make a
74 // copy of the original's device family.
75 if (aOrig
.mDeleteDevices
&& aOrig
.mDevices
) {
76 mDevices
= new GfxDeviceFamily
;
77 *mDevices
= *aOrig
.mDevices
;
79 mDevices
= aOrig
.mDevices
;
82 mDeleteDevices
= aOrig
.mDeleteDevices
;
85 GfxDriverInfo::~GfxDriverInfo() {
86 if (mDeleteDevices
) delete mDevices
;
89 // Macros for appending a device to the DeviceFamily.
90 #define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
91 #define APPEND_DEVICE2(device) \
92 deviceFamily->AppendElement(NS_LITERAL_STRING(device))
94 const GfxDeviceFamily
* GfxDriverInfo::GetDeviceFamily(DeviceFamily id
) {
95 // The code here is too sensitive to fall through to the default case if the
97 NS_ASSERTION(id
>= 0 && id
< DeviceFamilyMax
,
98 "DeviceFamily id is out of range");
100 // If it already exists, we must have processed it once, so return it now.
101 if (sDeviceFamilies
[id
]) return sDeviceFamilies
[id
];
103 sDeviceFamilies
[id
] = new GfxDeviceFamily
;
104 GfxDeviceFamily
* deviceFamily
= sDeviceFamilies
[id
];
108 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
109 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
112 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
113 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
114 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
115 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
118 APPEND_DEVICE(0x2772); /* Intel945G_1 */
119 APPEND_DEVICE(0x2776); /* Intel945G_2 */
120 APPEND_DEVICE(0x27a2); /* Intel945_1 */
121 APPEND_DEVICE(0x27a6); /* Intel945_2 */
122 APPEND_DEVICE(0x27ae); /* Intel945_3 */
125 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
126 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
127 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
128 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
131 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
132 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
133 APPEND_DEVICE(0x2982); /* IntelG35_1 */
134 APPEND_DEVICE(0x2983); /* IntelG35_2 */
135 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
136 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
137 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
138 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
139 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
140 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
141 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
142 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
143 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
144 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
145 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
146 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
147 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
148 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
150 case IntelGMAX4500HD
:
151 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
152 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
153 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
154 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
155 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
156 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
157 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
158 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
159 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
160 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
161 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
162 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
164 case IntelHDGraphicsToIvyBridge
:
165 APPEND_DEVICE(0x015A); /* IntelIvyBridge_GT1_1 (HD Graphics) */
167 APPEND_DEVICE(0x0152); /* IntelIvyBridge_GT1_2 (HD Graphics 2500, desktop) */
168 APPEND_DEVICE(0x0162); /* IntelIvyBridge_GT2_1 (HD Graphics 4000, desktop) */
169 APPEND_DEVICE(0x0166); /* IntelIvyBridge_GT2_2 (HD Graphics 4000, mobile) */
170 APPEND_DEVICE(0x016A); /* IntelIvyBridge_GT2_3 (HD Graphics P4000, workstation) */
173 case IntelHDGraphicsToSandyBridge
:
174 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
175 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
176 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
177 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
178 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
179 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
180 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
181 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
182 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
184 case IntelHDGraphicsToHaswell
:
185 APPEND_DEVICE(0x0402); /* IntelHaswell_GT1_1 */
186 APPEND_DEVICE(0x0406); /* IntelHaswell_GT1_2 */
187 APPEND_DEVICE(0x040A); /* IntelHaswell_GT1_3 */
188 APPEND_DEVICE(0x040B); /* IntelHaswell_GT1_4 */
189 APPEND_DEVICE(0x040E); /* IntelHaswell_GT1_5 */
190 APPEND_DEVICE(0x0A02); /* IntelHaswell_GT1_6 */
191 APPEND_DEVICE(0x0A06); /* IntelHaswell_GT1_7 */
192 APPEND_DEVICE(0x0A0A); /* IntelHaswell_GT1_8 */
193 APPEND_DEVICE(0x0A0B); /* IntelHaswell_GT1_9 */
194 APPEND_DEVICE(0x0A0E); /* IntelHaswell_GT1_10 */
195 APPEND_DEVICE(0x0412); /* IntelHaswell_GT2_1 */
196 APPEND_DEVICE(0x0416); /* IntelHaswell_GT2_2 */
197 APPEND_DEVICE(0x041A); /* IntelHaswell_GT2_3 */
198 APPEND_DEVICE(0x041B); /* IntelHaswell_GT2_4 */
199 APPEND_DEVICE(0x041E); /* IntelHaswell_GT2_5 */
200 APPEND_DEVICE(0x0A12); /* IntelHaswell_GT2_6 */
201 APPEND_DEVICE(0x0A16); /* IntelHaswell_GT2_7 */
202 APPEND_DEVICE(0x0A1A); /* IntelHaswell_GT2_8 */
203 APPEND_DEVICE(0x0A1B); /* IntelHaswell_GT2_9 */
204 APPEND_DEVICE(0x0A1E); /* IntelHaswell_GT2_10 */
205 APPEND_DEVICE(0x0422); /* IntelHaswell_GT3_1 */
206 APPEND_DEVICE(0x0426); /* IntelHaswell_GT3_2 */
207 APPEND_DEVICE(0x042A); /* IntelHaswell_GT3_3 */
208 APPEND_DEVICE(0x042B); /* IntelHaswell_GT3_4 */
209 APPEND_DEVICE(0x042E); /* IntelHaswell_GT3_5 */
210 APPEND_DEVICE(0x0A22); /* IntelHaswell_GT3_6 */
211 APPEND_DEVICE(0x0A26); /* IntelHaswell_GT3_7 */
212 APPEND_DEVICE(0x0A2A); /* IntelHaswell_GT3_8 */
213 APPEND_DEVICE(0x0A2B); /* IntelHaswell_GT3_9 */
214 APPEND_DEVICE(0x0A2E); /* IntelHaswell_GT3_10 */
215 APPEND_DEVICE(0x0D22); /* IntelHaswell_GT3e_1 */
216 APPEND_DEVICE(0x0D26); /* IntelHaswell_GT3e_2 */
217 APPEND_DEVICE(0x0D2A); /* IntelHaswell_GT3e_3 */
218 APPEND_DEVICE(0x0D2B); /* IntelHaswell_GT3e_4 */
219 APPEND_DEVICE(0x0D2E); /* IntelHaswell_GT3e_5 */
222 APPEND_DEVICE(0x0126);
225 APPEND_DEVICE(0x1916);
227 case IntelMobileHDGraphics
:
228 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
230 case NvidiaBlockD3D9Layers
:
231 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
232 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
233 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
234 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
235 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
236 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
237 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
238 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
239 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
240 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
241 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
242 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
243 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
244 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
245 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
246 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
247 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
248 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
249 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
250 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
251 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
254 // This list is from the ATIRadeonX1000.kext Info.plist
255 APPEND_DEVICE(0x7187);
256 APPEND_DEVICE(0x7210);
257 APPEND_DEVICE(0x71de);
258 APPEND_DEVICE(0x7146);
259 APPEND_DEVICE(0x7142);
260 APPEND_DEVICE(0x7109);
261 APPEND_DEVICE(0x71c5);
262 APPEND_DEVICE(0x71c0);
263 APPEND_DEVICE(0x7240);
264 APPEND_DEVICE(0x7249);
265 APPEND_DEVICE(0x7291);
268 APPEND_DEVICE(0x6766);
269 APPEND_DEVICE(0x6767);
270 APPEND_DEVICE(0x6768);
271 APPEND_DEVICE(0x6770);
272 APPEND_DEVICE(0x6771);
273 APPEND_DEVICE(0x6772);
274 APPEND_DEVICE(0x6778);
275 APPEND_DEVICE(0x6779);
276 APPEND_DEVICE(0x677b);
279 APPEND_DEVICE(0x0393);
282 APPEND_DEVICE(0x0A70);
285 APPEND_DEVICE(0x0193);
288 APPEND_DEVICE(0x0a29);
289 APPEND_DEVICE(0x0a2b);
290 APPEND_DEVICE(0x0a2d);
291 APPEND_DEVICE(0x0a35);
292 APPEND_DEVICE(0x0a6c);
293 APPEND_DEVICE(0x0a70);
294 APPEND_DEVICE(0x0a72);
295 APPEND_DEVICE(0x0a7a);
296 APPEND_DEVICE(0x0caf);
297 APPEND_DEVICE(0x0dd2);
298 APPEND_DEVICE(0x0dd3);
300 APPEND_DEVICE(0x0de3);
301 APPEND_DEVICE(0x0de8);
302 APPEND_DEVICE(0x0de9);
303 APPEND_DEVICE(0x0dea);
304 APPEND_DEVICE(0x0deb);
305 APPEND_DEVICE(0x0dec);
306 APPEND_DEVICE(0x0ded);
307 APPEND_DEVICE(0x0dee);
308 APPEND_DEVICE(0x0def);
309 APPEND_DEVICE(0x0df0);
310 APPEND_DEVICE(0x0df1);
311 APPEND_DEVICE(0x0df2);
312 APPEND_DEVICE(0x0df3);
313 APPEND_DEVICE(0x0df4);
314 APPEND_DEVICE(0x0df5);
315 APPEND_DEVICE(0x0df6);
316 APPEND_DEVICE(0x0df7);
317 APPEND_DEVICE(0x1050);
318 APPEND_DEVICE(0x1051);
319 APPEND_DEVICE(0x1052);
320 APPEND_DEVICE(0x1054);
321 APPEND_DEVICE(0x1055);
324 APPEND_DEVICE(0x2e32);
325 APPEND_DEVICE(0x2a02);
328 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
331 APPEND_DEVICE(0x9991);
332 APPEND_DEVICE(0x9993);
333 APPEND_DEVICE(0x9996);
334 APPEND_DEVICE(0x9998);
335 APPEND_DEVICE(0x9901);
336 APPEND_DEVICE(0x990b);
339 APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
340 APPEND_DEVICE(0xa002);
341 APPEND_DEVICE(0xa011);
342 APPEND_DEVICE(0xa012);
344 case NvidiaBlockWebRender
:
346 APPEND_DEVICE(0x0a60);
347 APPEND_DEVICE(0x0a62);
348 APPEND_DEVICE(0x0a63);
349 APPEND_DEVICE(0x0a64);
350 APPEND_DEVICE(0x0a65);
351 APPEND_DEVICE(0x0a66);
352 APPEND_DEVICE(0x0a67);
353 APPEND_DEVICE(0x0a7b);
354 APPEND_DEVICE(0x10c0);
355 APPEND_DEVICE(0x10c3);
356 APPEND_DEVICE(0x10c5);
357 APPEND_DEVICE(0x10d8);
359 APPEND_DEVICE(0x0a68);
360 APPEND_DEVICE(0x0a69);
361 APPEND_DEVICE(0x0a6a);
362 APPEND_DEVICE(0x0a6c);
363 APPEND_DEVICE(0x0a6e);
364 APPEND_DEVICE(0x0a6f);
365 APPEND_DEVICE(0x0a70);
366 APPEND_DEVICE(0x0a71);
367 APPEND_DEVICE(0x0a72);
368 APPEND_DEVICE(0x0a73);
369 APPEND_DEVICE(0x0a74);
370 APPEND_DEVICE(0x0a75);
371 APPEND_DEVICE(0x0a76);
372 APPEND_DEVICE(0x0a7a);
374 APPEND_DEVICE(0x0a78);
376 APPEND_DEVICE(0x0a7c);
378 // This should never happen, but we get a warning if we don't handle this.
379 case DeviceFamilyMax
:
380 NS_WARNING("Invalid DeviceFamily id");
387 // Macro for assigning a device vendor id to a string.
388 #define DECLARE_VENDOR_ID(name, deviceId) \
390 sDeviceVendors[id]->AssignLiteral(deviceId); \
393 const nsAString
& GfxDriverInfo::GetDeviceVendor(DeviceVendor id
) {
394 NS_ASSERTION(id
>= 0 && id
< DeviceVendorMax
,
395 "DeviceVendor id is out of range");
397 if (sDeviceVendors
[id
]) return *sDeviceVendors
[id
];
399 sDeviceVendors
[id
] = new nsString();
402 DECLARE_VENDOR_ID(VendorAll
, "");
403 DECLARE_VENDOR_ID(VendorIntel
, "0x8086");
404 DECLARE_VENDOR_ID(VendorNVIDIA
, "0x10de");
405 DECLARE_VENDOR_ID(VendorAMD
, "0x1022");
406 DECLARE_VENDOR_ID(VendorATI
, "0x1002");
407 DECLARE_VENDOR_ID(VendorMicrosoft
, "0x1414");
408 DECLARE_VENDOR_ID(VendorParallels
, "0x1ab8");
409 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
410 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
411 DECLARE_VENDOR_ID(VendorQualcomm
, "0x5143");
412 // Suppress a warning.
413 DECLARE_VENDOR_ID(DeviceVendorMax
, "");
416 return *sDeviceVendors
[id
];
419 // Macro for assigning a driver vendor id to a string.
420 #define DECLARE_DRIVER_VENDOR_ID(name, driverVendorId) \
422 sDriverVendors[id]->AssignLiteral(driverVendorId); \
425 const nsAString
& GfxDriverInfo::GetDriverVendor(DriverVendor id
) {
426 NS_ASSERTION(id
>= 0 && id
< DriverVendorMax
,
427 "DriverVendor id is out of range");
429 if (sDriverVendors
[id
]) return *sDriverVendors
[id
];
431 sDriverVendors
[id
] = new nsString();
434 DECLARE_DRIVER_VENDOR_ID(DriverVendorAll
, "");
435 DECLARE_DRIVER_VENDOR_ID(DriverMesaAll
, "mesa/all");
436 DECLARE_DRIVER_VENDOR_ID(DriverMesaLLVMPipe
, "mesa/llvmpipe");
437 DECLARE_DRIVER_VENDOR_ID(DriverMesaSoftPipe
, "mesa/softpipe");
438 DECLARE_DRIVER_VENDOR_ID(DriverMesaSWRast
, "mesa/swrast");
439 DECLARE_DRIVER_VENDOR_ID(DriverMesaUnknown
, "mesa/unknown");
440 DECLARE_DRIVER_VENDOR_ID(DriverNonMesaAll
, "non-mesa/all");
441 // Suppress a warning.
442 DECLARE_DRIVER_VENDOR_ID(DriverVendorMax
, "");
445 return *sDriverVendors
[id
];