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