1 /*
2  * Copyright (C) 2017 ARM Limited. All rights reserved.
3  *
4  * Copyright (C) 2008 The Android Open Source Project
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef MALI_GRALLOC_PRIVATE_INTERFACE_TYPES_H_
20 #define MALI_GRALLOC_PRIVATE_INTERFACE_TYPES_H_
21 
22 #define GRALLOC_ARM_BUFFER_ATTR_HDR_INFO_SUPPORT
23 
24 typedef enum
25 {
26 	MALI_HDR_NO_INFO,
27 	MALI_HDR_ST2084,
28 	MALI_HDR_HLG,
29 	MALI_HDR_LAST
30 } mali_transfer_function;
31 
32 typedef struct
33 {
34 	//values are in units of 0.00002
35 	uint16_t x;
36 	uint16_t y;
37 } primaries;
38 
39 typedef struct
40 {
41 	primaries r;
42 	primaries g;
43 	primaries b;
44 	primaries w;
45 	uint16_t minDisplayLuminance; // in cd/m^2
46 	uint16_t maxDisplayLuminance; // in 0.0001 cd/m^2
47 	uint16_t maxContentLightLevel; // in cd/m^2
48 	uint16_t maxFrameAverageLightLevel; // in cd/m^2
49 	mali_transfer_function eotf;
50 } mali_hdr_info;
51 
52 enum
53 {
54 	/* CROP_RECT and YUV_TRANS are intended to be
55 	 * written by producers and read by consumers.
56 	 * A producer should write these parameters before
57 	 * it queues a buffer to the consumer.
58 	 */
59 
60 	/* CROP RECT, defined as an int array of top, left, height, width. Origin in top-left corner */
61 	GRALLOC_ARM_BUFFER_ATTR_CROP_RECT = 1,
62 
63 	/* Set if the AFBC format used a YUV transform before compressing */
64 	GRALLOC_ARM_BUFFER_ATTR_AFBC_YUV_TRANS = 2,
65 
66 	/* Set if the AFBC format uses sparse allocation */
67 	GRALLOC_ARM_BUFFER_ATTR_AFBC_SPARSE_ALLOC = 3,
68 
69 	/* HDR Informations*/
70 	GRALLOC_ARM_BUFFER_ATTR_HDR_INFO = 4,
71 
72 	GRALLOC_ARM_BUFFER_ATTR_LAST
73 };
74 
75 typedef uint32_t buf_attr;
76 
77 typedef enum
78 {
79 	MALI_YUV_NO_INFO,
80 	MALI_YUV_BT601_NARROW,
81 	MALI_YUV_BT601_WIDE,
82 	MALI_YUV_BT709_NARROW,
83 	MALI_YUV_BT709_WIDE
84 } mali_gralloc_yuv_info;
85 
86 #endif /* MALI_GRALLOC_PRIVATE_INTERFACE_TYPES_H_ */
87