[email protected] | 84ad3a7 | 2012-02-07 00:29:45 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | a80f5ece | 2011-10-20 23:56:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
avi | f15d60a | 2015-12-21 17:06:33 | [diff] [blame] | 5 | #include <stdint.h> |
| 6 | |
[email protected] | d7b5cc7 | 2013-05-23 20:05:00 | [diff] [blame] | 7 | #include "gpu/config/gpu_info.h" |
Zhenyao Mo | 964f683 | 2019-09-17 01:41:09 | [diff] [blame] | 8 | #include "gpu/config/gpu_util.h" |
[email protected] | a80f5ece | 2011-10-20 23:56:55 | [diff] [blame] | 9 | |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 10 | namespace { |
| 11 | |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 12 | void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device, |
| 13 | gpu::GPUInfo::Enumerator* enumerator) { |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 14 | enumerator->BeginGPUDevice(); |
| 15 | enumerator->AddInt("vendorId", device.vendor_id); |
| 16 | enumerator->AddInt("deviceId", device.device_id); |
Zhenyao Mo | 1d8d106a | 2019-09-26 19:32:41 | [diff] [blame] | 17 | #if defined(OS_WIN) |
| 18 | enumerator->AddInt("subSysId", device.sub_sys_id); |
| 19 | enumerator->AddInt("revision", device.revision); |
| 20 | #endif // OS_WIN |
[email protected] | 20e7cfc | 2014-04-02 17:33:13 | [diff] [blame] | 21 | enumerator->AddBool("active", device.active); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 22 | enumerator->AddString("vendorString", device.vendor_string); |
| 23 | enumerator->AddString("deviceString", device.device_string); |
Zhenyao Mo | fbea81d | 2018-06-01 17:29:27 | [diff] [blame] | 24 | enumerator->AddString("driverVendor", device.driver_vendor); |
| 25 | enumerator->AddString("driverVersion", device.driver_version); |
Olli Etuaho | 1241aea | 2018-08-09 07:49:15 | [diff] [blame] | 26 | enumerator->AddInt("cudaComputeCapabilityMajor", |
| 27 | device.cuda_compute_capability_major); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 28 | enumerator->EndGPUDevice(); |
| 29 | } |
| 30 | |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 31 | void EnumerateVideoDecodeAcceleratorSupportedProfile( |
| 32 | const gpu::VideoDecodeAcceleratorSupportedProfile& profile, |
| 33 | gpu::GPUInfo::Enumerator* enumerator) { |
| 34 | enumerator->BeginVideoDecodeAcceleratorSupportedProfile(); |
| 35 | enumerator->AddInt("profile", profile.profile); |
| 36 | enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); |
| 37 | enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); |
| 38 | enumerator->AddInt("minResolutionWidth", profile.min_resolution.width()); |
| 39 | enumerator->AddInt("minResolutionHeight", profile.min_resolution.height()); |
dalecurtis | 4708098a | 2016-03-19 04:54:11 | [diff] [blame] | 40 | enumerator->AddBool("encrypted_only", profile.encrypted_only); |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 41 | enumerator->EndVideoDecodeAcceleratorSupportedProfile(); |
| 42 | } |
| 43 | |
wuchengli | 7980832 | 2014-09-23 05:58:14 | [diff] [blame] | 44 | void EnumerateVideoEncodeAcceleratorSupportedProfile( |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 45 | const gpu::VideoEncodeAcceleratorSupportedProfile& profile, |
| 46 | gpu::GPUInfo::Enumerator* enumerator) { |
wuchengli | 7980832 | 2014-09-23 05:58:14 | [diff] [blame] | 47 | enumerator->BeginVideoEncodeAcceleratorSupportedProfile(); |
| 48 | enumerator->AddInt("profile", profile.profile); |
Miguel Casas | 4f26c55 | 2019-10-09 01:11:39 | [diff] [blame] | 49 | enumerator->AddInt("minResolutionWidth", profile.min_resolution.width()); |
| 50 | enumerator->AddInt("minResolutionHeight", profile.min_resolution.height()); |
wuchengli | 7980832 | 2014-09-23 05:58:14 | [diff] [blame] | 51 | enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width()); |
| 52 | enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height()); |
| 53 | enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator); |
| 54 | enumerator->AddInt("maxFramerateDenominator", |
| 55 | profile.max_framerate_denominator); |
| 56 | enumerator->EndVideoEncodeAcceleratorSupportedProfile(); |
| 57 | } |
| 58 | |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 59 | const char* ImageDecodeAcceleratorTypeToString( |
| 60 | gpu::ImageDecodeAcceleratorType type) { |
| 61 | switch (type) { |
| 62 | case gpu::ImageDecodeAcceleratorType::kJpeg: |
| 63 | return "JPEG"; |
Gil Dekel | e2f8e252 | 2019-07-23 21:17:35 | [diff] [blame] | 64 | case gpu::ImageDecodeAcceleratorType::kWebP: |
| 65 | return "WebP"; |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 66 | case gpu::ImageDecodeAcceleratorType::kUnknown: |
| 67 | return "Unknown"; |
| 68 | } |
Gil Dekel | e2f8e252 | 2019-07-23 21:17:35 | [diff] [blame] | 69 | NOTREACHED() << "Invalid ImageDecodeAcceleratorType."; |
| 70 | return ""; |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | const char* ImageDecodeAcceleratorSubsamplingToString( |
| 74 | gpu::ImageDecodeAcceleratorSubsampling subsampling) { |
| 75 | switch (subsampling) { |
| 76 | case gpu::ImageDecodeAcceleratorSubsampling::k420: |
| 77 | return "4:2:0"; |
| 78 | case gpu::ImageDecodeAcceleratorSubsampling::k422: |
| 79 | return "4:2:2"; |
Andres Calderon Jaramillo | 4fdf6c4 | 2019-03-21 15:45:06 | [diff] [blame] | 80 | case gpu::ImageDecodeAcceleratorSubsampling::k444: |
| 81 | return "4:4:4"; |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 82 | } |
| 83 | } |
| 84 | |
| 85 | void EnumerateImageDecodeAcceleratorSupportedProfile( |
| 86 | const gpu::ImageDecodeAcceleratorSupportedProfile& profile, |
| 87 | gpu::GPUInfo::Enumerator* enumerator) { |
| 88 | enumerator->BeginImageDecodeAcceleratorSupportedProfile(); |
| 89 | enumerator->AddString("imageType", |
| 90 | ImageDecodeAcceleratorTypeToString(profile.image_type)); |
| 91 | enumerator->AddString("minEncodedDimensions", |
| 92 | profile.min_encoded_dimensions.ToString()); |
| 93 | enumerator->AddString("maxEncodedDimensions", |
| 94 | profile.max_encoded_dimensions.ToString()); |
| 95 | std::string subsamplings; |
| 96 | for (size_t i = 0; i < profile.subsamplings.size(); i++) { |
| 97 | if (i > 0) |
| 98 | subsamplings += ", "; |
| 99 | subsamplings += |
| 100 | ImageDecodeAcceleratorSubsamplingToString(profile.subsamplings[i]); |
| 101 | } |
| 102 | enumerator->AddString("subsamplings", subsamplings); |
| 103 | enumerator->EndImageDecodeAcceleratorSupportedProfile(); |
| 104 | } |
| 105 | |
Sunny Sachanandani | fc66e9a | 2018-07-10 18:08:29 | [diff] [blame] | 106 | #if defined(OS_WIN) |
Zhenyao Mo | da88bdc | 2018-09-27 01:47:33 | [diff] [blame] | 107 | void EnumerateDx12VulkanVersionInfo(const gpu::Dx12VulkanVersionInfo& info, |
| 108 | gpu::GPUInfo::Enumerator* enumerator) { |
| 109 | enumerator->BeginDx12VulkanVersionInfo(); |
| 110 | enumerator->AddBool("supportsDx12", info.supports_dx12); |
| 111 | enumerator->AddBool("supportsVulkan", info.supports_vulkan); |
Zhenyao Mo | 964f683 | 2019-09-17 01:41:09 | [diff] [blame] | 112 | enumerator->AddString("dx12FeatureLevel", |
| 113 | gpu::D3DFeatureLevelToString(info.d3d12_feature_level)); |
| 114 | enumerator->AddString("vulkanVersion", |
| 115 | gpu::VulkanVersionToString(info.vulkan_version)); |
Zhenyao Mo | da88bdc | 2018-09-27 01:47:33 | [diff] [blame] | 116 | enumerator->EndDx12VulkanVersionInfo(); |
| 117 | } |
Sunny Sachanandani | fc66e9a | 2018-07-10 18:08:29 | [diff] [blame] | 118 | #endif |
| 119 | |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 120 | } // namespace |
| 121 | |
[email protected] | d7b5cc7 | 2013-05-23 20:05:00 | [diff] [blame] | 122 | namespace gpu { |
[email protected] | a80f5ece | 2011-10-20 23:56:55 | [diff] [blame] | 123 | |
Sunny Sachanandani | 3dcb5da | 2018-10-18 04:59:43 | [diff] [blame] | 124 | #if defined(OS_WIN) |
Zhenyao Mo | 4178e19 | 2019-05-16 21:46:11 | [diff] [blame] | 125 | const char* OverlaySupportToString(gpu::OverlaySupport support) { |
| 126 | switch (support) { |
| 127 | case gpu::OverlaySupport::kNone: |
| 128 | return "NONE"; |
| 129 | case gpu::OverlaySupport::kDirect: |
| 130 | return "DIRECT"; |
| 131 | case gpu::OverlaySupport::kScaling: |
| 132 | return "SCALING"; |
Sunny Sachanandani | fc66e9a | 2018-07-10 18:08:29 | [diff] [blame] | 133 | } |
Sunny Sachanandani | fc66e9a | 2018-07-10 18:08:29 | [diff] [blame] | 134 | } |
Zhenyao Mo | 4178e19 | 2019-05-16 21:46:11 | [diff] [blame] | 135 | #endif // OS_WIN |
Sunny Sachanandani | fc66e9a | 2018-07-10 18:08:29 | [diff] [blame] | 136 | |
liberato | 57587790 | 2015-12-10 17:16:26 | [diff] [blame] | 137 | VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities() |
| 138 | : flags(0) {} |
| 139 | |
vmpstr | 3b7b8b2 | 2016-03-01 23:00:20 | [diff] [blame] | 140 | VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities( |
| 141 | const VideoDecodeAcceleratorCapabilities& other) = default; |
| 142 | |
Chris Watkins | 8103077 | 2017-12-07 01:20:56 | [diff] [blame] | 143 | VideoDecodeAcceleratorCapabilities::~VideoDecodeAcceleratorCapabilities() = |
| 144 | default; |
liberato | 57587790 | 2015-12-10 17:16:26 | [diff] [blame] | 145 | |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 146 | ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile() |
| 147 | : image_type(ImageDecodeAcceleratorType::kUnknown) {} |
| 148 | |
| 149 | ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile( |
| 150 | const ImageDecodeAcceleratorSupportedProfile& other) = default; |
| 151 | |
| 152 | ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile( |
| 153 | ImageDecodeAcceleratorSupportedProfile&& other) = default; |
| 154 | |
| 155 | ImageDecodeAcceleratorSupportedProfile:: |
| 156 | ~ImageDecodeAcceleratorSupportedProfile() = default; |
| 157 | |
| 158 | ImageDecodeAcceleratorSupportedProfile& ImageDecodeAcceleratorSupportedProfile:: |
| 159 | operator=(const ImageDecodeAcceleratorSupportedProfile& other) = default; |
| 160 | |
| 161 | ImageDecodeAcceleratorSupportedProfile& ImageDecodeAcceleratorSupportedProfile:: |
| 162 | operator=(ImageDecodeAcceleratorSupportedProfile&& other) = default; |
| 163 | |
Zhenyao Mo | 1d8d106a | 2019-09-26 19:32:41 | [diff] [blame] | 164 | GPUInfo::GPUDevice::GPUDevice() = default; |
[email protected] | a094e2c | 2012-05-10 23:02:42 | [diff] [blame] | 165 | |
Zhenyao Mo | fbea81d | 2018-06-01 17:29:27 | [diff] [blame] | 166 | GPUInfo::GPUDevice::GPUDevice(const GPUInfo::GPUDevice& other) = default; |
| 167 | |
| 168 | GPUInfo::GPUDevice::GPUDevice(GPUInfo::GPUDevice&& other) noexcept = default; |
| 169 | |
| 170 | GPUInfo::GPUDevice::~GPUDevice() noexcept = default; |
| 171 | |
| 172 | GPUInfo::GPUDevice& GPUInfo::GPUDevice::operator=( |
| 173 | const GPUInfo::GPUDevice& other) = default; |
| 174 | |
| 175 | GPUInfo::GPUDevice& GPUInfo::GPUDevice::operator=( |
| 176 | GPUInfo::GPUDevice&& other) noexcept = default; |
[email protected] | a094e2c | 2012-05-10 23:02:42 | [diff] [blame] | 177 | |
[email protected] | a80f5ece | 2011-10-20 23:56:55 | [diff] [blame] | 178 | GPUInfo::GPUInfo() |
zmo | 84eae5e | 2014-09-05 01:36:23 | [diff] [blame] | 179 | : optimus(false), |
[email protected] | c32b0c2c | 2012-04-07 01:34:33 | [diff] [blame] | 180 | amd_switchable(false), |
[email protected] | 6c7784e | 2013-08-01 22:41:28 | [diff] [blame] | 181 | gl_reset_notification_strategy(0), |
[email protected] | fad3ccf | 2012-09-11 22:36:00 | [diff] [blame] | 182 | software_rendering(false), |
[email protected] | 4775298 | 2014-07-29 08:01:43 | [diff] [blame] | 183 | sandboxed(false), |
bajones | e3677b649ff | 2015-07-25 00:41:56 | [diff] [blame] | 184 | in_process_gpu(true), |
geofflang | 774e87a | 2016-12-05 16:29:01 | [diff] [blame] | 185 | passthrough_cmd_decoder(false), |
Jonathan Backer | a57031b | 2018-06-04 15:44:32 | [diff] [blame] | 186 | jpeg_decode_accelerator_supported(false), |
Antonio Gomes | 5b4d98e | 2017-08-24 05:53:07 | [diff] [blame] | 187 | #if defined(USE_X11) |
thomasanderson | 62ba78ff | 2016-10-01 02:03:42 | [diff] [blame] | 188 | system_visual(0), |
Jonathan Backer | a57031b | 2018-06-04 15:44:32 | [diff] [blame] | 189 | rgba_visual(0), |
thomasanderson | 62ba78ff | 2016-10-01 02:03:42 | [diff] [blame] | 190 | #endif |
Mitsuru Oshima | 345e9b5 | 2019-10-19 00:07:36 | [diff] [blame^] | 191 | oop_rasterization_supported(false), |
| 192 | subpixel_font_rendering(true) { |
[email protected] | a80f5ece | 2011-10-20 23:56:55 | [diff] [blame] | 193 | } |
| 194 | |
vmpstr | 3b7b8b2 | 2016-03-01 23:00:20 | [diff] [blame] | 195 | GPUInfo::GPUInfo(const GPUInfo& other) = default; |
| 196 | |
Chris Watkins | 8103077 | 2017-12-07 01:20:56 | [diff] [blame] | 197 | GPUInfo::~GPUInfo() = default; |
[email protected] | a80f5ece | 2011-10-20 23:56:55 | [diff] [blame] | 198 | |
Zhenyao Mo | fbea81d | 2018-06-01 17:29:27 | [diff] [blame] | 199 | GPUInfo::GPUDevice& GPUInfo::active_gpu() { |
| 200 | return const_cast<GPUInfo::GPUDevice&>( |
| 201 | const_cast<const GPUInfo&>(*this).active_gpu()); |
| 202 | } |
| 203 | |
ccameron | 8c3b0dd13 | 2017-05-16 19:30:50 | [diff] [blame] | 204 | const GPUInfo::GPUDevice& GPUInfo::active_gpu() const { |
Zhenyao Mo | c4f79c3 | 2018-01-27 02:44:13 | [diff] [blame] | 205 | if (gpu.active || secondary_gpus.empty()) |
ccameron | 8c3b0dd13 | 2017-05-16 19:30:50 | [diff] [blame] | 206 | return gpu; |
Zhenyao Mo | fbea81d | 2018-06-01 17:29:27 | [diff] [blame] | 207 | for (const auto& secondary_gpu : secondary_gpus) { |
ccameron | 8c3b0dd13 | 2017-05-16 19:30:50 | [diff] [blame] | 208 | if (secondary_gpu.active) |
| 209 | return secondary_gpu; |
| 210 | } |
Zhenyao Mo | fbea81d | 2018-06-01 17:29:27 | [diff] [blame] | 211 | DVLOG(2) << "No active GPU found, returning primary GPU."; |
ccameron | 8c3b0dd13 | 2017-05-16 19:30:50 | [diff] [blame] | 212 | return gpu; |
| 213 | } |
| 214 | |
Zhenyao Mo | 68ef56d | 2018-04-21 01:05:10 | [diff] [blame] | 215 | bool GPUInfo::IsInitialized() const { |
| 216 | return gpu.vendor_id != 0 || !gl_vendor.empty(); |
| 217 | } |
| 218 | |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 219 | void GPUInfo::EnumerateFields(Enumerator* enumerator) const { |
| 220 | struct GPUInfoKnownFields { |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 221 | base::TimeDelta initialization_time; |
| 222 | bool optimus; |
| 223 | bool amd_switchable; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 224 | GPUDevice gpu; |
| 225 | std::vector<GPUDevice> secondary_gpus; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 226 | std::string pixel_shader_version; |
| 227 | std::string vertex_shader_version; |
senorblanco | b7a64d57 | 2015-04-08 16:59:02 | [diff] [blame] | 228 | std::string max_msaa_samples; |
[email protected] | 2ac8e51c | 2014-04-21 20:54:13 | [diff] [blame] | 229 | std::string machine_model_name; |
| 230 | std::string machine_model_version; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 231 | std::string gl_version_string; |
| 232 | std::string gl_vendor; |
| 233 | std::string gl_renderer; |
| 234 | std::string gl_extensions; |
| 235 | std::string gl_ws_vendor; |
| 236 | std::string gl_ws_version; |
| 237 | std::string gl_ws_extensions; |
avi | f15d60a | 2015-12-21 17:06:33 | [diff] [blame] | 238 | uint32_t gl_reset_notification_strategy; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 239 | bool software_rendering; |
Jonathan Backer | 0129383 | 2019-03-20 20:27:10 | [diff] [blame] | 240 | std::string direct_rendering_version; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 241 | bool sandboxed; |
bajones | e3677b649ff | 2015-07-25 00:41:56 | [diff] [blame] | 242 | bool in_process_gpu; |
geofflang | 774e87a | 2016-12-05 16:29:01 | [diff] [blame] | 243 | bool passthrough_cmd_decoder; |
Bo Liu | 9cad099c | 2017-07-06 14:45:27 | [diff] [blame] | 244 | bool can_support_threaded_texture_mailbox; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 245 | #if defined(OS_WIN) |
Sunny Sachanandani | 6e844c4 | 2018-11-09 20:27:12 | [diff] [blame] | 246 | bool direct_composition; |
| 247 | bool supports_overlays; |
Zhenyao Mo | 4178e19 | 2019-05-16 21:46:11 | [diff] [blame] | 248 | OverlaySupport yuy2_overlay_support; |
| 249 | OverlaySupport nv12_overlay_support; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 250 | DxDiagNode dx_diagnostics; |
Zhenyao Mo | da88bdc | 2018-09-27 01:47:33 | [diff] [blame] | 251 | Dx12VulkanVersionInfo dx12_vulkan_version_info; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 252 | #endif |
Maggie Chen | 35d65e4a | 2018-04-12 21:15:25 | [diff] [blame] | 253 | |
liberato | 57587790 | 2015-12-10 17:16:26 | [diff] [blame] | 254 | VideoDecodeAcceleratorCapabilities video_decode_accelerator_capabilities; |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 255 | VideoEncodeAcceleratorSupportedProfiles |
wuchengli | 7980832 | 2014-09-23 05:58:14 | [diff] [blame] | 256 | video_encode_accelerator_supported_profiles; |
henryhsu | 74f6ef1 | 2015-07-23 08:34:37 | [diff] [blame] | 257 | bool jpeg_decode_accelerator_supported; |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 258 | |
| 259 | ImageDecodeAcceleratorSupportedProfiles |
| 260 | image_decode_accelerator_supported_profiles; |
| 261 | |
Antonio Gomes | 5b4d98e | 2017-08-24 05:53:07 | [diff] [blame] | 262 | #if defined(USE_X11) |
thomasanderson | 62ba78ff | 2016-10-01 02:03:42 | [diff] [blame] | 263 | VisualID system_visual; |
| 264 | VisualID rgba_visual; |
| 265 | #endif |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 266 | |
Jonathan Backer | a57031b | 2018-06-04 15:44:32 | [diff] [blame] | 267 | bool oop_rasterization_supported; |
Mitsuru Oshima | 345e9b5 | 2019-10-19 00:07:36 | [diff] [blame^] | 268 | bool subpixel_font_rendering; |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 269 | }; |
| 270 | |
| 271 | // If this assert fails then most likely something below needs to be updated. |
| 272 | // Note that this assert is only approximate. If a new field is added to |
| 273 | // GPUInfo which fits within the current padding then it will not be caught. |
mostynb | 7f03209 | 2014-12-20 00:36:44 | [diff] [blame] | 274 | static_assert( |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 275 | sizeof(GPUInfo) == sizeof(GPUInfoKnownFields), |
mostynb | 7f03209 | 2014-12-20 00:36:44 | [diff] [blame] | 276 | "fields have changed in GPUInfo, GPUInfoKnownFields must be updated"); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 277 | |
| 278 | // Required fields (according to DevTools protocol) first. |
[email protected] | 2ac8e51c | 2014-04-21 20:54:13 | [diff] [blame] | 279 | enumerator->AddString("machineModelName", machine_model_name); |
| 280 | enumerator->AddString("machineModelVersion", machine_model_version); |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 281 | EnumerateGPUDevice(gpu, enumerator); |
Jonathan Backer | a57031b | 2018-06-04 15:44:32 | [diff] [blame] | 282 | for (const auto& secondary_gpu : secondary_gpus) |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 283 | EnumerateGPUDevice(secondary_gpu, enumerator); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 284 | |
| 285 | enumerator->BeginAuxAttributes(); |
Miguel Casas | 28ee90f | 2019-05-28 19:12:26 | [diff] [blame] | 286 | enumerator->AddTimeDeltaInSecondsF("initializationTime", initialization_time); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 287 | enumerator->AddBool("optimus", optimus); |
| 288 | enumerator->AddBool("amdSwitchable", amd_switchable); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 289 | enumerator->AddString("pixelShaderVersion", pixel_shader_version); |
| 290 | enumerator->AddString("vertexShaderVersion", vertex_shader_version); |
senorblanco | b7a64d57 | 2015-04-08 16:59:02 | [diff] [blame] | 291 | enumerator->AddString("maxMsaaSamples", max_msaa_samples); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 292 | enumerator->AddString("glVersion", gl_version); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 293 | enumerator->AddString("glVendor", gl_vendor); |
| 294 | enumerator->AddString("glRenderer", gl_renderer); |
| 295 | enumerator->AddString("glExtensions", gl_extensions); |
| 296 | enumerator->AddString("glWsVendor", gl_ws_vendor); |
| 297 | enumerator->AddString("glWsVersion", gl_ws_version); |
| 298 | enumerator->AddString("glWsExtensions", gl_ws_extensions); |
| 299 | enumerator->AddInt( |
| 300 | "glResetNotificationStrategy", |
| 301 | static_cast<int>(gl_reset_notification_strategy)); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 302 | // TODO(kbr): add performance_stats. |
| 303 | enumerator->AddBool("softwareRendering", software_rendering); |
Jonathan Backer | 0129383 | 2019-03-20 20:27:10 | [diff] [blame] | 304 | enumerator->AddString("directRenderingVersion", direct_rendering_version); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 305 | enumerator->AddBool("sandboxed", sandboxed); |
bajones | e3677b649ff | 2015-07-25 00:41:56 | [diff] [blame] | 306 | enumerator->AddBool("inProcessGpu", in_process_gpu); |
geofflang | 774e87a | 2016-12-05 16:29:01 | [diff] [blame] | 307 | enumerator->AddBool("passthroughCmdDecoder", passthrough_cmd_decoder); |
Bo Liu | 9cad099c | 2017-07-06 14:45:27 | [diff] [blame] | 308 | enumerator->AddBool("canSupportThreadedTextureMailbox", |
| 309 | can_support_threaded_texture_mailbox); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 310 | // TODO(kbr): add dx_diagnostics on Windows. |
Maggie Chen | 35d65e4a | 2018-04-12 21:15:25 | [diff] [blame] | 311 | #if defined(OS_WIN) |
Sunny Sachanandani | 6e844c4 | 2018-11-09 20:27:12 | [diff] [blame] | 312 | enumerator->AddBool("directComposition", direct_composition); |
| 313 | enumerator->AddBool("supportsOverlays", supports_overlays); |
Zhenyao Mo | 4178e19 | 2019-05-16 21:46:11 | [diff] [blame] | 314 | enumerator->AddString("yuy2OverlaySupport", |
| 315 | OverlaySupportToString(yuy2_overlay_support)); |
| 316 | enumerator->AddString("nv12OverlaySupport", |
| 317 | OverlaySupportToString(nv12_overlay_support)); |
Zhenyao Mo | da88bdc | 2018-09-27 01:47:33 | [diff] [blame] | 318 | EnumerateDx12VulkanVersionInfo(dx12_vulkan_version_info, enumerator); |
Maggie Chen | 35d65e4a | 2018-04-12 21:15:25 | [diff] [blame] | 319 | #endif |
liberato | 57587790 | 2015-12-10 17:16:26 | [diff] [blame] | 320 | enumerator->AddInt("videoDecodeAcceleratorFlags", |
| 321 | video_decode_accelerator_capabilities.flags); |
Miguel Casas | 28ee90f | 2019-05-28 19:12:26 | [diff] [blame] | 322 | |
| 323 | // TODO(crbug.com/966839): Fix the two supported profile dumping below. |
liberato | 57587790 | 2015-12-10 17:16:26 | [diff] [blame] | 324 | for (const auto& profile : |
| 325 | video_decode_accelerator_capabilities.supported_profiles) |
henryhsu | d118544 | 2015-04-10 06:39:14 | [diff] [blame] | 326 | EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator); |
| 327 | for (const auto& profile : video_encode_accelerator_supported_profiles) |
| 328 | EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator); |
henryhsu | 74f6ef1 | 2015-07-23 08:34:37 | [diff] [blame] | 329 | enumerator->AddBool("jpegDecodeAcceleratorSupported", |
| 330 | jpeg_decode_accelerator_supported); |
Andres Calderon Jaramillo | c68cd914 | 2019-02-16 00:43:33 | [diff] [blame] | 331 | for (const auto& profile : image_decode_accelerator_supported_profiles) |
| 332 | EnumerateImageDecodeAcceleratorSupportedProfile(profile, enumerator); |
Antonio Gomes | 5b4d98e | 2017-08-24 05:53:07 | [diff] [blame] | 333 | #if defined(USE_X11) |
thomasanderson | 62ba78ff | 2016-10-01 02:03:42 | [diff] [blame] | 334 | enumerator->AddInt64("systemVisual", system_visual); |
| 335 | enumerator->AddInt64("rgbaVisual", rgba_visual); |
| 336 | #endif |
Jonathan Backer | a57031b | 2018-06-04 15:44:32 | [diff] [blame] | 337 | enumerator->AddBool("oopRasterizationSupported", oop_rasterization_supported); |
Mitsuru Oshima | 345e9b5 | 2019-10-19 00:07:36 | [diff] [blame^] | 338 | enumerator->AddBool("subpixelFontRendering", subpixel_font_rendering); |
Samuel Attard | 9cb0f77a | 2019-07-02 23:31:31 | [diff] [blame] | 339 | enumerator->EndAuxAttributes(); |
[email protected] | fd4dcc5 | 2013-08-15 11:37:43 | [diff] [blame] | 340 | } |
| 341 | |
[email protected] | d7b5cc7 | 2013-05-23 20:05:00 | [diff] [blame] | 342 | } // namespace gpu |