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::mDeviceFamilies
[DeviceFamilyMax
];
18 nsAString
* GfxDriverInfo::mDeviceVendors
[DeviceVendorMax
];
20 GfxDriverInfo::GfxDriverInfo()
21 : mOperatingSystem(DRIVER_OS_UNKNOWN
),
22 mOperatingSystemVersion(0),
23 mAdapterVendor(GfxDriverInfo::GetDeviceVendor(VendorAll
)),
25 mDeleteDevices(false),
26 mFeature(allFeatures
),
27 mFeatureStatus(nsIGfxInfo::FEATURE_STATUS_OK
),
28 mComparisonOp(DRIVER_COMPARISON_IGNORED
),
31 mSuggestedVersion(nullptr),
35 GfxDriverInfo::GfxDriverInfo(OperatingSystem os
, nsAString
& vendor
,
36 GfxDeviceFamily
* devices
,
37 int32_t feature
, int32_t featureStatus
,
38 VersionComparisonOp op
,
39 uint64_t driverVersion
,
40 const char *suggestedVersion
/* = nullptr */,
41 bool ownDevices
/* = false */,
42 bool gpu2
/* = false */)
43 : mOperatingSystem(os
),
44 mOperatingSystemVersion(0),
45 mAdapterVendor(vendor
),
47 mDeleteDevices(ownDevices
),
49 mFeatureStatus(featureStatus
),
51 mDriverVersion(driverVersion
),
53 mSuggestedVersion(suggestedVersion
),
57 GfxDriverInfo::GfxDriverInfo(const GfxDriverInfo
& aOrig
)
58 : mOperatingSystem(aOrig
.mOperatingSystem
),
59 mOperatingSystemVersion(aOrig
.mOperatingSystemVersion
),
60 mAdapterVendor(aOrig
.mAdapterVendor
),
61 mFeature(aOrig
.mFeature
),
62 mFeatureStatus(aOrig
.mFeatureStatus
),
63 mComparisonOp(aOrig
.mComparisonOp
),
64 mDriverVersion(aOrig
.mDriverVersion
),
65 mDriverVersionMax(aOrig
.mDriverVersionMax
),
66 mSuggestedVersion(aOrig
.mSuggestedVersion
),
69 // If we're managing the lifetime of the device family, we have to make a
70 // copy of the original's device family.
71 if (aOrig
.mDeleteDevices
&& aOrig
.mDevices
) {
72 mDevices
= new GfxDeviceFamily
;
73 *mDevices
= *aOrig
.mDevices
;
75 mDevices
= aOrig
.mDevices
;
78 mDeleteDevices
= aOrig
.mDeleteDevices
;
81 GfxDriverInfo::~GfxDriverInfo()
87 // Macros for appending a device to the DeviceFamily.
88 #define APPEND_DEVICE(device) APPEND_DEVICE2(#device)
89 #define APPEND_DEVICE2(device) deviceFamily->AppendElement(NS_LITERAL_STRING(device))
91 const GfxDeviceFamily
* GfxDriverInfo::GetDeviceFamily(DeviceFamily id
)
93 // The code here is too sensitive to fall through to the default case if the
95 NS_ASSERTION(id
>= 0 && id
< DeviceFamilyMax
, "DeviceFamily id is out of range");
97 // If it already exists, we must have processed it once, so return it now.
98 if (mDeviceFamilies
[id
])
99 return mDeviceFamilies
[id
];
101 mDeviceFamilies
[id
] = new GfxDeviceFamily
;
102 GfxDeviceFamily
* deviceFamily
= mDeviceFamilies
[id
];
106 APPEND_DEVICE(0x8108); /* IntelGMA500_1 */
107 APPEND_DEVICE(0x8109); /* IntelGMA500_2 */
110 APPEND_DEVICE(0x2582); /* IntelGMA900_1 */
111 APPEND_DEVICE(0x2782); /* IntelGMA900_2 */
112 APPEND_DEVICE(0x2592); /* IntelGMA900_3 */
113 APPEND_DEVICE(0x2792); /* IntelGMA900_4 */
116 APPEND_DEVICE(0x2772); /* Intel945G_1 */
117 APPEND_DEVICE(0x2776); /* Intel945G_2 */
118 APPEND_DEVICE(0x27a2); /* Intel945_1 */
119 APPEND_DEVICE(0x27a6); /* Intel945_2 */
120 APPEND_DEVICE(0x27ae); /* Intel945_3 */
123 APPEND_DEVICE(0xa001); /* IntelGMA3150_Nettop_1 */
124 APPEND_DEVICE(0xa002); /* IntelGMA3150_Nettop_2 */
125 APPEND_DEVICE(0xa011); /* IntelGMA3150_Netbook_1 */
126 APPEND_DEVICE(0xa012); /* IntelGMA3150_Netbook_2 */
129 APPEND_DEVICE(0x2972); /* Intel946GZ_1 */
130 APPEND_DEVICE(0x2973); /* Intel946GZ_2 */
131 APPEND_DEVICE(0x2982); /* IntelG35_1 */
132 APPEND_DEVICE(0x2983); /* IntelG35_2 */
133 APPEND_DEVICE(0x2992); /* IntelQ965_1 */
134 APPEND_DEVICE(0x2993); /* IntelQ965_2 */
135 APPEND_DEVICE(0x29a2); /* IntelG965_1 */
136 APPEND_DEVICE(0x29a3); /* IntelG965_2 */
137 APPEND_DEVICE(0x29b2); /* IntelQ35_1 */
138 APPEND_DEVICE(0x29b3); /* IntelQ35_2 */
139 APPEND_DEVICE(0x29c2); /* IntelG33_1 */
140 APPEND_DEVICE(0x29c3); /* IntelG33_2 */
141 APPEND_DEVICE(0x29d2); /* IntelQ33_1 */
142 APPEND_DEVICE(0x29d3); /* IntelQ33_2 */
143 APPEND_DEVICE(0x2a02); /* IntelGL960_1 */
144 APPEND_DEVICE(0x2a03); /* IntelGL960_2 */
145 APPEND_DEVICE(0x2a12); /* IntelGM965_1 */
146 APPEND_DEVICE(0x2a13); /* IntelGM965_2 */
148 case IntelGMAX4500HD
:
149 APPEND_DEVICE(0x2a42); /* IntelGMA4500MHD_1 */
150 APPEND_DEVICE(0x2a43); /* IntelGMA4500MHD_2 */
151 APPEND_DEVICE(0x2e42); /* IntelB43_1 */
152 APPEND_DEVICE(0x2e43); /* IntelB43_2 */
153 APPEND_DEVICE(0x2e92); /* IntelB43_3 */
154 APPEND_DEVICE(0x2e93); /* IntelB43_4 */
155 APPEND_DEVICE(0x2e32); /* IntelG41_1 */
156 APPEND_DEVICE(0x2e33); /* IntelG41_2 */
157 APPEND_DEVICE(0x2e22); /* IntelG45_1 */
158 APPEND_DEVICE(0x2e23); /* IntelG45_2 */
159 APPEND_DEVICE(0x2e12); /* IntelQ45_1 */
160 APPEND_DEVICE(0x2e13); /* IntelQ45_2 */
161 APPEND_DEVICE(0x0042); /* IntelHDGraphics */
162 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
163 APPEND_DEVICE(0x0102); /* IntelSandyBridge_1 */
164 APPEND_DEVICE(0x0106); /* IntelSandyBridge_2 */
165 APPEND_DEVICE(0x0112); /* IntelSandyBridge_3 */
166 APPEND_DEVICE(0x0116); /* IntelSandyBridge_4 */
167 APPEND_DEVICE(0x0122); /* IntelSandyBridge_5 */
168 APPEND_DEVICE(0x0126); /* IntelSandyBridge_6 */
169 APPEND_DEVICE(0x010a); /* IntelSandyBridge_7 */
170 APPEND_DEVICE(0x0080); /* IntelIvyBridge */
173 APPEND_DEVICE(0x0126);
175 case IntelMobileHDGraphics
:
176 APPEND_DEVICE(0x0046); /* IntelMobileHDGraphics */
178 case NvidiaBlockD3D9Layers
:
179 // Glitches whilst scrolling (see bugs 612007, 644787, 645872)
180 APPEND_DEVICE(0x00f3); /* NV43 [GeForce 6200 (TM)] */
181 APPEND_DEVICE(0x0146); /* NV43 [Geforce Go 6600TE/6200TE (TM)] */
182 APPEND_DEVICE(0x014f); /* NV43 [GeForce 6200 (TM)] */
183 APPEND_DEVICE(0x0161); /* NV44 [GeForce 6200 TurboCache (TM)] */
184 APPEND_DEVICE(0x0162); /* NV44 [GeForce 6200SE TurboCache (TM)] */
185 APPEND_DEVICE(0x0163); /* NV44 [GeForce 6200 LE (TM)] */
186 APPEND_DEVICE(0x0164); /* NV44 [GeForce Go 6200 (TM)] */
187 APPEND_DEVICE(0x0167); /* NV43 [GeForce Go 6200/6400 (TM)] */
188 APPEND_DEVICE(0x0168); /* NV43 [GeForce Go 6200/6400 (TM)] */
189 APPEND_DEVICE(0x0169); /* NV44 [GeForce 6250 (TM)] */
190 APPEND_DEVICE(0x0222); /* NV44 [GeForce 6200 A-LE (TM)] */
191 APPEND_DEVICE(0x0240); /* C51PV [GeForce 6150 (TM)] */
192 APPEND_DEVICE(0x0241); /* C51 [GeForce 6150 LE (TM)] */
193 APPEND_DEVICE(0x0244); /* C51 [Geforce Go 6150 (TM)] */
194 APPEND_DEVICE(0x0245); /* C51 [Quadro NVS 210S/GeForce 6150LE (TM)] */
195 APPEND_DEVICE(0x0247); /* C51 [GeForce Go 6100 (TM)] */
196 APPEND_DEVICE(0x03d0); /* C61 [GeForce 6150SE nForce 430 (TM)] */
197 APPEND_DEVICE(0x03d1); /* C61 [GeForce 6100 nForce 405 (TM)] */
198 APPEND_DEVICE(0x03d2); /* C61 [GeForce 6100 nForce 400 (TM)] */
199 APPEND_DEVICE(0x03d5); /* C61 [GeForce 6100 nForce 420 (TM)] */
202 // This list is from the ATIRadeonX1000.kext Info.plist
203 APPEND_DEVICE(0x7187);
204 APPEND_DEVICE(0x7210);
205 APPEND_DEVICE(0x71de);
206 APPEND_DEVICE(0x7146);
207 APPEND_DEVICE(0x7142);
208 APPEND_DEVICE(0x7109);
209 APPEND_DEVICE(0x71c5);
210 APPEND_DEVICE(0x71c0);
211 APPEND_DEVICE(0x7240);
212 APPEND_DEVICE(0x7249);
213 APPEND_DEVICE(0x7291);
216 APPEND_DEVICE(0x0393);
219 APPEND_DEVICE(0x0A70);
222 APPEND_DEVICE(0x0a29);
223 APPEND_DEVICE(0x0a2b);
224 APPEND_DEVICE(0x0a2d);
225 APPEND_DEVICE(0x0a35);
226 APPEND_DEVICE(0x0a6c);
227 APPEND_DEVICE(0x0a70);
228 APPEND_DEVICE(0x0a72);
229 APPEND_DEVICE(0x0a7a);
230 APPEND_DEVICE(0x0caf);
232 APPEND_DEVICE(0x0de3);
233 APPEND_DEVICE(0x0de8);
234 APPEND_DEVICE(0x0de9);
235 APPEND_DEVICE(0x0dea);
236 APPEND_DEVICE(0x0deb);
237 APPEND_DEVICE(0x0dec);
238 APPEND_DEVICE(0x0ded);
239 APPEND_DEVICE(0x0dee);
240 APPEND_DEVICE(0x0def);
241 APPEND_DEVICE(0x0df0);
242 APPEND_DEVICE(0x0df1);
243 APPEND_DEVICE(0x0df2);
244 APPEND_DEVICE(0x0df3);
245 APPEND_DEVICE(0x0df4);
246 APPEND_DEVICE(0x0df5);
247 APPEND_DEVICE(0x0df6);
248 APPEND_DEVICE(0x0df7);
250 case AMDRadeonHD5800
:
251 APPEND_DEVICE(0x6899);
253 // This should never happen, but we get a warning if we don't handle this.
254 case DeviceFamilyMax
:
255 NS_WARNING("Invalid DeviceFamily id");
262 // Macro for assigning a device vendor id to a string.
263 #define DECLARE_VENDOR_ID(name, deviceId) \
265 mDeviceVendors[id]->AssignLiteral(deviceId); \
268 const nsAString
& GfxDriverInfo::GetDeviceVendor(DeviceVendor id
)
270 NS_ASSERTION(id
>= 0 && id
< DeviceVendorMax
, "DeviceVendor id is out of range");
272 if (mDeviceVendors
[id
])
273 return *mDeviceVendors
[id
];
275 mDeviceVendors
[id
] = new nsString();
278 DECLARE_VENDOR_ID(VendorAll
, "");
279 DECLARE_VENDOR_ID(VendorIntel
, "0x8086");
280 DECLARE_VENDOR_ID(VendorNVIDIA
, "0x10de");
281 DECLARE_VENDOR_ID(VendorAMD
, "0x1022");
282 DECLARE_VENDOR_ID(VendorATI
, "0x1002");
283 DECLARE_VENDOR_ID(VendorMicrosoft
, "0x1414");
284 // Suppress a warning.
285 DECLARE_VENDOR_ID(DeviceVendorMax
, "");
288 return *mDeviceVendors
[id
];