blob: abdcd29e95aa583dcca921514f0082f5a656aa53 [file] [log] [blame]
Ethan Yonker4ee5ad72014-02-18 18:41:17 -06001/* include/linux/msm_mdp.h
2 *
3 * Copyright (C) 2007 Google Incorporated
4 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef _MSM_MDP_H_
16#define _MSM_MDP_H_
17
18#include <linux/types.h>
19#include <linux/fb.h>
20
21#define MSMFB_IOCTL_MAGIC 'm'
22#define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int)
23#define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int)
24#define MSMFB_SUSPEND_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 128, unsigned int)
25#define MSMFB_RESUME_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 129, unsigned int)
26#define MSMFB_CURSOR _IOW(MSMFB_IOCTL_MAGIC, 130, struct fb_cursor)
27#define MSMFB_SET_LUT _IOW(MSMFB_IOCTL_MAGIC, 131, struct fb_cmap)
28#define MSMFB_HISTOGRAM _IOWR(MSMFB_IOCTL_MAGIC, 132, struct mdp_histogram_data)
29/* new ioctls's for set/get ccs matrix */
30#define MSMFB_GET_CCS_MATRIX _IOWR(MSMFB_IOCTL_MAGIC, 133, struct mdp_ccs)
31#define MSMFB_SET_CCS_MATRIX _IOW(MSMFB_IOCTL_MAGIC, 134, struct mdp_ccs)
32#define MSMFB_OVERLAY_SET _IOWR(MSMFB_IOCTL_MAGIC, 135, \
33 struct mdp_overlay)
34#define MSMFB_OVERLAY_UNSET _IOW(MSMFB_IOCTL_MAGIC, 136, unsigned int)
35
36#define MSMFB_OVERLAY_PLAY _IOW(MSMFB_IOCTL_MAGIC, 137, \
37 struct msmfb_overlay_data)
38#define MSMFB_OVERLAY_QUEUE MSMFB_OVERLAY_PLAY
39
40#define MSMFB_GET_PAGE_PROTECTION _IOR(MSMFB_IOCTL_MAGIC, 138, \
41 struct mdp_page_protection)
42#define MSMFB_SET_PAGE_PROTECTION _IOW(MSMFB_IOCTL_MAGIC, 139, \
43 struct mdp_page_protection)
44#define MSMFB_OVERLAY_GET _IOR(MSMFB_IOCTL_MAGIC, 140, \
45 struct mdp_overlay)
46#define MSMFB_OVERLAY_PLAY_ENABLE _IOW(MSMFB_IOCTL_MAGIC, 141, unsigned int)
47#define MSMFB_OVERLAY_BLT _IOWR(MSMFB_IOCTL_MAGIC, 142, \
48 struct msmfb_overlay_blt)
49#define MSMFB_OVERLAY_BLT_OFFSET _IOW(MSMFB_IOCTL_MAGIC, 143, unsigned int)
50#define MSMFB_HISTOGRAM_START _IOR(MSMFB_IOCTL_MAGIC, 144, \
51 struct mdp_histogram_start_req)
52#define MSMFB_HISTOGRAM_STOP _IOR(MSMFB_IOCTL_MAGIC, 145, unsigned int)
53#define MSMFB_NOTIFY_UPDATE _IOWR(MSMFB_IOCTL_MAGIC, 146, unsigned int)
54
55#define MSMFB_OVERLAY_3D _IOWR(MSMFB_IOCTL_MAGIC, 147, \
56 struct msmfb_overlay_3d)
57
58#define MSMFB_MIXER_INFO _IOWR(MSMFB_IOCTL_MAGIC, 148, \
59 struct msmfb_mixer_info_req)
60#define MSMFB_OVERLAY_PLAY_WAIT _IOWR(MSMFB_IOCTL_MAGIC, 149, \
61 struct msmfb_overlay_data)
62#define MSMFB_WRITEBACK_INIT _IO(MSMFB_IOCTL_MAGIC, 150)
63#define MSMFB_WRITEBACK_START _IO(MSMFB_IOCTL_MAGIC, 151)
64#define MSMFB_WRITEBACK_STOP _IO(MSMFB_IOCTL_MAGIC, 152)
65#define MSMFB_WRITEBACK_QUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 153, \
66 struct msmfb_data)
67#define MSMFB_WRITEBACK_DEQUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 154, \
68 struct msmfb_data)
69#define MSMFB_WRITEBACK_TERMINATE _IO(MSMFB_IOCTL_MAGIC, 155)
70#define MSMFB_MDP_PP _IOWR(MSMFB_IOCTL_MAGIC, 156, struct msmfb_mdp_pp)
71#define MSMFB_OVERLAY_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 160, unsigned int)
72#define MSMFB_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 161, unsigned int)
73#define MSMFB_BUFFER_SYNC _IOW(MSMFB_IOCTL_MAGIC, 162, struct mdp_buf_sync)
74#define MSMFB_OVERLAY_COMMIT _IO(MSMFB_IOCTL_MAGIC, 163)
75#define MSMFB_DISPLAY_COMMIT _IOW(MSMFB_IOCTL_MAGIC, 164, \
76 struct mdp_display_commit)
77#define MSMFB_METADATA_SET _IOW(MSMFB_IOCTL_MAGIC, 165, struct msmfb_metadata)
78#define MSMFB_METADATA_GET _IOW(MSMFB_IOCTL_MAGIC, 166, struct msmfb_metadata)
79#define MSMFB_WRITEBACK_SET_MIRRORING_HINT _IOW(MSMFB_IOCTL_MAGIC, 167, \
80 unsigned int)
81#define MSMFB_ASYNC_BLIT _IOW(MSMFB_IOCTL_MAGIC, 168, unsigned int)
82
83#define FB_TYPE_3D_PANEL 0x10101010
84#define MDP_IMGTYPE2_START 0x10000
85#define MSMFB_DRIVER_VERSION 0xF9E8D701
86
87enum {
88 NOTIFY_UPDATE_START,
89 NOTIFY_UPDATE_STOP,
90 NOTIFY_UPDATE_POWER_OFF,
91};
92
93enum {
94 NOTIFY_TYPE_NO_UPDATE,
95 NOTIFY_TYPE_SUSPEND,
96 NOTIFY_TYPE_UPDATE,
97};
98
99enum {
100 MDP_RGB_565, /* RGB 565 planer */
101 MDP_XRGB_8888, /* RGB 888 padded */
102 MDP_Y_CBCR_H2V2, /* Y and CbCr, pseudo planer w/ Cb is in MSB */
103 MDP_Y_CBCR_H2V2_ADRENO,
104 MDP_ARGB_8888, /* ARGB 888 */
105 MDP_RGB_888, /* RGB 888 planer */
106 MDP_Y_CRCB_H2V2, /* Y and CrCb, pseudo planer w/ Cr is in MSB */
107 MDP_YCRYCB_H2V1, /* YCrYCb interleave */
108 MDP_CBYCRY_H2V1, /* CbYCrY interleave */
109 MDP_Y_CRCB_H2V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */
110 MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */
111 MDP_Y_CRCB_H1V2,
112 MDP_Y_CBCR_H1V2,
113 MDP_RGBA_8888, /* ARGB 888 */
114 MDP_BGRA_8888, /* ABGR 888 */
115 MDP_RGBX_8888, /* RGBX 888 */
116 MDP_Y_CRCB_H2V2_TILE, /* Y and CrCb, pseudo planer tile */
117 MDP_Y_CBCR_H2V2_TILE, /* Y and CbCr, pseudo planer tile */
118 MDP_Y_CR_CB_H2V2, /* Y, Cr and Cb, planar */
119 MDP_Y_CR_CB_GH2V2, /* Y, Cr and Cb, planar aligned to Android YV12 */
120 MDP_Y_CB_CR_H2V2, /* Y, Cb and Cr, planar */
121 MDP_Y_CRCB_H1V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */
122 MDP_Y_CBCR_H1V1, /* Y and CbCr, pseduo planer w/ Cb is in MSB */
123 MDP_YCRCB_H1V1, /* YCrCb interleave */
124 MDP_YCBCR_H1V1, /* YCbCr interleave */
125 MDP_BGR_565, /* BGR 565 planer */
126 MDP_BGR_888, /* BGR 888 */
127 MDP_Y_CBCR_H2V2_VENUS,
128 MDP_BGRX_8888, /* BGRX 8888 */
129 MDP_RGBA_8888_TILE, /* RGBA 8888 in tile format */
130 MDP_ARGB_8888_TILE, /* ARGB 8888 in tile format */
131 MDP_ABGR_8888_TILE, /* ABGR 8888 in tile format */
132 MDP_BGRA_8888_TILE, /* BGRA 8888 in tile format */
133 MDP_RGBX_8888_TILE, /* RGBX 8888 in tile format */
134 MDP_XRGB_8888_TILE, /* XRGB 8888 in tile format */
135 MDP_XBGR_8888_TILE, /* XBGR 8888 in tile format */
136 MDP_BGRX_8888_TILE, /* BGRX 8888 in tile format */
137 MDP_YCBYCR_H2V1, /* YCbYCr interleave */
138 MDP_IMGTYPE_LIMIT,
139 MDP_RGB_BORDERFILL, /* border fill pipe */
140 MDP_FB_FORMAT = MDP_IMGTYPE2_START, /* framebuffer format */
141 MDP_IMGTYPE_LIMIT2 /* Non valid image type after this enum */
142};
143
144enum {
145 PMEM_IMG,
146 FB_IMG,
147};
148
149enum {
150 HSIC_HUE = 0,
151 HSIC_SAT,
152 HSIC_INT,
153 HSIC_CON,
154 NUM_HSIC_PARAM,
155};
156
157#define MDSS_MDP_ROT_ONLY 0x80
158#define MDSS_MDP_RIGHT_MIXER 0x100
159#define MDSS_MDP_DUAL_PIPE 0x200
160
161/* mdp_blit_req flag values */
162#define MDP_ROT_NOP 0
163#define MDP_FLIP_LR 0x1
164#define MDP_FLIP_UD 0x2
165#define MDP_ROT_90 0x4
166#define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR)
167#define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR)
168#define MDP_DITHER 0x8
169#define MDP_BLUR 0x10
170#define MDP_BLEND_FG_PREMULT 0x20000
171#define MDP_IS_FG 0x40000
172#define MDP_SOLID_FILL 0x0000100
173#define MDP_DEINTERLACE 0x80000000
174#define MDP_SHARPENING 0x40000000
175#define MDP_NO_DMA_BARRIER_START 0x20000000
176#define MDP_NO_DMA_BARRIER_END 0x10000000
177#define MDP_NO_BLIT 0x08000000
178#define MDP_BLIT_WITH_DMA_BARRIERS 0x000
179#define MDP_BLIT_WITH_NO_DMA_BARRIERS \
180 (MDP_NO_DMA_BARRIER_START | MDP_NO_DMA_BARRIER_END)
181#define MDP_BLIT_SRC_GEM 0x04000000
182#define MDP_BLIT_DST_GEM 0x02000000
183#define MDP_BLIT_NON_CACHED 0x01000000
184#define MDP_OV_PIPE_SHARE 0x00800000
185#define MDP_DEINTERLACE_ODD 0x00400000
186#define MDP_OV_PLAY_NOWAIT 0x00200000
187#define MDP_SOURCE_ROTATED_90 0x00100000
188#define MDP_OVERLAY_PP_CFG_EN 0x00080000
189#define MDP_BACKEND_COMPOSITION 0x00040000
190#define MDP_BORDERFILL_SUPPORTED 0x00010000
191#define MDP_SECURE_OVERLAY_SESSION 0x00008000
192#define MDP_SECURE_DISPLAY_OVERLAY_SESSION 0x00002000
193#define MDP_OV_PIPE_FORCE_DMA 0x00004000
194#define MDP_MEMORY_ID_TYPE_FB 0x00001000
195#define MDP_BWC_EN 0x00000400
196#define MDP_DECIMATION_EN 0x00000800
197#define MDP_TRANSP_NOP 0xffffffff
198#define MDP_ALPHA_NOP 0xff
199
200#define MDP_FB_PAGE_PROTECTION_NONCACHED (0)
201#define MDP_FB_PAGE_PROTECTION_WRITECOMBINE (1)
202#define MDP_FB_PAGE_PROTECTION_WRITETHROUGHCACHE (2)
203#define MDP_FB_PAGE_PROTECTION_WRITEBACKCACHE (3)
204#define MDP_FB_PAGE_PROTECTION_WRITEBACKWACACHE (4)
205/* Sentinel: Don't use! */
206#define MDP_FB_PAGE_PROTECTION_INVALID (5)
207/* Count of the number of MDP_FB_PAGE_PROTECTION_... values. */
208#define MDP_NUM_FB_PAGE_PROTECTION_VALUES (5)
209
210struct mdp_rect {
211 uint32_t x;
212 uint32_t y;
213 uint32_t w;
214 uint32_t h;
215};
216
217struct mdp_img {
218 uint32_t width;
219 uint32_t height;
220 uint32_t format;
221 uint32_t offset;
222 int memory_id; /* the file descriptor */
223 uint32_t priv;
224};
225
226/*
227 * {3x3} + {3} ccs matrix
228 */
229
230#define MDP_CCS_RGB2YUV 0
231#define MDP_CCS_YUV2RGB 1
232
233#define MDP_CCS_SIZE 9
234#define MDP_BV_SIZE 3
235
236struct mdp_ccs {
237 int direction; /* MDP_CCS_RGB2YUV or YUV2RGB */
238 uint16_t ccs[MDP_CCS_SIZE]; /* 3x3 color coefficients */
239 uint16_t bv[MDP_BV_SIZE]; /* 1x3 bias vector */
240};
241
242struct mdp_csc {
243 int id;
244 uint32_t csc_mv[9];
245 uint32_t csc_pre_bv[3];
246 uint32_t csc_post_bv[3];
247 uint32_t csc_pre_lv[6];
248 uint32_t csc_post_lv[6];
249};
250
251/* The version of the mdp_blit_req structure so that
252 * user applications can selectively decide which functionality
253 * to include
254 */
255
256#define MDP_BLIT_REQ_VERSION 2
257
258struct color {
259 uint32_t r;
260 uint32_t g;
261 uint32_t b;
262 uint32_t alpha;
263};
264
265struct mdp_blit_req {
266 struct mdp_img src;
267 struct mdp_img dst;
268 struct mdp_rect src_rect;
269 struct mdp_rect dst_rect;
270 struct color const_color;
271 uint32_t alpha;
272 uint32_t transp_mask;
273 uint32_t flags;
274 int sharpening_strength; /* -127 <--> 127, default 64 */
275};
276
277struct mdp_blit_req_list {
278 uint32_t count;
279 struct mdp_blit_req req[];
280};
281
282#define MSMFB_DATA_VERSION 2
283
284struct msmfb_data {
285 uint32_t offset;
286 int memory_id;
287 int id;
288 uint32_t flags;
289 uint32_t priv;
290 uint32_t iova;
291};
292
293#define MSMFB_NEW_REQUEST -1
294
295struct msmfb_overlay_data {
296 uint32_t id;
297 struct msmfb_data data;
298 uint32_t version_key;
299 struct msmfb_data plane1_data;
300 struct msmfb_data plane2_data;
301 struct msmfb_data dst_data;
302};
303
304struct msmfb_img {
305 uint32_t width;
306 uint32_t height;
307 uint32_t format;
308};
309
310#define MSMFB_WRITEBACK_DEQUEUE_BLOCKING 0x1
311struct msmfb_writeback_data {
312 struct msmfb_data buf_info;
313 struct msmfb_img img;
314};
315
316#define MDP_PP_OPS_ENABLE 0x1
317#define MDP_PP_OPS_READ 0x2
318#define MDP_PP_OPS_WRITE 0x4
319#define MDP_PP_OPS_DISABLE 0x8
320#define MDP_PP_IGC_FLAG_ROM0 0x10
321#define MDP_PP_IGC_FLAG_ROM1 0x20
322
323#define MDSS_PP_DSPP_CFG 0x000
324#define MDSS_PP_SSPP_CFG 0x100
325#define MDSS_PP_LM_CFG 0x200
326#define MDSS_PP_WB_CFG 0x300
327
328#define MDSS_PP_ARG_MASK 0x3C00
329#define MDSS_PP_ARG_NUM 4
330#define MDSS_PP_ARG_SHIFT 10
331#define MDSS_PP_LOCATION_MASK 0x0300
332#define MDSS_PP_LOGICAL_MASK 0x00FF
333
334#define MDSS_PP_ADD_ARG(var, arg) ((var) | (0x1 << (MDSS_PP_ARG_SHIFT + (arg))))
335#define PP_ARG(x, var) ((var) & (0x1 << (MDSS_PP_ARG_SHIFT + (x))))
336#define PP_LOCAT(var) ((var) & MDSS_PP_LOCATION_MASK)
337#define PP_BLOCK(var) ((var) & MDSS_PP_LOGICAL_MASK)
338
339
340struct mdp_qseed_cfg {
341 uint32_t table_num;
342 uint32_t ops;
343 uint32_t len;
344 uint32_t *data;
345};
346
347struct mdp_sharp_cfg {
348 uint32_t flags;
349 uint32_t strength;
350 uint32_t edge_thr;
351 uint32_t smooth_thr;
352 uint32_t noise_thr;
353};
354
355struct mdp_qseed_cfg_data {
356 uint32_t block;
357 struct mdp_qseed_cfg qseed_data;
358};
359
360#define MDP_OVERLAY_PP_CSC_CFG 0x1
361#define MDP_OVERLAY_PP_QSEED_CFG 0x2
362#define MDP_OVERLAY_PP_PA_CFG 0x4
363#define MDP_OVERLAY_PP_IGC_CFG 0x8
364#define MDP_OVERLAY_PP_SHARP_CFG 0x10
365#define MDP_OVERLAY_PP_HIST_CFG 0x20
366#define MDP_OVERLAY_PP_HIST_LUT_CFG 0x40
367
368#define MDP_CSC_FLAG_ENABLE 0x1
369#define MDP_CSC_FLAG_YUV_IN 0x2
370#define MDP_CSC_FLAG_YUV_OUT 0x4
371
372struct mdp_csc_cfg {
373 /* flags for enable CSC, toggling RGB,YUV input/output */
374 uint32_t flags;
375 uint32_t csc_mv[9];
376 uint32_t csc_pre_bv[3];
377 uint32_t csc_post_bv[3];
378 uint32_t csc_pre_lv[6];
379 uint32_t csc_post_lv[6];
380};
381
382struct mdp_csc_cfg_data {
383 uint32_t block;
384 struct mdp_csc_cfg csc_data;
385};
386
387struct mdp_pa_cfg {
388 uint32_t flags;
389 uint32_t hue_adj;
390 uint32_t sat_adj;
391 uint32_t val_adj;
392 uint32_t cont_adj;
393};
394
395struct mdp_igc_lut_data {
396 uint32_t block;
397 uint32_t len, ops;
398 uint32_t *c0_c1_data;
399 uint32_t *c2_data;
400};
401
402struct mdp_histogram_cfg {
403 uint32_t ops;
404 uint32_t block;
405 uint8_t frame_cnt;
406 uint8_t bit_mask;
407 uint16_t num_bins;
408};
409
410struct mdp_hist_lut_data {
411 uint32_t block;
412 uint32_t ops;
413 uint32_t len;
414 uint32_t *data;
415};
416
417struct mdp_overlay_pp_params {
418 uint32_t config_ops;
419 struct mdp_csc_cfg csc_cfg;
420 struct mdp_qseed_cfg qseed_cfg[2];
421 struct mdp_pa_cfg pa_cfg;
422 struct mdp_igc_lut_data igc_cfg;
423 struct mdp_sharp_cfg sharp_cfg;
424 struct mdp_histogram_cfg hist_cfg;
425 struct mdp_hist_lut_data hist_lut_cfg;
426};
427
428/**
429 * enum mdss_mdp_blend_op - Different blend operations set by userspace
430 *
431 * @BLEND_OP_NOT_DEFINED: No blend operation defined for the layer.
432 * @BLEND_OP_OPAQUE: Apply a constant blend operation. The layer
433 * would appear opaque in case fg plane alpha is
434 * 0xff.
435 * @BLEND_OP_PREMULTIPLIED: Apply source over blend rule. Layer already has
436 * alpha pre-multiplication done. If fg plane alpha
437 * is less than 0xff, apply modulation as well. This
438 * operation is intended on layers having alpha
439 * channel.
440 * @BLEND_OP_COVERAGE: Apply source over blend rule. Layer is not alpha
441 * pre-multiplied. Apply pre-multiplication. If fg
442 * plane alpha is less than 0xff, apply modulation as
443 * well.
444 * @BLEND_OP_MAX: Used to track maximum blend operation possible by
445 * mdp.
446 */
447enum mdss_mdp_blend_op {
448 BLEND_OP_NOT_DEFINED = 0,
449 BLEND_OP_OPAQUE,
450 BLEND_OP_PREMULTIPLIED,
451 BLEND_OP_COVERAGE,
452 BLEND_OP_MAX,
453};
454
455#define MAX_PLANES 4
456struct mdp_scale_data {
457 uint8_t enable_pxl_ext;
458
459 int init_phase_x[MAX_PLANES];
460 int phase_step_x[MAX_PLANES];
461 int init_phase_y[MAX_PLANES];
462 int phase_step_y[MAX_PLANES];
463
464 int num_ext_pxls_left[MAX_PLANES];
465 int num_ext_pxls_right[MAX_PLANES];
466 int num_ext_pxls_top[MAX_PLANES];
467 int num_ext_pxls_btm[MAX_PLANES];
468
469 int left_ftch[MAX_PLANES];
470 int left_rpt[MAX_PLANES];
471 int right_ftch[MAX_PLANES];
472 int right_rpt[MAX_PLANES];
473
474 int top_rpt[MAX_PLANES];
475 int btm_rpt[MAX_PLANES];
476 int top_ftch[MAX_PLANES];
477 int btm_ftch[MAX_PLANES];
478
479 uint32_t roi_w[MAX_PLANES];
480};
481
482/**
483 * struct mdp_overlay - overlay surface structure
484 * @src: Source image information (width, height, format).
485 * @src_rect: Source crop rectangle, portion of image that will be fetched.
486 * This should always be within boundaries of source image.
487 * @dst_rect: Destination rectangle, the position and size of image on screen.
488 * This should always be within panel boundaries.
489 * @z_order: Blending stage to occupy in display, if multiple layers are
490 * present, highest z_order usually means the top most visible
491 * layer. The range acceptable is from 0-3 to support blending
492 * up to 4 layers.
493 * @is_fg: This flag is used to disable blending of any layers with z_order
494 * less than this overlay. It means that any layers with z_order
495 * less than this layer will not be blended and will be replaced
496 * by the background border color.
497 * @alpha: Used to set plane opacity. The range can be from 0-255, where
498 * 0 means completely transparent and 255 means fully opaque.
499 * @transp_mask: Color used as color key for transparency. Any pixel in fetched
500 * image matching this color will be transparent when blending.
501 * The color should be in same format as the source image format.
502 * @flags: This is used to customize operation of overlay. See MDP flags
503 * for more information.
504 * @user_data: DEPRECATED* Used to store user application specific information.
505 * @bg_color: Solid color used to fill the overlay surface when no source
506 * buffer is provided.
507 * @horz_deci: Horizontal decimation value, this indicates the amount of pixels
508 * dropped for each pixel that is fetched from a line. The value
509 * given should be power of two of decimation amount.
510 * 0: no decimation
511 * 1: decimate by 2 (drop 1 pixel for each pixel fetched)
512 * 2: decimate by 4 (drop 3 pixels for each pixel fetched)
513 * 3: decimate by 8 (drop 7 pixels for each pixel fetched)
514 * 4: decimate by 16 (drop 15 pixels for each pixel fetched)
515 * @vert_deci: Vertical decimation value, this indicates the amount of lines
516 * dropped for each line that is fetched from overlay. The value
517 * given should be power of two of decimation amount.
518 * 0: no decimation
519 * 1: decimation by 2 (drop 1 line for each line fetched)
520 * 2: decimation by 4 (drop 3 lines for each line fetched)
521 * 3: decimation by 8 (drop 7 lines for each line fetched)
522 * 4: decimation by 16 (drop 15 lines for each line fetched)
523 * @overlay_pp_cfg: Overlay post processing configuration, for more information
524 * see struct mdp_overlay_pp_params.
525 */
526struct mdp_overlay {
527 struct msmfb_img src;
528 struct mdp_rect src_rect;
529 struct mdp_rect dst_rect;
530 uint32_t z_order; /* stage number */
531 uint32_t is_fg; /* control alpha & transp */
532 uint32_t alpha;
533 uint32_t blend_op;
534 uint32_t transp_mask;
535 uint32_t flags;
536 uint32_t id;
537 uint32_t user_data[6];
538 uint32_t bg_color;
539 uint8_t horz_deci;
540 uint8_t vert_deci;
541 struct mdp_overlay_pp_params overlay_pp_cfg;
542 struct mdp_scale_data scale;
543};
544
545struct msmfb_overlay_3d {
546 uint32_t is_3d;
547 uint32_t width;
548 uint32_t height;
549};
550
551
552struct msmfb_overlay_blt {
553 uint32_t enable;
554 uint32_t offset;
555 uint32_t width;
556 uint32_t height;
557 uint32_t bpp;
558};
559
560struct mdp_histogram {
561 uint32_t frame_cnt;
562 uint32_t bin_cnt;
563 uint32_t *r;
564 uint32_t *g;
565 uint32_t *b;
566};
567
568enum {
569 DISPLAY_MISR_EDP,
570 DISPLAY_MISR_DSI0,
571 DISPLAY_MISR_DSI1,
572 DISPLAY_MISR_HDMI,
573 DISPLAY_MISR_LCDC,
574 DISPLAY_MISR_ATV,
575 DISPLAY_MISR_DSI_CMD,
576 DISPLAY_MISR_MAX
577};
578
579enum {
580 MISR_OP_NONE,
581 MISR_OP_SFM,
582 MISR_OP_MFM,
583 MISR_OP_BM,
584 MISR_OP_MAX
585};
586
587struct mdp_misr {
588 uint32_t block_id;
589 uint32_t frame_count;
590 uint32_t crc_op_mode;
591 uint32_t crc_value[32];
592};
593
594/*
595
596 mdp_block_type defines the identifiers for pipes in MDP 4.3 and up
597
598 MDP_BLOCK_RESERVED is provided for backward compatibility and is
599 deprecated. It corresponds to DMA_P. So MDP_BLOCK_DMA_P should be used
600 instead.
601
602 MDP_LOGICAL_BLOCK_DISP_0 identifies the display pipe which fb0 uses,
603 same for others.
604
605*/
606
607enum {
608 MDP_BLOCK_RESERVED = 0,
609 MDP_BLOCK_OVERLAY_0,
610 MDP_BLOCK_OVERLAY_1,
611 MDP_BLOCK_VG_1,
612 MDP_BLOCK_VG_2,
613 MDP_BLOCK_RGB_1,
614 MDP_BLOCK_RGB_2,
615 MDP_BLOCK_DMA_P,
616 MDP_BLOCK_DMA_S,
617 MDP_BLOCK_DMA_E,
618 MDP_BLOCK_OVERLAY_2,
619 MDP_LOGICAL_BLOCK_DISP_0 = 0x10,
620 MDP_LOGICAL_BLOCK_DISP_1,
621 MDP_LOGICAL_BLOCK_DISP_2,
622 MDP_BLOCK_MAX,
623};
624
625/*
626 * mdp_histogram_start_req is used to provide the parameters for
627 * histogram start request
628 */
629
630struct mdp_histogram_start_req {
631 uint32_t block;
632 uint8_t frame_cnt;
633 uint8_t bit_mask;
634 uint16_t num_bins;
635};
636
637/*
638 * mdp_histogram_data is used to return the histogram data, once
639 * the histogram is done/stopped/cance
640 */
641
642struct mdp_histogram_data {
643 uint32_t block;
644 uint32_t bin_cnt;
645 uint32_t *c0;
646 uint32_t *c1;
647 uint32_t *c2;
648 uint32_t *extra_info;
649};
650
651struct mdp_pcc_coeff {
652 uint32_t c, r, g, b, rr, gg, bb, rg, gb, rb, rgb_0, rgb_1;
653};
654
655struct mdp_pcc_cfg_data {
656 uint32_t block;
657 uint32_t ops;
658 struct mdp_pcc_coeff r, g, b;
659};
660
661#define MDP_GAMUT_TABLE_NUM 8
662
663enum {
664 mdp_lut_igc,
665 mdp_lut_pgc,
666 mdp_lut_hist,
667 mdp_lut_max,
668};
669
670struct mdp_ar_gc_lut_data {
671 uint32_t x_start;
672 uint32_t slope;
673 uint32_t offset;
674};
675
676struct mdp_pgc_lut_data {
677 uint32_t block;
678 uint32_t flags;
679 uint8_t num_r_stages;
680 uint8_t num_g_stages;
681 uint8_t num_b_stages;
682 struct mdp_ar_gc_lut_data *r_data;
683 struct mdp_ar_gc_lut_data *g_data;
684 struct mdp_ar_gc_lut_data *b_data;
685};
686
687
688struct mdp_lut_cfg_data {
689 uint32_t lut_type;
690 union {
691 struct mdp_igc_lut_data igc_lut_data;
692 struct mdp_pgc_lut_data pgc_lut_data;
693 struct mdp_hist_lut_data hist_lut_data;
694 } data;
695};
696
697struct mdp_bl_scale_data {
698 uint32_t min_lvl;
699 uint32_t scale;
700};
701
702struct mdp_pa_cfg_data {
703 uint32_t block;
704 struct mdp_pa_cfg pa_data;
705};
706
707struct mdp_dither_cfg_data {
708 uint32_t block;
709 uint32_t flags;
710 uint32_t g_y_depth;
711 uint32_t r_cr_depth;
712 uint32_t b_cb_depth;
713};
714
715struct mdp_gamut_cfg_data {
716 uint32_t block;
717 uint32_t flags;
718 uint32_t gamut_first;
719 uint32_t tbl_size[MDP_GAMUT_TABLE_NUM];
720 uint16_t *r_tbl[MDP_GAMUT_TABLE_NUM];
721 uint16_t *g_tbl[MDP_GAMUT_TABLE_NUM];
722 uint16_t *b_tbl[MDP_GAMUT_TABLE_NUM];
723};
724
725struct mdp_calib_config_data {
726 uint32_t ops;
727 uint32_t addr;
728 uint32_t data;
729};
730
731struct mdp_calib_config_buffer {
732 uint32_t ops;
733 uint32_t size;
734 uint32_t *buffer;
735};
736
737struct mdp_calib_dcm_state {
738 uint32_t ops;
739 uint32_t dcm_state;
740};
741
742enum {
743 DCM_UNINIT,
744 DCM_UNBLANK,
745 DCM_ENTER,
746 DCM_EXIT,
747 DCM_BLANK,
748};
749
750#define MDSS_MAX_BL_BRIGHTNESS 255
751#define AD_BL_LIN_LEN (MDSS_MAX_BL_BRIGHTNESS + 1)
752
753#define MDSS_AD_MODE_AUTO_BL 0x0
754#define MDSS_AD_MODE_AUTO_STR 0x1
755#define MDSS_AD_MODE_TARG_STR 0x3
756#define MDSS_AD_MODE_MAN_STR 0x7
757#define MDSS_AD_MODE_CALIB 0xF
758
759#define MDP_PP_AD_INIT 0x10
760#define MDP_PP_AD_CFG 0x20
761
762struct mdss_ad_init {
763 uint32_t asym_lut[33];
764 uint32_t color_corr_lut[33];
765 uint8_t i_control[2];
766 uint16_t black_lvl;
767 uint16_t white_lvl;
768 uint8_t var;
769 uint8_t limit_ampl;
770 uint8_t i_dither;
771 uint8_t slope_max;
772 uint8_t slope_min;
773 uint8_t dither_ctl;
774 uint8_t format;
775 uint8_t auto_size;
776 uint16_t frame_w;
777 uint16_t frame_h;
778 uint8_t logo_v;
779 uint8_t logo_h;
780 uint32_t bl_lin_len;
781 uint32_t *bl_lin;
782 uint32_t *bl_lin_inv;
783};
784
785#define MDSS_AD_BL_CTRL_MODE_EN 1
786#define MDSS_AD_BL_CTRL_MODE_DIS 0
787struct mdss_ad_cfg {
788 uint32_t mode;
789 uint32_t al_calib_lut[33];
790 uint16_t backlight_min;
791 uint16_t backlight_max;
792 uint16_t backlight_scale;
793 uint16_t amb_light_min;
794 uint16_t filter[2];
795 uint16_t calib[4];
796 uint8_t strength_limit;
797 uint8_t t_filter_recursion;
798 uint16_t stab_itr;
799 uint32_t bl_ctrl_mode;
800};
801
802/* ops uses standard MDP_PP_* flags */
803struct mdss_ad_init_cfg {
804 uint32_t ops;
805 union {
806 struct mdss_ad_init init;
807 struct mdss_ad_cfg cfg;
808 } params;
809};
810
811/* mode uses MDSS_AD_MODE_* flags */
812struct mdss_ad_input {
813 uint32_t mode;
814 union {
815 uint32_t amb_light;
816 uint32_t strength;
817 uint32_t calib_bl;
818 } in;
819 uint32_t output;
820};
821
822#define MDSS_CALIB_MODE_BL 0x1
823struct mdss_calib_cfg {
824 uint32_t ops;
825 uint32_t calib_mask;
826};
827
828enum {
829 mdp_op_pcc_cfg,
830 mdp_op_csc_cfg,
831 mdp_op_lut_cfg,
832 mdp_op_qseed_cfg,
833 mdp_bl_scale_cfg,
834 mdp_op_pa_cfg,
835 mdp_op_dither_cfg,
836 mdp_op_gamut_cfg,
837 mdp_op_calib_cfg,
838 mdp_op_ad_cfg,
839 mdp_op_ad_input,
840 mdp_op_calib_mode,
841 mdp_op_calib_buffer,
842 mdp_op_calib_dcm_state,
843 mdp_op_max,
844};
845
846enum {
847 WB_FORMAT_NV12,
848 WB_FORMAT_RGB_565,
849 WB_FORMAT_RGB_888,
850 WB_FORMAT_xRGB_8888,
851 WB_FORMAT_ARGB_8888,
852 WB_FORMAT_BGRA_8888,
853 WB_FORMAT_BGRX_8888,
854 WB_FORMAT_ARGB_8888_INPUT_ALPHA /* Need to support */
855};
856
857struct msmfb_mdp_pp {
858 uint32_t op;
859 union {
860 struct mdp_pcc_cfg_data pcc_cfg_data;
861 struct mdp_csc_cfg_data csc_cfg_data;
862 struct mdp_lut_cfg_data lut_cfg_data;
863 struct mdp_qseed_cfg_data qseed_cfg_data;
864 struct mdp_bl_scale_data bl_scale_data;
865 struct mdp_pa_cfg_data pa_cfg_data;
866 struct mdp_dither_cfg_data dither_cfg_data;
867 struct mdp_gamut_cfg_data gamut_cfg_data;
868 struct mdp_calib_config_data calib_cfg;
869 struct mdss_ad_init_cfg ad_init_cfg;
870 struct mdss_calib_cfg mdss_calib_cfg;
871 struct mdss_ad_input ad_input;
872 struct mdp_calib_config_buffer calib_buffer;
873 struct mdp_calib_dcm_state calib_dcm;
874 } data;
875};
876
877#define FB_METADATA_VIDEO_INFO_CODE_SUPPORT 1
878enum {
879 metadata_op_none,
880 metadata_op_base_blend,
881 metadata_op_frame_rate,
882 metadata_op_vic,
883 metadata_op_wb_format,
884 metadata_op_get_caps,
885 metadata_op_crc,
886 metadata_op_max
887};
888
889struct mdp_blend_cfg {
890 uint32_t is_premultiplied;
891};
892
893struct mdp_mixer_cfg {
894 uint32_t writeback_format;
895 uint32_t alpha;
896};
897
898struct mdss_hw_caps {
899 uint32_t mdp_rev;
900 uint8_t rgb_pipes;
901 uint8_t vig_pipes;
902 uint8_t dma_pipes;
903 uint32_t features;
904};
905
906struct msmfb_metadata {
907 uint32_t op;
908 uint32_t flags;
909 union {
910 struct mdp_misr misr_request;
911 struct mdp_blend_cfg blend_cfg;
912 struct mdp_mixer_cfg mixer_cfg;
913 uint32_t panel_frame_rate;
914 uint32_t video_info_code;
915 struct mdss_hw_caps caps;
916 } data;
917};
918
919#define MDP_MAX_FENCE_FD 32
920#define MDP_BUF_SYNC_FLAG_WAIT 1
921
922struct mdp_buf_sync {
923 uint32_t flags;
924 uint32_t acq_fen_fd_cnt;
925 uint32_t session_id;
926 int *acq_fen_fd;
927 int *rel_fen_fd;
928};
929
930struct mdp_async_blit_req_list {
931 struct mdp_buf_sync sync;
932 uint32_t count;
933 struct mdp_blit_req req[];
934};
935
936#define MDP_DISPLAY_COMMIT_OVERLAY 1
937struct mdp_buf_fence {
938 uint32_t flags;
939 uint32_t acq_fen_fd_cnt;
940 int acq_fen_fd[MDP_MAX_FENCE_FD];
941 int rel_fen_fd[MDP_MAX_FENCE_FD];
942};
943
944
945struct mdp_display_commit {
946 uint32_t flags;
947 uint32_t wait_for_finish;
948 struct fb_var_screeninfo var;
949 struct mdp_buf_fence buf_fence;
950 struct mdp_rect roi;
951};
952
953struct mdp_page_protection {
954 uint32_t page_protection;
955};
956
957
958struct mdp_mixer_info {
959 int pndx;
960 int pnum;
961 int ptype;
962 int mixer_num;
963 int z_order;
964};
965
966#define MAX_PIPE_PER_MIXER 4
967
968struct msmfb_mixer_info_req {
969 int mixer_num;
970 int cnt;
971 struct mdp_mixer_info info[MAX_PIPE_PER_MIXER];
972};
973
974enum {
975 DISPLAY_SUBSYSTEM_ID,
976 ROTATOR_SUBSYSTEM_ID,
977};
978
979enum {
980 MDP_IOMMU_DOMAIN_CP,
981 MDP_IOMMU_DOMAIN_NS,
982};
983
984enum {
985 MDP_WRITEBACK_MIRROR_OFF,
986 MDP_WRITEBACK_MIRROR_ON,
987 MDP_WRITEBACK_MIRROR_PAUSE,
988 MDP_WRITEBACK_MIRROR_RESUME,
989};
990
991
992#endif /*_MSM_MDP_H_*/