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(const gpu::GPUInfo::GPUDevice& device, |
10 const gpu::GPUInfo::GPUDevice& device) { | 10 gpu::GPUInfo::Enumerator* enumerator) { |
11 enumerator->BeginGPUDevice(); | 11 enumerator->BeginGPUDevice(); |
12 enumerator->AddInt("vendorId", device.vendor_id); | 12 enumerator->AddInt("vendorId", device.vendor_id); |
13 enumerator->AddInt("deviceId", device.device_id); | 13 enumerator->AddInt("deviceId", device.device_id); |
14 enumerator->AddBool("active", device.active); | 14 enumerator->AddBool("active", device.active); |
15 enumerator->AddString("vendorString", device.vendor_string); | 15 enumerator->AddString("vendorString", device.vendor_string); |
16 enumerator->AddString("deviceString", device.device_string); | 16 enumerator->AddString("deviceString", device.device_string); |
17 enumerator->EndGPUDevice(); | 17 enumerator->EndGPUDevice(); |
18 } | 18 } |
19 | 19 |
| 20 void EnumerateVideoDecodeAcceleratorSupportedResolution( |
| 21 const gpu::VideoDecodeAcceleratorSupportedResolution& resolution, |
| 22 gpu::GPUInfo::Enumerator* enumerator) { |
| 23 enumerator->AddInt( |
| 24 "videoDecodeAcceleratorSupportedResolutionMinWidth", |
| 25 resolution.min.width()); |
| 26 enumerator->AddInt( |
| 27 "videoDecodeAcceleratorSupportedResolutionMinHeight", |
| 28 resolution.min.height()); |
| 29 enumerator->AddInt( |
| 30 "videoDecodeAcceleratorSupportedResolutionMaxWidth", |
| 31 resolution.max.width()); |
| 32 enumerator->AddInt( |
| 33 "videoDecodeAcceleratorSupportedResolutionMaxHeight", |
| 34 resolution.max.height()); |
| 35 } |
| 36 |
20 void EnumerateVideoEncodeAcceleratorSupportedProfile( | 37 void EnumerateVideoEncodeAcceleratorSupportedProfile( |
21 gpu::GPUInfo::Enumerator* enumerator, | 38 const gpu::VideoEncodeAcceleratorSupportedProfile& profile, |
22 const gpu::VideoEncodeAcceleratorSupportedProfile profile) { | 39 gpu::GPUInfo::Enumerator* enumerator) { |
23 enumerator->BeginVideoEncodeAcceleratorSupportedProfile(); | 40 enumerator->BeginVideoEncodeAcceleratorSupportedProfile(); |
24 enumerator->AddInt("profile", profile.profile); | 41 enumerator->AddInt("profile", profile.profile); |
25 enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); | 42 enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); |
26 enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); | 43 enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); |
27 enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator); | 44 enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator); |
28 enumerator->AddInt("maxFramerateDenominator", | 45 enumerator->AddInt("maxFramerateDenominator", |
29 profile.max_framerate_denominator); | 46 profile.max_framerate_denominator); |
30 enumerator->EndVideoEncodeAcceleratorSupportedProfile(); | 47 enumerator->EndVideoEncodeAcceleratorSupportedProfile(); |
31 } | 48 } |
32 | 49 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool software_rendering; | 111 bool software_rendering; |
95 bool direct_rendering; | 112 bool direct_rendering; |
96 bool sandboxed; | 113 bool sandboxed; |
97 int process_crash_count; | 114 int process_crash_count; |
98 CollectInfoResult basic_info_state; | 115 CollectInfoResult basic_info_state; |
99 CollectInfoResult context_info_state; | 116 CollectInfoResult context_info_state; |
100 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
101 CollectInfoResult dx_diagnostics_info_state; | 118 CollectInfoResult dx_diagnostics_info_state; |
102 DxDiagNode dx_diagnostics; | 119 DxDiagNode dx_diagnostics; |
103 #endif | 120 #endif |
| 121 VideoDecodeAcceleratorSupportedResolution |
| 122 video_decode_accelerator_supported_resolution; |
104 std::vector<VideoEncodeAcceleratorSupportedProfile> | 123 std::vector<VideoEncodeAcceleratorSupportedProfile> |
105 video_encode_accelerator_supported_profiles; | 124 video_encode_accelerator_supported_profiles; |
106 }; | 125 }; |
107 | 126 |
108 // If this assert fails then most likely something below needs to be updated. | 127 // If this assert fails then most likely something below needs to be updated. |
109 // Note that this assert is only approximate. If a new field is added to | 128 // Note that this assert is only approximate. If a new field is added to |
110 // GPUInfo which fits within the current padding then it will not be caught. | 129 // GPUInfo which fits within the current padding then it will not be caught. |
111 COMPILE_ASSERT( | 130 COMPILE_ASSERT( |
112 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), | 131 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), |
113 Fields_Have_Changed_In_GPUInfo_So_Update_Below); | 132 Fields_Have_Changed_In_GPUInfo_So_Update_Below); |
114 | 133 |
115 // Required fields (according to DevTools protocol) first. | 134 // Required fields (according to DevTools protocol) first. |
116 enumerator->AddString("machineModelName", machine_model_name); | 135 enumerator->AddString("machineModelName", machine_model_name); |
117 enumerator->AddString("machineModelVersion", machine_model_version); | 136 enumerator->AddString("machineModelVersion", machine_model_version); |
118 EnumerateGPUDevice(enumerator, gpu); | 137 EnumerateGPUDevice(gpu, enumerator); |
119 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { | 138 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { |
120 EnumerateGPUDevice(enumerator, secondary_gpus[ii]); | 139 EnumerateGPUDevice(secondary_gpus[ii], enumerator); |
121 } | 140 } |
122 | 141 |
123 enumerator->BeginAuxAttributes(); | 142 enumerator->BeginAuxAttributes(); |
124 enumerator->AddTimeDeltaInSecondsF("initializationTime", | 143 enumerator->AddTimeDeltaInSecondsF("initializationTime", |
125 initialization_time); | 144 initialization_time); |
126 enumerator->AddBool("optimus", optimus); | 145 enumerator->AddBool("optimus", optimus); |
127 enumerator->AddBool("amdSwitchable", amd_switchable); | 146 enumerator->AddBool("amdSwitchable", amd_switchable); |
128 enumerator->AddBool("lenovoDcute", lenovo_dcute); | 147 enumerator->AddBool("lenovoDcute", lenovo_dcute); |
129 if (display_link_version.IsValid()) { | 148 if (display_link_version.IsValid()) { |
130 enumerator->AddString("displayLinkVersion", | 149 enumerator->AddString("displayLinkVersion", |
(...skipping 20 matching lines...) Expand all Loading... |
151 enumerator->AddBool("softwareRendering", software_rendering); | 170 enumerator->AddBool("softwareRendering", software_rendering); |
152 enumerator->AddBool("directRendering", direct_rendering); | 171 enumerator->AddBool("directRendering", direct_rendering); |
153 enumerator->AddBool("sandboxed", sandboxed); | 172 enumerator->AddBool("sandboxed", sandboxed); |
154 enumerator->AddInt("processCrashCount", process_crash_count); | 173 enumerator->AddInt("processCrashCount", process_crash_count); |
155 enumerator->AddInt("basicInfoState", basic_info_state); | 174 enumerator->AddInt("basicInfoState", basic_info_state); |
156 enumerator->AddInt("contextInfoState", context_info_state); | 175 enumerator->AddInt("contextInfoState", context_info_state); |
157 #if defined(OS_WIN) | 176 #if defined(OS_WIN) |
158 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); | 177 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); |
159 #endif | 178 #endif |
160 // TODO(kbr): add dx_diagnostics on Windows. | 179 // TODO(kbr): add dx_diagnostics on Windows. |
| 180 EnumerateVideoDecodeAcceleratorSupportedResolution( |
| 181 video_decode_accelerator_supported_resolution, enumerator); |
161 for (size_t ii = 0; ii < video_encode_accelerator_supported_profiles.size(); | 182 for (size_t ii = 0; ii < video_encode_accelerator_supported_profiles.size(); |
162 ++ii) { | 183 ++ii) { |
163 EnumerateVideoEncodeAcceleratorSupportedProfile( | 184 EnumerateVideoEncodeAcceleratorSupportedProfile( |
164 enumerator, video_encode_accelerator_supported_profiles[ii]); | 185 video_encode_accelerator_supported_profiles[ii], enumerator); |
165 } | 186 } |
166 enumerator->EndAuxAttributes(); | 187 enumerator->EndAuxAttributes(); |
167 } | 188 } |
168 | 189 |
169 } // namespace gpu | 190 } // namespace gpu |
OLD | NEW |