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 kCollectInfoNotSupported = 2, | |
|
piman
2014/09/03 00:50:55
Do we really need to discriminate this from NonFat
Zhenyao Mo
2014/09/03 01:31:23
Done.
| |
| 34 kCollectInfoNonFatalFailure = 3, | |
| 35 kCollectInfoFatalFailure = 4 | |
| 36 }; | |
| 37 | |
| 24 struct GPU_EXPORT GPUInfo { | 38 struct GPU_EXPORT GPUInfo { |
| 25 struct GPU_EXPORT GPUDevice { | 39 struct GPU_EXPORT GPUDevice { |
| 26 GPUDevice(); | 40 GPUDevice(); |
| 27 ~GPUDevice(); | 41 ~GPUDevice(); |
| 28 | 42 |
| 29 // The DWORD (uint32) representing the graphics card vendor id. | 43 // The DWORD (uint32) representing the graphics card vendor id. |
| 30 uint32 vendor_id; | 44 uint32 vendor_id; |
| 31 | 45 |
| 32 // The DWORD (uint32) representing the graphics card device id. | 46 // The DWORD (uint32) representing the graphics card device id. |
| 33 // Device ids are unique to vendor, not to one another. | 47 // Device ids are unique to vendor, not to one another. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 45 std::string device_string; | 59 std::string device_string; |
| 46 }; | 60 }; |
| 47 | 61 |
| 48 GPUInfo(); | 62 GPUInfo(); |
| 49 ~GPUInfo(); | 63 ~GPUInfo(); |
| 50 | 64 |
| 51 bool SupportsAccelerated2dCanvas() const { | 65 bool SupportsAccelerated2dCanvas() const { |
| 52 return !can_lose_context && !software_rendering; | 66 return !can_lose_context && !software_rendering; |
| 53 } | 67 } |
| 54 | 68 |
| 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 | 69 // The amount of time taken to get from the process starting to the message |
| 59 // loop being pumped. | 70 // loop being pumped. |
| 60 base::TimeDelta initialization_time; | 71 base::TimeDelta initialization_time; |
| 61 | 72 |
| 62 // Computer has NVIDIA Optimus | 73 // Computer has NVIDIA Optimus |
| 63 bool optimus; | 74 bool optimus; |
| 64 | 75 |
| 65 // Computer has AMD Dynamic Switchable Graphics | 76 // Computer has AMD Dynamic Switchable Graphics |
| 66 bool amd_switchable; | 77 bool amd_switchable; |
| 67 | 78 |
| (...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 | 160 // Whether the driver uses direct rendering. True on most platforms, false on |
| 150 // X11 when using remote X. | 161 // X11 when using remote X. |
| 151 bool direct_rendering; | 162 bool direct_rendering; |
| 152 | 163 |
| 153 // Whether the gpu process is running in a sandbox. | 164 // Whether the gpu process is running in a sandbox. |
| 154 bool sandboxed; | 165 bool sandboxed; |
| 155 | 166 |
| 156 // Number of GPU process crashes recorded. | 167 // Number of GPU process crashes recorded. |
| 157 int process_crash_count; | 168 int process_crash_count; |
| 158 | 169 |
| 170 // The state of whether the basic/context/DxDiagnostics info is collected and | |
| 171 // if the collection fails or not. | |
| 172 CollectInfoResult basic_info_state; | |
| 173 CollectInfoResult context_info_state; | |
| 159 #if defined(OS_WIN) | 174 #if defined(OS_WIN) |
| 175 CollectInfoResult dx_diagnostics_info_state; | |
| 176 | |
| 160 // The information returned by the DirectX Diagnostics Tool. | 177 // The information returned by the DirectX Diagnostics Tool. |
| 161 DxDiagNode dx_diagnostics; | 178 DxDiagNode dx_diagnostics; |
| 162 #endif | 179 #endif |
| 163 // Note: when adding new members, please remember to update EnumerateFields | 180 // Note: when adding new members, please remember to update EnumerateFields |
| 164 // in gpu_info.cc. | 181 // in gpu_info.cc. |
| 165 | 182 |
| 166 // In conjunction with EnumerateFields, this allows the embedder to | 183 // In conjunction with EnumerateFields, this allows the embedder to |
| 167 // enumerate the values in this structure without having to embed | 184 // enumerate the values in this structure without having to embed |
| 168 // references to its specific member variables. This simplifies the | 185 // references to its specific member variables. This simplifies the |
| 169 // addition of new fields to this type. | 186 // addition of new fields to this type. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 193 virtual ~Enumerator() {} | 210 virtual ~Enumerator() {} |
| 194 }; | 211 }; |
| 195 | 212 |
| 196 // Outputs the fields in this structure to the provided enumerator. | 213 // Outputs the fields in this structure to the provided enumerator. |
| 197 void EnumerateFields(Enumerator* enumerator) const; | 214 void EnumerateFields(Enumerator* enumerator) const; |
| 198 }; | 215 }; |
| 199 | 216 |
| 200 } // namespace gpu | 217 } // namespace gpu |
| 201 | 218 |
| 202 #endif // GPU_CONFIG_GPU_INFO_H_ | 219 #endif // GPU_CONFIG_GPU_INFO_H_ |
| OLD | NEW |