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 EnumerateVideoDecodeAcceleratorSupportedProfile( |
| 21 const gpu::VideoDecodeAcceleratorSupportedProfile& profile, |
| 22 gpu::GPUInfo::Enumerator* enumerator) { |
| 23 enumerator->BeginVideoDecodeAcceleratorSupportedProfile(); |
| 24 enumerator->AddInt("profile", profile.profile); |
| 25 enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); |
| 26 enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); |
| 27 enumerator->AddInt("minResolutionWidth", profile.min_resolution.width()); |
| 28 enumerator->AddInt("minResolutionHeight", profile.min_resolution.height()); |
| 29 enumerator->EndVideoDecodeAcceleratorSupportedProfile(); |
| 30 } |
| 31 |
20 void EnumerateVideoEncodeAcceleratorSupportedProfile( | 32 void EnumerateVideoEncodeAcceleratorSupportedProfile( |
21 gpu::GPUInfo::Enumerator* enumerator, | 33 const gpu::VideoEncodeAcceleratorSupportedProfile& profile, |
22 const gpu::VideoEncodeAcceleratorSupportedProfile profile) { | 34 gpu::GPUInfo::Enumerator* enumerator) { |
23 enumerator->BeginVideoEncodeAcceleratorSupportedProfile(); | 35 enumerator->BeginVideoEncodeAcceleratorSupportedProfile(); |
24 enumerator->AddInt("profile", profile.profile); | 36 enumerator->AddInt("profile", profile.profile); |
25 enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); | 37 enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); |
26 enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); | 38 enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); |
27 enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator); | 39 enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator); |
28 enumerator->AddInt("maxFramerateDenominator", | 40 enumerator->AddInt("maxFramerateDenominator", |
29 profile.max_framerate_denominator); | 41 profile.max_framerate_denominator); |
30 enumerator->EndVideoEncodeAcceleratorSupportedProfile(); | 42 enumerator->EndVideoEncodeAcceleratorSupportedProfile(); |
31 } | 43 } |
32 | 44 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool software_rendering; | 106 bool software_rendering; |
95 bool direct_rendering; | 107 bool direct_rendering; |
96 bool sandboxed; | 108 bool sandboxed; |
97 int process_crash_count; | 109 int process_crash_count; |
98 CollectInfoResult basic_info_state; | 110 CollectInfoResult basic_info_state; |
99 CollectInfoResult context_info_state; | 111 CollectInfoResult context_info_state; |
100 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
101 CollectInfoResult dx_diagnostics_info_state; | 113 CollectInfoResult dx_diagnostics_info_state; |
102 DxDiagNode dx_diagnostics; | 114 DxDiagNode dx_diagnostics; |
103 #endif | 115 #endif |
| 116 bool support_query_video_decode_profiles; |
| 117 std::vector<VideoDecodeAcceleratorSupportedProfile> |
| 118 video_decode_accelerator_supported_profiles; |
104 std::vector<VideoEncodeAcceleratorSupportedProfile> | 119 std::vector<VideoEncodeAcceleratorSupportedProfile> |
105 video_encode_accelerator_supported_profiles; | 120 video_encode_accelerator_supported_profiles; |
106 }; | 121 }; |
107 | 122 |
108 // If this assert fails then most likely something below needs to be updated. | 123 // 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 | 124 // 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. | 125 // GPUInfo which fits within the current padding then it will not be caught. |
111 static_assert( | 126 static_assert( |
112 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), | 127 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), |
113 "fields have changed in GPUInfo, GPUInfoKnownFields must be updated"); | 128 "fields have changed in GPUInfo, GPUInfoKnownFields must be updated"); |
114 | 129 |
115 // Required fields (according to DevTools protocol) first. | 130 // Required fields (according to DevTools protocol) first. |
116 enumerator->AddString("machineModelName", machine_model_name); | 131 enumerator->AddString("machineModelName", machine_model_name); |
117 enumerator->AddString("machineModelVersion", machine_model_version); | 132 enumerator->AddString("machineModelVersion", machine_model_version); |
118 EnumerateGPUDevice(enumerator, gpu); | 133 EnumerateGPUDevice(gpu, enumerator); |
119 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { | 134 for (const auto& secondary_gpu: secondary_gpus) |
120 EnumerateGPUDevice(enumerator, secondary_gpus[ii]); | 135 EnumerateGPUDevice(secondary_gpu, enumerator); |
121 } | |
122 | 136 |
123 enumerator->BeginAuxAttributes(); | 137 enumerator->BeginAuxAttributes(); |
124 enumerator->AddTimeDeltaInSecondsF("initializationTime", | 138 enumerator->AddTimeDeltaInSecondsF("initializationTime", |
125 initialization_time); | 139 initialization_time); |
126 enumerator->AddBool("optimus", optimus); | 140 enumerator->AddBool("optimus", optimus); |
127 enumerator->AddBool("amdSwitchable", amd_switchable); | 141 enumerator->AddBool("amdSwitchable", amd_switchable); |
128 enumerator->AddBool("lenovoDcute", lenovo_dcute); | 142 enumerator->AddBool("lenovoDcute", lenovo_dcute); |
129 if (display_link_version.IsValid()) { | 143 if (display_link_version.IsValid()) { |
130 enumerator->AddString("displayLinkVersion", | 144 enumerator->AddString("displayLinkVersion", |
131 display_link_version.GetString()); | 145 display_link_version.GetString()); |
(...skipping 19 matching lines...) Expand all Loading... |
151 enumerator->AddBool("softwareRendering", software_rendering); | 165 enumerator->AddBool("softwareRendering", software_rendering); |
152 enumerator->AddBool("directRendering", direct_rendering); | 166 enumerator->AddBool("directRendering", direct_rendering); |
153 enumerator->AddBool("sandboxed", sandboxed); | 167 enumerator->AddBool("sandboxed", sandboxed); |
154 enumerator->AddInt("processCrashCount", process_crash_count); | 168 enumerator->AddInt("processCrashCount", process_crash_count); |
155 enumerator->AddInt("basicInfoState", basic_info_state); | 169 enumerator->AddInt("basicInfoState", basic_info_state); |
156 enumerator->AddInt("contextInfoState", context_info_state); | 170 enumerator->AddInt("contextInfoState", context_info_state); |
157 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
158 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); | 172 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); |
159 #endif | 173 #endif |
160 // TODO(kbr): add dx_diagnostics on Windows. | 174 // TODO(kbr): add dx_diagnostics on Windows. |
161 for (size_t ii = 0; ii < video_encode_accelerator_supported_profiles.size(); | 175 enumerator->AddBool("supportQueryVideoDecodeProfiles", |
162 ++ii) { | 176 support_query_video_decode_profiles); |
163 EnumerateVideoEncodeAcceleratorSupportedProfile( | 177 for (const auto& profile : video_decode_accelerator_supported_profiles) |
164 enumerator, video_encode_accelerator_supported_profiles[ii]); | 178 EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator); |
165 } | 179 for (const auto& profile : video_encode_accelerator_supported_profiles) |
| 180 EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator); |
166 enumerator->EndAuxAttributes(); | 181 enumerator->EndAuxAttributes(); |
167 } | 182 } |
168 | 183 |
169 } // namespace gpu | 184 } // namespace gpu |
OLD | NEW |