blob: 61c9f1c227c919340eba3306bb57178b533db348 [file] [log] [blame]
Marissa Wall48586522019-11-19 14:01:36 -08001/*
2 * Copyright 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <aidl/android/hardware/graphics/common/BlendMode.h>
Marissa Wallef785e12019-12-12 14:26:59 -080020#include <aidl/android/hardware/graphics/common/ChromaSiting.h>
21#include <aidl/android/hardware/graphics/common/Compression.h>
22#include <aidl/android/hardware/graphics/common/Cta861_3.h>
Marissa Wall48586522019-11-19 14:01:36 -080023#include <aidl/android/hardware/graphics/common/Dataspace.h>
24#include <aidl/android/hardware/graphics/common/ExtendableType.h>
25#include <aidl/android/hardware/graphics/common/Interlaced.h>
26#include <aidl/android/hardware/graphics/common/PlaneLayout.h>
Joseph Murphy048552f2019-12-17 19:58:45 +000027#include <aidl/android/hardware/graphics/common/PlaneLayoutComponentType.h>
Marissa Wallef785e12019-12-12 14:26:59 -080028#include <aidl/android/hardware/graphics/common/Smpte2086.h>
29#include <aidl/android/hardware/graphics/common/StandardMetadataType.h>
30#include <aidl/android/hardware/graphics/common/XyColor.h>
Marissa Wall48586522019-11-19 14:01:36 -080031#include <android/hardware/graphics/mapper/4.0/IMapper.h>
32
Marissa Wall85d423a2019-12-15 13:42:02 -080033/**
34 * Define equality operators for Stable AIDL types.
35 */
36inline bool operator==(const aidl::android::hardware::graphics::common::ExtendableType& lhs,
37 const aidl::android::hardware::graphics::common::ExtendableType& rhs) {
38 return !std::strcmp(lhs.name.c_str(), rhs.name.c_str()) && lhs.value == rhs.value;
39}
40
41inline bool operator!=(const aidl::android::hardware::graphics::common::ExtendableType& lhs,
42 const aidl::android::hardware::graphics::common::ExtendableType& rhs) {
43 return !(lhs == rhs);
44}
45
46inline bool operator==(const aidl::android::hardware::graphics::common::PlaneLayoutComponent& lhs,
47 const aidl::android::hardware::graphics::common::PlaneLayoutComponent& rhs) {
48 if (lhs.type.name != rhs.type.name) {
49 return false;
50 }
51 if (lhs.type.value != rhs.type.value) {
52 return false;
53 }
54 if (lhs.sizeInBits != rhs.sizeInBits) {
55 return false;
56 }
57 if (lhs.offsetInBits != rhs.offsetInBits) {
58 return false;
59 }
60 return true;
61}
62
63inline bool operator!=(const aidl::android::hardware::graphics::common::PlaneLayoutComponent& lhs,
64 const aidl::android::hardware::graphics::common::PlaneLayoutComponent& rhs) {
65 return !(lhs == rhs);
66}
67
68inline bool operator==(const aidl::android::hardware::graphics::common::Rect& lhs,
69 const aidl::android::hardware::graphics::common::Rect& rhs) {
70 if (lhs.left != rhs.left) {
71 return false;
72 }
73 if (lhs.top != rhs.top) {
74 return false;
75 }
76 if (lhs.right != rhs.right) {
77 return false;
78 }
79 if (lhs.bottom != rhs.bottom) {
80 return false;
81 }
82 return true;
83}
84
85inline bool operator!=(const aidl::android::hardware::graphics::common::Rect& lhs,
86 const aidl::android::hardware::graphics::common::Rect& rhs) {
87 return !(lhs == rhs);
88}
89
90inline bool operator==(const aidl::android::hardware::graphics::common::PlaneLayout& lhs,
91 const aidl::android::hardware::graphics::common::PlaneLayout& rhs) {
92 if (lhs.offsetInBytes != rhs.offsetInBytes) {
93 return false;
94 }
95 if (lhs.sampleIncrementInBits != rhs.sampleIncrementInBits) {
96 return false;
97 }
98 if (lhs.strideInBytes != rhs.strideInBytes) {
99 return false;
100 }
101 if (lhs.widthInSamples != rhs.widthInSamples) {
102 return false;
103 }
104 if (lhs.heightInSamples != rhs.heightInSamples) {
105 return false;
106 }
107 if (lhs.totalSizeInBytes != rhs.totalSizeInBytes) {
108 return false;
109 }
110 if (lhs.horizontalSubsampling != rhs.horizontalSubsampling) {
111 return false;
112 }
113 if (lhs.verticalSubsampling != rhs.verticalSubsampling) {
114 return false;
115 }
116 if (lhs.crop != rhs.crop) {
117 return false;
118 }
119 if (lhs.components.size() != rhs.components.size()) {
120 return false;
121 }
122 for (size_t i = 0; i < lhs.components.size(); i++) {
123 if (lhs.components[i] != rhs.components[i]) {
124 return false;
125 }
126 }
127 return true;
128}
129
130inline bool operator!=(const aidl::android::hardware::graphics::common::PlaneLayout& lhs,
131 const aidl::android::hardware::graphics::common::PlaneLayout& rhs) {
132 return !(lhs == rhs);
133}
134
135inline bool operator==(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& lhs,
136 const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& rhs) {
137 if (lhs.size() != rhs.size()) {
138 return false;
139 }
140 for (size_t i = 0; i < lhs.size(); i++) {
141 if (lhs[i] != rhs[i]) {
142 return false;
143 }
144 }
145 return true;
146}
147
148inline bool operator!=(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& lhs,
149 const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& rhs) {
150 return !(lhs == rhs);
151}
152
153inline bool operator==(const aidl::android::hardware::graphics::common::XyColor& lhs,
154 const aidl::android::hardware::graphics::common::XyColor& rhs) {
155 if (lhs.x != rhs.x) {
156 return false;
157 }
158 if (lhs.y != rhs.y) {
159 return false;
160 }
161 return true;
162}
163
164inline bool operator!=(const aidl::android::hardware::graphics::common::XyColor& lhs,
165 const aidl::android::hardware::graphics::common::XyColor& rhs) {
166 return !(lhs == rhs);
167}
168
169inline bool operator==(const aidl::android::hardware::graphics::common::Smpte2086& lhs,
170 const aidl::android::hardware::graphics::common::Smpte2086& rhs) {
171 if (lhs.primaryRed != rhs.primaryRed) {
172 return false;
173 }
174 if (lhs.primaryGreen != rhs.primaryGreen) {
175 return false;
176 }
177 if (lhs.primaryBlue != rhs.primaryBlue) {
178 return false;
179 }
180 if (lhs.whitePoint != rhs.whitePoint) {
181 return false;
182 }
183 if (lhs.maxLuminance != rhs.maxLuminance) {
184 return false;
185 }
186 if (lhs.minLuminance != rhs.minLuminance) {
187 return false;
188 }
189 return true;
190}
191
192inline bool operator!=(const aidl::android::hardware::graphics::common::Smpte2086& lhs,
193 const aidl::android::hardware::graphics::common::Smpte2086& rhs) {
194 return !(lhs == rhs);
195}
196
197inline bool operator==(const aidl::android::hardware::graphics::common::Cta861_3& lhs,
198 const aidl::android::hardware::graphics::common::Cta861_3& rhs) {
199 if (lhs.maxContentLightLevel != rhs.maxContentLightLevel) {
200 return false;
201 }
202 if (lhs.maxFrameAverageLightLevel != rhs.maxFrameAverageLightLevel) {
203 return false;
204 }
205 return true;
206}
207
208inline bool operator!=(const aidl::android::hardware::graphics::common::Cta861_3& lhs,
209 const aidl::android::hardware::graphics::common::Cta861_3& rhs) {
210 return !(lhs == rhs);
211}
212
Marissa Wall48586522019-11-19 14:01:36 -0800213namespace android {
214
215namespace gralloc4 {
216
Marissa Wall48586522019-11-19 14:01:36 -0800217#define GRALLOC4_STANDARD_METADATA_TYPE "android.hardware.graphics.common.StandardMetadataType"
Marissa Wall22b2de12019-12-02 18:11:43 -0800218#define GRALLOC4_STANDARD_CHROMA_SITING "android.hardware.graphics.common.ChromaSiting"
219#define GRALLOC4_STANDARD_COMPRESSION "android.hardware.graphics.common.Compression"
220#define GRALLOC4_STANDARD_INTERLACED "android.hardware.graphics.common.Interlaced"
221#define GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE \
222 "android.hardware.graphics.common.PlaneLayoutComponentType"
Marissa Wall48586522019-11-19 14:01:36 -0800223
224/*---------------------------------------------------------------------------------------------*/
225/**
226 * Definitions of the standard buffer metadata types. It is recommended that everyone uses
227 * these definitions directly for standard buffer metadata types.
228 */
229static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_BufferId = {
230 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::BUFFER_ID)
231};
232
233static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Name = {
234 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::NAME)
235};
236
237static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Width = {
238 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::WIDTH)
239};
240
241static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Height = {
242 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::HEIGHT)
243};
244
245static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_LayerCount = {
246 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::LAYER_COUNT)
247};
248
249static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PixelFormatRequested = {
250 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PIXEL_FORMAT_REQUESTED)
251};
252
253static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PixelFormatFourCC = {
254 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PIXEL_FORMAT_FOURCC)
255};
256
257static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PixelFormatModifier = {
258 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PIXEL_FORMAT_MODIFIER)
259};
260
261static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Usage = {
262 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::USAGE)
263};
264
265static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_AllocationSize = {
266 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::ALLOCATION_SIZE)
267};
268
269static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_ProtectedContent = {
270 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PROTECTED_CONTENT)
271};
272
273static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Compression = {
274 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::COMPRESSION)
275};
276
277static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Interlaced = {
278 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::INTERLACED)
279};
280
281static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_ChromaSiting = {
282 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::CHROMA_SITING)
283};
284
285static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_PlaneLayouts = {
286 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::PLANE_LAYOUTS)
287};
288
289static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_Dataspace = {
290 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::DATASPACE)
291};
292
293static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType MetadataType_BlendMode = {
294 GRALLOC4_STANDARD_METADATA_TYPE, static_cast<int64_t>(aidl::android::hardware::graphics::common::StandardMetadataType::BLEND_MODE)
295};
296
Marissa Wallef785e12019-12-12 14:26:59 -0800297static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType
298 MetadataType_Smpte2086 = {GRALLOC4_STANDARD_METADATA_TYPE,
299 static_cast<int64_t>(aidl::android::hardware::graphics::common::
300 StandardMetadataType::SMPTE2086)};
301
302static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType
303 MetadataType_Cta861_3 = {GRALLOC4_STANDARD_METADATA_TYPE,
304 static_cast<int64_t>(aidl::android::hardware::graphics::common::
305 StandardMetadataType::CTA861_3)};
306
307static const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType
308 MetadataType_Smpte2094_40 = {GRALLOC4_STANDARD_METADATA_TYPE,
309 static_cast<int64_t>(
310 aidl::android::hardware::graphics::common::
311 StandardMetadataType::SMPTE2094_40)};
312
Marissa Wall48586522019-11-19 14:01:36 -0800313/*---------------------------------------------------------------------------------------------*/
314
315/**
316 * Definitions of the standard compression strategies. It is recommended that everyone uses
317 * these definitions directly for standard compression strategies.
318 */
Marissa Wall22b2de12019-12-02 18:11:43 -0800319static const aidl::android::hardware::graphics::common::ExtendableType Compression_None =
320 {GRALLOC4_STANDARD_COMPRESSION,
321 static_cast<int64_t>(aidl::android::hardware::graphics::common::Compression::NONE)};
Marissa Wall48586522019-11-19 14:01:36 -0800322
Marissa Wall22b2de12019-12-02 18:11:43 -0800323static const aidl::android::hardware::graphics::common::ExtendableType
324 Compression_DisplayStreamCompression =
325 {GRALLOC4_STANDARD_COMPRESSION,
326 static_cast<int64_t>(aidl::android::hardware::graphics::common::Compression::
327 DISPLAY_STREAM_COMPRESSION)};
Marissa Wall48586522019-11-19 14:01:36 -0800328
329/*---------------------------------------------------------------------------------------------*/
330
331/**
332 * Definitions of the standard interlaced strategies. It is recommended that everyone uses
333 * these definitions directly for standard interlaced strategies.
334 */
Marissa Wall22b2de12019-12-02 18:11:43 -0800335static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_None =
336 {GRALLOC4_STANDARD_INTERLACED,
337 static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::NONE)};
Marissa Wall48586522019-11-19 14:01:36 -0800338
Marissa Wall22b2de12019-12-02 18:11:43 -0800339static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_TopBottom =
340 {GRALLOC4_STANDARD_INTERLACED,
341 static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::TOP_BOTTOM)};
Marissa Wall48586522019-11-19 14:01:36 -0800342
Marissa Wall22b2de12019-12-02 18:11:43 -0800343static const aidl::android::hardware::graphics::common::ExtendableType Interlaced_RightLeft =
344 {GRALLOC4_STANDARD_INTERLACED,
345 static_cast<int64_t>(aidl::android::hardware::graphics::common::Interlaced::RIGHT_LEFT)};
Marissa Wall48586522019-11-19 14:01:36 -0800346
347/*---------------------------------------------------------------------------------------------*/
348
349/**
350 * Definitions of the standard chroma siting. It is recommended that everyone uses
351 * these definitions directly for standard chroma siting.
352 */
Marissa Wall22b2de12019-12-02 18:11:43 -0800353static const aidl::android::hardware::graphics::common::ExtendableType ChromaSiting_None =
354 {GRALLOC4_STANDARD_CHROMA_SITING,
355 static_cast<int64_t>(aidl::android::hardware::graphics::common::ChromaSiting::NONE)};
Marissa Wall48586522019-11-19 14:01:36 -0800356
Marissa Wall22b2de12019-12-02 18:11:43 -0800357static const aidl::android::hardware::graphics::common::ExtendableType ChromaSiting_Unknown =
358 {GRALLOC4_STANDARD_CHROMA_SITING,
359 static_cast<int64_t>(aidl::android::hardware::graphics::common::ChromaSiting::UNKNOWN)};
Marissa Wall48586522019-11-19 14:01:36 -0800360
Marissa Wall22b2de12019-12-02 18:11:43 -0800361static const aidl::android::hardware::graphics::common::ExtendableType
362 ChromaSiting_SitedInterstitial = {GRALLOC4_STANDARD_CHROMA_SITING,
363 static_cast<int64_t>(
364 aidl::android::hardware::graphics::common::
365 ChromaSiting::SITED_INTERSTITIAL)};
Marissa Wall48586522019-11-19 14:01:36 -0800366
Marissa Wall22b2de12019-12-02 18:11:43 -0800367static const aidl::android::hardware::graphics::common::ExtendableType
368 ChromaSiting_CositedHorizontal = {GRALLOC4_STANDARD_CHROMA_SITING,
369 static_cast<int64_t>(
370 aidl::android::hardware::graphics::common::
371 ChromaSiting::COSITED_HORIZONTAL)};
Marissa Wall48586522019-11-19 14:01:36 -0800372
373/*---------------------------------------------------------------------------------------------*/
374
375/**
376 * Definitions of the standard plane layout component types. It is recommended that everyone uses
377 * these definitions directly for standard plane layout component types
378 */
Marissa Wall22b2de12019-12-02 18:11:43 -0800379static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_Y =
380 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
381 static_cast<int64_t>(
382 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::Y)};
Marissa Wall48586522019-11-19 14:01:36 -0800383
Marissa Wall22b2de12019-12-02 18:11:43 -0800384static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_CB =
385 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
386 static_cast<int64_t>(
387 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::CB)};
Marissa Wall48586522019-11-19 14:01:36 -0800388
Marissa Wall22b2de12019-12-02 18:11:43 -0800389static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_CR =
390 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
391 static_cast<int64_t>(
392 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::CR)};
Marissa Wall48586522019-11-19 14:01:36 -0800393
Marissa Wall22b2de12019-12-02 18:11:43 -0800394static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_R =
395 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
396 static_cast<int64_t>(
397 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::R)};
Marissa Wall48586522019-11-19 14:01:36 -0800398
Marissa Wall22b2de12019-12-02 18:11:43 -0800399static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_G =
400 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
401 static_cast<int64_t>(
402 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::G)};
Marissa Wall48586522019-11-19 14:01:36 -0800403
Marissa Wall22b2de12019-12-02 18:11:43 -0800404static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_B =
405 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
406 static_cast<int64_t>(
407 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::B)};
Marissa Wall48586522019-11-19 14:01:36 -0800408
Marissa Wall22b2de12019-12-02 18:11:43 -0800409static const aidl::android::hardware::graphics::common::ExtendableType PlaneLayoutComponentType_A =
410 {GRALLOC4_STANDARD_PLANE_LAYOUT_COMPONENT_TYPE,
411 static_cast<int64_t>(
412 aidl::android::hardware::graphics::common::PlaneLayoutComponentType::A)};
Marissa Wall48586522019-11-19 14:01:36 -0800413
414/*---------------------------------------------------------------------------------------------*/
415
416/**
Marissa Wall48586522019-11-19 14:01:36 -0800417 * The functions below encode and decode standard metadata into a byte stream. It is STRONGLY
418 * recommended that both the vendor and system partitions use these functions when getting
419 * and setting metadata through gralloc 4 (IMapper 4.0).
420 */
421status_t encodeBufferId(uint64_t bufferId, android::hardware::hidl_vec<uint8_t>* outBufferId);
422status_t decodeBufferId(const android::hardware::hidl_vec<uint8_t>& bufferId, uint64_t* outBufferId);
423
424status_t encodeName(const std::string& name, android::hardware::hidl_vec<uint8_t>* outName);
425status_t decodeName(const android::hardware::hidl_vec<uint8_t>& name, std::string* outName);
426
427status_t encodeWidth(uint64_t width, android::hardware::hidl_vec<uint8_t>* outWidth);
428status_t decodeWidth(const android::hardware::hidl_vec<uint8_t>& width, uint64_t* outWidth);
429
430status_t encodeHeight(uint64_t height, android::hardware::hidl_vec<uint8_t>* outHeight);
431status_t decodeHeight(const android::hardware::hidl_vec<uint8_t>& height, uint64_t* outHeight);
432
433status_t encodeLayerCount(uint64_t layerCount, android::hardware::hidl_vec<uint8_t>* outLayerCount);
434status_t decodeLayerCount(const android::hardware::hidl_vec<uint8_t>& layerCount, uint64_t* outLayerCount);
435
436status_t encodePixelFormatRequested(const hardware::graphics::common::V1_2::PixelFormat& pixelFormatRequested, android::hardware::hidl_vec<uint8_t>* outPixelFormatRequested);
437status_t decodePixelFormatRequested(const android::hardware::hidl_vec<uint8_t>& pixelFormatRequested, hardware::graphics::common::V1_2::PixelFormat* outPixelFormatRequested);
438
439status_t encodePixelFormatFourCC(uint32_t pixelFormatFourCC, android::hardware::hidl_vec<uint8_t>* outPixelFormatFourCC);
440status_t decodePixelFormatFourCC(const android::hardware::hidl_vec<uint8_t>& pixelFormatFourCC, uint32_t* outPixelFormatFourCC);
441
442status_t encodePixelFormatModifier(uint64_t pixelFormatModifier, android::hardware::hidl_vec<uint8_t>* outPixelFormatModifier);
443status_t decodePixelFormatModifier(const android::hardware::hidl_vec<uint8_t>& pixelFormatModifier, uint64_t* outPixelFormatModifier);
444
445status_t encodeUsage(uint64_t usage, android::hardware::hidl_vec<uint8_t>* outUsage);
446status_t decodeUsage(const android::hardware::hidl_vec<uint8_t>& usage, uint64_t* outUsage);
447
448status_t encodeAllocationSize(uint64_t allocationSize, android::hardware::hidl_vec<uint8_t>* outAllocationSize);
449status_t decodeAllocationSize(const android::hardware::hidl_vec<uint8_t>& allocationSize, uint64_t* outAllocationSize);
450
451status_t encodeProtectedContent(uint64_t protectedContent, android::hardware::hidl_vec<uint8_t>* outProtectedContent);
452status_t decodeProtectedContent(const android::hardware::hidl_vec<uint8_t>& protectedContent, uint64_t* outProtectedContent);
453
454status_t encodeCompression(const aidl::android::hardware::graphics::common::ExtendableType& compression, android::hardware::hidl_vec<uint8_t>* outCompression);
455status_t decodeCompression(const android::hardware::hidl_vec<uint8_t>& compression, aidl::android::hardware::graphics::common::ExtendableType* outCompression);
456
457status_t encodeInterlaced(const aidl::android::hardware::graphics::common::ExtendableType& interlaced, android::hardware::hidl_vec<uint8_t>* outInterlaced);
458status_t decodeInterlaced(const android::hardware::hidl_vec<uint8_t>& interlaced, aidl::android::hardware::graphics::common::ExtendableType* outInterlaced);
459
460status_t encodeChromaSiting(const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting, android::hardware::hidl_vec<uint8_t>* outChromaSiting);
461status_t decodeChromaSiting(const android::hardware::hidl_vec<uint8_t>& chromaSiting, aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting);
462
463status_t encodePlaneLayouts(const std::vector<aidl::android::hardware::graphics::common::PlaneLayout>& planeLayouts, android::hardware::hidl_vec<uint8_t>* outPlaneLayouts);
464status_t decodePlaneLayouts(const android::hardware::hidl_vec<uint8_t>& planeLayouts, std::vector<aidl::android::hardware::graphics::common::PlaneLayout>* outPlaneLayouts);
465
466status_t encodeDataspace(const aidl::android::hardware::graphics::common::Dataspace& dataspace, android::hardware::hidl_vec<uint8_t>* outDataspace);
467status_t decodeDataspace(const android::hardware::hidl_vec<uint8_t>& dataspace, aidl::android::hardware::graphics::common::Dataspace* outDataspace);
468
469status_t encodeBlendMode(const aidl::android::hardware::graphics::common::BlendMode& blendMode, android::hardware::hidl_vec<uint8_t>* outBlendMode);
470status_t decodeBlendMode(const android::hardware::hidl_vec<uint8_t>& blendMode, aidl::android::hardware::graphics::common::BlendMode* outBlendMode);
471
Marissa Wallef785e12019-12-12 14:26:59 -0800472status_t encodeSmpte2086(
473 const std::optional<aidl::android::hardware::graphics::common::Smpte2086>& smpte2086,
474 android::hardware::hidl_vec<uint8_t>* outSmpte2086);
475status_t decodeSmpte2086(
476 const android::hardware::hidl_vec<uint8_t>& smpte2086,
477 std::optional<aidl::android::hardware::graphics::common::Smpte2086>* outSmpte2086);
478
479status_t encodeCta861_3(
480 const std::optional<aidl::android::hardware::graphics::common::Cta861_3>& cta861_3,
481 android::hardware::hidl_vec<uint8_t>* outCta861_3);
482status_t decodeCta861_3(
483 const android::hardware::hidl_vec<uint8_t>& cta861_3,
484 std::optional<aidl::android::hardware::graphics::common::Cta861_3>* outCta861_3);
485
486status_t encodeSmpte2094_40(const std::optional<std::vector<uint8_t>>& smpte2094_40,
487 android::hardware::hidl_vec<uint8_t>* outSmpte2094_40);
488status_t decodeSmpte2094_40(const android::hardware::hidl_vec<uint8_t>& smpte2094_40,
489 std::optional<std::vector<uint8_t>>* outSmpte2094_40);
490
Marissa Wall22b2de12019-12-02 18:11:43 -0800491/**
492 * The functions below can be used to parse extendable types.
493 */
494bool isStandardMetadataType(
495 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType);
496bool isStandardCompression(
497 const aidl::android::hardware::graphics::common::ExtendableType& compression);
498bool isStandardInterlaced(
499 const aidl::android::hardware::graphics::common::ExtendableType& interlaced);
500bool isStandardChromaSiting(
501 const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting);
502bool isStandardPlaneLayoutComponentType(
503 const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType);
504
505aidl::android::hardware::graphics::common::StandardMetadataType getStandardMetadataTypeValue(
506 const android::hardware::graphics::mapper::V4_0::IMapper::MetadataType& metadataType);
507aidl::android::hardware::graphics::common::Compression getStandardCompressionValue(
508 const aidl::android::hardware::graphics::common::ExtendableType& compression);
509aidl::android::hardware::graphics::common::Interlaced getStandardInterlacedValue(
510 const aidl::android::hardware::graphics::common::ExtendableType& interlaced);
511aidl::android::hardware::graphics::common::ChromaSiting getStandardChromaSitingValue(
512 const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting);
513aidl::android::hardware::graphics::common::PlaneLayoutComponentType
514getStandardPlaneLayoutComponentTypeValue(
515 const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType);
516
517/**
518 * The functions below return string representations of ExtendableTypes
519 */
520std::string getCompressionName(
521 const aidl::android::hardware::graphics::common::ExtendableType& compression);
522std::string getInterlacedName(
523 const aidl::android::hardware::graphics::common::ExtendableType& interlaced);
524std::string getChromaSitingName(
525 const aidl::android::hardware::graphics::common::ExtendableType& chromaSiting);
526std::string getPlaneLayoutComponentTypeName(
527 const aidl::android::hardware::graphics::common::ExtendableType& planeLayoutComponentType);
528
Marissa Wall48586522019-11-19 14:01:36 -0800529} // namespace gralloc4
530
531} // namespace android