| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 bool software_rendering; | 105 bool software_rendering; |
| 94 bool direct_rendering; | 106 bool direct_rendering; |
| 95 bool sandboxed; | 107 bool sandboxed; |
| 96 int process_crash_count; | 108 int process_crash_count; |
| 97 CollectInfoResult basic_info_state; | 109 CollectInfoResult basic_info_state; |
| 98 CollectInfoResult context_info_state; | 110 CollectInfoResult context_info_state; |
| 99 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 100 CollectInfoResult dx_diagnostics_info_state; | 112 CollectInfoResult dx_diagnostics_info_state; |
| 101 DxDiagNode dx_diagnostics; | 113 DxDiagNode dx_diagnostics; |
| 102 #endif | 114 #endif |
| 115 std::vector<VideoDecodeAcceleratorSupportedProfile> |
| 116 video_decode_accelerator_supported_profiles; |
| 103 std::vector<VideoEncodeAcceleratorSupportedProfile> | 117 std::vector<VideoEncodeAcceleratorSupportedProfile> |
| 104 video_encode_accelerator_supported_profiles; | 118 video_encode_accelerator_supported_profiles; |
| 105 }; | 119 }; |
| 106 | 120 |
| 107 // If this assert fails then most likely something below needs to be updated. | 121 // If this assert fails then most likely something below needs to be updated. |
| 108 // Note that this assert is only approximate. If a new field is added to | 122 // Note that this assert is only approximate. If a new field is added to |
| 109 // GPUInfo which fits within the current padding then it will not be caught. | 123 // GPUInfo which fits within the current padding then it will not be caught. |
| 110 static_assert( | 124 static_assert( |
| 111 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), | 125 sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), |
| 112 "fields have changed in GPUInfo, GPUInfoKnownFields must be updated"); | 126 "fields have changed in GPUInfo, GPUInfoKnownFields must be updated"); |
| 113 | 127 |
| 114 // Required fields (according to DevTools protocol) first. | 128 // Required fields (according to DevTools protocol) first. |
| 115 enumerator->AddString("machineModelName", machine_model_name); | 129 enumerator->AddString("machineModelName", machine_model_name); |
| 116 enumerator->AddString("machineModelVersion", machine_model_version); | 130 enumerator->AddString("machineModelVersion", machine_model_version); |
| 117 EnumerateGPUDevice(enumerator, gpu); | 131 EnumerateGPUDevice(gpu, enumerator); |
| 118 for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) { | 132 for (const auto& secondary_gpu: secondary_gpus) |
| 119 EnumerateGPUDevice(enumerator, secondary_gpus[ii]); | 133 EnumerateGPUDevice(secondary_gpu, enumerator); |
| 120 } | |
| 121 | 134 |
| 122 enumerator->BeginAuxAttributes(); | 135 enumerator->BeginAuxAttributes(); |
| 123 enumerator->AddTimeDeltaInSecondsF("initializationTime", | 136 enumerator->AddTimeDeltaInSecondsF("initializationTime", |
| 124 initialization_time); | 137 initialization_time); |
| 125 enumerator->AddBool("optimus", optimus); | 138 enumerator->AddBool("optimus", optimus); |
| 126 enumerator->AddBool("amdSwitchable", amd_switchable); | 139 enumerator->AddBool("amdSwitchable", amd_switchable); |
| 127 enumerator->AddBool("lenovoDcute", lenovo_dcute); | 140 enumerator->AddBool("lenovoDcute", lenovo_dcute); |
| 128 if (display_link_version.IsValid()) { | 141 if (display_link_version.IsValid()) { |
| 129 enumerator->AddString("displayLinkVersion", | 142 enumerator->AddString("displayLinkVersion", |
| 130 display_link_version.GetString()); | 143 display_link_version.GetString()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 150 enumerator->AddBool("softwareRendering", software_rendering); | 163 enumerator->AddBool("softwareRendering", software_rendering); |
| 151 enumerator->AddBool("directRendering", direct_rendering); | 164 enumerator->AddBool("directRendering", direct_rendering); |
| 152 enumerator->AddBool("sandboxed", sandboxed); | 165 enumerator->AddBool("sandboxed", sandboxed); |
| 153 enumerator->AddInt("processCrashCount", process_crash_count); | 166 enumerator->AddInt("processCrashCount", process_crash_count); |
| 154 enumerator->AddInt("basicInfoState", basic_info_state); | 167 enumerator->AddInt("basicInfoState", basic_info_state); |
| 155 enumerator->AddInt("contextInfoState", context_info_state); | 168 enumerator->AddInt("contextInfoState", context_info_state); |
| 156 #if defined(OS_WIN) | 169 #if defined(OS_WIN) |
| 157 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); | 170 enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state); |
| 158 #endif | 171 #endif |
| 159 // TODO(kbr): add dx_diagnostics on Windows. | 172 // TODO(kbr): add dx_diagnostics on Windows. |
| 160 for (size_t ii = 0; ii < video_encode_accelerator_supported_profiles.size(); | 173 for (const auto& profile : video_decode_accelerator_supported_profiles) |
| 161 ++ii) { | 174 EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator); |
| 162 EnumerateVideoEncodeAcceleratorSupportedProfile( | 175 for (const auto& profile : video_encode_accelerator_supported_profiles) |
| 163 enumerator, video_encode_accelerator_supported_profiles[ii]); | 176 EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator); |
| 164 } | |
| 165 enumerator->EndAuxAttributes(); | 177 enumerator->EndAuxAttributes(); |
| 166 } | 178 } |
| 167 | 179 |
| 168 } // namespace gpu | 180 } // namespace gpu |
| OLD | NEW |