1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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/. */
6
7#include "nsISupports.idl"
8
9/* NOTE: this interface is completely undesigned, not stable and likely to change */
10[scriptable, uuid(1accd618-4c80-4703-9d29-ecf257d397c8)]
11interface nsIGfxInfo : nsISupports
12{
13  /*
14   * These are win32-specific
15   */
16  readonly attribute boolean D2DEnabled;
17  readonly attribute boolean DWriteEnabled;
18  readonly attribute DOMString DWriteVersion;
19  readonly attribute DOMString cleartypeParameters;
20
21  /*
22   * These are valid across all platforms.
23   */
24  readonly attribute DOMString ContentBackend;
25
26  // XXX: Switch to a list of devices, rather than explicitly numbering them.
27
28  /**
29   * The name of the display adapter.
30   */
31  readonly attribute DOMString adapterDescription;
32  readonly attribute DOMString adapterDescription2;
33
34  readonly attribute DOMString adapterDriver;
35  readonly attribute DOMString adapterDriver2;
36
37  /* These types are inspired by DXGI_ADAPTER_DESC */
38  readonly attribute DOMString adapterVendorID;
39  readonly attribute DOMString adapterVendorID2;
40
41  readonly attribute DOMString adapterDeviceID;
42  readonly attribute DOMString adapterDeviceID2;
43
44  readonly attribute DOMString adapterSubsysID;
45  readonly attribute DOMString adapterSubsysID2;
46
47  /**
48   * The amount of RAM in MB in the display adapter.
49   */
50  readonly attribute DOMString adapterRAM;
51  readonly attribute DOMString adapterRAM2;
52
53  readonly attribute DOMString adapterDriverVersion;
54  readonly attribute DOMString adapterDriverVersion2;
55
56  readonly attribute DOMString adapterDriverDate;
57  readonly attribute DOMString adapterDriverDate2;
58
59  readonly attribute boolean isGPU2Active;
60
61  /**
62   * Returns an array of objects describing each monitor. Guaranteed properties
63   * are "screenWidth" and "screenHeight". This is only implemented on Desktop.
64   *
65   * Windows additionally supplies "refreshRate" and "pseudoDisplay".
66   *
67   * OS X additionally supplies "scale".
68   */
69  [implicit_jscontext]
70  jsval getMonitors();
71
72  void getFailures(
73               out unsigned long failureCount,
74               [optional, array, size_is(failureCount)] out long indices,
75               [retval, array, size_is(failureCount)] out string failures);
76
77  [noscript, notxpcom] void logFailure(in ACString failure);
78  /*
79   * A set of constants for features that we can ask this GfxInfo object
80   * about via GetFeatureStatus
81   */
82  /* Don't assign any value <= 0 */
83  /* Whether Direct2D is supported for content rendering. */
84  const long FEATURE_DIRECT2D = 1;
85  /* Whether Direct3D 9 is supported for layers. */
86  const long FEATURE_DIRECT3D_9_LAYERS = 2;
87  /* Whether Direct3D 10.0 is supported for layers. */
88  const long FEATURE_DIRECT3D_10_LAYERS = 3;
89  /* Whether Direct3D 10.1 is supported for layers. */
90  const long FEATURE_DIRECT3D_10_1_LAYERS = 4;
91  /* Whether OpenGL is supported for layers */
92  const long FEATURE_OPENGL_LAYERS = 5;
93  /* Whether WebGL is supported via OpenGL. */
94  const long FEATURE_WEBGL_OPENGL = 6;
95  /* Whether WebGL is supported via ANGLE (D3D9 -- does not check for the presence of ANGLE libs). */
96  const long FEATURE_WEBGL_ANGLE = 7;
97  /* Whether WebGL antialiasing is supported. */
98  const long FEATURE_WEBGL_MSAA = 8;
99  /* Whether Stagefright is supported, starting in 17. */
100  const long FEATURE_STAGEFRIGHT = 9;
101  /* Whether Webrtc Hardware acceleration is supported, starting in 31. */
102  const long FEATURE_WEBRTC_HW_ACCELERATION = 10;
103  /* Whether Direct3D 11 is supported for layers, starting in 32. */
104  const long FEATURE_DIRECT3D_11_LAYERS = 11;
105  /* Whether hardware accelerated video decoding is supported, starting in 36. */
106  const long FEATURE_HARDWARE_VIDEO_DECODING = 12;
107  /* Whether Direct3D 11 is supported for ANGLE, starting in 38. */
108  const long FEATURE_DIRECT3D_11_ANGLE = 13;
109  /* Whether Webrtc Hardware acceleration is supported, starting in 42. */
110  const long FEATURE_WEBRTC_HW_ACCELERATION_ENCODE = 14;
111  /* Whether Webrtc Hardware acceleration is supported, starting in 42. */
112  const long FEATURE_WEBRTC_HW_ACCELERATION_DECODE = 15;
113  /* Whether Canvas acceleration is supported, starting in 45 */
114  const long FEATURE_CANVAS2D_ACCELERATION = 16;
115  /* Whether hardware VP8 decoding is supported, starting in 48. */
116  const long FEATURE_VP8_HW_DECODE = 17;
117  /* Whether hardware VP9 decoding is supported, starting in 48. */
118  const long FEATURE_VP9_HW_DECODE = 18;
119  /* Whether NV_dx_interop2 is supported, starting in 50. */
120  const long FEATURE_DX_INTEROP2 = 19;
121
122  /*
123   * A set of return values from GetFeatureStatus
124   */
125
126  /* The driver is safe to the best of our knowledge */
127  const long FEATURE_STATUS_OK = 1;
128  /* We don't know the status of the feature yet. The analysis probably hasn't finished yet. */
129  const long FEATURE_STATUS_UNKNOWN = 2;
130  /* This feature is blocked on this driver version. Updating driver will typically unblock it. */
131  const long FEATURE_BLOCKED_DRIVER_VERSION = 3;
132  /* This feature is blocked on this device, regardless of driver version.
133   * Typically means we hit too many driver crashes without a good reason to hope for them to
134   * get fixed soon. */
135  const long FEATURE_BLOCKED_DEVICE = 4;
136  /* This feature is available and can be used, but is not suggested (e.g. shouldn't be used by default */
137  const long FEATURE_DISCOURAGED = 5;
138  /* This feature is blocked on this OS version. */
139  const long FEATURE_BLOCKED_OS_VERSION = 6;
140  /* This feature is blocked because of mismatched driver versions. */
141  const long FEATURE_BLOCKED_MISMATCHED_VERSION = 7;
142
143  /**
144   * Ask about a feature, and return the status of that feature.
145   * If the feature is not ok then aFailureId will give a unique failure Id
146   * otherwise it will be empty.
147   */
148  long getFeatureStatus(in long aFeature, [optional] out ACString aFailureId);
149
150  /*
151   * Ask about a feature, return the minimum driver version required for it if its status is
152   * FEATURE_BLOCKED_DRIVER_VERSION, otherwise return an empty string.
153   */
154  DOMString getFeatureSuggestedDriverVersion(in long aFeature);
155
156  /**
157   * WebGL info; valid params are "full-renderer", "vendor", "renderer", "version",
158   * "shading_language_version", "extensions".  These return info from
159   * underlying GL impl that's used to implement WebGL.
160   */
161  DOMString getWebGLParameter(in DOMString aParam);
162
163  // only useful on X11
164  [noscript, notxpcom] void GetData();
165
166  [implicit_jscontext]
167  jsval getInfo();
168
169  // Return an object describing all features that have been configured:
170  //
171  //   "features": [
172  //     // For each feature:
173  //     {
174  //       "name": <string>,
175  //       "description": <string>,
176  //       "status": <string>,
177  //       "log": [
178  //          // One or more log entries, the first denotes the default value.
179  //          {
180  //            "type": <string>,    // "base", "user", "env", or "runtime"
181  //            "status": <string>,
182  //            "message": <string>  // Set unless type is "base" and status is "available".
183  //          }
184  //       ]
185  //     }
186  //   ]
187  //   "fallbacks": [
188  //     // For each workaround:
189  //     {
190  //       "name:" <string>,
191  //       "description": <string>,
192  //       "message": <string>
193  //     ]
194  //   }
195  //
196  // When a message is prefixed with a '#', it is a special status code. Status
197  // codes are unique identifiers that can be searched in the codebase to find
198  // which line of code caused the message. Some codes are standardized to
199  // improve about:support messaging:
200  //
201  //   "[CONTEXT_]FEATURE_FAILURE_BUG_<number>"
202  //     CONTEXT is optional and can currently only be "BLOCKLIST".
203  //     <number> refers to a bug number in Bugzilla.
204  //
205  [implicit_jscontext]
206  jsval getFeatureLog();
207
208  // Returns an object containing information about graphics features. It is
209  // intended to be directly included into the Telemetry environment.
210  //
211  //   "layers":
212  //   {
213  //     "compositor": "d3d9", "d3d11", "opengl", "basic", or "none"
214  //                   // ("none" indicates no compositors have been created)
215  //     // Feature is one of "d3d9", "d3d11", "opengl", "basic", or "d2d".
216  //     "<feature>": {
217  //       // Each backend can have one of the following statuses:
218  //       //   "unused"      - This feature has not been requested.
219  //       //   "unavailable" - OS version or restriction prevents use.
220  //       //   "blocked"     - An internal condition (such as safe mode) prevents use.
221  //       //   "blacklisted" - Blocked due to a blacklist restriction.
222  //       //   "disabled"    - User explicitly disabled this default feature.
223  //       //   "failed"      - Feature failed to initialize.
224  //       //   "available"   - User has this feature available by default.
225  //       "status": "<status>",
226  //       "version": "<version>",
227  //       "warp": true|false,           // D3D11 only.
228  //       "textureSharing": true|false, // D3D11 only.
229  //     }
230  //   }
231  [implicit_jscontext]
232  jsval getFeatures();
233
234  // Returns an array listing any active crash guards.
235  //
236  //   [
237  //     {
238  //       // Type is one of "d3d11layers", "d3d9video", "glcontext",
239  //       // or "d3d11video".
240  //       "type":        "<identifier>",
241  //
242  //       // Preference that must be deleted/reset to retrigger the guard.
243  //       "prefName":    "<preference>",
244  //     }
245  //   ]
246  [implicit_jscontext]
247  jsval getActiveCrashGuards();
248};
249
250