webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
gpu_info.h
Go to the documentation of this file.
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef GPU_CONFIG_GPU_INFO_H_
6 #define GPU_CONFIG_GPU_INFO_H_
7 
8 // Provides access to the GPU information for the system
9 // on which chrome is currently running.
10 
11 #include <string>
12 #include <vector>
13 
14 #include "angle_config.h"
15 
16 namespace gpu {
17 
18 // Result for the various Collect*Info* functions below.
19 // Fatal failures are for cases where we can't create a context at all or
20 // something, making the use of the GPU impossible.
21 // Non-fatal failures are for cases where we could gather most info, but maybe
22 // some is missing (e.g. unable to parse a version string or to detect the exact
23 // model).
29 };
30 
31 // Video profile. This *must* match media::VideoCodecProfile.
49 };
50 
53  GPUDevice();
54  ~GPUDevice();
55 
56  // The DWORD (uint32) representing the graphics card vendor id.
58 
59  // The DWORD (uint32) representing the graphics card device id.
60  // Device ids are unique to vendor, not to one another.
62 
63  // Whether this GPU is the currently used one.
64  // Currently this field is only supported and meaningful on OS X.
65  bool active;
66 
67  // The strings that describe the GPU.
68  // In Linux these strings are obtained through libpci.
69  // In Win/MacOSX, these two strings are not filled at the moment.
70  // In Android, these are respectively GL_VENDOR and GL_RENDERER.
73  };
74 
75  GPUInfo();
76  ~GPUInfo();
77 
79  return !can_lose_context && !software_rendering;
80  }
81 
82  // Computer has NVIDIA Optimus
83  bool optimus;
84 
85  // Computer has AMD Dynamic Switchable Graphics
87 
88  // Lenovo dCute is installed. http://crbug.com/181665.
90 
91  // Primary GPU, for exmaple, the discrete GPU in a dual GPU machine.
93 
94  // Secondary GPUs, for example, the integrated GPU in a dual GPU machine.
95  std::vector<GPUDevice> secondary_gpus;
96 
97  // On Windows, the unique identifier of the adapter the GPU process uses.
98  // The default is zero, which makes the browser process create its D3D device
99  // on the primary adapter. Note that the primary adapter can change at any
100  // time so it is better to specify a particular LUID. Note that valid LUIDs
101  // are always non-zero.
103 
104  // The vendor of the graphics driver currently installed.
106 
107  // The version of the graphics driver currently installed.
109 
110  // The date of the graphics driver currently installed.
112 
113  // The version of the pixel/fragment shader used by the gpu.
115 
116  // The version of the vertex shader used by the gpu.
118 
119  // The maximum multisapling sample count, either through ES3 or
120  // EXT_multisampled_render_to_texture MSAA.
122 
123  // The machine model identifier. They can contain any character, including
124  // whitespaces. Currently it is supported on MacOSX and Android.
125  // Android examples: "Naxus 5", "XT1032".
126  // On MacOSX, the version is stripped out of the model identifier, for
127  // example, the original identifier is "MacBookPro7,2", and we put
128  // "MacBookPro" as machine_model_name, and "7.2" as machine_model_version.
130 
131  // The version of the machine model. Currently it is supported on MacOSX.
132  // See machine_model_name's comment.
134 
135  // The GL_VERSION string.
137 
138  // The GL_VENDOR string.
140 
141  // The GL_RENDERER string.
143 
144  // The GL_EXTENSIONS string.
146 
147  // GL window system binding vendor. "" if not available.
149 
150  // GL window system binding version. "" if not available.
152 
153  // GL window system binding extensions. "" if not available.
155 
156  // GL reset notification strategy as defined by GL_ARB_robustness. 0 if GPU
157  // reset detection or notification not available.
159 
160  // The device semantics, i.e. whether the Vista and Windows 7 specific
161  // semantics are available.
163 
165 
166  // Whether the driver uses direct rendering. True on most platforms, false on
167  // X11 when using remote X.
169 
170  // Whether the gpu process is running in a sandbox.
171  bool sandboxed;
172 
173  // Number of GPU process crashes recorded.
175 
176  // True if the GPU is running in the browser process instead of its own.
178 
179  // The state of whether the basic/context/DxDiagnostics info is collected and
180  // if the collection fails or not.
183 
185 
186  // Note: when adding new members, please remember to update EnumerateFields
187  // in gpu_info.cc.
188 
189  // In conjunction with EnumerateFields, this allows the embedder to
190  // enumerate the values in this structure without having to embed
191  // references to its specific member variables. This simplifies the
192  // addition of new fields to this type.
193  class Enumerator {
194  public:
195  // The following methods apply to the "current" object. Initially this
196  // is the root object, but calls to BeginGPUDevice/EndGPUDevice and
197  // BeginAuxAttributes/EndAuxAttributes change the object to which these
198  // calls should apply.
199  virtual void AddInt64(const char* name, int64 value) = 0;
200  virtual void AddInt(const char* name, int value) = 0;
201  virtual void AddString(const char* name, const std::string& value) = 0;
202  virtual void AddBool(const char* name, bool value) = 0;
203 
204  // Markers indicating that a GPUDevice is being described.
205  virtual void BeginGPUDevice() = 0;
206  virtual void EndGPUDevice() = 0;
207 
208  // Markers indicating that a VideoDecodeAcceleratorSupportedProfile is
209  // being described.
210  virtual void BeginVideoDecodeAcceleratorSupportedProfile() = 0;
211  virtual void EndVideoDecodeAcceleratorSupportedProfile() = 0;
212 
213  // Markers indicating that a VideoEncodeAcceleratorSupportedProfile is
214  // being described.
215  virtual void BeginVideoEncodeAcceleratorSupportedProfile() = 0;
216  virtual void EndVideoEncodeAcceleratorSupportedProfile() = 0;
217 
218  // Markers indicating that "auxiliary" attributes of the GPUInfo
219  // (according to the DevTools protocol) are being described.
220  virtual void BeginAuxAttributes() = 0;
221  virtual void EndAuxAttributes() = 0;
222 
223  protected:
224  virtual ~Enumerator() {}
225  };
226 
227  // Outputs the fields in this structure to the provided enumerator.
228  void EnumerateFields(Enumerator* enumerator) const;
229 };
230 
231 } // namespace gpu
232 
233 #endif // GPU_CONFIG_GPU_INFO_H_
Definition: gpu_info.h:43
std::string gl_ws_vendor
Definition: gpu_info.h:148
Definition: gpu_info.h:35
std::string gl_version
Definition: gpu_info.h:136
Definition: gpu_info.h:51
std::string gl_renderer
Definition: gpu_info.h:142
Definition: gpu_info.h:37
CollectInfoResult
Definition: gpu_info.h:24
Definition: gpu_info.h:26
VideoCodecProfile
Definition: gpu_info.h:32
bool direct_rendering
Definition: gpu_info.h:168
Definition: gpu_info.h:38
Definition: gpu_info.h:45
virtual ~Enumerator()
Definition: gpu_info.h:224
uint32 vendor_id
Definition: gpu_info.h:57
Definition: gpu_info.h:48
std::string vendor_string
Definition: gpu_info.h:71
std::string max_msaa_samples
Definition: gpu_info.h:121
uint64_t uint64
Definition: angle_config.h:30
bool amd_switchable
Definition: gpu_info.h:86
int64_t int64
Definition: angle_config.h:29
bool sandboxed
Definition: gpu_info.h:171
CollectInfoResult context_info_state
Definition: gpu_info.h:182
std::string machine_model_version
Definition: gpu_info.h:133
std::string gl_ws_extensions
Definition: gpu_info.h:154
std::string device_string
Definition: gpu_info.h:72
Definition: gpu_info.h:39
uint64 adapter_luid
Definition: gpu_info.h:102
bool active
Definition: gpu_info.h:65
Definition: gpu_info.h:36
Definition: gpu_info.h:27
EGLAttrib * value
Definition: eglext.h:120
int process_crash_count
Definition: gpu_info.h:174
std::string driver_version
Definition: gpu_info.h:108
EGLImageKHR EGLint * name
Definition: eglext.h:851
#define GPU_EXPORT
Definition: angle_config.h:25
Definition: gpu_info.h:25
Definition: gpu_info.h:44
CollectInfoResult basic_info_state
Definition: gpu_info.h:181
uint32 gl_reset_notification_strategy
Definition: gpu_info.h:158
bool lenovo_dcute
Definition: gpu_info.h:89
Definition: gpu_info.cc:22
bool jpeg_decode_accelerator_supported
Definition: gpu_info.h:184
Definition: gpu_info.h:28
Definition: gpu_info.h:47
bool optimus
Definition: gpu_info.h:83
Definition: gpu_info.h:46
GLsizei const GLchar *const * string
Definition: gl2.h:479
Definition: gpu_info.h:34
bool can_lose_context
Definition: gpu_info.h:162
std::string machine_model_name
Definition: gpu_info.h:129
GPUDevice gpu
Definition: gpu_info.h:92
std::string driver_date
Definition: gpu_info.h:111
std::string gl_extensions
Definition: gpu_info.h:145
Definition: gpu_info.h:42
Definition: gpu_info.h:40
std::string driver_vendor
Definition: gpu_info.h:105
std::string gl_ws_version
Definition: gpu_info.h:151
bool software_rendering
Definition: gpu_info.h:164
std::string vertex_shader_version
Definition: gpu_info.h:117
std::string pixel_shader_version
Definition: gpu_info.h:114
uint32_t uint32
Definition: angle_config.h:28
uint32 device_id
Definition: gpu_info.h:61
Definition: gpu_info.h:193
bool in_process_gpu
Definition: gpu_info.h:177
std::vector< GPUDevice > secondary_gpus
Definition: gpu_info.h:95
std::string gl_vendor
Definition: gpu_info.h:139
Definition: gpu_info.h:52
bool SupportsAccelerated2dCanvas() const
Definition: gpu_info.h:78
Definition: gpu_info.h:33