Bug 1942006 - Upstream a variety of Servo-specific code from Servo's downstream fork...
[gecko.git] / widget / nsIGfxInfo.idl
blobe9f7ed9df0233e6bc13ed3f3e743c7292a3735b2
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 /* NOTE: this interface is completely undesigned, not stable and likely to change */
10 [scriptable, builtinclass, uuid(1accd618-4c80-4703-9d29-ecf257d397c8)]
11 interface nsIGfxInfo : nsISupports
14 * These are win32-specific
16 readonly attribute boolean D2DEnabled;
17 readonly attribute boolean DWriteEnabled;
18 readonly attribute boolean EmbeddedInFirefoxReality;
19 readonly attribute AString AzureCanvasBackend;
20 readonly attribute AString AzureContentBackend;
21 readonly attribute boolean usingGPUProcess;
22 readonly attribute boolean usingRemoteCanvas;
23 readonly attribute boolean usingAcceleratedCanvas;
24 readonly attribute boolean hasBattery;
25 readonly attribute AString DWriteVersion;
26 readonly attribute AString cleartypeParameters;
27 readonly attribute float textScaleFactor;
30 * These are non-Android linux-specific
32 readonly attribute AString windowProtocol;
33 readonly attribute AString testType;
36 * These are valid across all platforms.
38 readonly attribute AString ContentBackend;
39 readonly attribute boolean isHeadless;
40 readonly attribute unsigned long TargetFrameRate;
41 readonly attribute ACString CodecSupportInfo;
43 // XXX: Switch to a list of devices, rather than explicitly numbering them.
45 // Present on all platforms, but only useful on Android
46 cenum FontVisibilityDeviceDetermination : 8 {
47 Unassigned = 0,
48 Unknown_Platform = 1,
49 Windows_Platform = 2,
50 MacOS_Unknown = 3,
51 Android_Unknown_Release_Version = 4,
52 Android_Unknown_Peloton = 5,
53 Android_Unknown_vbox = 6,
54 Android_Unknown_mitv = 7,
55 Android_Chromebook = 8,
56 Android_Amazon = 9,
57 Android_sub_9 = 10,
58 Android_9_11 = 11,
59 Android_12_plus = 12,
60 Linux_Unknown = 13,
61 Linux_Ubuntu_any = 14,
62 Linux_Ubuntu_20 = 15,
63 Linux_Ubuntu_22 = 16,
64 Linux_Fedora_any = 17,
65 Linux_Fedora_38 = 18,
66 Linux_Fedora_39 = 19,
67 MacOS_13_plus = 20,
68 MacOS_sub_13 = 21
70 readonly attribute nsIGfxInfo_FontVisibilityDeviceDetermination fontVisibilityDetermination;
71 readonly attribute AString fontVisibilityDeterminationStr;
73 /**
74 * The name of the display adapter.
76 readonly attribute AString adapterDescription;
77 readonly attribute AString adapterDescription2;
79 readonly attribute AString adapterDriver;
80 readonly attribute AString adapterDriver2;
82 /* These types are inspired by DXGI_ADAPTER_DESC */
83 readonly attribute AString adapterVendorID;
84 readonly attribute AString adapterVendorID2;
86 readonly attribute AString adapterDeviceID;
87 readonly attribute AString adapterDeviceID2;
89 readonly attribute AString adapterSubsysID;
90 readonly attribute AString adapterSubsysID2;
92 /**
93 * The amount of RAM in MB in the display adapter.
95 readonly attribute unsigned long adapterRAM;
96 readonly attribute unsigned long adapterRAM2;
98 readonly attribute AString adapterDriverVendor;
99 readonly attribute AString adapterDriverVendor2;
101 readonly attribute AString adapterDriverVersion;
102 readonly attribute AString adapterDriverVersion2;
104 readonly attribute AString adapterDriverDate;
105 readonly attribute AString adapterDriverDate2;
107 readonly attribute boolean isGPU2Active;
109 readonly attribute ACString drmRenderDevice;
112 * Returns an array of objects describing each monitor. Guaranteed properties
113 * are "screenWidth" and "screenHeight". This is only implemented on Desktop.
115 * Windows additionally supplies "refreshRate" and "pseudoDisplay".
117 * OS X additionally supplies "scale".
119 [implicit_jscontext]
120 jsval getMonitors();
122 Array<ACString> getFailures(out Array<long> indices);
124 [noscript, notxpcom] void logFailure(in ACString failure);
126 %{C++
128 * A set of constants for features that we can ask this GfxInfo object
129 * about via GetFeatureStatus
131 enum FeatureType : uint8_t {
132 FEATURE_INVALID = 0,
133 #define GFXINFO_FEATURE(id, name, pref) FEATURE_##id,
134 #include "mozilla/widget/GfxInfoFeatureDefs.h"
135 #undef GFXINFO_FEATURE
136 FEATURE_COUNT,
137 /* This must be the first value after INVALID/ALL/OPTIONAL. */
138 FEATURE_START = FEATURE_DIRECT2D
142 * A set of return values from GetFeatureStatus
144 enum FeatureStatusType : uint8_t {
145 FEATURE_STATUS_INVALID = 0,
146 #define GFXINFO_FEATURE_STATUS(id) FEATURE_##id,
147 #include "mozilla/widget/GfxInfoFeatureStatusDefs.h"
148 #undef GFXINFO_FEATURE_STATUS
153 * Ask about a feature, and return the status of that feature.
154 * If the feature is not ok then aFailureId will give a unique failure Id
155 * otherwise it will be empty.
157 long getFeatureStatus(in long aFeature, [optional] out ACString aFailureId);
158 AString getFeatureStatusStr(in AString aFeature, [optional] out ACString aFailureId);
161 * Ask about a feature, return the minimum driver version required for it if its status is
162 * FEATURE_BLOCKED_DRIVER_VERSION, otherwise return an empty string.
164 AString getFeatureSuggestedDriverVersion(in long aFeature);
165 AString getFeatureSuggestedDriverVersionStr(in AString aFeature);
167 // only useful on X11
168 [noscript, notxpcom] void GetData();
171 * Maximum refresh rate among detected monitors. -1 if unknown. aMixed is set
172 * to true if we know there are multiple displays and they have different
173 * refresh rates, else false. The returned value is in Hz.
175 [noscript, notxpcom] long GetMaxRefreshRate(out boolean aMixed);
177 [implicit_jscontext]
178 jsval getInfo();
180 // Return an object describing all features that have been configured:
182 // "features": [
183 // // For each feature:
184 // {
185 // "name": <string>,
186 // "description": <string>,
187 // "status": <string>,
188 // "log": [
189 // // One or more log entries, the first denotes the default value.
190 // {
191 // "type": <string>, // "base", "user", "env", or "runtime"
192 // "status": <string>,
193 // "message": <string> // Set unless type is "base" and status is "available".
194 // }
195 // ]
196 // }
197 // ]
198 // "fallbacks": [
199 // // For each workaround:
200 // {
201 // "name:" <string>,
202 // "description": <string>,
203 // "message": <string>
204 // ]
205 // }
207 // When a message is prefixed with a '#', it is a special status code. Status
208 // codes are unique identifiers that can be searched in the codebase to find
209 // which line of code caused the message. Some codes are standardized to
210 // improve about:support messaging:
212 // "[CONTEXT_]FEATURE_FAILURE_BUG_<number>"
213 // CONTEXT is optional and can currently only be "BLOCKLIST".
214 // <number> refers to a bug number in Bugzilla.
216 [implicit_jscontext]
217 jsval getFeatureLog();
219 // Returns an object containing information about graphics features. It is
220 // intended to be directly included into the Telemetry environment.
222 // "layers":
223 // {
224 // "compositor": "d3d9", "d3d11", "opengl", "basic", or "none"
225 // // ("none" indicates no compositors have been created)
226 // // Feature is one of "d3d9", "d3d11", "opengl", "basic", or "d2d".
227 // "<feature>": {
228 // // Each backend can have one of the following statuses:
229 // // "unused" - This feature has not been requested.
230 // // "unavailable" - OS version or restriction prevents use.
231 // // "blocked" - An internal condition (such as safe mode) prevents use.
232 // // "blocklisted" - Blocked due to a blocklist restriction.
233 // // "denied" - Blocked due to allowlist restrictions.
234 // // "disabled" - User explicitly disabled this default feature.
235 // // "failed" - Feature failed to initialize.
236 // // "available" - User has this feature available by default.
237 // "status": "<status>",
238 // "version": "<version>",
239 // "warp": true|false, // D3D11 only.
240 // "textureSharing": true|false, // D3D11 only.
241 // }
242 // }
243 [implicit_jscontext]
244 jsval getFeatures();
246 // Returns an array listing any active crash guards.
248 // [
249 // {
250 // // Type is one of "d3d11layers", or "glcontext".
251 // "type": "<identifier>",
253 // // Preference that must be deleted/reset to retrigger the guard.
254 // "prefName": "<preference>",
255 // }
256 // ]
257 [implicit_jscontext]
258 jsval getActiveCrashGuards();
260 // Forces the GPU process to start or shutdown. This is intended only for
261 // xpcshell-tests.
262 boolean controlGPUProcessForXPCShell(in boolean aEnable);
264 // Kills the GPU process cleanly, without generating a crash dump.
265 // This is intended only for use by tests.
266 void killGPUProcessForTests();
268 // Causes the GPU process to crash. This is intended only for use by tests.
269 void crashGPUProcessForTests();