Bug 1527661 [wpt PR 15356] - Update wpt metadata, a=testonly
[gecko.git] / widget / GfxDriverInfo.cpp
blobc924fa8ccb1338939c39bc38382f418f623d7779
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"
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];
20 GfxDriverInfo::GfxDriverInfo()
21 : mOperatingSystem(OperatingSystem::Unknown),
22 mOperatingSystemVersion(0),
23 mAdapterVendor(GfxDriverInfo::GetDeviceVendor(VendorAll)),
24 mDevices(allDevices),
25 mDeleteDevices(false),
26 mFeature(allFeatures),
27 mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK),
28 mComparisonOp(DRIVER_COMPARISON_IGNORED),
29 mDriverVersion(0),
30 mDriverVersionMax(0),
31 mSuggestedVersion(nullptr),
32 mRuleId(nullptr),
33 mGpu2(false) {}
35 GfxDriverInfo::GfxDriverInfo(OperatingSystem os, nsAString& vendor,
36 GfxDeviceFamily* devices, int32_t feature,
37 int32_t featureStatus, VersionComparisonOp op,
38 uint64_t driverVersion, const char* ruleId,
39 const char* suggestedVersion /* = nullptr */,
40 bool ownDevices /* = false */,
41 bool gpu2 /* = false */)
42 : mOperatingSystem(os),
43 mOperatingSystemVersion(0),
44 mAdapterVendor(vendor),
45 mDevices(devices),
46 mDeleteDevices(ownDevices),
47 mFeature(feature),
48 mFeatureStatus(featureStatus),
49 mComparisonOp(op),
50 mDriverVersion(driverVersion),
51 mDriverVersionMax(0),
52 mSuggestedVersion(suggestedVersion),
53 mRuleId(ruleId),
54 mGpu2(gpu2) {}
56 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo& aOrig)
57 : mOperatingSystem(aOrig.mOperatingSystem),
58 mOperatingSystemVersion(aOrig.mOperatingSystemVersion),
59 mAdapterVendor(aOrig.mAdapterVendor),
60 mFeature(aOrig.mFeature),
61 mFeatureStatus(aOrig.mFeatureStatus),
62 mComparisonOp(aOrig.mComparisonOp),
63 mDriverVersion(aOrig.mDriverVersion),
64 mDriverVersionMax(aOrig.mDriverVersionMax),
65 mSuggestedVersion(aOrig.mSuggestedVersion),
66 mRuleId(aOrig.mRuleId),
67 mGpu2(aOrig.mGpu2) {
68 // If we're managing the lifetime of the device family, we have to make a
69 // copy of the original's device family.
70 if (aOrig.mDeleteDevices && aOrig.mDevices) {
71 mDevices = new GfxDeviceFamily;
72 *mDevices = *aOrig.mDevices;
73 } else {
74 mDevices = aOrig.mDevices;
77 mDeleteDevices = aOrig.mDeleteDevices;
80 GfxDriverInfo::~GfxDriverInfo() {
81 if (mDeleteDevices) delete mDevices;
84 // Macros for appending a device to the DeviceFamily.
85 #define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
86 #define APPEND_DEVICE2(device) \
87 deviceFamily->AppendElement(NS_LITERAL_STRING(device))
89 const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id) {
90 // The code here is too sensitive to fall through to the default case if the
91 // code is invalid.
92 NS_ASSERTION(id >= 0 && id < DeviceFamilyMax,
93 "DeviceFamily id is out of range");
95 // If it already exists, we must have processed it once, so return it now.
96 if (sDeviceFamilies[id]) return sDeviceFamilies[id];
98 sDeviceFamilies[id] = new GfxDeviceFamily;
99 GfxDeviceFamily* deviceFamily = sDeviceFamilies[id];
101 switch (id) {
102 case IntelGMA500:
103 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
104 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
105 break;
106 case IntelGMA900:
107 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
108 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
109 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
110 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
111 break;
112 case IntelGMA950:
113 APPEND_DEVICE(0x2772); /* Intel945G_1 */
114 APPEND_DEVICE(0x2776); /* Intel945G_2 */
115 APPEND_DEVICE(0x27a2); /* Intel945_1 */
116 APPEND_DEVICE(0x27a6); /* Intel945_2 */
117 APPEND_DEVICE(0x27ae); /* Intel945_3 */
118 break;
119 case IntelGMA3150:
120 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
121 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
122 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
123 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
124 break;
125 case IntelGMAX3000:
126 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
127 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
128 APPEND_DEVICE(0x2982); /* IntelG35_1 */
129 APPEND_DEVICE(0x2983); /* IntelG35_2 */
130 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
131 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
132 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
133 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
134 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
135 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
136 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
137 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
138 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
139 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
140 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
141 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
142 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
143 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
144 break;
145 case IntelGMAX4500HD:
146 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
147 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
148 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
149 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
150 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
151 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
152 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
153 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
154 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
155 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
156 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
157 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
158 break;
159 case IntelHDGraphicsToSandyBridge:
160 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
161 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
162 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
163 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
164 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
165 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
166 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
167 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
168 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
169 break;
170 case IntelHDGraphicsToHaswell:
171 APPEND_DEVICE(0x0402); /* IntelHaswell_GT1_1 */
172 APPEND_DEVICE(0x0406); /* IntelHaswell_GT1_2 */
173 APPEND_DEVICE(0x040A); /* IntelHaswell_GT1_3 */
174 APPEND_DEVICE(0x040B); /* IntelHaswell_GT1_4 */
175 APPEND_DEVICE(0x040E); /* IntelHaswell_GT1_5 */
176 APPEND_DEVICE(0x0A02); /* IntelHaswell_GT1_6 */
177 APPEND_DEVICE(0x0A06); /* IntelHaswell_GT1_7 */
178 APPEND_DEVICE(0x0A0A); /* IntelHaswell_GT1_8 */
179 APPEND_DEVICE(0x0A0B); /* IntelHaswell_GT1_9 */
180 APPEND_DEVICE(0x0A0E); /* IntelHaswell_GT1_10 */
181 APPEND_DEVICE(0x0412); /* IntelHaswell_GT2_1 */
182 APPEND_DEVICE(0x0416); /* IntelHaswell_GT2_2 */
183 APPEND_DEVICE(0x041A); /* IntelHaswell_GT2_3 */
184 APPEND_DEVICE(0x041B); /* IntelHaswell_GT2_4 */
185 APPEND_DEVICE(0x041E); /* IntelHaswell_GT2_5 */
186 APPEND_DEVICE(0x0A12); /* IntelHaswell_GT2_6 */
187 APPEND_DEVICE(0x0A16); /* IntelHaswell_GT2_7 */
188 APPEND_DEVICE(0x0A1A); /* IntelHaswell_GT2_8 */
189 APPEND_DEVICE(0x0A1B); /* IntelHaswell_GT2_9 */
190 APPEND_DEVICE(0x0A1E); /* IntelHaswell_GT2_10 */
191 APPEND_DEVICE(0x0422); /* IntelHaswell_GT3_1 */
192 APPEND_DEVICE(0x0426); /* IntelHaswell_GT3_2 */
193 APPEND_DEVICE(0x042A); /* IntelHaswell_GT3_3 */
194 APPEND_DEVICE(0x042B); /* IntelHaswell_GT3_4 */
195 APPEND_DEVICE(0x042E); /* IntelHaswell_GT3_5 */
196 APPEND_DEVICE(0x0A22); /* IntelHaswell_GT3_6 */
197 APPEND_DEVICE(0x0A26); /* IntelHaswell_GT3_7 */
198 APPEND_DEVICE(0x0A2A); /* IntelHaswell_GT3_8 */
199 APPEND_DEVICE(0x0A2B); /* IntelHaswell_GT3_9 */
200 APPEND_DEVICE(0x0A2E); /* IntelHaswell_GT3_10 */
201 APPEND_DEVICE(0x0D22); /* IntelHaswell_GT3e_1 */
202 APPEND_DEVICE(0x0D26); /* IntelHaswell_GT3e_2 */
203 APPEND_DEVICE(0x0D2A); /* IntelHaswell_GT3e_3 */
204 APPEND_DEVICE(0x0D2B); /* IntelHaswell_GT3e_4 */
205 APPEND_DEVICE(0x0D2E); /* IntelHaswell_GT3e_5 */
206 break;
207 case IntelHD3000:
208 APPEND_DEVICE(0x0126);
209 break;
210 case IntelMobileHDGraphics:
211 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
212 break;
213 case NvidiaBlockD3D9Layers:
214 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
215 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
216 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
217 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
218 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
219 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
220 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
221 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
222 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
223 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
224 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
225 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
226 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
227 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
228 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
229 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
230 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
231 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
232 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
233 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
234 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
235 break;
236 case RadeonX1000:
237 // This list is from the ATIRadeonX1000.kext Info.plist
238 APPEND_DEVICE(0x7187);
239 APPEND_DEVICE(0x7210);
240 APPEND_DEVICE(0x71de);
241 APPEND_DEVICE(0x7146);
242 APPEND_DEVICE(0x7142);
243 APPEND_DEVICE(0x7109);
244 APPEND_DEVICE(0x71c5);
245 APPEND_DEVICE(0x71c0);
246 APPEND_DEVICE(0x7240);
247 APPEND_DEVICE(0x7249);
248 APPEND_DEVICE(0x7291);
249 break;
250 case Geforce7300GT:
251 APPEND_DEVICE(0x0393);
252 break;
253 case Nvidia310M:
254 APPEND_DEVICE(0x0A70);
255 break;
256 case Nvidia8800GTS:
257 APPEND_DEVICE(0x0193);
258 break;
259 case Bug1137716:
260 APPEND_DEVICE(0x0a29);
261 APPEND_DEVICE(0x0a2b);
262 APPEND_DEVICE(0x0a2d);
263 APPEND_DEVICE(0x0a35);
264 APPEND_DEVICE(0x0a6c);
265 APPEND_DEVICE(0x0a70);
266 APPEND_DEVICE(0x0a72);
267 APPEND_DEVICE(0x0a7a);
268 APPEND_DEVICE(0x0caf);
269 APPEND_DEVICE(0x0dd2);
270 APPEND_DEVICE(0x0dd3);
271 // GF180M ids
272 APPEND_DEVICE(0x0de3);
273 APPEND_DEVICE(0x0de8);
274 APPEND_DEVICE(0x0de9);
275 APPEND_DEVICE(0x0dea);
276 APPEND_DEVICE(0x0deb);
277 APPEND_DEVICE(0x0dec);
278 APPEND_DEVICE(0x0ded);
279 APPEND_DEVICE(0x0dee);
280 APPEND_DEVICE(0x0def);
281 APPEND_DEVICE(0x0df0);
282 APPEND_DEVICE(0x0df1);
283 APPEND_DEVICE(0x0df2);
284 APPEND_DEVICE(0x0df3);
285 APPEND_DEVICE(0x0df4);
286 APPEND_DEVICE(0x0df5);
287 APPEND_DEVICE(0x0df6);
288 APPEND_DEVICE(0x0df7);
289 APPEND_DEVICE(0x1050);
290 APPEND_DEVICE(0x1051);
291 APPEND_DEVICE(0x1052);
292 APPEND_DEVICE(0x1054);
293 APPEND_DEVICE(0x1055);
294 break;
295 case Bug1116812:
296 APPEND_DEVICE(0x2e32);
297 APPEND_DEVICE(0x2a02);
298 break;
299 case Bug1155608:
300 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
301 break;
302 case Bug1447141:
303 APPEND_DEVICE(0x9991);
304 APPEND_DEVICE(0x9993);
305 APPEND_DEVICE(0x9996);
306 APPEND_DEVICE(0x9998);
307 APPEND_DEVICE(0x9901);
308 APPEND_DEVICE(0x990b);
309 break;
310 case Bug1207665:
311 APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
312 APPEND_DEVICE(0xa002);
313 APPEND_DEVICE(0xa011);
314 APPEND_DEVICE(0xa012);
315 break;
316 case NvidiaBlockWebRender:
317 /* GT218 */
318 APPEND_DEVICE(0x0a60);
319 APPEND_DEVICE(0x0a62);
320 APPEND_DEVICE(0x0a63);
321 APPEND_DEVICE(0x0a64);
322 APPEND_DEVICE(0x0a65);
323 APPEND_DEVICE(0x0a66);
324 APPEND_DEVICE(0x0a67);
325 APPEND_DEVICE(0x0a7b);
326 APPEND_DEVICE(0x10c0);
327 APPEND_DEVICE(0x10c3);
328 APPEND_DEVICE(0x10c5);
329 APPEND_DEVICE(0x10d8);
330 /* GT218M */
331 APPEND_DEVICE(0x0a68);
332 APPEND_DEVICE(0x0a69);
333 APPEND_DEVICE(0x0a6a);
334 APPEND_DEVICE(0x0a6c);
335 APPEND_DEVICE(0x0a6e);
336 APPEND_DEVICE(0x0a6f);
337 APPEND_DEVICE(0x0a70);
338 APPEND_DEVICE(0x0a71);
339 APPEND_DEVICE(0x0a72);
340 APPEND_DEVICE(0x0a73);
341 APPEND_DEVICE(0x0a74);
342 APPEND_DEVICE(0x0a75);
343 APPEND_DEVICE(0x0a76);
344 APPEND_DEVICE(0x0a7a);
345 /* GT218GL */
346 APPEND_DEVICE(0x0a78);
347 /* GT218GLM */
348 APPEND_DEVICE(0x0a7c);
349 break;
350 // This should never happen, but we get a warning if we don't handle this.
351 case DeviceFamilyMax:
352 NS_WARNING("Invalid DeviceFamily id");
353 break;
356 return deviceFamily;
359 // Macro for assigning a device vendor id to a string.
360 #define DECLARE_VENDOR_ID(name, deviceId) \
361 case name: \
362 sDeviceVendors[id]->AssignLiteral(deviceId); \
363 break;
365 const nsAString& GfxDriverInfo::GetDeviceVendor(DeviceVendor id) {
366 NS_ASSERTION(id >= 0 && id < DeviceVendorMax,
367 "DeviceVendor id is out of range");
369 if (sDeviceVendors[id]) return *sDeviceVendors[id];
371 sDeviceVendors[id] = new nsString();
373 switch (id) {
374 DECLARE_VENDOR_ID(VendorAll, "");
375 DECLARE_VENDOR_ID(VendorIntel, "0x8086");
376 DECLARE_VENDOR_ID(VendorNVIDIA, "0x10de");
377 DECLARE_VENDOR_ID(VendorAMD, "0x1022");
378 DECLARE_VENDOR_ID(VendorATI, "0x1002");
379 DECLARE_VENDOR_ID(VendorMicrosoft, "0x1414");
380 DECLARE_VENDOR_ID(VendorParallels, "0x1ab8");
381 // Choose an arbitrary Qualcomm PCI VENdor ID for now.
382 // TODO: This should be "QCOM" when Windows device ID parsing is reworked.
383 DECLARE_VENDOR_ID(VendorQualcomm, "0x5143");
384 // Suppress a warning.
385 DECLARE_VENDOR_ID(DeviceVendorMax, "");
388 return *sDeviceVendors[id];