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 #define GRALLOC_ARM_BUFFER_ATTR_DATASPACE_SUPPORT
24 
25 /*
26  * Deprecated.
27  * Use GRALLOC_ARM_BUFFER_ATTR_DATASPACE
28  * instead.
29  */
30 typedef enum
31 {
32 	MALI_HDR_NO_INFO,
33 	MALI_HDR_ST2084,
34 	MALI_HDR_HLG,
35 	MALI_HDR_LAST
36 } mali_transfer_function;
37 
38 typedef struct
39 {
40 	//values are in units of 0.00002
41 	uint16_t x;
42 	uint16_t y;
43 } primaries;
44 
45 typedef struct
46 {
47 	primaries r;
48 	primaries g;
49 	primaries b;
50 	primaries w;
51 	uint16_t minDisplayLuminance; // in cd/m^2
52 	uint16_t maxDisplayLuminance; // in 0.0001 cd/m^2
53 	uint16_t maxContentLightLevel; // in cd/m^2
54 	uint16_t maxFrameAverageLightLevel; // in cd/m^2
55 
56 	/* Deprecated. Use GRALLOC_ARM_BUFFER_ATTR_DATASPACE instead. */
57 	mali_transfer_function eotf;
58 } mali_hdr_info;
59 
60 enum
61 {
62 	/* CROP_RECT and YUV_TRANS are intended to be
63 	 * written by producers and read by consumers.
64 	 * A producer should write these parameters before
65 	 * it queues a buffer to the consumer.
66 	 */
67 
68 	/* CROP RECT, defined as an int array of top, left, height, width. Origin in top-left corner */
69 	GRALLOC_ARM_BUFFER_ATTR_CROP_RECT = 1,
70 
71 	/* DEPRECATED. Set if the AFBC format used a YUV transform before compressing */
72 	GRALLOC_ARM_BUFFER_ATTR_AFBC_YUV_TRANS = 2,
73 
74 	/* Set if the AFBC format uses sparse allocation */
75 	GRALLOC_ARM_BUFFER_ATTR_AFBC_SPARSE_ALLOC = 3,
76 
77 	/* HDR Information */
78 	GRALLOC_ARM_BUFFER_ATTR_HDR_INFO = 4,
79 
80 	/* Dataspace - used for YUV to RGB conversion. */
81 	GRALLOC_ARM_BUFFER_ATTR_DATASPACE = 5,
82 
83 	/* Forced Dataspace - overrides ATTR_DATASPACE if not -1
84 	 * Used to override dataspace used in GPU YUV->RGB conversion if dataspace support is
85 	 * disabled in gralloc or system-wide.
86 	 * Datspace support is disabled system-wide when ro.vendor.cscsupported == 0 or not set.
87 	 * Otherwise remains as -1
88 	 * */
89 	GRALLOC_ARM_BUFFER_ATTR_FORCE_DATASPACE = 6,
90 
91 	GRALLOC_ARM_BUFFER_ATTR_LAST
92 };
93 
94 typedef uint32_t buf_attr;
95 
96 /*
97  * Deprecated.
98  * Use GRALLOC_ARM_BUFFER_ATTR_DATASPACE
99  * instead.
100  */
101 typedef enum
102 {
103 	MALI_YUV_NO_INFO,
104 	MALI_YUV_BT601_NARROW,
105 	MALI_YUV_BT601_WIDE,
106 	MALI_YUV_BT709_NARROW,
107 	MALI_YUV_BT709_WIDE,
108 	MALI_YUV_BT2020_NARROW,
109 	MALI_YUV_BT2020_WIDE
110 } mali_gralloc_yuv_info;
111 
112 #endif /* MALI_GRALLOC_PRIVATE_INTERFACE_TYPES_H_ */
113