| 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 #include "gpu/config/gpu_info.h" | 5 #include "gpu/config/gpu_info.h" |
| 6 | 6 |
| 7 namespace gpu { | 7 namespace gpu { |
| 8 | 8 |
| 9 GPUInfo::GPUDevice::GPUDevice() | 9 GPUInfo::GPUDevice::GPUDevice() |
| 10 : vendor_id(0), | 10 : vendor_id(0), |
| 11 device_id(0) { | 11 device_id(0) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 GPUInfo::GPUDevice::~GPUDevice() { } | 14 GPUInfo::GPUDevice::~GPUDevice() { } |
| 15 | 15 |
| 16 GPUInfo::GPUInfo() | 16 GPUInfo::GPUInfo() |
| 17 : finalized(false), | 17 : finalized(false), |
| 18 optimus(false), | 18 optimus(false), |
| 19 amd_switchable(false), | 19 amd_switchable(false), |
| 20 lenovo_dcute(false), | 20 lenovo_dcute(false), |
| 21 adapter_luid(0), | 21 adapter_luid(0), |
| 22 gl_reset_notification_strategy(0), | 22 gl_reset_notification_strategy(0), |
| 23 can_lose_context(false), | 23 can_lose_context(false), |
| 24 software_rendering(false), | 24 software_rendering(false), |
| 25 sandboxed(false) { | 25 sandboxed(false) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 GPUInfo::~GPUInfo() { } | 28 GPUInfo::~GPUInfo() { } |
| 29 | 29 |
| 30 void GPUInfo::EnumerateFields(Enumerator* enumerator) const { |
| 31 struct GPUInfoKnownFields { |
| 32 bool finalized; |
| 33 base::TimeDelta initialization_time; |
| 34 bool optimus; |
| 35 bool amd_switchable; |
| 36 bool lenovo_dcute; |
| 37 Version display_link_version; |
| 38 GPUDevice gpu; |
| 39 std::vector<GPUDevice> secondary_gpus; |
| 40 uint64 adapter_luid; |
| 41 std::string driver_vendor; |
| 42 std::string driver_version; |
| 43 std::string driver_date; |
| 44 std::string pixel_shader_version; |
| 45 std::string vertex_shader_version; |
| 46 std::string machine_model; |
| 47 std::string gl_version; |
| 48 std::string gl_version_string; |
| 49 std::string gl_vendor; |
| 50 std::string gl_renderer; |
| 51 std::string gl_extensions; |
| 52 std::string gl_ws_vendor; |
| 53 std::string gl_ws_version; |
| 54 std::string gl_ws_extensions; |
| 55 uint32 gl_reset_notification_strategy; |
| 56 bool can_lose_context; |
| 57 GpuPerformanceStats performance_stats; |
| 58 bool software_rendering; |
| 59 bool sandboxed; |
| 60 #if defined(OS_WIN) |
| 61 DxDiagNode dx_diagnostics; |
| 62 #endif |
| 63 }; |
| 64 |
| 65 // If this assert fails then most likely something below needs to be updated. |
| 66 // Note that this assert is only approximate. If a new field is added to |
| 67 // GPUInfo which fits within the current padding then it will not be caught. |
| 68 COMPILE_ASSERT( |
| 69 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), |
| 70 Fields_Have_Changed_In_GPUInfo_So_Update_Below); |
| 71 |
| 72 // Note that we use the C++, and Python, naming convention for these |
| 73 // fields. The final consumer of this information is Telemetry's Python |
| 74 // classes, and using a consistent naming convention reduces the amount |
| 75 // of code that must be written converting back and forth. |
| 76 enumerator->AddBool("finalized", finalized); |
| 77 enumerator->AddTimeDeltaInSecondsF("initializationTime", |
| 78 initialization_time); |
| 79 enumerator->AddBool("optimus", optimus); |
| 80 enumerator->AddBool("amdSwitchable", amd_switchable); |
| 81 enumerator->AddBool("lenovoDcute", lenovo_dcute); |
| 82 if (display_link_version.IsValid()) { |
| 83 enumerator->AddString("displayLinkVersion", |
| 84 display_link_version.GetString()); |
| 85 } |
| 86 enumerator->AddGPUDevice(gpu); |
| 87 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { |
| 88 enumerator->AddGPUDevice(secondary_gpus[ii]); |
| 89 } |
| 90 enumerator->AddInt64("adapterLuid", adapter_luid); |
| 91 enumerator->AddString("driverVendor", driver_vendor); |
| 92 enumerator->AddString("driverVersion", driver_version); |
| 93 enumerator->AddString("driverDate", driver_date); |
| 94 enumerator->AddString("pixelShaderVersion", pixel_shader_version); |
| 95 enumerator->AddString("vertexShaderVersion", vertex_shader_version); |
| 96 enumerator->AddString("machineModel", machine_model); |
| 97 enumerator->AddString("glVersion", gl_version); |
| 98 enumerator->AddString("glVersionString", gl_version_string); |
| 99 enumerator->AddString("glVendor", gl_vendor); |
| 100 enumerator->AddString("glRenderer", gl_renderer); |
| 101 enumerator->AddString("glExtensions", gl_extensions); |
| 102 enumerator->AddString("glWsVendor", gl_ws_vendor); |
| 103 enumerator->AddString("glWsVersion", gl_ws_version); |
| 104 enumerator->AddString("glWsExtensions", gl_ws_extensions); |
| 105 enumerator->AddInt( |
| 106 "glResetNotificationStrategy", |
| 107 static_cast<int>(gl_reset_notification_strategy)); |
| 108 enumerator->AddBool("can_lose_context", can_lose_context); |
| 109 // TODO(kbr): add performance_stats. |
| 110 enumerator->AddBool("softwareRendering", software_rendering); |
| 111 enumerator->AddBool("sandboxed", sandboxed); |
| 112 // TODO(kbr): add dx_diagnostics on Windows. |
| 113 } |
| 114 |
| 30 } // namespace gpu | 115 } // namespace gpu |
| OLD | NEW |