summaryrefslogtreecommitdiff
path: root/gralloc-headers/pixel-gralloc/metadata.h
blob: 7502f298ad9ae890d7644ca88e04c529dcbd7213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include <aidl/android/hardware/graphics/common/StandardMetadataType.h>
#include <gralloctypes/Gralloc4.h>

#include <cstdint>
#include <limits>

namespace pixel::graphics {

constexpr const char* kGralloc4StandardMetadataTypeName = GRALLOC4_STANDARD_METADATA_TYPE;
constexpr const char* kPixelMetadataTypeName = "android.hardware.graphics.common.PixelMetadataType";

using StandardMetadataType = aidl::android::hardware::graphics::common::StandardMetadataType;

#define MapMetadataType(f) f = static_cast<uint64_t>(StandardMetadataType::f)

// This seemingly clashes with MetadataType in Mapper, but this enum represents just the "value"
// member of that struct. MetadataType comprises of a metadata name and value. Name is just there to
// identify what kind of metadata it is. So, for all StandardMetadataType, clients need to use
// kGralloc4StandardMetadataType and for pixel specific metadata, clients should use
// kPixelMetadataType.
enum class MetadataType : int64_t {
    MapMetadataType(INVALID),
    MapMetadataType(BUFFER_ID),
    MapMetadataType(NAME),
    MapMetadataType(WIDTH),
    MapMetadataType(HEIGHT),
    MapMetadataType(LAYER_COUNT),
    MapMetadataType(PIXEL_FORMAT_REQUESTED),
    MapMetadataType(PIXEL_FORMAT_FOURCC),
    MapMetadataType(PIXEL_FORMAT_MODIFIER),
    MapMetadataType(USAGE),
    MapMetadataType(ALLOCATION_SIZE),
    MapMetadataType(PROTECTED_CONTENT),
    MapMetadataType(COMPRESSION),
    MapMetadataType(INTERLACED),
    MapMetadataType(CHROMA_SITING),
    MapMetadataType(PLANE_LAYOUTS),
    MapMetadataType(CROP),
    MapMetadataType(DATASPACE),
    MapMetadataType(BLEND_MODE),
    MapMetadataType(SMPTE2086),
    MapMetadataType(CTA861_3),
    MapMetadataType(SMPTE2094_40),
    MapMetadataType(SMPTE2094_10),
    MapMetadataType(STRIDE),

    // Pixel specific metadata
    // Make sure to use kPixelMetadataType as the name when using these metadata.

    // TODO: These metadata queries returns a pointer inside metadata for now. Need to change that
    // so we are returning proper data only.
    VIDEO_HDR = std::numeric_limits<int64_t>::max() - (1 << 16),

    // TODO(b/289448426#comment2): ROIINFO is probably not being used. Remove this after
    // confirmation.
    VIDEO_ROI,
};

#undef MapMetadataType

} // namespace pixel::graphics