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