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.
5 #ifndef GPU_CONFIG_GPU_INFO_H_
6 #define GPU_CONFIG_GPU_INFO_H_
8 // Provides access to the GPU information for the system
9 // on which chrome is currently running.
14 #include "base/basictypes.h"
15 #include "base/time/time.h"
16 #include "base/version.h"
17 #include "build/build_config.h"
18 #include "gpu/config/dx_diag_node.h"
19 #include "gpu/config/gpu_performance_stats.h"
20 #include "gpu/gpu_export.h"
24 struct GPU_EXPORT GPUInfo {
25 struct GPU_EXPORT GPUDevice {
29 // The DWORD (uint32) representing the graphics card vendor id.
32 // The DWORD (uint32) representing the graphics card device id.
33 // Device ids are unique to vendor, not to one another.
36 // The strings that describe the GPU.
37 // In Linux these strings are obtained through libpci.
38 // In Win/MacOSX, these two strings are not filled at the moment.
39 // In Android, these are respectively GL_VENDOR and GL_RENDERER.
40 std::string vendor_string;
41 std::string device_string;
47 // Whether more GPUInfo fields might be collected in the future.
50 // The amount of time taken to get from the process starting to the message
52 base::TimeDelta initialization_time;
54 // Computer has NVIDIA Optimus
57 // Computer has AMD Dynamic Switchable Graphics
60 // Lenovo dCute is installed. http://crbug.com/181665.
63 // Version of DisplayLink driver installed. Zero if not installed.
64 // http://crbug.com/177611.
65 Version display_link_version;
67 // Primary GPU, for exmaple, the discrete GPU in a dual GPU machine.
70 // Secondary GPUs, for example, the integrated GPU in a dual GPU machine.
71 std::vector<GPUDevice> secondary_gpus;
73 // On Windows, the unique identifier of the adapter the GPU process uses.
74 // The default is zero, which makes the browser process create its D3D device
75 // on the primary adapter. Note that the primary adapter can change at any
76 // time so it is better to specify a particular LUID. Note that valid LUIDs
77 // are always non-zero.
80 // The vendor of the graphics driver currently installed.
81 std::string driver_vendor;
83 // The version of the graphics driver currently installed.
84 std::string driver_version;
86 // The date of the graphics driver currently installed.
87 std::string driver_date;
89 // The version of the pixel/fragment shader used by the gpu.
90 std::string pixel_shader_version;
92 // The version of the vertex shader used by the gpu.
93 std::string vertex_shader_version;
95 // The machine model identifier with format "name major.minor".
96 // Name should not contain any whitespaces.
97 std::string machine_model;
99 // The version of OpenGL we are using.
100 // TODO(zmo): should be able to tell if it's GL or GLES.
101 std::string gl_version;
103 // The GL_VERSION string. "" if we are not using OpenGL.
104 std::string gl_version_string;
106 // The GL_VENDOR string. "" if we are not using OpenGL.
107 std::string gl_vendor;
109 // The GL_RENDERER string. "" if we are not using OpenGL.
110 std::string gl_renderer;
112 // The GL_EXTENSIONS string. "" if we are not using OpenGL.
113 std::string gl_extensions;
115 // GL window system binding vendor. "" if not available.
116 std::string gl_ws_vendor;
118 // GL window system binding version. "" if not available.
119 std::string gl_ws_version;
121 // GL window system binding extensions. "" if not available.
122 std::string gl_ws_extensions;
124 // GL reset notification strategy as defined by GL_ARB_robustness. 0 if GPU
125 // reset detection or notification not available.
126 uint32 gl_reset_notification_strategy;
128 // The device semantics, i.e. whether the Vista and Windows 7 specific
129 // semantics are available.
130 bool can_lose_context;
132 // By default all values are 0.
133 GpuPerformanceStats performance_stats;
135 bool software_rendering;
137 // Whether the gpu process is running in a sandbox.
141 // The information returned by the DirectX Diagnostics Tool.
142 DxDiagNode dx_diagnostics;
144 // Note: when adding new members, please remember to update EnumerateFields
147 // In conjunction with EnumerateFields, this allows the embedder to
148 // enumerate the values in this structure without having to embed
149 // references to its specific member variables. This simplifies the
150 // addition of new fields to this type.
153 // The following methods apply to the "current" object. Initially this
154 // is the root object, but calls to BeginGPUDevice/EndGPUDevice and
155 // BeginAuxAttributes/EndAuxAttributes change the object to which these
156 // calls should apply.
157 virtual void AddInt64(const char* name, int64 value) = 0;
158 virtual void AddInt(const char* name, int value) = 0;
159 virtual void AddString(const char* name, const std::string& value) = 0;
160 virtual void AddBool(const char* name, bool value) = 0;
161 virtual void AddTimeDeltaInSecondsF(const char* name,
162 const base::TimeDelta& value) = 0;
164 // Markers indicating that a GPUDevice is being described.
165 virtual void BeginGPUDevice() = 0;
166 virtual void EndGPUDevice() = 0;
168 // Markers indicating that "auxiliary" attributes of the GPUInfo
169 // (according to the DevTools protocol) are being described.
170 virtual void BeginAuxAttributes() = 0;
171 virtual void EndAuxAttributes() = 0;
174 virtual ~Enumerator() {}
177 // Outputs the fields in this structure to the provided enumerator.
178 void EnumerateFields(Enumerator* enumerator) const;
183 #endif // GPU_CONFIG_GPU_INFO_H_