summaryrefslogtreecommitdiff
path: root/graphics/common/1.2/types.hal
blob: ebea1dcc7b190834d60c9667617b7bb4b24dd436 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.graphics.common@1.2;

import @1.0::Hdr;
import @1.1::BufferUsage;
import @1.1::ColorMode;
import @1.1::Dataspace;
import @1.1::PixelFormat;

/**
 * Hdr
 */
@export(name="android_hdr_v1_2_t", value_prefix="HAL_HDR_",
        export_parent="false")
enum Hdr : @1.0::Hdr {
    HDR10_PLUS = 4,
};

@export(name="android_dataspace_v1_2_t", value_prefix="HAL_DATASPACE_",
        export_parent="false")
enum Dataspace : @1.1::Dataspace {
    /**
     * ITU-R Recommendation 2020 (BT.2020)
     *
     * Ultra High-definition television
     *
     * Use full range, sRGB transfer and BT2020 standard
     */
    DISPLAY_BT2020 = STANDARD_BT2020 | TRANSFER_SRGB | RANGE_FULL,

    /**
     * ISO 16684-1:2011(E)
     *
     * Embedded depth metadata following the dynamic depth specification.
     */
    DYNAMIC_DEPTH = 0x1002,

    /**
     * JPEG APP segments format as specified by JEIDA spec
     *
     * The buffer must only contain APP1 (Application Marker) segment followed
     * by zero or more APPn segments, as is specified by JEITA CP-3451C section 4.5.4.
     * The APP1 segment optionally contains a thumbnail. The buffer will not
     * contain main compressed image.
     *
     * This value is valid with formats:
     *    HAL_PIXEL_FORMAT_BLOB: JPEG APP segments optionally containing thumbnail image
     * in APP1. BLOB buffer with this dataspace is output by HAL, and used by
     * camera framework to encode into a HEIC image.
     */
    JPEG_APP_SEGMENTS = 0x1003,

    /**
     * ISO/IEC 23008-12
     *
     * High Efficiency Image File Format (HEIF)
     *
     * This value is valid with formats:
     *    HAL_PIXEL_FORMAT_BLOB: A HEIC image encoded by HEIC or HEVC encoder
     * according to ISO/IEC 23008-12.
     */
    HEIF = 0x1004,
};

enum ColorMode : @1.1::ColorMode {
    /**
     * DISPLAY_BT2020 corresponds with display settings that implement the ITU-R
     * Recommendation BT.2020 / Rec. 2020 for UHDTV, but specifies an SRGB
     * transfer function.
     *
     * Primaries:
     *                  x       y
     *  green           0.170   0.797
     *  blue            0.131   0.046
     *  red             0.708   0.292
     *  white (D65)     0.3127  0.3290
     *
     * Transfer Function is sRGB
     */
    DISPLAY_BT2020 = 13,
};

/**
 * Buffer usage definitions.
 */
enum BufferUsage : @1.1::BufferUsage {
    /**
     * Buffer is used as input for HEIC encoder.
     */
    HW_IMAGE_ENCODER = 1ULL << 27,

    /* bits 28 and 32-47 must be zero and are reserved for future versions */
};

/**
 * HIDL counterpart of `AHardwareBuffer_Desc`.
 *
 * An `AHardwareBuffer_Desc` object can be converted to and from a
 * `HardwareBufferDescription` object by `memcpy()`.
 *
 * @sa +ndk libnativewindow#AHardwareBuffer_Desc.
 */
typedef uint32_t[10] HardwareBufferDescription;

/**
 * HIDL counterpart of `AHardwareBuffer`.
 *
 * AHardwareBuffer_createFromHandle() can be used to convert a `HardwareBuffer`
 * object to an `AHardwareBuffer` object.
 *
 * Conversely, AHardwareBuffer_getNativeHandle() can be used to extract a native
 * handle from an `AHardwareBuffer` object. Paired with `AHardwareBuffer_Desc`,
 * AHardwareBuffer_getNativeHandle() can be used to convert between
 * `HardwareBuffer` and `AHardwareBuffer`.
 *
 * @sa +ndk libnativewindow#AHardwareBuffer".
 */
struct HardwareBuffer {
    HardwareBufferDescription description;
    handle nativeHandle;
};

/**
 * HIDL counterpart of `ARect`.
 *
 * @sa +ndk libarect_headers#ARect.
 */
typedef int32_t[4] Rect;

/**
 * Pixel formats for graphics buffers.
 */
@export(name="android_pixel_format_v1_2_t", value_prefix="HAL_PIXEL_FORMAT_",
        export_parent="false")
enum PixelFormat : @1.1::PixelFormat {
    /**
     * 24-bit format that has 8-bit H, S, and V components, in that order,
     * from the lowest memory address to the highest memory address.
     *
     * The component values are unsigned normalized to the range [0, 1], whose
     * interpretation is defined by the dataspace.
    */
    HSV_888 = 0x37,
};