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 "base/time/time.h" |
9 #include "gpu/config/gpu_info.h" | 9 #include "gpu/config/gpu_info.h" |
10 #include "gpu/ipc/common/dx_diag_node_struct_traits.h" | 10 #include "gpu/ipc/common/dx_diag_node_struct_traits.h" |
11 #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" | 12 #include "mojo/common/common_custom_types_struct_traits.h" |
13 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | 13 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 | 16 |
17 template <> | 17 template <> |
18 struct StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice> { | 18 struct StructTraits<gpu::mojom::GpuDeviceDataView, gpu::GPUInfo::GPUDevice> { |
19 static bool Read(gpu::mojom::GpuDeviceDataView data, | 19 static bool Read(gpu::mojom::GpuDeviceDataView data, |
20 gpu::GPUInfo::GPUDevice* out); | 20 gpu::GPUInfo::GPUDevice* out); |
21 | 21 |
22 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) { | 22 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) { |
23 return input.vendor_id; | 23 return input.vendor_id; |
24 } | 24 } |
25 | 25 |
26 static uint32_t device_id(const gpu::GPUInfo::GPUDevice& input) { | 26 static uint32_t device_id(const gpu::GPUInfo::GPUDevice& input) { |
27 return input.device_id; | 27 return input.device_id; |
28 } | 28 } |
(...skipping 24 matching lines...) Expand all Loading... |
53 | 53 |
54 template <> | 54 template <> |
55 struct EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile> { | 55 struct EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile> { |
56 static gpu::mojom::VideoCodecProfile ToMojom( | 56 static gpu::mojom::VideoCodecProfile ToMojom( |
57 gpu::VideoCodecProfile video_codec_profile); | 57 gpu::VideoCodecProfile video_codec_profile); |
58 static bool FromMojom(gpu::mojom::VideoCodecProfile input, | 58 static bool FromMojom(gpu::mojom::VideoCodecProfile input, |
59 gpu::VideoCodecProfile* out); | 59 gpu::VideoCodecProfile* out); |
60 }; | 60 }; |
61 | 61 |
62 template <> | 62 template <> |
63 struct StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfile, | 63 struct StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView, |
64 gpu::VideoDecodeAcceleratorSupportedProfile> { | 64 gpu::VideoDecodeAcceleratorSupportedProfile> { |
65 static bool Read( | 65 static bool Read( |
66 gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data, | 66 gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data, |
67 gpu::VideoDecodeAcceleratorSupportedProfile* out); | 67 gpu::VideoDecodeAcceleratorSupportedProfile* out); |
68 | 68 |
69 static gpu::VideoCodecProfile profile( | 69 static gpu::VideoCodecProfile profile( |
70 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { | 70 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { |
71 return input.profile; | 71 return input.profile; |
72 } | 72 } |
73 | 73 |
74 static const gfx::Size& max_resolution( | 74 static const gfx::Size& max_resolution( |
75 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { | 75 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { |
76 return input.max_resolution; | 76 return input.max_resolution; |
77 } | 77 } |
78 | 78 |
79 static const gfx::Size& min_resolution( | 79 static const gfx::Size& min_resolution( |
80 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { | 80 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { |
81 return input.min_resolution; | 81 return input.min_resolution; |
82 } | 82 } |
83 | 83 |
84 static bool encrypted_only( | 84 static bool encrypted_only( |
85 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { | 85 const gpu::VideoDecodeAcceleratorSupportedProfile& input) { |
86 return input.encrypted_only; | 86 return input.encrypted_only; |
87 } | 87 } |
88 }; | 88 }; |
89 | 89 |
90 template <> | 90 template <> |
91 struct StructTraits<gpu::mojom::VideoDecodeAcceleratorCapabilities, | 91 struct StructTraits<gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView, |
92 gpu::VideoDecodeAcceleratorCapabilities> { | 92 gpu::VideoDecodeAcceleratorCapabilities> { |
93 static bool Read(gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView data, | 93 static bool Read(gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView data, |
94 gpu::VideoDecodeAcceleratorCapabilities* out); | 94 gpu::VideoDecodeAcceleratorCapabilities* out); |
95 | 95 |
96 static uint32_t flags(const gpu::VideoDecodeAcceleratorCapabilities& input) { | 96 static uint32_t flags(const gpu::VideoDecodeAcceleratorCapabilities& input) { |
97 return input.flags; | 97 return input.flags; |
98 } | 98 } |
99 }; | 99 }; |
100 | 100 |
101 template <> | 101 template <> |
102 struct StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile, | 102 struct StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView, |
103 gpu::VideoEncodeAcceleratorSupportedProfile> { | 103 gpu::VideoEncodeAcceleratorSupportedProfile> { |
104 static bool Read( | 104 static bool Read( |
105 gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data, | 105 gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data, |
106 gpu::VideoEncodeAcceleratorSupportedProfile* out); | 106 gpu::VideoEncodeAcceleratorSupportedProfile* out); |
107 | 107 |
108 static gpu::VideoCodecProfile profile( | 108 static gpu::VideoCodecProfile profile( |
109 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { | 109 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { |
110 return input.profile; | 110 return input.profile; |
111 } | 111 } |
112 | 112 |
113 static const gfx::Size& max_resolution( | 113 static const gfx::Size& max_resolution( |
114 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { | 114 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { |
115 return input.max_resolution; | 115 return input.max_resolution; |
116 } | 116 } |
117 | 117 |
118 static uint32_t max_framerate_numerator( | 118 static uint32_t max_framerate_numerator( |
119 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { | 119 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { |
120 return input.max_framerate_numerator; | 120 return input.max_framerate_numerator; |
121 } | 121 } |
122 | 122 |
123 static uint32_t max_framerate_denominator( | 123 static uint32_t max_framerate_denominator( |
124 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { | 124 const gpu::VideoEncodeAcceleratorSupportedProfile& input) { |
125 return input.max_framerate_denominator; | 125 return input.max_framerate_denominator; |
126 } | 126 } |
127 }; | 127 }; |
128 | 128 |
129 template <> | 129 template <> |
130 struct StructTraits<gpu::mojom::GpuInfo, gpu::GPUInfo> { | 130 struct StructTraits<gpu::mojom::GpuInfoDataView, gpu::GPUInfo> { |
131 static bool Read(gpu::mojom::GpuInfoDataView data, gpu::GPUInfo* out); | 131 static bool Read(gpu::mojom::GpuInfoDataView data, gpu::GPUInfo* out); |
132 | 132 |
133 static base::TimeDelta initialization_time(const gpu::GPUInfo& input) { | 133 static base::TimeDelta initialization_time(const gpu::GPUInfo& input) { |
134 return input.initialization_time; | 134 return input.initialization_time; |
135 } | 135 } |
136 | 136 |
137 static bool optimus(const gpu::GPUInfo& input) { return input.optimus; } | 137 static bool optimus(const gpu::GPUInfo& input) { return input.optimus; } |
138 | 138 |
139 static bool amd_switchable(const gpu::GPUInfo& input) { | 139 static bool amd_switchable(const gpu::GPUInfo& input) { |
140 return input.amd_switchable; | 140 return input.amd_switchable; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return input.video_encode_accelerator_supported_profiles; | 281 return input.video_encode_accelerator_supported_profiles; |
282 } | 282 } |
283 | 283 |
284 static bool jpeg_decode_accelerator_supported(const gpu::GPUInfo& input) { | 284 static bool jpeg_decode_accelerator_supported(const gpu::GPUInfo& input) { |
285 return input.jpeg_decode_accelerator_supported; | 285 return input.jpeg_decode_accelerator_supported; |
286 } | 286 } |
287 }; | 287 }; |
288 | 288 |
289 } // namespace mojo | 289 } // namespace mojo |
290 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ | 290 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ |
OLD | NEW |