1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _MSM_MDP_EXT_H_
8 #define _MSM_MDP_EXT_H_
9 #include <linux/msm_mdp.h>
10 #define MDP_IOCTL_MAGIC 'S'
11 #define MSMFB_ATOMIC_COMMIT _IOWR(MDP_IOCTL_MAGIC, 128, void *)
12 #define MSMFB_ASYNC_POSITION_UPDATE _IOWR(MDP_IOCTL_MAGIC, 129, struct mdp_position_update)
13 #define MSMFB_MDP_SET_CFG _IOW(MDP_IOCTL_MAGIC, 130, struct mdp_set_cfg)
14 #define MSMFB_MDP_SET_PANEL_PPM _IOW(MDP_IOCTL_MAGIC, 131, int)
15 #ifdef __LP64
16 #define MDP_LAYER_COMMIT_V1_PAD 2
17 #else
18 #define MDP_LAYER_COMMIT_V1_PAD 3
19 #endif
20 #define MDP_LAYER_FLIP_LR 0x1
21 #define MDP_LAYER_FLIP_UD 0x2
22 #define MDP_LAYER_ENABLE_PIXEL_EXT 0x4
23 #define MDP_LAYER_FORGROUND 0x8
24 #define MDP_LAYER_SECURE_SESSION 0x10
25 #define MDP_LAYER_SOLID_FILL 0x20
26 #define MDP_LAYER_DEINTERLACE 0x40
27 #define MDP_LAYER_BWC 0x80
28 #define MDP_LAYER_ASYNC 0x100
29 #define MDP_LAYER_PP 0x200
30 #define MDP_LAYER_SECURE_DISPLAY_SESSION 0x400
31 #define MDP_LAYER_ENABLE_QSEED3_SCALE 0x800
32 #define MDP_LAYER_MULTIRECT_ENABLE 0x1000
33 #define MDP_LAYER_MULTIRECT_PARALLEL_MODE 0x2000
34 #define MDP_LAYER_SECURE_CAMERA_SESSION 0x4000
35 #define MDP_DESTSCALER_ENABLE 0x1
36 #define MDP_DESTSCALER_SCALE_UPDATE 0x2
37 #define MDP_DESTSCALER_ENHANCER_UPDATE 0x4
38 #define MDP_DESTSCALER_ROI_ENABLE 0x8
39 #define MDP_VALIDATE_LAYER 0x01
40 #define MDP_COMMIT_WAIT_FOR_FINISH 0x02
41 #define MDP_COMMIT_SYNC_FENCE_WAIT 0x04
42 #define MDP_COMMIT_AVR_EN 0x08
43 #define MDP_COMMIT_AVR_ONE_SHOT_MODE 0x10
44 #define MDP_COMMIT_PARTIAL_UPDATE_DUAL_ROI 0x20
45 #define MDP_COMMIT_UPDATE_BRIGHTNESS 0x40
46 #define MDP_COMMIT_CWB_EN 0x800
47 #define MDP_COMMIT_CWB_DSPP 0x1000
48 #define MDP_COMMIT_RECT_NUM 0x2000
49 #define MDP_COMMIT_VERSION_1_0 0x00010000
50 #define OUT_LAYER_COLOR_SPACE
51 #define MDP_HDR_EOTF_SMTPE_ST2084 0x2
52 #define MDP_HDR_EOTF_HLG 0x3
53 #define MDP_PIXEL_ENCODING_RGB 0x0
54 #define MDP_PIXEL_ENCODING_YCBCR_444 0x1
55 #define MDP_PIXEL_ENCODING_YCBCR_422 0x2
56 #define MDP_PIXEL_ENCODING_YCBCR_420 0x3
57 #define MDP_PIXEL_ENCODING_Y_ONLY 0x4
58 #define MDP_PIXEL_ENCODING_RAW 0x5
59 #define MDP_COLORIMETRY_RGB_SRGB 0x0
60 #define MDP_COLORIMETRY_RGB_WIDE_FIXED_POINT 0x1
61 #define MDP_COLORIMETRY_RGB_WIDE_FLOAT_POINT 0x2
62 #define MDP_COLORIMETRY_RGB_ADOBE 0x3
63 #define MDP_COLORIMETRY_RGB_DPI_P3 0x4
64 #define MDP_COLORIMETRY_RGB_CUSTOM 0x5
65 #define MDP_COLORIMETRY_RGB_ITU_R_BT_2020 0x6
66 #define MDP_COLORIMETRY_YCBCR_ITU_R_BT_601 0x0
67 #define MDP_COLORIMETRY_YCBCR_ITU_R_BT_709 0x1
68 #define MDP_COLORIMETRY_YCBCR_XV_YCC_601 0x2
69 #define MDP_COLORIMETRY_YCBCR_XV_YCC_709 0x3
70 #define MDP_COLORIMETRY_YCBCR_S_YCC_601 0x4
71 #define MDP_COLORIMETRY_YCBCR_ADOBE_YCC_601 0x5
72 #define MDP_COLORIMETRY_YCBCR_ITU_R_BT_2020_YCBCR_CONST 0x6
73 #define MDP_COLORIMETRY_YCBCR_ITU_R_BT_2020_YCBCR 0x7
74 #define MDP_DYNAMIC_RANGE_VESA 0x0
75 #define MDP_DYNAMIC_RANGE_CEA 0x1
76 #define MDP_RGB_6_BPC 0x0
77 #define MDP_RGB_8_BPC 0x1
78 #define MDP_RGB_10_BPC 0x2
79 #define MDP_RGB_12_BPC 0x3
80 #define MDP_RGB_16_BPC 0x4
81 #define MDP_YUV_8_BPC 0x1
82 #define MDP_YUV_10_BPC 0x2
83 #define MDP_YUV_12_BPC 0x3
84 #define MDP_YUV_16_BPC 0x4
85 #define MDP_RAW_6_BPC 0x1
86 #define MDP_RAW_7_BPC 0x2
87 #define MDP_RAW_8_BPC 0x3
88 #define MDP_RAW_10_BPC 0x4
89 #define MDP_RAW_12_BPC 0x5
90 #define MDP_RAW_14_BPC 0x6
91 #define MDP_RAW16_BPC 0x7
92 #define MDP_CONTENT_TYPE_NOT_DEFINED 0x0
93 #define MDP_CONTENT_TYPE_GRAPHICS 0x1
94 #define MDP_CONTENT_TYPE_PHOTO 0x2
95 #define MDP_CONTENT_TYPE_VIDEO 0x3
96 #define MDP_CONTENT_TYPE_GAME 0x4
97 struct mdp_layer_plane {
98   int fd;
99   uint32_t offset;
100   uint32_t stride;
101 };
102 struct mdp_layer_buffer {
103   uint32_t width;
104   uint32_t height;
105   uint32_t format;
106   struct mdp_layer_plane planes[MAX_PLANES];
107   uint32_t plane_count;
108   struct mult_factor comp_ratio;
109   int fence;
110   uint32_t reserved;
111 };
112 struct mdp_input_layer {
113   uint32_t flags;
114   uint32_t pipe_ndx;
115   uint8_t horz_deci;
116   uint8_t vert_deci;
117   uint8_t alpha;
118   uint16_t z_order;
119   uint32_t transp_mask;
120   uint32_t bg_color;
121   enum mdss_mdp_blend_op blend_op;
122   enum mdp_color_space color_space;
123   struct mdp_rect src_rect;
124   struct mdp_rect dst_rect;
125   void * scale;
126   struct mdp_layer_buffer buffer;
127   void * pp_info;
128   int error_code;
129   uint32_t rect_num;
130   uint32_t reserved[5];
131 };
132 struct mdp_output_layer {
133   uint32_t flags;
134   uint32_t writeback_ndx;
135   struct mdp_layer_buffer buffer;
136   enum mdp_color_space color_space;
137   uint32_t reserved[5];
138 };
139 struct mdp_destination_scaler_data {
140   uint32_t flags;
141   uint32_t dest_scaler_ndx;
142   uint32_t lm_width;
143   uint32_t lm_height;
144   uint64_t scale;
145   struct mdp_rect panel_roi;
146 };
147 struct mdp_layer_commit_v1 {
148   uint32_t flags;
149   int release_fence;
150   struct mdp_rect left_roi;
151   struct mdp_rect right_roi;
152   struct mdp_input_layer * input_layers;
153   uint32_t input_layer_cnt;
154   struct mdp_output_layer * output_layer;
155   int retire_fence;
156   void * dest_scaler;
157   uint32_t dest_scaler_cnt;
158   uint32_t bl_level;
159   uint32_t reserved[MDP_LAYER_COMMIT_V1_PAD];
160 };
161 struct mdp_layer_commit {
162   uint32_t version;
163   union {
164     struct mdp_layer_commit_v1 commit_v1;
165   };
166 };
167 struct mdp_point {
168   uint32_t x;
169   uint32_t y;
170 };
171 struct mdp_async_layer {
172   uint32_t flags;
173   uint32_t pipe_ndx;
174   struct mdp_point src;
175   struct mdp_point dst;
176   int error_code;
177   uint32_t reserved[3];
178 };
179 struct mdp_position_update {
180   struct mdp_async_layer * input_layers;
181   uint32_t input_layer_cnt;
182 };
183 #define MAX_DET_CURVES 3
184 struct mdp_det_enhance_data {
185   uint32_t enable;
186   int16_t sharpen_level1;
187   int16_t sharpen_level2;
188   uint16_t clip;
189   uint16_t limit;
190   uint16_t thr_quiet;
191   uint16_t thr_dieout;
192   uint16_t thr_low;
193   uint16_t thr_high;
194   uint16_t prec_shift;
195   int16_t adjust_a[MAX_DET_CURVES];
196   int16_t adjust_b[MAX_DET_CURVES];
197   int16_t adjust_c[MAX_DET_CURVES];
198 };
199 #define ENABLE_SCALE 0x1
200 #define ENABLE_DETAIL_ENHANCE 0x2
201 #define ENABLE_DIRECTION_DETECTION 0x4
202 #define SCALER_LUT_SWAP 0x1
203 #define SCALER_LUT_DIR_WR 0x2
204 #define SCALER_LUT_Y_CIR_WR 0x4
205 #define SCALER_LUT_UV_CIR_WR 0x8
206 #define SCALER_LUT_Y_SEP_WR 0x10
207 #define SCALER_LUT_UV_SEP_WR 0x20
208 #define FILTER_EDGE_DIRECTED_2D 0x0
209 #define FILTER_CIRCULAR_2D 0x1
210 #define FILTER_SEPARABLE_1D 0x2
211 #define FILTER_BILINEAR 0x3
212 #define FILTER_ALPHA_DROP_REPEAT 0x0
213 #define FILTER_ALPHA_BILINEAR 0x1
214 struct mdp_scale_data_v2 {
215   uint32_t enable;
216   int32_t init_phase_x[MAX_PLANES];
217   int32_t phase_step_x[MAX_PLANES];
218   int32_t init_phase_y[MAX_PLANES];
219   int32_t phase_step_y[MAX_PLANES];
220   uint32_t num_ext_pxls_left[MAX_PLANES];
221   uint32_t num_ext_pxls_right[MAX_PLANES];
222   uint32_t num_ext_pxls_top[MAX_PLANES];
223   uint32_t num_ext_pxls_btm[MAX_PLANES];
224   int32_t left_ftch[MAX_PLANES];
225   int32_t left_rpt[MAX_PLANES];
226   int32_t right_ftch[MAX_PLANES];
227   int32_t right_rpt[MAX_PLANES];
228   uint32_t top_rpt[MAX_PLANES];
229   uint32_t btm_rpt[MAX_PLANES];
230   uint32_t top_ftch[MAX_PLANES];
231   uint32_t btm_ftch[MAX_PLANES];
232   uint32_t roi_w[MAX_PLANES];
233   uint32_t preload_x[MAX_PLANES];
234   uint32_t preload_y[MAX_PLANES];
235   uint32_t src_width[MAX_PLANES];
236   uint32_t src_height[MAX_PLANES];
237   uint32_t dst_width;
238   uint32_t dst_height;
239   uint32_t y_rgb_filter_cfg;
240   uint32_t uv_filter_cfg;
241   uint32_t alpha_filter_cfg;
242   uint32_t blend_cfg;
243   uint32_t lut_flag;
244   uint32_t dir_lut_idx;
245   uint32_t y_rgb_cir_lut_idx;
246   uint32_t uv_cir_lut_idx;
247   uint32_t y_rgb_sep_lut_idx;
248   uint32_t uv_sep_lut_idx;
249   struct mdp_det_enhance_data detail_enhance;
250   uint64_t reserved[8];
251 };
252 struct mdp_scale_luts_info {
253   uint64_t dir_lut;
254   uint64_t cir_lut;
255   uint64_t sep_lut;
256   uint32_t dir_lut_size;
257   uint32_t cir_lut_size;
258   uint32_t sep_lut_size;
259 };
260 #define MDP_QSEED3_LUT_CFG 0x1
261 struct mdp_set_cfg {
262   uint64_t flags;
263   uint32_t len;
264   uint64_t payload;
265 };
266 #define HDR_PRIMARIES_COUNT 3
267 #define MDP_HDR_STREAM
268 struct mdp_hdr_stream {
269   uint32_t eotf;
270   uint32_t display_primaries_x[HDR_PRIMARIES_COUNT];
271   uint32_t display_primaries_y[HDR_PRIMARIES_COUNT];
272   uint32_t white_point_x;
273   uint32_t white_point_y;
274   uint32_t max_luminance;
275   uint32_t min_luminance;
276   uint32_t max_content_light_level;
277   uint32_t max_average_light_level;
278   uint32_t pixel_encoding;
279   uint32_t colorimetry;
280   uint32_t range;
281   uint32_t bits_per_component;
282   uint32_t content_type;
283   uint32_t reserved[5];
284 };
285 #define HDR_ENABLE (1 << 0)
286 #define HDR_DISABLE (1 << 1)
287 #define HDR_RESET (1 << 2)
288 struct mdp_hdr_stream_ctrl {
289   __u8 hdr_state;
290   struct mdp_hdr_stream hdr_stream;
291 };
292 #endif
293