| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CC_IPC_GPU_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_GPU_STRUCT_TRAITS_H_ |
| 6 #define CC_IPC_GPU_STRUCT_TRAITS_H_ | 6 #define CC_IPC_GPU_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" |
| 8 #include "gpu/config/gpu_info.h" | 9 #include "gpu/config/gpu_info.h" |
| 10 #include "gpu/ipc/common/dx_diag_node_struct_traits.h" |
| 9 #include "gpu/ipc/common/gpu_info.mojom.h" | 11 #include "gpu/ipc/common/gpu_info.mojom.h" |
| 12 #include "mojo/common/common_custom_types_struct_traits.h" |
| 10 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | 13 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
| 11 | 14 |
| 12 namespace mojo { | 15 namespace mojo { |
| 13 | 16 |
| 14 template <> | 17 template <> |
| 15 struct StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice> { | 18 struct StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice> { |
| 16 static bool Read(gpu::mojom::GpuDeviceDataView data, | 19 static bool Read(gpu::mojom::GpuDeviceDataView data, |
| 17 gpu::GPUInfo::GPUDevice* out); | 20 gpu::GPUInfo::GPUDevice* out); |
| 18 | 21 |
| 19 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) { | 22 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { | 119 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { |
| 117 return input.max_framerate_numerator; | 120 return input.max_framerate_numerator; |
| 118 } | 121 } |
| 119 | 122 |
| 120 static uint32_t max_framerate_denominator( | 123 static uint32_t max_framerate_denominator( |
| 121 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { | 124 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { |
| 122 return input.max_framerate_denominator; | 125 return input.max_framerate_denominator; |
| 123 } | 126 } |
| 124 }; | 127 }; |
| 125 | 128 |
| 129 template <> |
| 130 struct StructTraits<gpu::mojom::GpuInfo, gpu::GPUInfo> { |
| 131 static bool Read(gpu::mojom::GpuInfoDataView data, gpu::GPUInfo* out); |
| 132 |
| 133 static base::TimeDelta initialization_time(const gpu::GPUInfo& input) { |
| 134 return input.initialization_time; |
| 135 } |
| 136 |
| 137 static bool optimus(const gpu::GPUInfo& input) { return input.optimus; } |
| 138 |
| 139 static bool amd_switchable(const gpu::GPUInfo& input) { |
| 140 return input.amd_switchable; |
| 141 } |
| 142 |
| 143 static bool lenovo_dcute(const gpu::GPUInfo& input) { |
| 144 return input.lenovo_dcute; |
| 145 } |
| 146 |
| 147 static const base::Version& display_link_version(const gpu::GPUInfo& input) { |
| 148 return input.display_link_version; |
| 149 } |
| 150 |
| 151 static const gpu::GPUInfo::GPUDevice& gpu(const gpu::GPUInfo& input) { |
| 152 return input.gpu; |
| 153 } |
| 154 |
| 155 static const std::vector<gpu::GPUInfo::GPUDevice>& secondary_gpus( |
| 156 const gpu::GPUInfo& input) { |
| 157 return input.secondary_gpus; |
| 158 } |
| 159 |
| 160 static uint64_t adapter_luid(const gpu::GPUInfo& input) { |
| 161 return input.adapter_luid; |
| 162 } |
| 163 |
| 164 static const std::string& driver_vendor(const gpu::GPUInfo& input) { |
| 165 return input.driver_vendor; |
| 166 } |
| 167 |
| 168 static const std::string& driver_version(const gpu::GPUInfo& input) { |
| 169 return input.driver_version; |
| 170 } |
| 171 |
| 172 static const std::string& driver_date(const gpu::GPUInfo& input) { |
| 173 return input.driver_date; |
| 174 } |
| 175 |
| 176 static const std::string& pixel_shader_version(const gpu::GPUInfo& input) { |
| 177 return input.pixel_shader_version; |
| 178 } |
| 179 |
| 180 static const std::string& vertex_shader_version(const gpu::GPUInfo& input) { |
| 181 return input.vertex_shader_version; |
| 182 } |
| 183 |
| 184 static const std::string& max_msaa_samples(const gpu::GPUInfo& input) { |
| 185 return input.max_msaa_samples; |
| 186 } |
| 187 |
| 188 static const std::string& machine_model_name(const gpu::GPUInfo& input) { |
| 189 return input.machine_model_name; |
| 190 } |
| 191 |
| 192 static const std::string& machine_model_version(const gpu::GPUInfo& input) { |
| 193 return input.machine_model_version; |
| 194 } |
| 195 |
| 196 static const std::string& gl_version(const gpu::GPUInfo& input) { |
| 197 return input.gl_version; |
| 198 } |
| 199 |
| 200 static const std::string& gl_vendor(const gpu::GPUInfo& input) { |
| 201 return input.gl_vendor; |
| 202 } |
| 203 |
| 204 static const std::string& gl_renderer(const gpu::GPUInfo& input) { |
| 205 return input.gl_renderer; |
| 206 } |
| 207 |
| 208 static const std::string& gl_extensions(const gpu::GPUInfo& input) { |
| 209 return input.gl_extensions; |
| 210 } |
| 211 |
| 212 static const std::string& gl_ws_vendor(const gpu::GPUInfo& input) { |
| 213 return input.gl_ws_vendor; |
| 214 } |
| 215 |
| 216 static const std::string& gl_ws_version(const gpu::GPUInfo& input) { |
| 217 return input.gl_ws_version; |
| 218 } |
| 219 |
| 220 static const std::string& gl_ws_extensions(const gpu::GPUInfo& input) { |
| 221 return input.gl_ws_extensions; |
| 222 } |
| 223 |
| 224 static uint32_t gl_reset_notification_strategy(const gpu::GPUInfo& input) { |
| 225 return input.gl_reset_notification_strategy; |
| 226 } |
| 227 |
| 228 static bool can_lose_context(const gpu::GPUInfo& input) { |
| 229 return input.can_lose_context; |
| 230 } |
| 231 |
| 232 static bool software_rendering(const gpu::GPUInfo& input) { |
| 233 return input.software_rendering; |
| 234 } |
| 235 |
| 236 static bool direct_rendering(const gpu::GPUInfo& input) { |
| 237 return input.direct_rendering; |
| 238 } |
| 239 |
| 240 static bool sandboxed(const gpu::GPUInfo& input) { return input.sandboxed; } |
| 241 |
| 242 static int process_crash_count(const gpu::GPUInfo& input) { |
| 243 return input.process_crash_count; |
| 244 } |
| 245 |
| 246 static bool in_process_gpu(const gpu::GPUInfo& input) { |
| 247 return input.in_process_gpu; |
| 248 } |
| 249 |
| 250 static gpu::CollectInfoResult basic_info_state(const gpu::GPUInfo& input) { |
| 251 return input.basic_info_state; |
| 252 } |
| 253 |
| 254 static gpu::CollectInfoResult context_info_state(const gpu::GPUInfo& input) { |
| 255 return input.context_info_state; |
| 256 } |
| 257 #if defined(OS_WIN) |
| 258 static const gpu::DxDiagNode& dx_diagnostics(const gpu::GPUInfo& input) { |
| 259 return input.dx_diagnostics; |
| 260 } |
| 261 #else |
| 262 static const base::Optional<gpu::DxDiagNode>& dx_diagnostics( |
| 263 const gpu::GPUInfo& input) { |
| 264 static const base::Optional<gpu::DxDiagNode> dx_diag_node(base::nullopt); |
| 265 return dx_diag_node; |
| 266 } |
| 267 #endif |
| 268 |
| 269 static gpu::CollectInfoResult dx_diagnostics_info_state( |
| 270 const gpu::GPUInfo& input) { |
| 271 #if defined(OS_WIN) |
| 272 return input.dx_diagnostics_info_state; |
| 273 #else |
| 274 return gpu::CollectInfoResult::kCollectInfoNone; |
| 275 #endif |
| 276 } |
| 277 |
| 278 static const gpu::VideoDecodeAcceleratorCapabilities& |
| 279 video_decode_accelerator_capabilities(const gpu::GPUInfo& input) { |
| 280 return input.video_decode_accelerator_capabilities; |
| 281 } |
| 282 |
| 283 static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> |
| 284 video_encode_accelerator_supported_profiles(const gpu::GPUInfo& input) { |
| 285 return input.video_encode_accelerator_supported_profiles; |
| 286 } |
| 287 |
| 288 static bool jpeg_decode_accelerator_supported(const gpu::GPUInfo& input) { |
| 289 return input.jpeg_decode_accelerator_supported; |
| 290 } |
| 291 }; |
| 292 |
| 126 } // namespace mojo | 293 } // namespace mojo |
| 127 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ | 294 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ |
| OLD | NEW |