Chromium Code Reviews| Index: gpu/ipc/common/gpu_info_struct_traits.h |
| diff --git a/gpu/ipc/common/gpu_info_struct_traits.h b/gpu/ipc/common/gpu_info_struct_traits.h |
| index 1dedef1e860ee54315a880b2df1a6cab208b7147..a75003a0ae995a5531a7787c2f85880858fa4d84 100644 |
| --- a/gpu/ipc/common/gpu_info_struct_traits.h |
| +++ b/gpu/ipc/common/gpu_info_struct_traits.h |
| @@ -5,8 +5,11 @@ |
| #ifndef CC_IPC_GPU_STRUCT_TRAITS_H_ |
| #define CC_IPC_GPU_STRUCT_TRAITS_H_ |
| +#include "base/time/time.h" |
| #include "gpu/config/gpu_info.h" |
| +#include "gpu/ipc/common/dx_diag_node_struct_traits.h" |
| #include "gpu/ipc/common/gpu_info.mojom.h" |
| +#include "mojo/common/common_custom_types_struct_traits.h" |
| #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
| namespace mojo { |
| @@ -123,5 +126,167 @@ struct StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile, |
| } |
| }; |
| +template <> |
| +struct StructTraits<gpu::mojom::GpuInfo, gpu::GPUInfo> { |
| + static bool Read(gpu::mojom::GpuInfoDataView data, gpu::GPUInfo* out); |
| + |
| + static base::TimeDelta initialization_time(const gpu::GPUInfo& input) { |
| + return input.initialization_time; |
| + } |
| + |
| + static bool optimus(const gpu::GPUInfo& input) { return input.optimus; } |
| + |
| + static bool amd_switchable(const gpu::GPUInfo& input) { |
| + return input.amd_switchable; |
| + } |
| + |
| + static bool lenovo_dcute(const gpu::GPUInfo& input) { |
| + return input.lenovo_dcute; |
| + } |
| + |
| + static const base::Version& display_link_version(const gpu::GPUInfo& input) { |
| + return input.display_link_version; |
| + } |
| + |
| + static const gpu::GPUInfo::GPUDevice& gpu(const gpu::GPUInfo& input) { |
| + return input.gpu; |
| + } |
| + |
| + static const std::vector<gpu::GPUInfo::GPUDevice>& secondary_gpus( |
| + const gpu::GPUInfo& input) { |
| + return input.secondary_gpus; |
| + } |
| + |
| + static uint64_t adapter_luid(const gpu::GPUInfo& input) { |
| + return input.adapter_luid; |
| + } |
| + |
| + static const std::string& driver_vendor(const gpu::GPUInfo& input) { |
| + return input.driver_vendor; |
| + } |
| + |
| + static const std::string& driver_version(const gpu::GPUInfo& input) { |
| + return input.driver_version; |
| + } |
| + |
| + static const std::string& driver_date(const gpu::GPUInfo& input) { |
| + return input.driver_date; |
| + } |
| + |
| + static const std::string& pixel_shader_version(const gpu::GPUInfo& input) { |
| + return input.pixel_shader_version; |
| + } |
| + |
| + static const std::string& vertex_shader_version(const gpu::GPUInfo& input) { |
| + return input.vertex_shader_version; |
| + } |
| + |
| + static const std::string& max_msaa_samples(const gpu::GPUInfo& input) { |
| + return input.max_msaa_samples; |
| + } |
| + |
| + static const std::string& machine_model_name(const gpu::GPUInfo& input) { |
| + return input.machine_model_name; |
| + } |
| + |
| + static const std::string& machine_model_version(const gpu::GPUInfo& input) { |
| + return input.machine_model_version; |
| + } |
| + |
| + static const std::string& gl_version(const gpu::GPUInfo& input) { |
| + return input.gl_version; |
| + } |
| + |
| + static const std::string& gl_vendor(const gpu::GPUInfo& input) { |
| + return input.gl_vendor; |
| + } |
| + |
| + static const std::string& gl_renderer(const gpu::GPUInfo& input) { |
| + return input.gl_renderer; |
| + } |
| + |
| + static const std::string& gl_extensions(const gpu::GPUInfo& input) { |
| + return input.gl_extensions; |
| + } |
| + |
| + static const std::string& gl_ws_vendor(const gpu::GPUInfo& input) { |
| + return input.gl_ws_vendor; |
| + } |
| + |
| + static const std::string& gl_ws_version(const gpu::GPUInfo& input) { |
| + return input.gl_ws_version; |
| + } |
| + |
| + static const std::string& gl_ws_extensions(const gpu::GPUInfo& input) { |
| + return input.gl_ws_extensions; |
| + } |
| + |
| + static uint32_t gl_reset_notification_strategy(const gpu::GPUInfo& input) { |
| + return input.gl_reset_notification_strategy; |
| + } |
| + |
| + static bool can_lose_context(const gpu::GPUInfo& input) { |
| + return input.can_lose_context; |
| + } |
| + |
| + static bool software_rendering(const gpu::GPUInfo& input) { |
| + return input.software_rendering; |
| + } |
| + |
| + static bool direct_rendering(const gpu::GPUInfo& input) { |
| + return input.direct_rendering; |
| + } |
| + |
| + static bool sandboxed(const gpu::GPUInfo& input) { return input.sandboxed; } |
| + |
| + static int process_crash_count(const gpu::GPUInfo& input) { |
| + return input.process_crash_count; |
| + } |
| + |
| + static bool in_process_gpu(const gpu::GPUInfo& input) { |
| + return input.in_process_gpu; |
| + } |
| + |
| + static gpu::CollectInfoResult basic_info_state(const gpu::GPUInfo& input) { |
| + return input.basic_info_state; |
| + } |
| + |
| + static gpu::CollectInfoResult context_info_state(const gpu::GPUInfo& input) { |
| + return input.context_info_state; |
| + } |
| + |
| + static gpu::CollectInfoResult dx_diagnostics_info_state( |
| + const gpu::GPUInfo& input) { |
| +#if defined(OS_WIN) |
| + return input.dx_diagnostics_info_state; |
| +#else |
| + return gpu::CollectInfoResult::kCollectInfoNone; |
| +#endif |
| + } |
| + |
| + static const gpu::DxDiagNode& dx_diagnostics(const gpu::GPUInfo& input) { |
| +#if defined(OS_WIN) |
| + return input.dx_diagnostics; |
| +#else |
| + static const gpu::DxDiagNode dx_diag_node; |
|
Fady Samuel
2016/08/10 12:13:24
This is very icky. I'm not sure if there's a bette
yzshen1
2016/08/10 16:29:19
This works correctly, although it is a little inef
Alex Z.
2016/08/10 19:27:53
Done.
|
| + return dx_diag_node; |
| +#endif |
| + } |
| + |
| + static const gpu::VideoDecodeAcceleratorCapabilities& |
| + video_decode_accelerator_capabilities(const gpu::GPUInfo& input) { |
| + return input.video_decode_accelerator_capabilities; |
| + } |
| + |
| + static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> |
| + video_encode_accelerator_supported_profiles(const gpu::GPUInfo& input) { |
| + return input.video_encode_accelerator_supported_profiles; |
| + } |
| + |
| + static bool jpeg_decode_accelerator_supported(const gpu::GPUInfo& input) { |
| + return input.jpeg_decode_accelerator_supported; |
| + } |
| +}; |
| + |
| } // namespace mojo |
| #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ |