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 "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" 21 22 namespace gpu { 23 24 struct GPU_EXPORT GPUInfo { 25 struct GPU_EXPORT GPUDevice { 26 GPUDevice(); 27 ~GPUDevice(); 28 29 // The DWORD (uint32) representing the graphics card vendor id. 30 uint32 vendor_id; 31 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; 35 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 std::string vendor_string; 40 std::string device_string; 41 }; 42 43 GPUInfo(); 44 ~GPUInfo(); 45 46 // Whether more GPUInfo fields might be collected in the future. 47 bool finalized; 48 49 // The amount of time taken to get from the process starting to the message 50 // loop being pumped. 51 base::TimeDelta initialization_time; 52 53 // Computer has NVIDIA Optimus 54 bool optimus; 55 56 // Computer has AMD Dynamic Switchable Graphics 57 bool amd_switchable; 58 59 // Lenovo dCute is installed. http://crbug.com/181665. 60 bool lenovo_dcute; 61 62 // Version of DisplayLink driver installed. Zero if not installed. 63 // http://crbug.com/177611. 64 Version display_link_version; 65 66 // Primary GPU, for exmaple, the discrete GPU in a dual GPU machine. 67 GPUDevice gpu; 68 69 // Secondary GPUs, for example, the integrated GPU in a dual GPU machine. 70 std::vector<GPUDevice> secondary_gpus; 71 72 // On Windows, the unique identifier of the adapter the GPU process uses. 73 // The default is zero, which makes the browser process create its D3D device 74 // on the primary adapter. Note that the primary adapter can change at any 75 // time so it is better to specify a particular LUID. Note that valid LUIDs 76 // are always non-zero. 77 uint64 adapter_luid; 78 79 // The vendor of the graphics driver currently installed. 80 std::string driver_vendor; 81 82 // The version of the graphics driver currently installed. 83 std::string driver_version; 84 85 // The date of the graphics driver currently installed. 86 std::string driver_date; 87 88 // The version of the pixel/fragment shader used by the gpu. 89 std::string pixel_shader_version; 90 91 // The version of the vertex shader used by the gpu. 92 std::string vertex_shader_version; 93 94 // The machine model identifier with format "name major.minor". 95 // Name should not contain any whitespaces. 96 std::string machine_model; 97 98 // The version of OpenGL we are using. 99 // TODO(zmo): should be able to tell if it's GL or GLES. 100 std::string gl_version; 101 102 // The GL_VERSION string. "" if we are not using OpenGL. 103 std::string gl_version_string; 104 105 // The GL_VENDOR string. "" if we are not using OpenGL. 106 std::string gl_vendor; 107 108 // The GL_RENDERER string. "" if we are not using OpenGL. 109 std::string gl_renderer; 110 111 // The GL_EXTENSIONS string. "" if we are not using OpenGL. 112 std::string gl_extensions; 113 114 // GL window system binding vendor. "" if not available. 115 std::string gl_ws_vendor; 116 117 // GL window system binding version. "" if not available. 118 std::string gl_ws_version; 119 120 // GL window system binding extensions. "" if not available. 121 std::string gl_ws_extensions; 122 123 // GL reset notification strategy as defined by GL_ARB_robustness. 0 if GPU 124 // reset detection or notification not available. 125 uint32 gl_reset_notification_strategy; 126 127 // The device semantics, i.e. whether the Vista and Windows 7 specific 128 // semantics are available. 129 bool can_lose_context; 130 131 // By default all values are 0. 132 GpuPerformanceStats performance_stats; 133 134 bool software_rendering; 135 136 // Whether the gpu process is running in a sandbox. 137 bool sandboxed; 138 139 #if defined(OS_WIN) 140 // The information returned by the DirectX Diagnostics Tool. 141 DxDiagNode dx_diagnostics; 142 #endif 143 }; 144 145 } // namespace gpu 146 147 #endif // GPU_CONFIG_GPU_INFO_H_ 148