Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GPU_CONFIG_GPU_INFO_H_ | 5 #ifndef GPU_CONFIG_GPU_INFO_H_ |
| 6 #define GPU_CONFIG_GPU_INFO_H_ | 6 #define GPU_CONFIG_GPU_INFO_H_ |
| 7 | 7 |
| 8 // Provides access to the GPU information for the system | 8 // Provides access to the GPU information for the system |
| 9 // on which chrome is currently running. | 9 // on which chrome is currently running. |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/version.h" | 16 #include "base/version.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "gpu/config/dx_diag_node.h" | 18 #include "gpu/config/dx_diag_node.h" |
| 19 #include "gpu/config/gpu_performance_stats.h" | 19 #include "gpu/config/gpu_performance_stats.h" |
| 20 #include "gpu/gpu_export.h" | 20 #include "gpu/gpu_export.h" |
| 21 | 21 |
| 22 namespace gpu { | 22 namespace gpu { |
| 23 | 23 |
| 24 // Result for the various Collect*Info* functions below. | |
| 25 // Fatal failures are for cases where we can't create a context at all or | |
| 26 // something, making the use of the GPU impossible. | |
| 27 // Non-fatal failures are for cases where we could gather most info, but maybe | |
| 28 // some is missing (e.g. unable to parse a version string or to detect the exact | |
| 29 // model). | |
| 30 enum CollectInfoResult { | |
| 31 kCollectInfoNone = 0, | |
| 32 kCollectInfoSuccess = 1, | |
| 33 kCollectInfoNonFatalFailure = 2, | |
| 34 kCollectInfoFatalFailure = 3 | |
|
Ken Russell (switch to Gerrit)
2014/09/03 22:22:00
Something to consider for a follow-on CL: perhaps
| |
| 35 }; | |
| 36 | |
| 24 struct GPU_EXPORT GPUInfo { | 37 struct GPU_EXPORT GPUInfo { |
| 25 struct GPU_EXPORT GPUDevice { | 38 struct GPU_EXPORT GPUDevice { |
| 26 GPUDevice(); | 39 GPUDevice(); |
| 27 ~GPUDevice(); | 40 ~GPUDevice(); |
| 28 | 41 |
| 29 // The DWORD (uint32) representing the graphics card vendor id. | 42 // The DWORD (uint32) representing the graphics card vendor id. |
| 30 uint32 vendor_id; | 43 uint32 vendor_id; |
| 31 | 44 |
| 32 // The DWORD (uint32) representing the graphics card device id. | 45 // The DWORD (uint32) representing the graphics card device id. |
| 33 // Device ids are unique to vendor, not to one another. | 46 // Device ids are unique to vendor, not to one another. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 45 std::string device_string; | 58 std::string device_string; |
| 46 }; | 59 }; |
| 47 | 60 |
| 48 GPUInfo(); | 61 GPUInfo(); |
| 49 ~GPUInfo(); | 62 ~GPUInfo(); |
| 50 | 63 |
| 51 bool SupportsAccelerated2dCanvas() const { | 64 bool SupportsAccelerated2dCanvas() const { |
| 52 return !can_lose_context && !software_rendering; | 65 return !can_lose_context && !software_rendering; |
| 53 } | 66 } |
| 54 | 67 |
| 55 // Whether more GPUInfo fields might be collected in the future. | |
| 56 bool finalized; | |
| 57 | |
| 58 // The amount of time taken to get from the process starting to the message | 68 // The amount of time taken to get from the process starting to the message |
| 59 // loop being pumped. | 69 // loop being pumped. |
| 60 base::TimeDelta initialization_time; | 70 base::TimeDelta initialization_time; |
| 61 | 71 |
| 62 // Computer has NVIDIA Optimus | 72 // Computer has NVIDIA Optimus |
| 63 bool optimus; | 73 bool optimus; |
| 64 | 74 |
| 65 // Computer has AMD Dynamic Switchable Graphics | 75 // Computer has AMD Dynamic Switchable Graphics |
| 66 bool amd_switchable; | 76 bool amd_switchable; |
| 67 | 77 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 // Whether the driver uses direct rendering. True on most platforms, false on | 159 // Whether the driver uses direct rendering. True on most platforms, false on |
| 150 // X11 when using remote X. | 160 // X11 when using remote X. |
| 151 bool direct_rendering; | 161 bool direct_rendering; |
| 152 | 162 |
| 153 // Whether the gpu process is running in a sandbox. | 163 // Whether the gpu process is running in a sandbox. |
| 154 bool sandboxed; | 164 bool sandboxed; |
| 155 | 165 |
| 156 // Number of GPU process crashes recorded. | 166 // Number of GPU process crashes recorded. |
| 157 int process_crash_count; | 167 int process_crash_count; |
| 158 | 168 |
| 169 // The state of whether the basic/context/DxDiagnostics info is collected and | |
| 170 // if the collection fails or not. | |
| 171 CollectInfoResult basic_info_state; | |
| 172 CollectInfoResult context_info_state; | |
| 159 #if defined(OS_WIN) | 173 #if defined(OS_WIN) |
| 174 CollectInfoResult dx_diagnostics_info_state; | |
| 175 | |
| 160 // The information returned by the DirectX Diagnostics Tool. | 176 // The information returned by the DirectX Diagnostics Tool. |
| 161 DxDiagNode dx_diagnostics; | 177 DxDiagNode dx_diagnostics; |
| 162 #endif | 178 #endif |
| 163 // Note: when adding new members, please remember to update EnumerateFields | 179 // Note: when adding new members, please remember to update EnumerateFields |
| 164 // in gpu_info.cc. | 180 // in gpu_info.cc. |
| 165 | 181 |
| 166 // In conjunction with EnumerateFields, this allows the embedder to | 182 // In conjunction with EnumerateFields, this allows the embedder to |
| 167 // enumerate the values in this structure without having to embed | 183 // enumerate the values in this structure without having to embed |
| 168 // references to its specific member variables. This simplifies the | 184 // references to its specific member variables. This simplifies the |
| 169 // addition of new fields to this type. | 185 // addition of new fields to this type. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 193 virtual ~Enumerator() {} | 209 virtual ~Enumerator() {} |
| 194 }; | 210 }; |
| 195 | 211 |
| 196 // Outputs the fields in this structure to the provided enumerator. | 212 // Outputs the fields in this structure to the provided enumerator. |
| 197 void EnumerateFields(Enumerator* enumerator) const; | 213 void EnumerateFields(Enumerator* enumerator) const; |
| 198 }; | 214 }; |
| 199 | 215 |
| 200 } // namespace gpu | 216 } // namespace gpu |
| 201 | 217 |
| 202 #endif // GPU_CONFIG_GPU_INFO_H_ | 218 #endif // GPU_CONFIG_GPU_INFO_H_ |
| OLD | NEW |