blob: a691330c8e87c37d6f1d787f06319ab968abf799 [file] [log] [blame]
Daniel Walkerda6df072010-04-23 16:04:20 -07001/* include/linux/msm_mdp.h
2 *
3 * Copyright (C) 2007 Google Incorporated
Ken Zhang420dd202013-01-08 14:28:20 -05004 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
Daniel Walkerda6df072010-04-23 16:04:20 -07005 *
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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/fb.h>
Daniel Walkerda6df072010-04-23 16:04:20 -070020
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)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024#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)
Carl Vanderlipba093a22011-11-22 13:59:59 -080028#define MSMFB_HISTOGRAM _IOWR(MSMFB_IOCTL_MAGIC, 132, struct mdp_histogram_data)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029/* 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)
Kuogee Hsieh586fd162012-02-14 15:24:16 -080035
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#define MSMFB_OVERLAY_PLAY _IOW(MSMFB_IOCTL_MAGIC, 137, \
37 struct msmfb_overlay_data)
Kuogee Hsieh586fd162012-02-14 15:24:16 -080038#define MSMFB_OVERLAY_QUEUE MSMFB_OVERLAY_PLAY
39
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#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)
Carl Vanderlipba093a22011-11-22 13:59:59 -080050#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)
Carl Vanderlip0d6ef4a2013-05-30 11:48:48 -070053#define MSMFB_NOTIFY_UPDATE _IOWR(MSMFB_IOCTL_MAGIC, 146, unsigned int)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054
55#define MSMFB_OVERLAY_3D _IOWR(MSMFB_IOCTL_MAGIC, 147, \
56 struct msmfb_overlay_3d)
57
kuogee hsieh405dc302011-07-21 15:06:59 -070058#define MSMFB_MIXER_INFO _IOWR(MSMFB_IOCTL_MAGIC, 148, \
59 struct msmfb_mixer_info_req)
Nagamalleswararao Ganji0737d652011-10-14 02:02:33 -070060#define MSMFB_OVERLAY_PLAY_WAIT _IOWR(MSMFB_IOCTL_MAGIC, 149, \
61 struct msmfb_overlay_data)
Vinay Kalia27020d12011-10-14 17:50:29 -070062#define MSMFB_WRITEBACK_INIT _IO(MSMFB_IOCTL_MAGIC, 150)
Vinay Kaliae1ba2702011-12-21 16:24:52 -080063#define MSMFB_WRITEBACK_START _IO(MSMFB_IOCTL_MAGIC, 151)
64#define MSMFB_WRITEBACK_STOP _IO(MSMFB_IOCTL_MAGIC, 152)
Vinay Kalia27020d12011-10-14 17:50:29 -070065#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)
Pravin Tamkhane02a40682011-11-29 14:17:01 -080070#define MSMFB_MDP_PP _IOWR(MSMFB_IOCTL_MAGIC, 156, struct msmfb_mdp_pp)
Padmanabhan Komanduruf3b0c232012-07-27 20:46:06 +053071#define MSMFB_OVERLAY_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 160, unsigned int)
72#define MSMFB_VSYNC_CTRL _IOW(MSMFB_IOCTL_MAGIC, 161, unsigned int)
Vishnuvardhan Prodduturifeb26292013-02-06 18:23:35 +053073#define MSMFB_BUFFER_SYNC _IOW(MSMFB_IOCTL_MAGIC, 162, struct mdp_buf_sync)
Kalyan Thota9284a272012-11-02 20:55:30 +053074#define MSMFB_OVERLAY_COMMIT _IO(MSMFB_IOCTL_MAGIC, 163)
Vishnuvardhan Prodduturifeb26292013-02-06 18:23:35 +053075#define MSMFB_DISPLAY_COMMIT _IOW(MSMFB_IOCTL_MAGIC, 164, \
Ken Zhang4e83b932012-12-02 21:15:47 -050076 struct mdp_display_commit)
Vishnuvardhan Prodduturifeb26292013-02-06 18:23:35 +053077#define MSMFB_METADATA_SET _IOW(MSMFB_IOCTL_MAGIC, 165, struct msmfb_metadata)
Ken Zhang420dd202013-01-08 14:28:20 -050078#define MSMFB_METADATA_GET _IOW(MSMFB_IOCTL_MAGIC, 166, struct msmfb_metadata)
Deva Ramasubramanian166b0982013-01-25 20:11:41 -080079#define MSMFB_WRITEBACK_SET_MIRRORING_HINT _IOW(MSMFB_IOCTL_MAGIC, 167, \
80 unsigned int)
Terence Hampson3e636aa2013-05-08 19:01:51 -040081#define MSMFB_ASYNC_BLIT _IOW(MSMFB_IOCTL_MAGIC, 168, unsigned int)
Kuogee Hsieha77eca62012-09-13 13:22:04 -070082
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#define FB_TYPE_3D_PANEL 0x10101010
84#define MDP_IMGTYPE2_START 0x10000
85#define MSMFB_DRIVER_VERSION 0xF9E8D701
Daniel Walkerda6df072010-04-23 16:04:20 -070086
87enum {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088 NOTIFY_UPDATE_START,
89 NOTIFY_UPDATE_STOP,
Arpita Banerjeea8b7fbf2013-06-11 19:24:20 -070090 NOTIFY_UPDATE_POWER_OFF,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091};
92
93enum {
Carl Vanderlip0d6ef4a2013-05-30 11:48:48 -070094 NOTIFY_TYPE_NO_UPDATE,
95 NOTIFY_TYPE_SUSPEND,
96 NOTIFY_TYPE_UPDATE,
97};
98
99enum {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700100 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 */
Padmanabhan Komandurud9f38b02012-02-02 18:57:03 +0530103 MDP_Y_CBCR_H2V2_ADRENO,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104 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 */
Pawan Kumar42acdef2013-03-21 19:55:49 +0530108 MDP_CBYCRY_H2V1, /* CbYCrY interleave */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109 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 */
Adrian Salido-Morenoe55fa122012-05-29 15:36:08 -0700111 MDP_Y_CRCB_H1V2,
112 MDP_Y_CBCR_H1V2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700113 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 */
Pradeep Jilagam9b4a6be2011-10-03 17:19:20 +0530119 MDP_Y_CR_CB_GH2V2, /* Y, Cr and Cb, planar aligned to Android YV12 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700120 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 */
Adrian Salido-Moreno2b410482011-08-15 10:40:40 -0700123 MDP_YCRCB_H1V1, /* YCrCb interleave */
124 MDP_YCBCR_H1V1, /* YCbCr interleave */
Adrian Salido-Morenoe55fa122012-05-29 15:36:08 -0700125 MDP_BGR_565, /* BGR 565 planer */
Adrian Salido-Morenod559ef12012-07-12 20:16:14 -0700126 MDP_BGR_888, /* BGR 888 */
Adrian Salido-Moreno330c0bf2012-08-22 14:15:33 -0700127 MDP_Y_CBCR_H2V2_VENUS,
Pawan Kumar79854382013-02-14 15:27:12 +0530128 MDP_BGRX_8888, /* BGRX 8888 */
Shalabh Jainbea586a2013-08-23 12:30:48 -0700129 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 */
Ramkumar Radhakrishnan97180fa2013-08-06 20:50:52 -0700137 MDP_YCBYCR_H2V1, /* YCbYCr interleave */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700138 MDP_IMGTYPE_LIMIT,
kuogee hsieh1ce7e4c2012-01-13 14:05:54 -0800139 MDP_RGB_BORDERFILL, /* border fill pipe */
Adrian Salido-Morenoe55fa122012-05-29 15:36:08 -0700140 MDP_FB_FORMAT = MDP_IMGTYPE2_START, /* framebuffer format */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700141 MDP_IMGTYPE_LIMIT2 /* Non valid image type after this enum */
Daniel Walkerda6df072010-04-23 16:04:20 -0700142};
143
144enum {
145 PMEM_IMG,
146 FB_IMG,
147};
148
Liyuan Lid9736632011-11-11 13:47:59 -0800149enum {
150 HSIC_HUE = 0,
151 HSIC_SAT,
152 HSIC_INT,
153 HSIC_CON,
154 NUM_HSIC_PARAM,
155};
156
Adrian Salido-Moreno1857f062012-05-29 17:57:28 -0700157#define MDSS_MDP_ROT_ONLY 0x80
Adrian Salido-Morenoe55fa122012-05-29 15:36:08 -0700158#define MDSS_MDP_RIGHT_MIXER 0x100
Adrian Salido-Moreno6afd7802013-08-05 14:03:25 -0700159#define MDSS_MDP_DUAL_PIPE 0x200
Adrian Salido-Morenoe55fa122012-05-29 15:36:08 -0700160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700161/* 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
Padmanabhan Komandurudd10bf12012-10-17 20:27:33 +0530171#define MDP_IS_FG 0x40000
Shivaraj Shettyd854a5a2013-10-10 18:44:58 +0530172#define MDP_SOLID_FILL 0x0000100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173#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
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700188#define MDP_OVERLAY_PP_CFG_EN 0x00080000
Ajay Singh Parmar4c7ccb32012-02-21 12:56:04 +0530189#define MDP_BACKEND_COMPOSITION 0x00040000
Nagamalleswararao Ganji880f8472011-12-14 03:52:28 -0800190#define MDP_BORDERFILL_SUPPORTED 0x00010000
191#define MDP_SECURE_OVERLAY_SESSION 0x00008000
Arun Kumar K.R9ce1fd62013-09-24 11:35:08 -0700192#define MDP_SECURE_DISPLAY_OVERLAY_SESSION 0x00002000
Adrian Salido-Moreno9a8485c2013-02-06 14:08:28 -0800193#define MDP_OV_PIPE_FORCE_DMA 0x00004000
Nagamalleswararao Ganji880f8472011-12-14 03:52:28 -0800194#define MDP_MEMORY_ID_TYPE_FB 0x00001000
Sree Sesha Aravind Vadrevu35143132013-03-12 02:32:06 -0700195#define MDP_BWC_EN 0x00000400
Sree Sesha Aravind Vadrevu05d4d222013-04-01 14:31:28 -0700196#define MDP_DECIMATION_EN 0x00000800
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700197#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)
Daniel Walkerda6df072010-04-23 16:04:20 -0700209
210struct mdp_rect {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211 uint32_t x;
212 uint32_t y;
213 uint32_t w;
214 uint32_t h;
Daniel Walkerda6df072010-04-23 16:04:20 -0700215};
216
217struct mdp_img {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700218 uint32_t width;
219 uint32_t height;
220 uint32_t format;
221 uint32_t offset;
Daniel Walkerda6df072010-04-23 16:04:20 -0700222 int memory_id; /* the file descriptor */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223 uint32_t priv;
Daniel Walkerda6df072010-04-23 16:04:20 -0700224};
225
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700226/*
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
Nagamalleswararao Ganji4b991722011-01-28 13:24:34 -0800242struct 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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251/* 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
Shivaraj Shetty1bbb3832013-10-22 18:43:17 +0530258struct color {
259 uint32_t r;
260 uint32_t g;
261 uint32_t b;
262 uint32_t alpha;
263};
264
Daniel Walkerda6df072010-04-23 16:04:20 -0700265struct 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;
Shivaraj Shetty1bbb3832013-10-22 18:43:17 +0530270 struct color const_color;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700271 uint32_t alpha;
272 uint32_t transp_mask;
273 uint32_t flags;
274 int sharpening_strength; /* -127 <--> 127, default 64 */
Daniel Walkerda6df072010-04-23 16:04:20 -0700275};
276
277struct mdp_blit_req_list {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278 uint32_t count;
Daniel Walkerda6df072010-04-23 16:04:20 -0700279 struct mdp_blit_req req[];
280};
281
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282#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;
Vinay Kaliae1ba2702011-12-21 16:24:52 -0800290 uint32_t iova;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700291};
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;
Adrian Salido-Moreno1857f062012-05-29 17:57:28 -0700301 struct msmfb_data dst_data;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302};
303
304struct msmfb_img {
305 uint32_t width;
306 uint32_t height;
307 uint32_t format;
308};
309
Vinay Kalia27020d12011-10-14 17:50:29 -0700310#define MSMFB_WRITEBACK_DEQUEUE_BLOCKING 0x1
311struct msmfb_writeback_data {
312 struct msmfb_data buf_info;
313 struct msmfb_img img;
314};
315
Ken Zhang77ce0192012-08-10 11:27:19 -0400316#define MDP_PP_OPS_ENABLE 0x1
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700317#define MDP_PP_OPS_READ 0x2
318#define MDP_PP_OPS_WRITE 0x4
Ken Zhang77ce0192012-08-10 11:27:19 -0400319#define MDP_PP_OPS_DISABLE 0x8
Ken Zhang824758e2012-08-15 11:02:21 -0400320#define MDP_PP_IGC_FLAG_ROM0 0x10
321#define MDP_PP_IGC_FLAG_ROM1 0x20
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700322
Benet Clark477baa02013-10-04 17:21:45 -0700323#define MDP_PP_PA_HUE_ENABLE 0x10
324#define MDP_PP_PA_SAT_ENABLE 0x20
325#define MDP_PP_PA_VAL_ENABLE 0x40
326#define MDP_PP_PA_CONT_ENABLE 0x80
327#define MDP_PP_PA_SIX_ZONE_ENABLE 0x100
328#define MDP_PP_PA_SKIN_ENABLE 0x200
329#define MDP_PP_PA_SKY_ENABLE 0x400
330#define MDP_PP_PA_FOL_ENABLE 0x800
331#define MDP_PP_PA_HUE_MASK 0x1000
332#define MDP_PP_PA_SAT_MASK 0x2000
333#define MDP_PP_PA_VAL_MASK 0x4000
334#define MDP_PP_PA_CONT_MASK 0x8000
335#define MDP_PP_PA_SIX_ZONE_HUE_MASK 0x10000
336#define MDP_PP_PA_SIX_ZONE_SAT_MASK 0x20000
337#define MDP_PP_PA_SIX_ZONE_VAL_MASK 0x40000
338#define MDP_PP_PA_MEM_COL_SKIN_MASK 0x80000
339#define MDP_PP_PA_MEM_COL_SKY_MASK 0x100000
340#define MDP_PP_PA_MEM_COL_FOL_MASK 0x200000
341#define MDP_PP_PA_MEM_PROTECT_EN 0x400000
342#define MDP_PP_PA_SAT_ZERO_EXP_EN 0x800000
343
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700344#define MDSS_PP_DSPP_CFG 0x000
345#define MDSS_PP_SSPP_CFG 0x100
346#define MDSS_PP_LM_CFG 0x200
347#define MDSS_PP_WB_CFG 0x300
Ping Li8231ae42013-01-09 20:39:25 -0500348
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700349#define MDSS_PP_ARG_MASK 0x3C00
350#define MDSS_PP_ARG_NUM 4
Carl Vanderlip793aa582013-03-18 10:18:47 -0700351#define MDSS_PP_ARG_SHIFT 10
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700352#define MDSS_PP_LOCATION_MASK 0x0300
353#define MDSS_PP_LOGICAL_MASK 0x00FF
Ping Li8231ae42013-01-09 20:39:25 -0500354
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700355#define MDSS_PP_ADD_ARG(var, arg) ((var) | (0x1 << (MDSS_PP_ARG_SHIFT + (arg))))
356#define PP_ARG(x, var) ((var) & (0x1 << (MDSS_PP_ARG_SHIFT + (x))))
Ping Li8231ae42013-01-09 20:39:25 -0500357#define PP_LOCAT(var) ((var) & MDSS_PP_LOCATION_MASK)
358#define PP_BLOCK(var) ((var) & MDSS_PP_LOGICAL_MASK)
359
360
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700361struct mdp_qseed_cfg {
362 uint32_t table_num;
363 uint32_t ops;
364 uint32_t len;
365 uint32_t *data;
366};
367
Ping Li87cca832013-01-30 18:27:52 -0500368struct mdp_sharp_cfg {
369 uint32_t flags;
370 uint32_t strength;
371 uint32_t edge_thr;
372 uint32_t smooth_thr;
373 uint32_t noise_thr;
374};
375
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700376struct mdp_qseed_cfg_data {
377 uint32_t block;
378 struct mdp_qseed_cfg qseed_data;
379};
380
Carl Vanderlip94d9b782013-01-16 12:13:52 -0800381#define MDP_OVERLAY_PP_CSC_CFG 0x1
382#define MDP_OVERLAY_PP_QSEED_CFG 0x2
383#define MDP_OVERLAY_PP_PA_CFG 0x4
384#define MDP_OVERLAY_PP_IGC_CFG 0x8
Ping Li87cca832013-01-30 18:27:52 -0500385#define MDP_OVERLAY_PP_SHARP_CFG 0x10
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700386#define MDP_OVERLAY_PP_HIST_CFG 0x20
Carl Vanderlip57027132013-03-18 13:53:16 -0700387#define MDP_OVERLAY_PP_HIST_LUT_CFG 0x40
Benet Clark477baa02013-10-04 17:21:45 -0700388#define MDP_OVERLAY_PP_PA_V2_CFG 0x80
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700389
390#define MDP_CSC_FLAG_ENABLE 0x1
391#define MDP_CSC_FLAG_YUV_IN 0x2
392#define MDP_CSC_FLAG_YUV_OUT 0x4
393
394struct mdp_csc_cfg {
395 /* flags for enable CSC, toggling RGB,YUV input/output */
396 uint32_t flags;
397 uint32_t csc_mv[9];
398 uint32_t csc_pre_bv[3];
399 uint32_t csc_post_bv[3];
400 uint32_t csc_pre_lv[6];
401 uint32_t csc_post_lv[6];
402};
403
404struct mdp_csc_cfg_data {
405 uint32_t block;
406 struct mdp_csc_cfg csc_data;
407};
408
Ping Li58229242012-11-30 14:05:43 -0500409struct mdp_pa_cfg {
410 uint32_t flags;
411 uint32_t hue_adj;
412 uint32_t sat_adj;
413 uint32_t val_adj;
414 uint32_t cont_adj;
415};
416
Benet Clark477baa02013-10-04 17:21:45 -0700417struct mdp_pa_mem_col_cfg {
418 uint32_t color_adjust_p0;
419 uint32_t color_adjust_p1;
420 uint32_t hue_region;
421 uint32_t sat_region;
422 uint32_t val_region;
423};
424
Carl Vanderlip4ac3a132013-11-19 16:52:52 -0800425#define MDP_SIX_ZONE_TABLE_NUM 384
426
Benet Clark477baa02013-10-04 17:21:45 -0700427struct mdp_pa_v2_data {
428 /* Mask bits for PA features */
429 uint32_t flags;
430 uint32_t global_hue_adj;
431 uint32_t global_sat_adj;
432 uint32_t global_val_adj;
433 uint32_t global_cont_adj;
Carl Vanderlip4ac3a132013-11-19 16:52:52 -0800434 uint32_t *six_zone_curve_p0;
435 uint32_t *six_zone_curve_p1;
436 uint32_t six_zone_thresh;
Benet Clark477baa02013-10-04 17:21:45 -0700437 struct mdp_pa_mem_col_cfg skin_cfg;
438 struct mdp_pa_mem_col_cfg sky_cfg;
439 struct mdp_pa_mem_col_cfg fol_cfg;
440};
441
Carl Vanderlip94d9b782013-01-16 12:13:52 -0800442struct mdp_igc_lut_data {
443 uint32_t block;
444 uint32_t len, ops;
445 uint32_t *c0_c1_data;
446 uint32_t *c2_data;
447};
448
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700449struct mdp_histogram_cfg {
450 uint32_t ops;
451 uint32_t block;
452 uint8_t frame_cnt;
453 uint8_t bit_mask;
454 uint16_t num_bins;
455};
456
Carl Vanderlip57027132013-03-18 13:53:16 -0700457struct mdp_hist_lut_data {
458 uint32_t block;
459 uint32_t ops;
460 uint32_t len;
461 uint32_t *data;
462};
463
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700464struct mdp_overlay_pp_params {
465 uint32_t config_ops;
466 struct mdp_csc_cfg csc_cfg;
467 struct mdp_qseed_cfg qseed_cfg[2];
Ping Li58229242012-11-30 14:05:43 -0500468 struct mdp_pa_cfg pa_cfg;
Benet Clark477baa02013-10-04 17:21:45 -0700469 struct mdp_pa_v2_data pa_v2_cfg;
Carl Vanderlip94d9b782013-01-16 12:13:52 -0800470 struct mdp_igc_lut_data igc_cfg;
Ping Li87cca832013-01-30 18:27:52 -0500471 struct mdp_sharp_cfg sharp_cfg;
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700472 struct mdp_histogram_cfg hist_cfg;
Carl Vanderlip57027132013-03-18 13:53:16 -0700473 struct mdp_hist_lut_data hist_lut_cfg;
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700474};
475
Mayank Chopra29c4ee52013-07-24 12:31:01 +0530476/**
477 * enum mdss_mdp_blend_op - Different blend operations set by userspace
478 *
479 * @BLEND_OP_NOT_DEFINED: No blend operation defined for the layer.
480 * @BLEND_OP_OPAQUE: Apply a constant blend operation. The layer
481 * would appear opaque in case fg plane alpha is
482 * 0xff.
483 * @BLEND_OP_PREMULTIPLIED: Apply source over blend rule. Layer already has
484 * alpha pre-multiplication done. If fg plane alpha
485 * is less than 0xff, apply modulation as well. This
486 * operation is intended on layers having alpha
487 * channel.
488 * @BLEND_OP_COVERAGE: Apply source over blend rule. Layer is not alpha
489 * pre-multiplied. Apply pre-multiplication. If fg
490 * plane alpha is less than 0xff, apply modulation as
491 * well.
492 * @BLEND_OP_MAX: Used to track maximum blend operation possible by
493 * mdp.
494 */
495enum mdss_mdp_blend_op {
496 BLEND_OP_NOT_DEFINED = 0,
497 BLEND_OP_OPAQUE,
498 BLEND_OP_PREMULTIPLIED,
499 BLEND_OP_COVERAGE,
500 BLEND_OP_MAX,
501};
502
Sree Sesha Aravind Vadrevu494961d2013-10-03 12:51:03 -0700503#define MAX_PLANES 4
504struct mdp_scale_data {
505 uint8_t enable_pxl_ext;
506
507 int init_phase_x[MAX_PLANES];
508 int phase_step_x[MAX_PLANES];
509 int init_phase_y[MAX_PLANES];
510 int phase_step_y[MAX_PLANES];
511
512 int num_ext_pxls_left[MAX_PLANES];
513 int num_ext_pxls_right[MAX_PLANES];
514 int num_ext_pxls_top[MAX_PLANES];
515 int num_ext_pxls_btm[MAX_PLANES];
516
517 int left_ftch[MAX_PLANES];
518 int left_rpt[MAX_PLANES];
519 int right_ftch[MAX_PLANES];
520 int right_rpt[MAX_PLANES];
521
522 int top_rpt[MAX_PLANES];
523 int btm_rpt[MAX_PLANES];
524 int top_ftch[MAX_PLANES];
525 int btm_ftch[MAX_PLANES];
526
527 uint32_t roi_w[MAX_PLANES];
528};
529
Adrian Salido-Morenof8da3922013-07-03 15:19:25 -0700530/**
531 * struct mdp_overlay - overlay surface structure
532 * @src: Source image information (width, height, format).
533 * @src_rect: Source crop rectangle, portion of image that will be fetched.
534 * This should always be within boundaries of source image.
535 * @dst_rect: Destination rectangle, the position and size of image on screen.
536 * This should always be within panel boundaries.
537 * @z_order: Blending stage to occupy in display, if multiple layers are
538 * present, highest z_order usually means the top most visible
539 * layer. The range acceptable is from 0-3 to support blending
540 * up to 4 layers.
541 * @is_fg: This flag is used to disable blending of any layers with z_order
542 * less than this overlay. It means that any layers with z_order
543 * less than this layer will not be blended and will be replaced
544 * by the background border color.
545 * @alpha: Used to set plane opacity. The range can be from 0-255, where
546 * 0 means completely transparent and 255 means fully opaque.
547 * @transp_mask: Color used as color key for transparency. Any pixel in fetched
548 * image matching this color will be transparent when blending.
549 * The color should be in same format as the source image format.
550 * @flags: This is used to customize operation of overlay. See MDP flags
551 * for more information.
552 * @user_data: DEPRECATED* Used to store user application specific information.
Adrian Salido-Morenoe21074d2013-07-03 15:41:33 -0700553 * @bg_color: Solid color used to fill the overlay surface when no source
554 * buffer is provided.
Adrian Salido-Morenof8da3922013-07-03 15:19:25 -0700555 * @horz_deci: Horizontal decimation value, this indicates the amount of pixels
556 * dropped for each pixel that is fetched from a line. The value
557 * given should be power of two of decimation amount.
558 * 0: no decimation
559 * 1: decimate by 2 (drop 1 pixel for each pixel fetched)
560 * 2: decimate by 4 (drop 3 pixels for each pixel fetched)
561 * 3: decimate by 8 (drop 7 pixels for each pixel fetched)
562 * 4: decimate by 16 (drop 15 pixels for each pixel fetched)
563 * @vert_deci: Vertical decimation value, this indicates the amount of lines
564 * dropped for each line that is fetched from overlay. The value
565 * given should be power of two of decimation amount.
566 * 0: no decimation
567 * 1: decimation by 2 (drop 1 line for each line fetched)
568 * 2: decimation by 4 (drop 3 lines for each line fetched)
569 * 3: decimation by 8 (drop 7 lines for each line fetched)
570 * 4: decimation by 16 (drop 15 lines for each line fetched)
571 * @overlay_pp_cfg: Overlay post processing configuration, for more information
572 * see struct mdp_overlay_pp_params.
573 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574struct mdp_overlay {
575 struct msmfb_img src;
576 struct mdp_rect src_rect;
577 struct mdp_rect dst_rect;
578 uint32_t z_order; /* stage number */
579 uint32_t is_fg; /* control alpha & transp */
580 uint32_t alpha;
Mayank Chopra29c4ee52013-07-24 12:31:01 +0530581 uint32_t blend_op;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582 uint32_t transp_mask;
583 uint32_t flags;
584 uint32_t id;
Adrian Salido-Morenoe21074d2013-07-03 15:41:33 -0700585 uint32_t user_data[6];
586 uint32_t bg_color;
Sree Sesha Aravind Vadrevu05d4d222013-04-01 14:31:28 -0700587 uint8_t horz_deci;
588 uint8_t vert_deci;
Carl Vanderlipdfe57512012-07-23 12:34:47 -0700589 struct mdp_overlay_pp_params overlay_pp_cfg;
Sree Sesha Aravind Vadrevu494961d2013-10-03 12:51:03 -0700590 struct mdp_scale_data scale;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591};
592
593struct msmfb_overlay_3d {
594 uint32_t is_3d;
595 uint32_t width;
596 uint32_t height;
597};
598
599
600struct msmfb_overlay_blt {
601 uint32_t enable;
602 uint32_t offset;
603 uint32_t width;
604 uint32_t height;
605 uint32_t bpp;
606};
607
608struct mdp_histogram {
609 uint32_t frame_cnt;
610 uint32_t bin_cnt;
611 uint32_t *r;
612 uint32_t *g;
613 uint32_t *b;
614};
615
Mayank Chopra0a8c4762013-07-12 18:19:36 +0530616#define MISR_CRC_BATCH_SIZE 32
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700617enum {
Mayank Chopra0a8c4762013-07-12 18:19:36 +0530618 DISPLAY_MISR_EDP = 0,
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700619 DISPLAY_MISR_DSI0,
620 DISPLAY_MISR_DSI1,
621 DISPLAY_MISR_HDMI,
622 DISPLAY_MISR_LCDC,
Mayank Chopra0a8c4762013-07-12 18:19:36 +0530623 DISPLAY_MISR_MDP,
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700624 DISPLAY_MISR_ATV,
625 DISPLAY_MISR_DSI_CMD,
626 DISPLAY_MISR_MAX
627};
628
629enum {
Mayank Chopra0a8c4762013-07-12 18:19:36 +0530630 MISR_OP_NONE = 0,
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700631 MISR_OP_SFM,
632 MISR_OP_MFM,
633 MISR_OP_BM,
634 MISR_OP_MAX
635};
636
637struct mdp_misr {
638 uint32_t block_id;
639 uint32_t frame_count;
640 uint32_t crc_op_mode;
Mayank Chopra0a8c4762013-07-12 18:19:36 +0530641 uint32_t crc_value[MISR_CRC_BATCH_SIZE];
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700642};
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800643
644/*
645
Ken Zhang6a431632012-08-08 16:46:22 -0400646 mdp_block_type defines the identifiers for pipes in MDP 4.3 and up
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800647
648 MDP_BLOCK_RESERVED is provided for backward compatibility and is
649 deprecated. It corresponds to DMA_P. So MDP_BLOCK_DMA_P should be used
650 instead.
651
Ken Zhang6a431632012-08-08 16:46:22 -0400652 MDP_LOGICAL_BLOCK_DISP_0 identifies the display pipe which fb0 uses,
653 same for others.
654
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800655*/
656
657enum {
658 MDP_BLOCK_RESERVED = 0,
659 MDP_BLOCK_OVERLAY_0,
660 MDP_BLOCK_OVERLAY_1,
661 MDP_BLOCK_VG_1,
662 MDP_BLOCK_VG_2,
663 MDP_BLOCK_RGB_1,
664 MDP_BLOCK_RGB_2,
665 MDP_BLOCK_DMA_P,
666 MDP_BLOCK_DMA_S,
667 MDP_BLOCK_DMA_E,
Pravin Tamkhaneb18c9e22012-04-13 18:29:34 -0700668 MDP_BLOCK_OVERLAY_2,
Carl Vanderlipbf16fdf62013-03-11 13:45:45 -0700669 MDP_LOGICAL_BLOCK_DISP_0 = 0x10,
Ken Zhang6a431632012-08-08 16:46:22 -0400670 MDP_LOGICAL_BLOCK_DISP_1,
671 MDP_LOGICAL_BLOCK_DISP_2,
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800672 MDP_BLOCK_MAX,
673};
674
Carl Vanderlipba093a22011-11-22 13:59:59 -0800675/*
676 * mdp_histogram_start_req is used to provide the parameters for
677 * histogram start request
678 */
679
680struct mdp_histogram_start_req {
681 uint32_t block;
682 uint8_t frame_cnt;
683 uint8_t bit_mask;
Carl Vanderlip16316322012-10-08 16:47:34 -0700684 uint16_t num_bins;
Carl Vanderlipba093a22011-11-22 13:59:59 -0800685};
686
687/*
688 * mdp_histogram_data is used to return the histogram data, once
689 * the histogram is done/stopped/cance
690 */
691
692struct mdp_histogram_data {
693 uint32_t block;
Ken Zhang0f523bd2012-08-23 11:14:03 -0400694 uint32_t bin_cnt;
Carl Vanderlipba093a22011-11-22 13:59:59 -0800695 uint32_t *c0;
696 uint32_t *c1;
697 uint32_t *c2;
Carl Vanderlip7b8b6402012-03-01 10:58:03 -0800698 uint32_t *extra_info;
Carl Vanderlipba093a22011-11-22 13:59:59 -0800699};
700
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800701struct mdp_pcc_coeff {
702 uint32_t c, r, g, b, rr, gg, bb, rg, gb, rb, rgb_0, rgb_1;
703};
704
705struct mdp_pcc_cfg_data {
706 uint32_t block;
707 uint32_t ops;
708 struct mdp_pcc_coeff r, g, b;
709};
710
Ken Zhangbf5fb4c2012-08-19 14:41:01 -0400711#define MDP_GAMUT_TABLE_NUM 8
712
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800713enum {
714 mdp_lut_igc,
715 mdp_lut_pgc,
716 mdp_lut_hist,
717 mdp_lut_max,
718};
719
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800720struct mdp_ar_gc_lut_data {
721 uint32_t x_start;
722 uint32_t slope;
723 uint32_t offset;
724};
725
726struct mdp_pgc_lut_data {
727 uint32_t block;
728 uint32_t flags;
729 uint8_t num_r_stages;
730 uint8_t num_g_stages;
731 uint8_t num_b_stages;
732 struct mdp_ar_gc_lut_data *r_data;
733 struct mdp_ar_gc_lut_data *g_data;
734 struct mdp_ar_gc_lut_data *b_data;
735};
736
737
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800738struct mdp_lut_cfg_data {
739 uint32_t lut_type;
740 union {
741 struct mdp_igc_lut_data igc_lut_data;
742 struct mdp_pgc_lut_data pgc_lut_data;
743 struct mdp_hist_lut_data hist_lut_data;
744 } data;
745};
746
Carl Vanderlipf0fd8e72012-05-03 15:08:20 -0700747struct mdp_bl_scale_data {
748 uint32_t min_lvl;
749 uint32_t scale;
750};
Pravin Tamkhane67726da2012-04-13 11:59:11 -0700751
Ken Zhang77ce0192012-08-10 11:27:19 -0400752struct mdp_pa_cfg_data {
753 uint32_t block;
Ping Li58229242012-11-30 14:05:43 -0500754 struct mdp_pa_cfg pa_data;
Ken Zhang77ce0192012-08-10 11:27:19 -0400755};
756
Benet Clark477baa02013-10-04 17:21:45 -0700757struct mdp_pa_v2_cfg_data {
758 uint32_t block;
759 struct mdp_pa_v2_data pa_v2_data;
760};
761
Ken Zhang7fb85772012-08-18 14:51:33 -0400762struct mdp_dither_cfg_data {
763 uint32_t block;
764 uint32_t flags;
765 uint32_t g_y_depth;
766 uint32_t r_cr_depth;
767 uint32_t b_cb_depth;
768};
769
Ken Zhangbf5fb4c2012-08-19 14:41:01 -0400770struct mdp_gamut_cfg_data {
771 uint32_t block;
772 uint32_t flags;
773 uint32_t gamut_first;
774 uint32_t tbl_size[MDP_GAMUT_TABLE_NUM];
775 uint16_t *r_tbl[MDP_GAMUT_TABLE_NUM];
776 uint16_t *g_tbl[MDP_GAMUT_TABLE_NUM];
777 uint16_t *b_tbl[MDP_GAMUT_TABLE_NUM];
778};
779
Carl Vanderlipe8ed5ec2012-09-28 16:04:10 -0700780struct mdp_calib_config_data {
781 uint32_t ops;
782 uint32_t addr;
783 uint32_t data;
784};
785
Arpita Banerjee676eea22013-06-04 19:43:24 -0700786struct mdp_calib_config_buffer {
787 uint32_t ops;
788 uint32_t size;
789 uint32_t *buffer;
790};
791
Arpita Banerjeea8b7fbf2013-06-11 19:24:20 -0700792struct mdp_calib_dcm_state {
793 uint32_t ops;
794 uint32_t dcm_state;
795};
796
797enum {
798 DCM_UNINIT,
799 DCM_UNBLANK,
800 DCM_ENTER,
801 DCM_EXIT,
802 DCM_BLANK,
803};
804
Carl Vanderlipe5592b62013-05-16 21:00:03 -0700805#define MDSS_MAX_BL_BRIGHTNESS 255
806#define AD_BL_LIN_LEN (MDSS_MAX_BL_BRIGHTNESS + 1)
807
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700808#define MDSS_AD_MODE_AUTO_BL 0x0
809#define MDSS_AD_MODE_AUTO_STR 0x1
810#define MDSS_AD_MODE_TARG_STR 0x3
811#define MDSS_AD_MODE_MAN_STR 0x7
Carl Vanderlip819c5092013-05-19 12:08:33 -0700812#define MDSS_AD_MODE_CALIB 0xF
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700813
814#define MDP_PP_AD_INIT 0x10
815#define MDP_PP_AD_CFG 0x20
816
817struct mdss_ad_init {
818 uint32_t asym_lut[33];
819 uint32_t color_corr_lut[33];
820 uint8_t i_control[2];
821 uint16_t black_lvl;
822 uint16_t white_lvl;
823 uint8_t var;
824 uint8_t limit_ampl;
825 uint8_t i_dither;
826 uint8_t slope_max;
827 uint8_t slope_min;
828 uint8_t dither_ctl;
829 uint8_t format;
830 uint8_t auto_size;
831 uint16_t frame_w;
832 uint16_t frame_h;
833 uint8_t logo_v;
834 uint8_t logo_h;
Carl Vanderlipe5592b62013-05-16 21:00:03 -0700835 uint32_t bl_lin_len;
836 uint32_t *bl_lin;
837 uint32_t *bl_lin_inv;
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700838};
839
Carl Vanderlip5e81ced2013-05-23 20:02:14 -0700840#define MDSS_AD_BL_CTRL_MODE_EN 1
841#define MDSS_AD_BL_CTRL_MODE_DIS 0
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700842struct mdss_ad_cfg {
843 uint32_t mode;
844 uint32_t al_calib_lut[33];
845 uint16_t backlight_min;
846 uint16_t backlight_max;
847 uint16_t backlight_scale;
848 uint16_t amb_light_min;
849 uint16_t filter[2];
850 uint16_t calib[4];
851 uint8_t strength_limit;
852 uint8_t t_filter_recursion;
Carl Vanderlip956360e2013-04-04 20:57:17 -0700853 uint16_t stab_itr;
Carl Vanderlip5e81ced2013-05-23 20:02:14 -0700854 uint32_t bl_ctrl_mode;
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700855};
856
857/* ops uses standard MDP_PP_* flags */
858struct mdss_ad_init_cfg {
859 uint32_t ops;
860 union {
861 struct mdss_ad_init init;
862 struct mdss_ad_cfg cfg;
863 } params;
864};
865
866/* mode uses MDSS_AD_MODE_* flags */
867struct mdss_ad_input {
868 uint32_t mode;
869 union {
870 uint32_t amb_light;
871 uint32_t strength;
Carl Vanderlip819c5092013-05-19 12:08:33 -0700872 uint32_t calib_bl;
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700873 } in;
Carl Vanderlip16e79532013-04-02 11:12:16 -0700874 uint32_t output;
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700875};
876
Carl Vanderlipa088b7c2013-05-17 13:52:53 -0700877#define MDSS_CALIB_MODE_BL 0x1
Carl Vanderlip95a07e12013-05-17 13:51:38 -0700878struct mdss_calib_cfg {
879 uint32_t ops;
880 uint32_t calib_mask;
881};
882
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800883enum {
884 mdp_op_pcc_cfg,
885 mdp_op_csc_cfg,
886 mdp_op_lut_cfg,
Pravin Tamkhane67726da2012-04-13 11:59:11 -0700887 mdp_op_qseed_cfg,
Carl Vanderlipf0fd8e72012-05-03 15:08:20 -0700888 mdp_bl_scale_cfg,
Ken Zhang77ce0192012-08-10 11:27:19 -0400889 mdp_op_pa_cfg,
Benet Clark477baa02013-10-04 17:21:45 -0700890 mdp_op_pa_v2_cfg,
Ken Zhang7fb85772012-08-18 14:51:33 -0400891 mdp_op_dither_cfg,
Ken Zhangbf5fb4c2012-08-19 14:41:01 -0400892 mdp_op_gamut_cfg,
Carl Vanderlipe8ed5ec2012-09-28 16:04:10 -0700893 mdp_op_calib_cfg,
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700894 mdp_op_ad_cfg,
895 mdp_op_ad_input,
Carl Vanderlip95a07e12013-05-17 13:51:38 -0700896 mdp_op_calib_mode,
Arpita Banerjee676eea22013-06-04 19:43:24 -0700897 mdp_op_calib_buffer,
Arpita Banerjeea8b7fbf2013-06-11 19:24:20 -0700898 mdp_op_calib_dcm_state,
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800899 mdp_op_max,
900};
901
Pawan Kumar9807ea12013-02-14 18:12:02 +0530902enum {
903 WB_FORMAT_NV12,
904 WB_FORMAT_RGB_565,
905 WB_FORMAT_RGB_888,
906 WB_FORMAT_xRGB_8888,
907 WB_FORMAT_ARGB_8888,
Pawan Kumaree811932013-07-09 15:45:01 +0530908 WB_FORMAT_BGRA_8888,
909 WB_FORMAT_BGRX_8888,
Pawan Kumar9807ea12013-02-14 18:12:02 +0530910 WB_FORMAT_ARGB_8888_INPUT_ALPHA /* Need to support */
911};
912
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800913struct msmfb_mdp_pp {
914 uint32_t op;
915 union {
916 struct mdp_pcc_cfg_data pcc_cfg_data;
917 struct mdp_csc_cfg_data csc_cfg_data;
918 struct mdp_lut_cfg_data lut_cfg_data;
Pravin Tamkhane67726da2012-04-13 11:59:11 -0700919 struct mdp_qseed_cfg_data qseed_cfg_data;
Carl Vanderlipf0fd8e72012-05-03 15:08:20 -0700920 struct mdp_bl_scale_data bl_scale_data;
Ken Zhang77ce0192012-08-10 11:27:19 -0400921 struct mdp_pa_cfg_data pa_cfg_data;
Benet Clark477baa02013-10-04 17:21:45 -0700922 struct mdp_pa_v2_cfg_data pa_v2_cfg_data;
Ken Zhang7fb85772012-08-18 14:51:33 -0400923 struct mdp_dither_cfg_data dither_cfg_data;
Ken Zhangbf5fb4c2012-08-19 14:41:01 -0400924 struct mdp_gamut_cfg_data gamut_cfg_data;
Carl Vanderlipe8ed5ec2012-09-28 16:04:10 -0700925 struct mdp_calib_config_data calib_cfg;
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700926 struct mdss_ad_init_cfg ad_init_cfg;
Carl Vanderlip95a07e12013-05-17 13:51:38 -0700927 struct mdss_calib_cfg mdss_calib_cfg;
Carl Vanderlip8b493b02013-03-22 13:40:02 -0700928 struct mdss_ad_input ad_input;
Arpita Banerjee676eea22013-06-04 19:43:24 -0700929 struct mdp_calib_config_buffer calib_buffer;
Arpita Banerjeea8b7fbf2013-06-11 19:24:20 -0700930 struct mdp_calib_dcm_state calib_dcm;
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800931 } data;
932};
933
Manoj Raoa8e39d92013-02-16 08:47:21 -0800934#define FB_METADATA_VIDEO_INFO_CODE_SUPPORT 1
Ken Zhang5cf85c02012-08-23 19:32:52 -0700935enum {
936 metadata_op_none,
937 metadata_op_base_blend,
Ken Zhang420dd202013-01-08 14:28:20 -0500938 metadata_op_frame_rate,
Manoj Raoa8e39d92013-02-16 08:47:21 -0800939 metadata_op_vic,
Pawan Kumar9807ea12013-02-14 18:12:02 +0530940 metadata_op_wb_format,
Tatenda Chipeperekwa5dc8c482013-10-25 17:44:37 -0700941 metadata_op_wb_secure,
Adrian Salido-Moreno9bf71f32013-03-05 19:23:44 -0800942 metadata_op_get_caps,
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700943 metadata_op_crc,
Ken Zhang5cf85c02012-08-23 19:32:52 -0700944 metadata_op_max
945};
Pravin Tamkhane02a40682011-11-29 14:17:01 -0800946
Ken Zhang5cf85c02012-08-23 19:32:52 -0700947struct mdp_blend_cfg {
948 uint32_t is_premultiplied;
949};
950
Pawan Kumar9807ea12013-02-14 18:12:02 +0530951struct mdp_mixer_cfg {
952 uint32_t writeback_format;
953 uint32_t alpha;
954};
955
Adrian Salido-Moreno9bf71f32013-03-05 19:23:44 -0800956struct mdss_hw_caps {
957 uint32_t mdp_rev;
958 uint8_t rgb_pipes;
959 uint8_t vig_pipes;
960 uint8_t dma_pipes;
Sree Sesha Aravind Vadrevu10c4d772013-03-28 13:11:12 -0700961 uint32_t features;
Adrian Salido-Moreno9bf71f32013-03-05 19:23:44 -0800962};
963
Ken Zhang5cf85c02012-08-23 19:32:52 -0700964struct msmfb_metadata {
965 uint32_t op;
966 uint32_t flags;
967 union {
Sree Sesha Aravind Vadrevu7bacaaa2013-03-20 11:50:25 -0700968 struct mdp_misr misr_request;
Ken Zhang5cf85c02012-08-23 19:32:52 -0700969 struct mdp_blend_cfg blend_cfg;
Pawan Kumar9807ea12013-02-14 18:12:02 +0530970 struct mdp_mixer_cfg mixer_cfg;
Ken Zhang420dd202013-01-08 14:28:20 -0500971 uint32_t panel_frame_rate;
Manoj Raoa8e39d92013-02-16 08:47:21 -0800972 uint32_t video_info_code;
Adrian Salido-Moreno9bf71f32013-03-05 19:23:44 -0800973 struct mdss_hw_caps caps;
Tatenda Chipeperekwa5dc8c482013-10-25 17:44:37 -0700974 uint8_t secure_en;
Ken Zhang5cf85c02012-08-23 19:32:52 -0700975 } data;
976};
Ken Zhang5295d802012-11-07 18:33:16 -0500977
Adrian Salido-Moreno1a74a492013-05-11 21:24:43 -0700978#define MDP_MAX_FENCE_FD 32
Ken Zhang5295d802012-11-07 18:33:16 -0500979#define MDP_BUF_SYNC_FLAG_WAIT 1
980
981struct mdp_buf_sync {
982 uint32_t flags;
983 uint32_t acq_fen_fd_cnt;
Jayant Shekharf3996992013-08-22 14:28:10 +0530984 uint32_t session_id;
Ken Zhang5295d802012-11-07 18:33:16 -0500985 int *acq_fen_fd;
986 int *rel_fen_fd;
987};
988
Terence Hampson3e636aa2013-05-08 19:01:51 -0400989struct mdp_async_blit_req_list {
990 struct mdp_buf_sync sync;
991 uint32_t count;
992 struct mdp_blit_req req[];
993};
994
Ken Zhang4e83b932012-12-02 21:15:47 -0500995#define MDP_DISPLAY_COMMIT_OVERLAY 1
Ken Zhang5e8588d2012-10-01 11:46:42 -0700996struct mdp_buf_fence {
997 uint32_t flags;
998 uint32_t acq_fen_fd_cnt;
999 int acq_fen_fd[MDP_MAX_FENCE_FD];
1000 int rel_fen_fd[MDP_MAX_FENCE_FD];
1001};
1002
Ken Zhang4e83b932012-12-02 21:15:47 -05001003
1004struct mdp_display_commit {
1005 uint32_t flags;
1006 uint32_t wait_for_finish;
1007 struct fb_var_screeninfo var;
Ken Zhang5e8588d2012-10-01 11:46:42 -07001008 struct mdp_buf_fence buf_fence;
Jeykumar Sankaranb826f332013-09-07 00:58:43 -07001009 struct mdp_rect roi;
Ken Zhang4e83b932012-12-02 21:15:47 -05001010};
1011
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012struct mdp_page_protection {
1013 uint32_t page_protection;
1014};
1015
kuogee hsieh405dc302011-07-21 15:06:59 -07001016
1017struct mdp_mixer_info {
1018 int pndx;
1019 int pnum;
1020 int ptype;
1021 int mixer_num;
1022 int z_order;
1023};
1024
1025#define MAX_PIPE_PER_MIXER 4
1026
1027struct msmfb_mixer_info_req {
1028 int mixer_num;
1029 int cnt;
1030 struct mdp_mixer_info info[MAX_PIPE_PER_MIXER];
1031};
1032
Ravishangar Kalyanam6bc448a2012-03-14 11:31:52 -07001033enum {
1034 DISPLAY_SUBSYSTEM_ID,
1035 ROTATOR_SUBSYSTEM_ID,
1036};
kuogee hsieh405dc302011-07-21 15:06:59 -07001037
Adrian Salido-Moreno96d88d42012-12-20 13:01:39 -08001038enum {
1039 MDP_IOMMU_DOMAIN_CP,
1040 MDP_IOMMU_DOMAIN_NS,
1041};
1042
Deva Ramasubramanian166b0982013-01-25 20:11:41 -08001043enum {
1044 MDP_WRITEBACK_MIRROR_OFF,
1045 MDP_WRITEBACK_MIRROR_ON,
1046 MDP_WRITEBACK_MIRROR_PAUSE,
1047 MDP_WRITEBACK_MIRROR_RESUME,
1048};
1049
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001050#ifdef __KERNEL__
Adrian Salido-Moreno96d88d42012-12-20 13:01:39 -08001051int msm_fb_get_iommu_domain(struct fb_info *info, int domain);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001052/* get the framebuffer physical address information */
Ravishangar Kalyanam6bc448a2012-03-14 11:31:52 -07001053int get_fb_phys_info(unsigned long *start, unsigned long *len, int fb_num,
1054 int subsys_id);
Vinay Kalia27020d12011-10-14 17:50:29 -07001055struct fb_info *msm_fb_get_writeback_fb(void);
1056int msm_fb_writeback_init(struct fb_info *info);
Vinay Kaliae1ba2702011-12-21 16:24:52 -08001057int msm_fb_writeback_start(struct fb_info *info);
Vinay Kalia27020d12011-10-14 17:50:29 -07001058int msm_fb_writeback_queue_buffer(struct fb_info *info,
1059 struct msmfb_data *data);
1060int msm_fb_writeback_dequeue_buffer(struct fb_info *info,
1061 struct msmfb_data *data);
Vinay Kaliae1ba2702011-12-21 16:24:52 -08001062int msm_fb_writeback_stop(struct fb_info *info);
Vinay Kalia27020d12011-10-14 17:50:29 -07001063int msm_fb_writeback_terminate(struct fb_info *info);
Adrian Salido-Moreno96d88d42012-12-20 13:01:39 -08001064int msm_fb_writeback_set_secure(struct fb_info *info, int enable);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001065#endif
1066
1067#endif /*_MSM_MDP_H_*/