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/. */
5
6 #include "GfxInfo.h"
7 #include "nsServiceManagerUtils.h"
8
9 namespace mozilla {
10 namespace widget {
11
12 #ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo,GfxInfoBase,nsIGfxInfoDebug)13 NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
14 #endif
15
16 GfxInfo::GfxInfo() {}
17
~GfxInfo()18 GfxInfo::~GfxInfo() {}
19
GetD2DEnabled(bool * aEnabled)20 nsresult GfxInfo::GetD2DEnabled(bool* aEnabled) { return NS_ERROR_FAILURE; }
21
GetDWriteEnabled(bool * aEnabled)22 nsresult GfxInfo::GetDWriteEnabled(bool* aEnabled) { return NS_ERROR_FAILURE; }
23
24 NS_IMETHODIMP
GetDWriteVersion(nsAString & aDwriteVersion)25 GfxInfo::GetDWriteVersion(nsAString& aDwriteVersion) {
26 return NS_ERROR_FAILURE;
27 }
28
29 NS_IMETHODIMP
GetCleartypeParameters(nsAString & aCleartypeParams)30 GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
31 return NS_ERROR_FAILURE;
32 }
33
34 NS_IMETHODIMP
GetAdapterDescription(nsAString & aAdapterDescription)35 GfxInfo::GetAdapterDescription(nsAString& aAdapterDescription) {
36 return NS_ERROR_FAILURE;
37 }
38
39 NS_IMETHODIMP
GetAdapterDescription2(nsAString & aAdapterDescription)40 GfxInfo::GetAdapterDescription2(nsAString& aAdapterDescription) {
41 return NS_ERROR_FAILURE;
42 }
43
44 NS_IMETHODIMP
GetAdapterRAM(nsAString & aAdapterRAM)45 GfxInfo::GetAdapterRAM(nsAString& aAdapterRAM) { return NS_ERROR_FAILURE; }
46
47 NS_IMETHODIMP
GetAdapterRAM2(nsAString & aAdapterRAM)48 GfxInfo::GetAdapterRAM2(nsAString& aAdapterRAM) { return NS_ERROR_FAILURE; }
49
50 NS_IMETHODIMP
GetAdapterDriver(nsAString & aAdapterDriver)51 GfxInfo::GetAdapterDriver(nsAString& aAdapterDriver) {
52 return NS_ERROR_FAILURE;
53 }
54
55 NS_IMETHODIMP
GetAdapterDriver2(nsAString & aAdapterDriver)56 GfxInfo::GetAdapterDriver2(nsAString& aAdapterDriver) {
57 return NS_ERROR_FAILURE;
58 }
59
60 NS_IMETHODIMP
GetAdapterDriverVersion(nsAString & aAdapterDriverVersion)61 GfxInfo::GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) {
62 return NS_ERROR_FAILURE;
63 }
64
65 NS_IMETHODIMP
GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion)66 GfxInfo::GetAdapterDriverVersion2(nsAString& aAdapterDriverVersion) {
67 return NS_ERROR_FAILURE;
68 }
69
70 NS_IMETHODIMP
GetAdapterDriverDate(nsAString & aAdapterDriverDate)71 GfxInfo::GetAdapterDriverDate(nsAString& aAdapterDriverDate) {
72 return NS_ERROR_FAILURE;
73 }
74
75 NS_IMETHODIMP
GetAdapterDriverDate2(nsAString & aAdapterDriverDate)76 GfxInfo::GetAdapterDriverDate2(nsAString& aAdapterDriverDate) {
77 return NS_ERROR_FAILURE;
78 }
79
80 NS_IMETHODIMP
GetAdapterVendorID(nsAString & aAdapterVendorID)81 GfxInfo::GetAdapterVendorID(nsAString& aAdapterVendorID) {
82 return NS_ERROR_FAILURE;
83 }
84
85 NS_IMETHODIMP
GetAdapterVendorID2(nsAString & aAdapterVendorID)86 GfxInfo::GetAdapterVendorID2(nsAString& aAdapterVendorID) {
87 return NS_ERROR_FAILURE;
88 }
89
90 NS_IMETHODIMP
GetAdapterDeviceID(nsAString & aAdapterDeviceID)91 GfxInfo::GetAdapterDeviceID(nsAString& aAdapterDeviceID) {
92 return NS_ERROR_FAILURE;
93 return NS_OK;
94 }
95
96 NS_IMETHODIMP
GetAdapterDeviceID2(nsAString & aAdapterDeviceID)97 GfxInfo::GetAdapterDeviceID2(nsAString& aAdapterDeviceID) {
98 return NS_ERROR_FAILURE;
99 }
100
101 NS_IMETHODIMP
GetAdapterSubsysID(nsAString & aAdapterSubsysID)102 GfxInfo::GetAdapterSubsysID(nsAString& aAdapterSubsysID) {
103 return NS_ERROR_FAILURE;
104 }
105
106 NS_IMETHODIMP
GetAdapterSubsysID2(nsAString & aAdapterSubsysID)107 GfxInfo::GetAdapterSubsysID2(nsAString& aAdapterSubsysID) {
108 return NS_ERROR_FAILURE;
109 }
110
111 NS_IMETHODIMP
GetIsGPU2Active(bool * aIsGPU2Active)112 GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active) { return NS_ERROR_FAILURE; }
113
GetGfxDriverInfo()114 const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
115 if (mDriverInfo->IsEmpty()) {
116 APPEND_TO_DRIVER_BLOCKLIST2(
117 OperatingSystem::Ios,
118 (nsAString&)GfxDriverInfo::GetDeviceVendor(VendorAll),
119 GfxDriverInfo::allDevices, nsIGfxInfo::FEATURE_OPENGL_LAYERS,
120 nsIGfxInfo::FEATURE_STATUS_OK, DRIVER_COMPARISON_IGNORED,
121 GfxDriverInfo::allDriverVersions);
122 }
123
124 return *mDriverInfo;
125 }
126
GetFeatureStatusImpl(int32_t aFeature,int32_t * aStatus,nsAString & aSuggestedDriverVersion,const nsTArray<GfxDriverInfo> & aDriverInfo,OperatingSystem * aOS)127 nsresult GfxInfo::GetFeatureStatusImpl(
128 int32_t aFeature, int32_t* aStatus, nsAString& aSuggestedDriverVersion,
129 const nsTArray<GfxDriverInfo>& aDriverInfo,
130 OperatingSystem* aOS /* = nullptr */) {
131 NS_ENSURE_ARG_POINTER(aStatus);
132 aSuggestedDriverVersion.SetIsVoid(true);
133 *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
134 if (aOS) *aOS = OperatingSystem::Ios;
135
136 if (mShutdownOccurred) {
137 return NS_OK;
138 }
139
140 // OpenGL layers are never blacklisted on iOS.
141 // This early return is so we avoid potentially slow
142 // GLStrings initialization on startup when we initialize GL layers.
143 if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS ||
144 aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL ||
145 aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {
146 *aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
147 return NS_OK;
148 }
149
150 return GfxInfoBase::GetFeatureStatusImpl(
151 aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aOS);
152 }
153
154 #ifdef DEBUG
155
156 // Implement nsIGfxInfoDebug
157
SpoofVendorID(const nsAString & aVendorID)158 NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString& aVendorID) {
159 return NS_ERROR_FAILURE;
160 }
161
SpoofDeviceID(const nsAString & aDeviceID)162 NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString& aDeviceID) {
163 return NS_ERROR_FAILURE;
164 }
165
SpoofDriverVersion(const nsAString & aDriverVersion)166 NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString& aDriverVersion) {
167 return NS_ERROR_FAILURE;
168 }
169
SpoofOSVersion(uint32_t aVersion)170 NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion) {
171 return NS_ERROR_FAILURE;
172 }
173
174 #endif
175 }
176 } // namespace mozilla
177