• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include <aidl/android/hardware/graphics/common/StandardMetadataType.h>
4 #include <gralloctypes/Gralloc4.h>
5 
6 #include <cstdint>
7 #include <limits>
8 
9 namespace pixel::graphics {
10 
11 constexpr const char* kGralloc4StandardMetadataTypeName = GRALLOC4_STANDARD_METADATA_TYPE;
12 constexpr const char* kPixelMetadataTypeName = "android.hardware.graphics.common.PixelMetadataType";
13 
14 using StandardMetadataType = aidl::android::hardware::graphics::common::StandardMetadataType;
15 
16 #define MapMetadataType(f) f = static_cast<uint64_t>(StandardMetadataType::f)
17 
18 // This seemingly clashes with MetadataType in Mapper, but this enum represents just the "value"
19 // member of that struct. MetadataType comprises of a metadata name and value. Name is just there to
20 // identify what kind of metadata it is. So, for all StandardMetadataType, clients need to use
21 // kGralloc4StandardMetadataType and for pixel specific metadata, clients should use
22 // kPixelMetadataType.
23 enum class MetadataType : int64_t {
24     MapMetadataType(INVALID),
25     MapMetadataType(BUFFER_ID),
26     MapMetadataType(NAME),
27     MapMetadataType(WIDTH),
28     MapMetadataType(HEIGHT),
29     MapMetadataType(LAYER_COUNT),
30     MapMetadataType(PIXEL_FORMAT_REQUESTED),
31     MapMetadataType(PIXEL_FORMAT_FOURCC),
32     MapMetadataType(PIXEL_FORMAT_MODIFIER),
33     MapMetadataType(USAGE),
34     MapMetadataType(ALLOCATION_SIZE),
35     MapMetadataType(PROTECTED_CONTENT),
36     MapMetadataType(COMPRESSION),
37     MapMetadataType(INTERLACED),
38     MapMetadataType(CHROMA_SITING),
39     MapMetadataType(PLANE_LAYOUTS),
40     MapMetadataType(CROP),
41     MapMetadataType(DATASPACE),
42     MapMetadataType(BLEND_MODE),
43     MapMetadataType(SMPTE2086),
44     MapMetadataType(CTA861_3),
45     MapMetadataType(SMPTE2094_40),
46     MapMetadataType(SMPTE2094_10),
47     MapMetadataType(STRIDE),
48 
49     // Pixel specific metadata
50     // Make sure to use kPixelMetadataType as the name when using these metadata.
51 
52     // TODO: These metadata queries returns a pointer inside metadata for now. Need to change that
53     // so we are returning proper data only.
54     VIDEO_HDR = std::numeric_limits<int64_t>::max() - (1 << 16),
55 
56     // TODO(b/289448426#comment2): ROIINFO is probably not being used. Remove this after
57     // confirmation.
58     VIDEO_ROI,
59 };
60 
61 #undef MapMetadataType
62 
63 } // namespace pixel::graphics
64