Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 1 | /* include/linux/msm_mdp.h |
| 2 | * |
| 3 | * Copyright (C) 2007 Google Incorporated |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | #ifndef _MSM_MDP_H_ |
| 15 | #define _MSM_MDP_H_ |
| 16 | |
| 17 | #include <linux/types.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 18 | #include <linux/fb.h> |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 19 | |
| 20 | #define MSMFB_IOCTL_MAGIC 'm' |
| 21 | #define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int) |
| 22 | #define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 23 | #define MSMFB_SUSPEND_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 128, unsigned int) |
| 24 | #define MSMFB_RESUME_SW_REFRESHER _IOW(MSMFB_IOCTL_MAGIC, 129, unsigned int) |
| 25 | #define MSMFB_CURSOR _IOW(MSMFB_IOCTL_MAGIC, 130, struct fb_cursor) |
| 26 | #define MSMFB_SET_LUT _IOW(MSMFB_IOCTL_MAGIC, 131, struct fb_cmap) |
| 27 | #define MSMFB_HISTOGRAM _IOWR(MSMFB_IOCTL_MAGIC, 132, struct mdp_histogram) |
| 28 | /* new ioctls's for set/get ccs matrix */ |
| 29 | #define MSMFB_GET_CCS_MATRIX _IOWR(MSMFB_IOCTL_MAGIC, 133, struct mdp_ccs) |
| 30 | #define MSMFB_SET_CCS_MATRIX _IOW(MSMFB_IOCTL_MAGIC, 134, struct mdp_ccs) |
| 31 | #define MSMFB_OVERLAY_SET _IOWR(MSMFB_IOCTL_MAGIC, 135, \ |
| 32 | struct mdp_overlay) |
| 33 | #define MSMFB_OVERLAY_UNSET _IOW(MSMFB_IOCTL_MAGIC, 136, unsigned int) |
| 34 | #define MSMFB_OVERLAY_PLAY _IOW(MSMFB_IOCTL_MAGIC, 137, \ |
| 35 | struct msmfb_overlay_data) |
| 36 | #define MSMFB_GET_PAGE_PROTECTION _IOR(MSMFB_IOCTL_MAGIC, 138, \ |
| 37 | struct mdp_page_protection) |
| 38 | #define MSMFB_SET_PAGE_PROTECTION _IOW(MSMFB_IOCTL_MAGIC, 139, \ |
| 39 | struct mdp_page_protection) |
| 40 | #define MSMFB_OVERLAY_GET _IOR(MSMFB_IOCTL_MAGIC, 140, \ |
| 41 | struct mdp_overlay) |
| 42 | #define MSMFB_OVERLAY_PLAY_ENABLE _IOW(MSMFB_IOCTL_MAGIC, 141, unsigned int) |
| 43 | #define MSMFB_OVERLAY_BLT _IOWR(MSMFB_IOCTL_MAGIC, 142, \ |
| 44 | struct msmfb_overlay_blt) |
| 45 | #define MSMFB_OVERLAY_BLT_OFFSET _IOW(MSMFB_IOCTL_MAGIC, 143, unsigned int) |
| 46 | #define MSMFB_HISTOGRAM_START _IO(MSMFB_IOCTL_MAGIC, 144) |
| 47 | #define MSMFB_HISTOGRAM_STOP _IO(MSMFB_IOCTL_MAGIC, 145) |
| 48 | #define MSMFB_NOTIFY_UPDATE _IOW(MSMFB_IOCTL_MAGIC, 146, unsigned int) |
| 49 | |
| 50 | #define MSMFB_OVERLAY_3D _IOWR(MSMFB_IOCTL_MAGIC, 147, \ |
| 51 | struct msmfb_overlay_3d) |
| 52 | |
kuogee hsieh | 405dc30 | 2011-07-21 15:06:59 -0700 | [diff] [blame] | 53 | #define MSMFB_MIXER_INFO _IOWR(MSMFB_IOCTL_MAGIC, 148, \ |
| 54 | struct msmfb_mixer_info_req) |
Nagamalleswararao Ganji | 0737d65 | 2011-10-14 02:02:33 -0700 | [diff] [blame] | 55 | #define MSMFB_OVERLAY_PLAY_WAIT _IOWR(MSMFB_IOCTL_MAGIC, 149, \ |
| 56 | struct msmfb_overlay_data) |
kuogee hsieh | 405dc30 | 2011-07-21 15:06:59 -0700 | [diff] [blame] | 57 | |
Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame] | 58 | #define MSMFB_WRITEBACK_INIT _IO(MSMFB_IOCTL_MAGIC, 150) |
| 59 | #define MSMFB_WRITEBACK_REGISTER_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 151, \ |
| 60 | struct msmfb_writeback_data) |
| 61 | #define MSMFB_WRITEBACK_UNREGISTER_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 152, \ |
| 62 | struct msmfb_writeback_data) |
| 63 | #define MSMFB_WRITEBACK_QUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 153, \ |
| 64 | struct msmfb_data) |
| 65 | #define MSMFB_WRITEBACK_DEQUEUE_BUFFER _IOW(MSMFB_IOCTL_MAGIC, 154, \ |
| 66 | struct msmfb_data) |
| 67 | #define MSMFB_WRITEBACK_TERMINATE _IO(MSMFB_IOCTL_MAGIC, 155) |
| 68 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 69 | #define FB_TYPE_3D_PANEL 0x10101010 |
| 70 | #define MDP_IMGTYPE2_START 0x10000 |
| 71 | #define MSMFB_DRIVER_VERSION 0xF9E8D701 |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 72 | |
| 73 | enum { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 74 | NOTIFY_UPDATE_START, |
| 75 | NOTIFY_UPDATE_STOP, |
| 76 | }; |
| 77 | |
| 78 | enum { |
| 79 | MDP_RGB_565, /* RGB 565 planer */ |
| 80 | MDP_XRGB_8888, /* RGB 888 padded */ |
| 81 | MDP_Y_CBCR_H2V2, /* Y and CbCr, pseudo planer w/ Cb is in MSB */ |
| 82 | MDP_ARGB_8888, /* ARGB 888 */ |
| 83 | MDP_RGB_888, /* RGB 888 planer */ |
| 84 | MDP_Y_CRCB_H2V2, /* Y and CrCb, pseudo planer w/ Cr is in MSB */ |
| 85 | MDP_YCRYCB_H2V1, /* YCrYCb interleave */ |
| 86 | MDP_Y_CRCB_H2V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */ |
| 87 | MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */ |
| 88 | MDP_RGBA_8888, /* ARGB 888 */ |
| 89 | MDP_BGRA_8888, /* ABGR 888 */ |
| 90 | MDP_RGBX_8888, /* RGBX 888 */ |
| 91 | MDP_Y_CRCB_H2V2_TILE, /* Y and CrCb, pseudo planer tile */ |
| 92 | MDP_Y_CBCR_H2V2_TILE, /* Y and CbCr, pseudo planer tile */ |
| 93 | MDP_Y_CR_CB_H2V2, /* Y, Cr and Cb, planar */ |
Pradeep Jilagam | 9b4a6be | 2011-10-03 17:19:20 +0530 | [diff] [blame] | 94 | MDP_Y_CR_CB_GH2V2, /* Y, Cr and Cb, planar aligned to Android YV12 */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | MDP_Y_CB_CR_H2V2, /* Y, Cb and Cr, planar */ |
| 96 | MDP_Y_CRCB_H1V1, /* Y and CrCb, pseduo planer w/ Cr is in MSB */ |
| 97 | MDP_Y_CBCR_H1V1, /* Y and CbCr, pseduo planer w/ Cb is in MSB */ |
| 98 | MDP_IMGTYPE_LIMIT, |
| 99 | MDP_BGR_565 = MDP_IMGTYPE2_START, /* BGR 565 planer */ |
| 100 | MDP_FB_FORMAT, /* framebuffer format */ |
| 101 | MDP_IMGTYPE_LIMIT2 /* Non valid image type after this enum */ |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | enum { |
| 105 | PMEM_IMG, |
| 106 | FB_IMG, |
| 107 | }; |
| 108 | |
Liyuan Li | d973663 | 2011-11-11 13:47:59 -0800 | [diff] [blame^] | 109 | enum { |
| 110 | HSIC_HUE = 0, |
| 111 | HSIC_SAT, |
| 112 | HSIC_INT, |
| 113 | HSIC_CON, |
| 114 | NUM_HSIC_PARAM, |
| 115 | }; |
| 116 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 117 | /* mdp_blit_req flag values */ |
| 118 | #define MDP_ROT_NOP 0 |
| 119 | #define MDP_FLIP_LR 0x1 |
| 120 | #define MDP_FLIP_UD 0x2 |
| 121 | #define MDP_ROT_90 0x4 |
| 122 | #define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR) |
| 123 | #define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR) |
| 124 | #define MDP_DITHER 0x8 |
| 125 | #define MDP_BLUR 0x10 |
| 126 | #define MDP_BLEND_FG_PREMULT 0x20000 |
| 127 | #define MDP_DEINTERLACE 0x80000000 |
| 128 | #define MDP_SHARPENING 0x40000000 |
| 129 | #define MDP_NO_DMA_BARRIER_START 0x20000000 |
| 130 | #define MDP_NO_DMA_BARRIER_END 0x10000000 |
| 131 | #define MDP_NO_BLIT 0x08000000 |
| 132 | #define MDP_BLIT_WITH_DMA_BARRIERS 0x000 |
| 133 | #define MDP_BLIT_WITH_NO_DMA_BARRIERS \ |
| 134 | (MDP_NO_DMA_BARRIER_START | MDP_NO_DMA_BARRIER_END) |
| 135 | #define MDP_BLIT_SRC_GEM 0x04000000 |
| 136 | #define MDP_BLIT_DST_GEM 0x02000000 |
| 137 | #define MDP_BLIT_NON_CACHED 0x01000000 |
| 138 | #define MDP_OV_PIPE_SHARE 0x00800000 |
| 139 | #define MDP_DEINTERLACE_ODD 0x00400000 |
| 140 | #define MDP_OV_PLAY_NOWAIT 0x00200000 |
| 141 | #define MDP_SOURCE_ROTATED_90 0x00100000 |
Nagamalleswararao Ganji | e69bed8 | 2011-10-17 16:21:42 -0700 | [diff] [blame] | 142 | #define MDP_MEMORY_ID_TYPE_FB 0x00001000 |
Liyuan Li | d973663 | 2011-11-11 13:47:59 -0800 | [diff] [blame^] | 143 | #define MDP_DPP_HSIC 0x00080000 |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 144 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 145 | #define MDP_TRANSP_NOP 0xffffffff |
| 146 | #define MDP_ALPHA_NOP 0xff |
| 147 | |
| 148 | #define MDP_FB_PAGE_PROTECTION_NONCACHED (0) |
| 149 | #define MDP_FB_PAGE_PROTECTION_WRITECOMBINE (1) |
| 150 | #define MDP_FB_PAGE_PROTECTION_WRITETHROUGHCACHE (2) |
| 151 | #define MDP_FB_PAGE_PROTECTION_WRITEBACKCACHE (3) |
| 152 | #define MDP_FB_PAGE_PROTECTION_WRITEBACKWACACHE (4) |
| 153 | /* Sentinel: Don't use! */ |
| 154 | #define MDP_FB_PAGE_PROTECTION_INVALID (5) |
| 155 | /* Count of the number of MDP_FB_PAGE_PROTECTION_... values. */ |
| 156 | #define MDP_NUM_FB_PAGE_PROTECTION_VALUES (5) |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 157 | |
| 158 | struct mdp_rect { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 159 | uint32_t x; |
| 160 | uint32_t y; |
| 161 | uint32_t w; |
| 162 | uint32_t h; |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | struct mdp_img { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 166 | uint32_t width; |
| 167 | uint32_t height; |
| 168 | uint32_t format; |
| 169 | uint32_t offset; |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 170 | int memory_id; /* the file descriptor */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 171 | uint32_t priv; |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 172 | }; |
| 173 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 174 | /* |
| 175 | * {3x3} + {3} ccs matrix |
| 176 | */ |
| 177 | |
| 178 | #define MDP_CCS_RGB2YUV 0 |
| 179 | #define MDP_CCS_YUV2RGB 1 |
| 180 | |
| 181 | #define MDP_CCS_SIZE 9 |
| 182 | #define MDP_BV_SIZE 3 |
| 183 | |
| 184 | struct mdp_ccs { |
| 185 | int direction; /* MDP_CCS_RGB2YUV or YUV2RGB */ |
| 186 | uint16_t ccs[MDP_CCS_SIZE]; /* 3x3 color coefficients */ |
| 187 | uint16_t bv[MDP_BV_SIZE]; /* 1x3 bias vector */ |
| 188 | }; |
| 189 | |
Nagamalleswararao Ganji | 4b99172 | 2011-01-28 13:24:34 -0800 | [diff] [blame] | 190 | struct mdp_csc { |
| 191 | int id; |
| 192 | uint32_t csc_mv[9]; |
| 193 | uint32_t csc_pre_bv[3]; |
| 194 | uint32_t csc_post_bv[3]; |
| 195 | uint32_t csc_pre_lv[6]; |
| 196 | uint32_t csc_post_lv[6]; |
| 197 | }; |
| 198 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 199 | /* The version of the mdp_blit_req structure so that |
| 200 | * user applications can selectively decide which functionality |
| 201 | * to include |
| 202 | */ |
| 203 | |
| 204 | #define MDP_BLIT_REQ_VERSION 2 |
| 205 | |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 206 | struct mdp_blit_req { |
| 207 | struct mdp_img src; |
| 208 | struct mdp_img dst; |
| 209 | struct mdp_rect src_rect; |
| 210 | struct mdp_rect dst_rect; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 211 | uint32_t alpha; |
| 212 | uint32_t transp_mask; |
| 213 | uint32_t flags; |
| 214 | int sharpening_strength; /* -127 <--> 127, default 64 */ |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | struct mdp_blit_req_list { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 218 | uint32_t count; |
Daniel Walker | da6df07 | 2010-04-23 16:04:20 -0700 | [diff] [blame] | 219 | struct mdp_blit_req req[]; |
| 220 | }; |
| 221 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 222 | #define MSMFB_DATA_VERSION 2 |
| 223 | |
| 224 | struct msmfb_data { |
| 225 | uint32_t offset; |
| 226 | int memory_id; |
| 227 | int id; |
| 228 | uint32_t flags; |
| 229 | uint32_t priv; |
| 230 | }; |
| 231 | |
| 232 | #define MSMFB_NEW_REQUEST -1 |
| 233 | |
| 234 | struct msmfb_overlay_data { |
| 235 | uint32_t id; |
| 236 | struct msmfb_data data; |
| 237 | uint32_t version_key; |
| 238 | struct msmfb_data plane1_data; |
| 239 | struct msmfb_data plane2_data; |
| 240 | }; |
| 241 | |
| 242 | struct msmfb_img { |
| 243 | uint32_t width; |
| 244 | uint32_t height; |
| 245 | uint32_t format; |
| 246 | }; |
| 247 | |
Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame] | 248 | #define MSMFB_WRITEBACK_DEQUEUE_BLOCKING 0x1 |
| 249 | struct msmfb_writeback_data { |
| 250 | struct msmfb_data buf_info; |
| 251 | struct msmfb_img img; |
| 252 | }; |
| 253 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 254 | struct dpp_ctrl { |
| 255 | /* |
| 256 | *'sharp_strength' has inputs = -128 <-> 127 |
| 257 | * Increasingly positive values correlate with increasingly sharper |
| 258 | * picture. Increasingly negative values correlate with increasingly |
| 259 | * smoothed picture. |
| 260 | */ |
| 261 | int8_t sharp_strength; |
Liyuan Li | d973663 | 2011-11-11 13:47:59 -0800 | [diff] [blame^] | 262 | int8_t hsic_params[NUM_HSIC_PARAM]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | struct mdp_overlay { |
| 266 | struct msmfb_img src; |
| 267 | struct mdp_rect src_rect; |
| 268 | struct mdp_rect dst_rect; |
| 269 | uint32_t z_order; /* stage number */ |
| 270 | uint32_t is_fg; /* control alpha & transp */ |
| 271 | uint32_t alpha; |
| 272 | uint32_t transp_mask; |
| 273 | uint32_t flags; |
| 274 | uint32_t id; |
| 275 | uint32_t user_data[8]; |
| 276 | struct dpp_ctrl dpp; |
| 277 | }; |
| 278 | |
| 279 | struct msmfb_overlay_3d { |
| 280 | uint32_t is_3d; |
| 281 | uint32_t width; |
| 282 | uint32_t height; |
| 283 | }; |
| 284 | |
| 285 | |
| 286 | struct msmfb_overlay_blt { |
| 287 | uint32_t enable; |
| 288 | uint32_t offset; |
| 289 | uint32_t width; |
| 290 | uint32_t height; |
| 291 | uint32_t bpp; |
| 292 | }; |
| 293 | |
| 294 | struct mdp_histogram { |
| 295 | uint32_t frame_cnt; |
| 296 | uint32_t bin_cnt; |
| 297 | uint32_t *r; |
| 298 | uint32_t *g; |
| 299 | uint32_t *b; |
| 300 | }; |
| 301 | |
| 302 | struct mdp_page_protection { |
| 303 | uint32_t page_protection; |
| 304 | }; |
| 305 | |
kuogee hsieh | 405dc30 | 2011-07-21 15:06:59 -0700 | [diff] [blame] | 306 | |
| 307 | struct mdp_mixer_info { |
| 308 | int pndx; |
| 309 | int pnum; |
| 310 | int ptype; |
| 311 | int mixer_num; |
| 312 | int z_order; |
| 313 | }; |
| 314 | |
| 315 | #define MAX_PIPE_PER_MIXER 4 |
| 316 | |
| 317 | struct msmfb_mixer_info_req { |
| 318 | int mixer_num; |
| 319 | int cnt; |
| 320 | struct mdp_mixer_info info[MAX_PIPE_PER_MIXER]; |
| 321 | }; |
| 322 | |
| 323 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 324 | #ifdef __KERNEL__ |
| 325 | |
| 326 | /* get the framebuffer physical address information */ |
| 327 | int get_fb_phys_info(unsigned long *start, unsigned long *len, int fb_num); |
Vinay Kalia | 27020d1 | 2011-10-14 17:50:29 -0700 | [diff] [blame] | 328 | struct fb_info *msm_fb_get_writeback_fb(void); |
| 329 | int msm_fb_writeback_init(struct fb_info *info); |
| 330 | int msm_fb_writeback_register_buffer(struct fb_info *info, |
| 331 | struct msmfb_writeback_data *data); |
| 332 | int msm_fb_writeback_queue_buffer(struct fb_info *info, |
| 333 | struct msmfb_data *data); |
| 334 | int msm_fb_writeback_dequeue_buffer(struct fb_info *info, |
| 335 | struct msmfb_data *data); |
| 336 | int msm_fb_writeback_unregister_buffer(struct fb_info *info, |
| 337 | struct msmfb_writeback_data *data); |
| 338 | int msm_fb_writeback_terminate(struct fb_info *info); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 339 | #endif |
| 340 | |
| 341 | #endif /*_MSM_MDP_H_*/ |