Bug 1852149 Part 1 - Add margin-rule pref r=firefox-style-system-reviewers,emilio
[gecko.git] / widget / nsIGfxInfo.idl
blob2bf6351611c22069f6aa2ccc6584320e10a7b51b
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 hasBattery;
23 readonly attribute AString DWriteVersion;
24 readonly attribute AString cleartypeParameters;
27 * These are non-Android linux-specific
29 readonly attribute AString windowProtocol;
30 readonly attribute AString testType;
33 * These are valid across all platforms.
35 readonly attribute AString ContentBackend;
36 readonly attribute boolean isHeadless;
37 readonly attribute unsigned long TargetFrameRate;
38 readonly attribute ACString CodecSupportInfo;
40 // XXX: Switch to a list of devices, rather than explicitly numbering them.
42 /**
43 * The name of the display adapter.
45 readonly attribute AString adapterDescription;
46 readonly attribute AString adapterDescription2;
48 readonly attribute AString adapterDriver;
49 readonly attribute AString adapterDriver2;
51 /* These types are inspired by DXGI_ADAPTER_DESC */
52 readonly attribute AString adapterVendorID;
53 readonly attribute AString adapterVendorID2;
55 readonly attribute AString adapterDeviceID;
56 readonly attribute AString adapterDeviceID2;
58 readonly attribute AString adapterSubsysID;
59 readonly attribute AString adapterSubsysID2;
61 /**
62 * The amount of RAM in MB in the display adapter.
64 readonly attribute unsigned long adapterRAM;
65 readonly attribute unsigned long adapterRAM2;
67 readonly attribute AString adapterDriverVendor;
68 readonly attribute AString adapterDriverVendor2;
70 readonly attribute AString adapterDriverVersion;
71 readonly attribute AString adapterDriverVersion2;
73 readonly attribute AString adapterDriverDate;
74 readonly attribute AString adapterDriverDate2;
76 readonly attribute boolean isGPU2Active;
78 readonly attribute ACString drmRenderDevice;
80 /**
81 * Returns an array of objects describing each monitor. Guaranteed properties
82 * are "screenWidth" and "screenHeight". This is only implemented on Desktop.
84 * Windows additionally supplies "refreshRate" and "pseudoDisplay".
86 * OS X additionally supplies "scale".
88 [implicit_jscontext]
89 jsval getMonitors();
91 Array<ACString> getFailures(out Array<long> indices);
93 [noscript, notxpcom] void logFailure(in ACString failure);
95 * A set of constants for features that we can ask this GfxInfo object
96 * about via GetFeatureStatus
98 /* Don't assign any value <= 0 */
99 /* Values must be contiguous */
100 /* Whether Direct2D is supported for content rendering. */
101 const long FEATURE_DIRECT2D = 1;
102 /* Whether Direct3D 9 is supported for layers. */
103 const long FEATURE_DIRECT3D_9_LAYERS = 2;
104 /* Whether Direct3D 10.0 is supported for layers. */
105 const long FEATURE_DIRECT3D_10_LAYERS = 3;
106 /* Whether Direct3D 10.1 is supported for layers. */
107 const long FEATURE_DIRECT3D_10_1_LAYERS = 4;
108 /* Whether OpenGL is supported for layers */
109 const long FEATURE_OPENGL_LAYERS = 5;
110 /* Whether WebGL is supported via OpenGL. */
111 const long FEATURE_WEBGL_OPENGL = 6;
112 /* Whether WebGL is supported via ANGLE (D3D9 -- does not check for the presence of ANGLE libs). */
113 const long FEATURE_WEBGL_ANGLE = 7;
114 /* (Unused) Whether WebGL antialiasing is supported. */
115 const long UNUSED_FEATURE_WEBGL_MSAA = 8;
116 /* Whether Stagefright is supported, starting in 17. */
117 const long FEATURE_STAGEFRIGHT = 9;
118 /* Whether Webrtc Hardware H.264 acceleration is supported, starting in 71. */
119 const long FEATURE_WEBRTC_HW_ACCELERATION_H264 = 10;
120 /* Whether Direct3D 11 is supported for layers, starting in 32. */
121 const long FEATURE_DIRECT3D_11_LAYERS = 11;
122 /* Whether hardware accelerated video decoding is supported, starting in 36. */
123 const long FEATURE_HARDWARE_VIDEO_DECODING = 12;
124 /* Whether Direct3D 11 is supported for ANGLE, starting in 38. */
125 const long FEATURE_DIRECT3D_11_ANGLE = 13;
126 /* Whether Webrtc Hardware acceleration is supported, starting in 42. */
127 const long FEATURE_WEBRTC_HW_ACCELERATION_ENCODE = 14;
128 /* Whether Webrtc Hardware acceleration is supported, starting in 42. */
129 const long FEATURE_WEBRTC_HW_ACCELERATION_DECODE = 15;
130 /* Whether Canvas acceleration is supported, starting in 45 */
131 const long FEATURE_CANVAS2D_ACCELERATION = 16;
132 /* Whether hardware VP8 decoding is supported, starting in 48; not for downloadable blocking. */
133 const long FEATURE_VP8_HW_DECODE = 17;
134 /* Whether hardware VP9 decoding is supported, starting in 48; not for downloadable blocking. */
135 const long FEATURE_VP9_HW_DECODE = 18;
136 /* Whether NV_dx_interop2 is supported, starting in 50; downloadable blocking in 58. */
137 const long FEATURE_DX_INTEROP2 = 19;
138 /* Whether the GPU process is supported, starting in 52; downloadable blocking in 58. */
139 const long FEATURE_GPU_PROCESS = 20;
140 /* Whether the WebGL2 is supported, starting in 54 */
141 const long FEATURE_WEBGL2 = 21;
142 /* Whether D3D11 keyed mutex is supported, starting in 56 */
143 const long FEATURE_D3D11_KEYED_MUTEX = 22;
144 /* Whether WebRender is supported, starting in 62 */
145 const long FEATURE_WEBRENDER = 23;
146 /* Whether WebRender is supported, starting in 62 */
147 const long FEATURE_DX_NV12 = 24;
148 const long FEATURE_DX_P010 = 25;
149 const long FEATURE_DX_P016 = 26;
150 /* Whether OpenGL swizzle configuration of texture units is supported, starting in 70 */
151 const long FEATURE_GL_SWIZZLE = 27;
152 /* Whether WebRender native compositor is supported, starting in 73 */
153 const long FEATURE_WEBRENDER_COMPOSITOR = 28;
154 /* Whether WebRender can use scissored clears for cached surfaces, staring in 79 */
155 const long FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS = 29;
156 /* Support webgl.out-of-process: true (starting in 83) */
157 const long FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS = 30;
158 /* Is OpenGL threadsafe (starting in 83) */
159 const long FEATURE_THREADSAFE_GL = 31;
160 /* Whether webrender uses pre-optimized shaders, starting in 87. */
161 const long FEATURE_WEBRENDER_OPTIMIZED_SHADERS = 32;
162 /* Whether we prefer EGL over GLX with X11, starting in 88. */
163 const long FEATURE_X11_EGL = 33;
164 /* Whether DMABUF is supported, starting in 88. */
165 const long FEATURE_DMABUF = 34;
166 /* Whether webrender caches shader program binaries to disk, starting in 89. */
167 const long FEATURE_WEBRENDER_SHADER_CACHE = 35;
168 /* Whether partial present is allowed with WebRender, starting in 98. */
169 const long FEATURE_WEBRENDER_PARTIAL_PRESENT = 36;
170 /* Whether WebGPU is supported, starting in 100. */
171 const long FEATURE_WEBGPU = 37;
172 /* Whether video overlay of hardware decoded video is supported, starting in 100. */
173 const long FEATURE_VIDEO_OVERLAY = 38;
174 /* Whether hardware decoded video zero copy is supported, starting in 101. */
175 const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 39;
176 /* Whether DMABUF export is supported, starting in 103. */
177 const long FEATURE_DMABUF_SURFACE_EXPORT = 40;
178 /* Whether reuse decoder device is supported, starting in 104. */
179 const long FEATURE_REUSE_DECODER_DEVICE = 41;
180 /* Whether to allow backdrop filter, starting in 105. */
181 const long FEATURE_BACKDROP_FILTER = 42;
182 /* Whether to use Accelerated Canvas2D, starting in 110. */
183 const long FEATURE_ACCELERATED_CANVAS2D = 43;
184 /* Whether hardware H264 decoding is supported, starting in 114; not for downloadable blocking. */
185 const long FEATURE_H264_HW_DECODE = 44;
186 /* Whether hardware AV1 decoding is supported, starting in 114; not for downloadable blocking. */
187 const long FEATURE_AV1_HW_DECODE = 45;
188 /* Whether video overlay of software decoded video is supported, starting in 116. */
189 const long FEATURE_VIDEO_SOFTWARE_OVERLAY = 46;
190 /* Whether WebGL is allowed to use hardware rendering, otherwise software fallbacks. */
191 const long FEATURE_WEBGL_USE_HARDWARE = 47;
192 /* the maximum feature value. */
193 const long FEATURE_MAX_VALUE = FEATURE_WEBGL_USE_HARDWARE;
196 * A set of return values from GetFeatureStatus
199 /* The driver is safe to the best of our knowledge */
200 const long FEATURE_STATUS_OK = 1;
201 /* We don't know the status of the feature yet. The analysis probably hasn't finished yet. */
202 const long FEATURE_STATUS_UNKNOWN = 2;
203 /* This feature is blocked on this driver version. Updating driver will typically unblock it. */
204 const long FEATURE_BLOCKED_DRIVER_VERSION = 3;
205 /* This feature is blocked on this device, regardless of driver version.
206 * Typically means we hit too many driver crashes without a good reason to hope for them to
207 * get fixed soon. */
208 const long FEATURE_BLOCKED_DEVICE = 4;
209 /* This feature is available and can be used, but is not suggested (e.g. shouldn't be used by default */
210 const long FEATURE_DISCOURAGED = 5;
211 /* This feature is blocked on this OS version. */
212 const long FEATURE_BLOCKED_OS_VERSION = 6;
213 /* This feature is blocked because of mismatched driver versions. */
214 const long FEATURE_BLOCKED_MISMATCHED_VERSION = 7;
215 /* This feature is blocked due to not being on the allowlist. */
216 const long FEATURE_DENIED = 8;
217 /* This feature is safe to be on this device due to the allowlist. */
218 const long FEATURE_ALLOW_ALWAYS = 9;
219 /* This feature is safe to be on this device due to the allowlist, depending on qualified/experiment status. */
220 const long FEATURE_ALLOW_QUALIFIED = 10;
221 /* This feature failed in a startup test, e.g. due to a crashing driver. */
222 const long FEATURE_BLOCKED_PLATFORM_TEST = 11;
225 * Ask about a feature, and return the status of that feature.
226 * If the feature is not ok then aFailureId will give a unique failure Id
227 * otherwise it will be empty.
229 long getFeatureStatus(in long aFeature, [optional] out ACString aFailureId);
232 * Ask about a feature, return the minimum driver version required for it if its status is
233 * FEATURE_BLOCKED_DRIVER_VERSION, otherwise return an empty string.
235 AString getFeatureSuggestedDriverVersion(in long aFeature);
237 // only useful on X11
238 [noscript, notxpcom] void GetData();
241 * Maximum refresh rate among detected monitors. -1 if unknown. aMixed is set
242 * to true if we know there are multiple displays and they have different
243 * refresh rates, else false. The returned value is in Hz.
245 [noscript, notxpcom] long GetMaxRefreshRate(out boolean aMixed);
247 [implicit_jscontext]
248 jsval getInfo();
250 // Return an object describing all features that have been configured:
252 // "features": [
253 // // For each feature:
254 // {
255 // "name": <string>,
256 // "description": <string>,
257 // "status": <string>,
258 // "log": [
259 // // One or more log entries, the first denotes the default value.
260 // {
261 // "type": <string>, // "base", "user", "env", or "runtime"
262 // "status": <string>,
263 // "message": <string> // Set unless type is "base" and status is "available".
264 // }
265 // ]
266 // }
267 // ]
268 // "fallbacks": [
269 // // For each workaround:
270 // {
271 // "name:" <string>,
272 // "description": <string>,
273 // "message": <string>
274 // ]
275 // }
277 // When a message is prefixed with a '#', it is a special status code. Status
278 // codes are unique identifiers that can be searched in the codebase to find
279 // which line of code caused the message. Some codes are standardized to
280 // improve about:support messaging:
282 // "[CONTEXT_]FEATURE_FAILURE_BUG_<number>"
283 // CONTEXT is optional and can currently only be "BLOCKLIST".
284 // <number> refers to a bug number in Bugzilla.
286 [implicit_jscontext]
287 jsval getFeatureLog();
289 // Returns an object containing information about graphics features. It is
290 // intended to be directly included into the Telemetry environment.
292 // "layers":
293 // {
294 // "compositor": "d3d9", "d3d11", "opengl", "basic", or "none"
295 // // ("none" indicates no compositors have been created)
296 // // Feature is one of "d3d9", "d3d11", "opengl", "basic", or "d2d".
297 // "<feature>": {
298 // // Each backend can have one of the following statuses:
299 // // "unused" - This feature has not been requested.
300 // // "unavailable" - OS version or restriction prevents use.
301 // // "blocked" - An internal condition (such as safe mode) prevents use.
302 // // "blocklisted" - Blocked due to a blocklist restriction.
303 // // "denied" - Blocked due to allowlist restrictions.
304 // // "disabled" - User explicitly disabled this default feature.
305 // // "failed" - Feature failed to initialize.
306 // // "available" - User has this feature available by default.
307 // "status": "<status>",
308 // "version": "<version>",
309 // "warp": true|false, // D3D11 only.
310 // "textureSharing": true|false, // D3D11 only.
311 // }
312 // }
313 [implicit_jscontext]
314 jsval getFeatures();
316 // Returns an array listing any active crash guards.
318 // [
319 // {
320 // // Type is one of "d3d11layers", or "glcontext".
321 // "type": "<identifier>",
323 // // Preference that must be deleted/reset to retrigger the guard.
324 // "prefName": "<preference>",
325 // }
326 // ]
327 [implicit_jscontext]
328 jsval getActiveCrashGuards();
330 // Forces the GPU process to start or shutdown. This is intended only for
331 // xpcshell-tests.
332 boolean controlGPUProcessForXPCShell(in boolean aEnable);
334 // Kills the GPU process cleanly, without generating a crash dump.
335 // This is intended only for use by tests.
336 void killGPUProcessForTests();
338 // Causes the GPU process to crash. This is intended only for use by tests.
339 void crashGPUProcessForTests();