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 { | 7 namespace { |
8 | 8 |
9 void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator, | 9 void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator, |
10 const gpu::GPUInfo::GPUDevice& device) { | 10 const gpu::GPUInfo::GPUDevice& device) { |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 GPUInfo::GPUDevice::GPUDevice() | 24 GPUInfo::GPUDevice::GPUDevice() |
25 : vendor_id(0), | 25 : vendor_id(0), |
26 device_id(0), | 26 device_id(0), |
27 active(false) { | 27 active(false) { |
28 } | 28 } |
29 | 29 |
30 GPUInfo::GPUDevice::~GPUDevice() { } | 30 GPUInfo::GPUDevice::~GPUDevice() { } |
31 | 31 |
32 GPUInfo::GPUInfo() | 32 GPUInfo::GPUInfo() |
33 : finalized(false), | 33 : optimus(false), |
34 optimus(false), | |
35 amd_switchable(false), | 34 amd_switchable(false), |
36 lenovo_dcute(false), | 35 lenovo_dcute(false), |
37 adapter_luid(0), | 36 adapter_luid(0), |
38 gl_reset_notification_strategy(0), | 37 gl_reset_notification_strategy(0), |
39 can_lose_context(false), | 38 can_lose_context(false), |
40 software_rendering(false), | 39 software_rendering(false), |
41 direct_rendering(true), | 40 direct_rendering(true), |
42 sandboxed(false), | 41 sandboxed(false), |
43 process_crash_count(0) { | 42 process_crash_count(0), |
| 43 basic_info_state(kCollectInfoNone), |
| 44 #if defined(OS_WIN) |
| 45 context_info_state(kCollectInfoNone), |
| 46 dx_diagnostics_info_state(kCollectInfoNone) { |
| 47 #else |
| 48 context_info_state(kCollectInfoNone) { |
| 49 #endif |
44 } | 50 } |
45 | 51 |
46 GPUInfo::~GPUInfo() { } | 52 GPUInfo::~GPUInfo() { } |
47 | 53 |
48 void GPUInfo::EnumerateFields(Enumerator* enumerator) const { | 54 void GPUInfo::EnumerateFields(Enumerator* enumerator) const { |
49 struct GPUInfoKnownFields { | 55 struct GPUInfoKnownFields { |
50 bool finalized; | |
51 base::TimeDelta initialization_time; | 56 base::TimeDelta initialization_time; |
52 bool optimus; | 57 bool optimus; |
53 bool amd_switchable; | 58 bool amd_switchable; |
54 bool lenovo_dcute; | 59 bool lenovo_dcute; |
55 Version display_link_version; | 60 Version display_link_version; |
56 GPUDevice gpu; | 61 GPUDevice gpu; |
57 std::vector<GPUDevice> secondary_gpus; | 62 std::vector<GPUDevice> secondary_gpus; |
58 uint64 adapter_luid; | 63 uint64 adapter_luid; |
59 std::string driver_vendor; | 64 std::string driver_vendor; |
60 std::string driver_version; | 65 std::string driver_version; |
61 std::string driver_date; | 66 std::string driver_date; |
62 std::string pixel_shader_version; | 67 std::string pixel_shader_version; |
63 std::string vertex_shader_version; | 68 std::string vertex_shader_version; |
64 std::string machine_model_name; | 69 std::string machine_model_name; |
65 std::string machine_model_version; | 70 std::string machine_model_version; |
66 std::string gl_version_string; | 71 std::string gl_version_string; |
67 std::string gl_vendor; | 72 std::string gl_vendor; |
68 std::string gl_renderer; | 73 std::string gl_renderer; |
69 std::string gl_extensions; | 74 std::string gl_extensions; |
70 std::string gl_ws_vendor; | 75 std::string gl_ws_vendor; |
71 std::string gl_ws_version; | 76 std::string gl_ws_version; |
72 std::string gl_ws_extensions; | 77 std::string gl_ws_extensions; |
73 uint32 gl_reset_notification_strategy; | 78 uint32 gl_reset_notification_strategy; |
74 bool can_lose_context; | 79 bool can_lose_context; |
75 GpuPerformanceStats performance_stats; | 80 GpuPerformanceStats performance_stats; |
76 bool software_rendering; | 81 bool software_rendering; |
77 bool direct_rendering; | 82 bool direct_rendering; |
78 bool sandboxed; | 83 bool sandboxed; |
79 int process_crash_count; | 84 int process_crash_count; |
| 85 CollectInfoResult basic_info_state; |
| 86 CollectInfoResult context_info_state; |
80 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
| 88 CollectInfoResult dx_diagnostics_info_state; |
81 DxDiagNode dx_diagnostics; | 89 DxDiagNode dx_diagnostics; |
82 #endif | 90 #endif |
83 }; | 91 }; |
84 | 92 |
85 // If this assert fails then most likely something below needs to be updated. | 93 // If this assert fails then most likely something below needs to be updated. |
86 // Note that this assert is only approximate. If a new field is added to | 94 // Note that this assert is only approximate. If a new field is added to |
87 // GPUInfo which fits within the current padding then it will not be caught. | 95 // GPUInfo which fits within the current padding then it will not be caught. |
88 COMPILE_ASSERT( | 96 COMPILE_ASSERT( |
89 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), | 97 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), |
90 Fields_Have_Changed_In_GPUInfo_So_Update_Below); | 98 Fields_Have_Changed_In_GPUInfo_So_Update_Below); |
91 | 99 |
92 // Required fields (according to DevTools protocol) first. | 100 // Required fields (according to DevTools protocol) first. |
93 enumerator->AddString("machineModelName", machine_model_name); | 101 enumerator->AddString("machineModelName", machine_model_name); |
94 enumerator->AddString("machineModelVersion", machine_model_version); | 102 enumerator->AddString("machineModelVersion", machine_model_version); |
95 EnumerateGPUDevice(enumerator, gpu); | 103 EnumerateGPUDevice(enumerator, gpu); |
96 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { | 104 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { |
97 EnumerateGPUDevice(enumerator, secondary_gpus[ii]); | 105 EnumerateGPUDevice(enumerator, secondary_gpus[ii]); |
98 } | 106 } |
99 | 107 |
100 enumerator->BeginAuxAttributes(); | 108 enumerator->BeginAuxAttributes(); |
101 enumerator->AddBool("finalized", finalized); | |
102 enumerator->AddTimeDeltaInSecondsF("initializationTime", | 109 enumerator->AddTimeDeltaInSecondsF("initializationTime", |
103 initialization_time); | 110 initialization_time); |
104 enumerator->AddBool("optimus", optimus); | 111 enumerator->AddBool("optimus", optimus); |
105 enumerator->AddBool("amdSwitchable", amd_switchable); | 112 enumerator->AddBool("amdSwitchable", amd_switchable); |
106 enumerator->AddBool("lenovoDcute", lenovo_dcute); | 113 enumerator->AddBool("lenovoDcute", lenovo_dcute); |
107 if (display_link_version.IsValid()) { | 114 if (display_link_version.IsValid()) { |
108 enumerator->AddString("displayLinkVersion", | 115 enumerator->AddString("displayLinkVersion", |
109 display_link_version.GetString()); | 116 display_link_version.GetString()); |
110 } | 117 } |
111 enumerator->AddInt64("adapterLuid", adapter_luid); | 118 enumerator->AddInt64("adapterLuid", adapter_luid); |
(...skipping 11 matching lines...) Expand all Loading... |
123 enumerator->AddString("glWsExtensions", gl_ws_extensions); | 130 enumerator->AddString("glWsExtensions", gl_ws_extensions); |
124 enumerator->AddInt( | 131 enumerator->AddInt( |
125 "glResetNotificationStrategy", | 132 "glResetNotificationStrategy", |
126 static_cast<int>(gl_reset_notification_strategy)); | 133 static_cast<int>(gl_reset_notification_strategy)); |
127 enumerator->AddBool("can_lose_context", can_lose_context); | 134 enumerator->AddBool("can_lose_context", can_lose_context); |
128 // TODO(kbr): add performance_stats. | 135 // TODO(kbr): add performance_stats. |
129 enumerator->AddBool("softwareRendering", software_rendering); | 136 enumerator->AddBool("softwareRendering", software_rendering); |
130 enumerator->AddBool("directRendering", direct_rendering); | 137 enumerator->AddBool("directRendering", direct_rendering); |
131 enumerator->AddBool("sandboxed", sandboxed); | 138 enumerator->AddBool("sandboxed", sandboxed); |
132 enumerator->AddInt("processCrashCount", process_crash_count); | 139 enumerator->AddInt("processCrashCount", process_crash_count); |
| 140 enumerator->AddInt("basicInfoState", basic_info_state); |
| 141 enumerator->AddInt("contextInfoState", context_info_state); |
| 142 #if defined(OS_WIN) |
| 143 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); |
| 144 #endif |
133 // TODO(kbr): add dx_diagnostics on Windows. | 145 // TODO(kbr): add dx_diagnostics on Windows. |
134 enumerator->EndAuxAttributes(); | 146 enumerator->EndAuxAttributes(); |
135 } | 147 } |
136 | 148 |
137 } // namespace gpu | 149 } // namespace gpu |
OLD | NEW |