Enable Tab Dragging Tests with Linux and Ash
[chromium-blink-merge.git] / gpu / config / gpu_info.h
blob40630b3b0aa283df3b62661124e61e5667913f68
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.
11 #include <string>
12 #include <vector>
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"
22 namespace gpu {
24 struct GPU_EXPORT GPUInfo {
25 struct GPU_EXPORT GPUDevice {
26 GPUDevice();
27 ~GPUDevice();
29 // The DWORD (uint32) representing the graphics card vendor id.
30 uint32 vendor_id;
32 // The DWORD (uint32) representing the graphics card device id.
33 // Device ids are unique to vendor, not to one another.
34 uint32 device_id;
36 // Whether this GPU is the currently used one.
37 // Currently this field is only supported and meaningful on OS X.
38 bool active;
40 // The strings that describe the GPU.
41 // In Linux these strings are obtained through libpci.
42 // In Win/MacOSX, these two strings are not filled at the moment.
43 // In Android, these are respectively GL_VENDOR and GL_RENDERER.
44 std::string vendor_string;
45 std::string device_string;
48 GPUInfo();
49 ~GPUInfo();
51 bool SupportsAccelerated2dCanvas() const {
52 return !can_lose_context && !software_rendering;
55 // Whether more GPUInfo fields might be collected in the future.
56 bool finalized;
58 // The amount of time taken to get from the process starting to the message
59 // loop being pumped.
60 base::TimeDelta initialization_time;
62 // Computer has NVIDIA Optimus
63 bool optimus;
65 // Computer has AMD Dynamic Switchable Graphics
66 bool amd_switchable;
68 // Lenovo dCute is installed. http://crbug.com/181665.
69 bool lenovo_dcute;
71 // Version of DisplayLink driver installed. Zero if not installed.
72 // http://crbug.com/177611.
73 Version display_link_version;
75 // Primary GPU, for exmaple, the discrete GPU in a dual GPU machine.
76 GPUDevice gpu;
78 // Secondary GPUs, for example, the integrated GPU in a dual GPU machine.
79 std::vector<GPUDevice> secondary_gpus;
81 // On Windows, the unique identifier of the adapter the GPU process uses.
82 // The default is zero, which makes the browser process create its D3D device
83 // on the primary adapter. Note that the primary adapter can change at any
84 // time so it is better to specify a particular LUID. Note that valid LUIDs
85 // are always non-zero.
86 uint64 adapter_luid;
88 // The vendor of the graphics driver currently installed.
89 std::string driver_vendor;
91 // The version of the graphics driver currently installed.
92 std::string driver_version;
94 // The date of the graphics driver currently installed.
95 std::string driver_date;
97 // The version of the pixel/fragment shader used by the gpu.
98 std::string pixel_shader_version;
100 // The version of the vertex shader used by the gpu.
101 std::string vertex_shader_version;
103 // The machine model identifier. They can contain any character, including
104 // whitespaces. Currently it is supported on MacOSX and Android.
105 // Android examples: "Naxus 5", "XT1032".
106 // On MacOSX, the version is stripped out of the model identifier, for
107 // example, the original identifier is "MacBookPro7,2", and we put
108 // "MacBookPro" as machine_model_name, and "7.2" as machine_model_version.
109 std::string machine_model_name;
111 // The version of the machine model. Currently it is supported on MacOSX.
112 // See machine_model_name's comment.
113 std::string machine_model_version;
115 // The GL_VERSION string.
116 std::string gl_version;
118 // The GL_VENDOR string.
119 std::string gl_vendor;
121 // The GL_RENDERER string.
122 std::string gl_renderer;
124 // The GL_EXTENSIONS string.
125 std::string gl_extensions;
127 // GL window system binding vendor. "" if not available.
128 std::string gl_ws_vendor;
130 // GL window system binding version. "" if not available.
131 std::string gl_ws_version;
133 // GL window system binding extensions. "" if not available.
134 std::string gl_ws_extensions;
136 // GL reset notification strategy as defined by GL_ARB_robustness. 0 if GPU
137 // reset detection or notification not available.
138 uint32 gl_reset_notification_strategy;
140 // The device semantics, i.e. whether the Vista and Windows 7 specific
141 // semantics are available.
142 bool can_lose_context;
144 // By default all values are 0.
145 GpuPerformanceStats performance_stats;
147 bool software_rendering;
149 // Whether the driver uses direct rendering. True on most platforms, false on
150 // X11 when using remote X.
151 bool direct_rendering;
153 // Whether the gpu process is running in a sandbox.
154 bool sandboxed;
156 #if defined(OS_WIN)
157 // The information returned by the DirectX Diagnostics Tool.
158 DxDiagNode dx_diagnostics;
159 #endif
160 // Note: when adding new members, please remember to update EnumerateFields
161 // in gpu_info.cc.
163 // In conjunction with EnumerateFields, this allows the embedder to
164 // enumerate the values in this structure without having to embed
165 // references to its specific member variables. This simplifies the
166 // addition of new fields to this type.
167 class Enumerator {
168 public:
169 // The following methods apply to the "current" object. Initially this
170 // is the root object, but calls to BeginGPUDevice/EndGPUDevice and
171 // BeginAuxAttributes/EndAuxAttributes change the object to which these
172 // calls should apply.
173 virtual void AddInt64(const char* name, int64 value) = 0;
174 virtual void AddInt(const char* name, int value) = 0;
175 virtual void AddString(const char* name, const std::string& value) = 0;
176 virtual void AddBool(const char* name, bool value) = 0;
177 virtual void AddTimeDeltaInSecondsF(const char* name,
178 const base::TimeDelta& value) = 0;
180 // Markers indicating that a GPUDevice is being described.
181 virtual void BeginGPUDevice() = 0;
182 virtual void EndGPUDevice() = 0;
184 // Markers indicating that "auxiliary" attributes of the GPUInfo
185 // (according to the DevTools protocol) are being described.
186 virtual void BeginAuxAttributes() = 0;
187 virtual void EndAuxAttributes() = 0;
189 protected:
190 virtual ~Enumerator() {}
193 // Outputs the fields in this structure to the provided enumerator.
194 void EnumerateFields(Enumerator* enumerator) const;
197 } // namespace gpu
199 #endif // GPU_CONFIG_GPU_INFO_H_