Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _SDE_HW_MDSS_H |
| 14 | #define _SDE_HW_MDSS_H |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/err.h> |
| 18 | |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 19 | #include "msm_drv.h" |
| 20 | |
Lloyd Atkinson | 113aefd | 2016-10-23 13:15:18 -0400 | [diff] [blame] | 21 | #define SDE_DBG_NAME "sde" |
| 22 | |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 23 | #define SDE_NONE 0 |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 24 | |
Clarence Ip | 5e2a922 | 2016-06-26 22:38:24 -0400 | [diff] [blame] | 25 | #ifndef SDE_CSC_MATRIX_COEFF_SIZE |
| 26 | #define SDE_CSC_MATRIX_COEFF_SIZE 9 |
| 27 | #endif |
| 28 | |
| 29 | #ifndef SDE_CSC_CLAMP_SIZE |
| 30 | #define SDE_CSC_CLAMP_SIZE 6 |
| 31 | #endif |
| 32 | |
| 33 | #ifndef SDE_CSC_BIAS_SIZE |
| 34 | #define SDE_CSC_BIAS_SIZE 3 |
| 35 | #endif |
| 36 | |
| 37 | #ifndef SDE_MAX_PLANES |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 38 | #define SDE_MAX_PLANES 4 |
Clarence Ip | 5e2a922 | 2016-06-26 22:38:24 -0400 | [diff] [blame] | 39 | #endif |
| 40 | |
Dhaval Patel | 48c7602 | 2016-09-01 17:51:23 -0700 | [diff] [blame] | 41 | #define PIPES_PER_STAGE 2 |
abeykun | 48f407a | 2016-08-25 12:06:44 -0400 | [diff] [blame] | 42 | #ifndef SDE_MAX_DE_CURVES |
| 43 | #define SDE_MAX_DE_CURVES 3 |
| 44 | #endif |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 45 | |
abeykun | 2997c81 | 2016-10-04 11:34:15 -0400 | [diff] [blame] | 46 | enum sde_format_flags { |
| 47 | SDE_FORMAT_FLAG_YUV_BIT, |
| 48 | SDE_FORMAT_FLAG_DX_BIT, |
Alan Kwong | 4fc006e | 2017-01-29 18:19:34 -0800 | [diff] [blame] | 49 | SDE_FORMAT_FLAG_COMPRESSED_BIT, |
abeykun | 2997c81 | 2016-10-04 11:34:15 -0400 | [diff] [blame] | 50 | SDE_FORMAT_FLAG_BIT_MAX, |
| 51 | }; |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 52 | |
abeykun | 2997c81 | 2016-10-04 11:34:15 -0400 | [diff] [blame] | 53 | #define SDE_FORMAT_FLAG_YUV BIT(SDE_FORMAT_FLAG_YUV_BIT) |
| 54 | #define SDE_FORMAT_FLAG_DX BIT(SDE_FORMAT_FLAG_DX_BIT) |
Alan Kwong | 4fc006e | 2017-01-29 18:19:34 -0800 | [diff] [blame] | 55 | #define SDE_FORMAT_FLAG_COMPRESSED BIT(SDE_FORMAT_FLAG_COMPRESSED_BIT) |
abeykun | 2997c81 | 2016-10-04 11:34:15 -0400 | [diff] [blame] | 56 | #define SDE_FORMAT_IS_YUV(X) \ |
| 57 | (test_bit(SDE_FORMAT_FLAG_YUV_BIT, (X)->flag)) |
| 58 | #define SDE_FORMAT_IS_DX(X) \ |
| 59 | (test_bit(SDE_FORMAT_FLAG_DX_BIT, (X)->flag)) |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 60 | #define SDE_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == SDE_FETCH_LINEAR) |
Alan Kwong | 4fc006e | 2017-01-29 18:19:34 -0800 | [diff] [blame] | 61 | #define SDE_FORMAT_IS_TILE(X) \ |
| 62 | (((X)->fetch_mode == SDE_FETCH_UBWC) && \ |
| 63 | !test_bit(SDE_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) |
| 64 | #define SDE_FORMAT_IS_UBWC(X) \ |
| 65 | (((X)->fetch_mode == SDE_FETCH_UBWC) && \ |
| 66 | test_bit(SDE_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 67 | |
Dhaval Patel | 48c7602 | 2016-09-01 17:51:23 -0700 | [diff] [blame] | 68 | #define SDE_BLEND_FG_ALPHA_FG_CONST (0 << 0) |
| 69 | #define SDE_BLEND_FG_ALPHA_BG_CONST (1 << 0) |
| 70 | #define SDE_BLEND_FG_ALPHA_FG_PIXEL (2 << 0) |
| 71 | #define SDE_BLEND_FG_ALPHA_BG_PIXEL (3 << 0) |
| 72 | #define SDE_BLEND_FG_INV_ALPHA (1 << 2) |
| 73 | #define SDE_BLEND_FG_MOD_ALPHA (1 << 3) |
| 74 | #define SDE_BLEND_FG_INV_MOD_ALPHA (1 << 4) |
| 75 | #define SDE_BLEND_FG_TRANSP_EN (1 << 5) |
| 76 | #define SDE_BLEND_BG_ALPHA_FG_CONST (0 << 8) |
| 77 | #define SDE_BLEND_BG_ALPHA_BG_CONST (1 << 8) |
| 78 | #define SDE_BLEND_BG_ALPHA_FG_PIXEL (2 << 8) |
| 79 | #define SDE_BLEND_BG_ALPHA_BG_PIXEL (3 << 8) |
| 80 | #define SDE_BLEND_BG_INV_ALPHA (1 << 10) |
| 81 | #define SDE_BLEND_BG_MOD_ALPHA (1 << 11) |
| 82 | #define SDE_BLEND_BG_INV_MOD_ALPHA (1 << 12) |
| 83 | #define SDE_BLEND_BG_TRANSP_EN (1 << 13) |
| 84 | |
Dhaval Patel | aab9b52 | 2017-07-20 12:38:46 -0700 | [diff] [blame] | 85 | #define SDE_VSYNC0_SOURCE_GPIO 0 |
| 86 | #define SDE_VSYNC1_SOURCE_GPIO 1 |
| 87 | #define SDE_VSYNC2_SOURCE_GPIO 2 |
| 88 | #define SDE_VSYNC_SOURCE_INTF_0 3 |
| 89 | #define SDE_VSYNC_SOURCE_INTF_1 4 |
| 90 | #define SDE_VSYNC_SOURCE_INTF_2 5 |
| 91 | #define SDE_VSYNC_SOURCE_INTF_3 6 |
| 92 | #define SDE_VSYNC_SOURCE_WD_TIMER_4 11 |
| 93 | #define SDE_VSYNC_SOURCE_WD_TIMER_3 12 |
| 94 | #define SDE_VSYNC_SOURCE_WD_TIMER_2 13 |
| 95 | #define SDE_VSYNC_SOURCE_WD_TIMER_1 14 |
| 96 | #define SDE_VSYNC_SOURCE_WD_TIMER_0 15 |
| 97 | |
Lloyd Atkinson | 6b3b9dd | 2016-08-10 18:45:31 -0400 | [diff] [blame] | 98 | enum sde_hw_blk_type { |
| 99 | SDE_HW_BLK_TOP = 0, |
| 100 | SDE_HW_BLK_SSPP, |
| 101 | SDE_HW_BLK_LM, |
| 102 | SDE_HW_BLK_DSPP, |
Sravanthi Kollukuduru | acdc591 | 2017-06-22 14:53:00 +0530 | [diff] [blame] | 103 | SDE_HW_BLK_DS, |
Lloyd Atkinson | 6b3b9dd | 2016-08-10 18:45:31 -0400 | [diff] [blame] | 104 | SDE_HW_BLK_CTL, |
| 105 | SDE_HW_BLK_CDM, |
| 106 | SDE_HW_BLK_PINGPONG, |
| 107 | SDE_HW_BLK_INTF, |
| 108 | SDE_HW_BLK_WB, |
Jeykumar Sankaran | 5c2f070 | 2017-03-09 18:03:15 -0800 | [diff] [blame] | 109 | SDE_HW_BLK_DSC, |
Alan Kwong | 4dd64c8 | 2017-02-04 18:41:51 -0800 | [diff] [blame] | 110 | SDE_HW_BLK_ROT, |
Lloyd Atkinson | 6b3b9dd | 2016-08-10 18:45:31 -0400 | [diff] [blame] | 111 | SDE_HW_BLK_MAX, |
| 112 | }; |
| 113 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 114 | enum sde_mdp { |
| 115 | MDP_TOP = 0x1, |
| 116 | MDP_MAX, |
| 117 | }; |
| 118 | |
| 119 | enum sde_sspp { |
| 120 | SSPP_NONE, |
| 121 | SSPP_VIG0, |
| 122 | SSPP_VIG1, |
| 123 | SSPP_VIG2, |
| 124 | SSPP_VIG3, |
| 125 | SSPP_RGB0, |
| 126 | SSPP_RGB1, |
| 127 | SSPP_RGB2, |
| 128 | SSPP_RGB3, |
| 129 | SSPP_DMA0, |
| 130 | SSPP_DMA1, |
| 131 | SSPP_DMA2, |
| 132 | SSPP_DMA3, |
| 133 | SSPP_CURSOR0, |
| 134 | SSPP_CURSOR1, |
| 135 | SSPP_MAX |
| 136 | }; |
| 137 | |
| 138 | enum sde_sspp_type { |
| 139 | SSPP_TYPE_VIG, |
| 140 | SSPP_TYPE_RGB, |
| 141 | SSPP_TYPE_DMA, |
| 142 | SSPP_TYPE_CURSOR, |
| 143 | SSPP_TYPE_MAX |
| 144 | }; |
| 145 | |
| 146 | enum sde_lm { |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 147 | LM_0 = 1, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 148 | LM_1, |
| 149 | LM_2, |
| 150 | LM_3, |
| 151 | LM_4, |
| 152 | LM_5, |
| 153 | LM_6, |
| 154 | LM_MAX |
| 155 | }; |
| 156 | |
| 157 | enum sde_stage { |
| 158 | SDE_STAGE_BASE = 0, |
| 159 | SDE_STAGE_0, |
| 160 | SDE_STAGE_1, |
| 161 | SDE_STAGE_2, |
| 162 | SDE_STAGE_3, |
| 163 | SDE_STAGE_4, |
| 164 | SDE_STAGE_5, |
| 165 | SDE_STAGE_6, |
Veera Sundaram Sankaran | 370b991 | 2017-01-10 18:03:42 -0800 | [diff] [blame] | 166 | SDE_STAGE_7, |
| 167 | SDE_STAGE_8, |
| 168 | SDE_STAGE_9, |
| 169 | SDE_STAGE_10, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 170 | SDE_STAGE_MAX |
| 171 | }; |
| 172 | enum sde_dspp { |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 173 | DSPP_0 = 1, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 174 | DSPP_1, |
| 175 | DSPP_2, |
| 176 | DSPP_3, |
| 177 | DSPP_MAX |
| 178 | }; |
| 179 | |
Sravanthi Kollukuduru | acdc591 | 2017-06-22 14:53:00 +0530 | [diff] [blame] | 180 | enum sde_ds { |
| 181 | DS_TOP, |
| 182 | DS_0, |
| 183 | DS_1, |
| 184 | DS_MAX |
| 185 | }; |
| 186 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 187 | enum sde_ctl { |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 188 | CTL_0 = 1, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 189 | CTL_1, |
| 190 | CTL_2, |
| 191 | CTL_3, |
| 192 | CTL_4, |
| 193 | CTL_MAX |
| 194 | }; |
| 195 | |
| 196 | enum sde_cdm { |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 197 | CDM_0 = 1, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 198 | CDM_1, |
| 199 | CDM_MAX |
| 200 | }; |
| 201 | |
| 202 | enum sde_pingpong { |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 203 | PINGPONG_0 = 1, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 204 | PINGPONG_1, |
| 205 | PINGPONG_2, |
| 206 | PINGPONG_3, |
| 207 | PINGPONG_4, |
Ben Chan | 78647cd | 2016-06-26 22:02:47 -0400 | [diff] [blame] | 208 | PINGPONG_S0, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 209 | PINGPONG_MAX |
| 210 | }; |
| 211 | |
Jeykumar Sankaran | 5c2f070 | 2017-03-09 18:03:15 -0800 | [diff] [blame] | 212 | enum sde_dsc { |
| 213 | DSC_NONE = 0, |
| 214 | DSC_0, |
| 215 | DSC_1, |
| 216 | DSC_2, |
| 217 | DSC_3, |
| 218 | DSC_4, |
| 219 | DSC_5, |
| 220 | DSC_MAX |
| 221 | }; |
| 222 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 223 | enum sde_intf { |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 224 | INTF_0 = 1, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 225 | INTF_1, |
| 226 | INTF_2, |
| 227 | INTF_3, |
| 228 | INTF_4, |
| 229 | INTF_5, |
| 230 | INTF_6, |
| 231 | INTF_MAX |
| 232 | }; |
| 233 | |
| 234 | enum sde_intf_type { |
| 235 | INTF_NONE = 0x0, |
| 236 | INTF_DSI = 0x1, |
| 237 | INTF_HDMI = 0x3, |
| 238 | INTF_LCDC = 0x5, |
| 239 | INTF_EDP = 0x9, |
Dhaval Patel | 8bf7ff3 | 2016-07-20 18:13:24 -0700 | [diff] [blame] | 240 | INTF_DP = 0xa, |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 241 | INTF_TYPE_MAX, |
| 242 | |
| 243 | /* virtual interfaces */ |
| 244 | INTF_WB = 0x100, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 245 | }; |
| 246 | |
| 247 | enum sde_intf_mode { |
| 248 | INTF_MODE_NONE = 0, |
| 249 | INTF_MODE_CMD, |
| 250 | INTF_MODE_VIDEO, |
| 251 | INTF_MODE_WB_BLOCK, |
| 252 | INTF_MODE_WB_LINE, |
| 253 | INTF_MODE_MAX |
| 254 | }; |
| 255 | |
| 256 | enum sde_wb { |
| 257 | WB_0 = 1, |
| 258 | WB_1, |
| 259 | WB_2, |
| 260 | WB_3, |
| 261 | WB_MAX |
| 262 | }; |
| 263 | |
| 264 | enum sde_ad { |
| 265 | AD_0 = 0x1, |
| 266 | AD_1, |
| 267 | AD_MAX |
| 268 | }; |
| 269 | |
Ben Chan | 78647cd | 2016-06-26 22:02:47 -0400 | [diff] [blame] | 270 | enum sde_cwb { |
| 271 | CWB_0 = 0x1, |
| 272 | CWB_1, |
| 273 | CWB_2, |
| 274 | CWB_3, |
| 275 | CWB_MAX |
| 276 | }; |
| 277 | |
| 278 | enum sde_wd_timer { |
| 279 | WD_TIMER_0 = 0x1, |
| 280 | WD_TIMER_1, |
| 281 | WD_TIMER_2, |
| 282 | WD_TIMER_3, |
| 283 | WD_TIMER_4, |
| 284 | WD_TIMER_5, |
| 285 | WD_TIMER_MAX |
| 286 | }; |
| 287 | |
Alan Kwong | dfa8c08 | 2016-07-29 04:10:00 -0400 | [diff] [blame] | 288 | enum sde_vbif { |
| 289 | VBIF_0, |
| 290 | VBIF_1, |
| 291 | VBIF_MAX, |
| 292 | VBIF_RT = VBIF_0, |
| 293 | VBIF_NRT = VBIF_1 |
| 294 | }; |
| 295 | |
| 296 | enum sde_iommu_domain { |
| 297 | SDE_IOMMU_DOMAIN_UNSECURE, |
| 298 | SDE_IOMMU_DOMAIN_SECURE, |
| 299 | SDE_IOMMU_DOMAIN_MAX |
| 300 | }; |
| 301 | |
Alan Kwong | 4dd64c8 | 2017-02-04 18:41:51 -0800 | [diff] [blame] | 302 | enum sde_rot { |
| 303 | ROT_0 = 1, |
| 304 | ROT_MAX |
| 305 | }; |
| 306 | |
Veera Sundaram Sankaran | 1e71ccb | 2017-05-24 18:48:50 -0700 | [diff] [blame] | 307 | enum sde_inline_rot { |
| 308 | INLINE_ROT_NONE, |
| 309 | INLINE_ROT0_SSPP, |
| 310 | INLINE_ROT0_WB, |
| 311 | INLINE_ROT_MAX |
| 312 | }; |
| 313 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 314 | /** |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 315 | * SDE HW,Component order color map |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 316 | */ |
| 317 | enum { |
| 318 | C0_G_Y = 0, |
| 319 | C1_B_Cb = 1, |
| 320 | C2_R_Cr = 2, |
| 321 | C3_ALPHA = 3 |
| 322 | }; |
| 323 | |
| 324 | /** |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 325 | * enum sde_plane_type - defines how the color component pixel packing |
| 326 | * @SDE_PLANE_INTERLEAVED : Color components in single plane |
| 327 | * @SDE_PLANE_PLANAR : Color component in separate planes |
| 328 | * @SDE_PLANE_PSEUDO_PLANAR : Chroma components interleaved in separate plane |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 329 | */ |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 330 | enum sde_plane_type { |
| 331 | SDE_PLANE_INTERLEAVED, |
| 332 | SDE_PLANE_PLANAR, |
| 333 | SDE_PLANE_PSEUDO_PLANAR, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 334 | }; |
| 335 | |
| 336 | /** |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 337 | * enum sde_chroma_samp_type - chroma sub-samplng type |
| 338 | * @SDE_CHROMA_RGB : No chroma subsampling |
| 339 | * @SDE_CHROMA_H2V1 : Chroma pixels are horizontally subsampled |
| 340 | * @SDE_CHROMA_H1V2 : Chroma pixels are vertically subsampled |
| 341 | * @SDE_CHROMA_420 : 420 subsampling |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 342 | */ |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 343 | enum sde_chroma_samp_type { |
| 344 | SDE_CHROMA_RGB, |
| 345 | SDE_CHROMA_H2V1, |
| 346 | SDE_CHROMA_H1V2, |
| 347 | SDE_CHROMA_420 |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 348 | }; |
| 349 | |
| 350 | /** |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 351 | * sde_fetch_type - Defines How SDE HW fetches data |
| 352 | * @SDE_FETCH_LINEAR : fetch is line by line |
| 353 | * @SDE_FETCH_TILE : fetches data in Z order from a tile |
| 354 | * @SDE_FETCH_UBWC : fetch and decompress data |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 355 | */ |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 356 | enum sde_fetch_type { |
| 357 | SDE_FETCH_LINEAR, |
| 358 | SDE_FETCH_TILE, |
| 359 | SDE_FETCH_UBWC |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 360 | }; |
| 361 | |
| 362 | /** |
| 363 | * Value of enum chosen to fit the number of bits |
| 364 | * expected by the HW programming. |
| 365 | */ |
| 366 | enum { |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 367 | COLOR_ALPHA_1BIT = 0, |
| 368 | COLOR_ALPHA_4BIT = 1, |
| 369 | COLOR_4BIT = 0, |
| 370 | COLOR_5BIT = 1, /* No 5-bit Alpha */ |
| 371 | COLOR_6BIT = 2, /* 6-Bit Alpha also = 2 */ |
| 372 | COLOR_8BIT = 3, /* 8-Bit Alpha also = 3 */ |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 373 | }; |
| 374 | |
Abhijit Kulkarni | 3e3e0d2 | 2016-06-24 17:56:13 -0400 | [diff] [blame] | 375 | /** |
| 376 | * enum sde_3d_blend_mode |
| 377 | * Desribes how the 3d data is blended |
| 378 | * @BLEND_3D_NONE : 3d blending not enabled |
| 379 | * @BLEND_3D_FRAME_INT : Frame interleaving |
| 380 | * @BLEND_3D_H_ROW_INT : Horizontal row interleaving |
| 381 | * @BLEND_3D_V_ROW_INT : vertical row interleaving |
| 382 | * @BLEND_3D_COL_INT : column interleaving |
| 383 | * @BLEND_3D_MAX : |
| 384 | */ |
| 385 | enum sde_3d_blend_mode { |
| 386 | BLEND_3D_NONE = 0, |
| 387 | BLEND_3D_FRAME_INT, |
| 388 | BLEND_3D_H_ROW_INT, |
| 389 | BLEND_3D_V_ROW_INT, |
| 390 | BLEND_3D_COL_INT, |
| 391 | BLEND_3D_MAX |
| 392 | }; |
| 393 | |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 394 | /** struct sde_format - defines the format configuration which |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 395 | * allows SDE HW to correctly fetch and decode the format |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 396 | * @base: base msm_format struture containing fourcc code |
| 397 | * @fetch_planes: how the color components are packed in pixel format |
| 398 | * @element: element color ordering |
| 399 | * @bits: element bit widths |
| 400 | * @chroma_sample: chroma sub-samplng type |
| 401 | * @unpack_align_msb: unpack aligned, 0 to LSB, 1 to MSB |
| 402 | * @unpack_tight: 0 for loose, 1 for tight |
| 403 | * @unpack_count: 0 = 1 component, 1 = 2 component |
| 404 | * @bpp: bytes per pixel |
| 405 | * @alpha_enable: whether the format has an alpha channel |
| 406 | * @num_planes: number of planes (including meta data planes) |
| 407 | * @fetch_mode: linear, tiled, or ubwc hw fetch behavior |
| 408 | * @is_yuv: is format a yuv variant |
| 409 | * @flag: usage bit flags |
| 410 | * @tile_width: format tile width |
| 411 | * @tile_height: format tile height |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 412 | */ |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 413 | struct sde_format { |
| 414 | struct msm_format base; |
| 415 | enum sde_plane_type fetch_planes; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 416 | u8 element[SDE_MAX_PLANES]; |
| 417 | u8 bits[SDE_MAX_PLANES]; |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 418 | enum sde_chroma_samp_type chroma_sample; |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 419 | u8 unpack_align_msb; |
| 420 | u8 unpack_tight; |
| 421 | u8 unpack_count; |
| 422 | u8 bpp; |
| 423 | u8 alpha_enable; |
| 424 | u8 num_planes; |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 425 | enum sde_fetch_type fetch_mode; |
abeykun | 2997c81 | 2016-10-04 11:34:15 -0400 | [diff] [blame] | 426 | DECLARE_BITMAP(flag, SDE_FORMAT_FLAG_BIT_MAX); |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 427 | u16 tile_width; |
| 428 | u16 tile_height; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 429 | }; |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 430 | #define to_sde_format(x) container_of(x, struct sde_format, base) |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 431 | |
| 432 | /** |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 433 | * struct sde_hw_fmt_layout - format information of the source pixel data |
| 434 | * @format: pixel format parameters |
| 435 | * @num_planes: number of planes (including meta data planes) |
| 436 | * @width: image width |
| 437 | * @height: image height |
| 438 | * @total_size: total size in bytes |
| 439 | * @plane_addr: address of each plane |
| 440 | * @plane_size: length of each plane |
| 441 | * @plane_pitch: pitch of each plane |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 442 | */ |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 443 | struct sde_hw_fmt_layout { |
Lloyd Atkinson | 9a67349 | 2016-07-05 11:41:57 -0400 | [diff] [blame] | 444 | const struct sde_format *format; |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 445 | uint32_t num_planes; |
| 446 | uint32_t width; |
| 447 | uint32_t height; |
| 448 | uint32_t total_size; |
| 449 | uint32_t plane_addr[SDE_MAX_PLANES]; |
| 450 | uint32_t plane_size[SDE_MAX_PLANES]; |
| 451 | uint32_t plane_pitch[SDE_MAX_PLANES]; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 452 | }; |
| 453 | |
| 454 | struct sde_rect { |
| 455 | u16 x; |
| 456 | u16 y; |
| 457 | u16 w; |
| 458 | u16 h; |
| 459 | }; |
| 460 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 461 | struct sde_csc_cfg { |
Clarence Ip | 373f859 | 2016-05-26 00:58:42 -0400 | [diff] [blame] | 462 | /* matrix coefficients in S15.16 format */ |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 463 | uint32_t csc_mv[SDE_CSC_MATRIX_COEFF_SIZE]; |
| 464 | uint32_t csc_pre_bv[SDE_CSC_BIAS_SIZE]; |
| 465 | uint32_t csc_post_bv[SDE_CSC_BIAS_SIZE]; |
| 466 | uint32_t csc_pre_lv[SDE_CSC_CLAMP_SIZE]; |
| 467 | uint32_t csc_post_lv[SDE_CSC_CLAMP_SIZE]; |
| 468 | }; |
| 469 | |
| 470 | /** |
| 471 | * struct sde_mdss_color - mdss color description |
| 472 | * color 0 : green |
| 473 | * color 1 : blue |
| 474 | * color 2 : red |
| 475 | * color 3 : alpha |
| 476 | */ |
| 477 | struct sde_mdss_color { |
| 478 | u32 color_0; |
| 479 | u32 color_1; |
| 480 | u32 color_2; |
| 481 | u32 color_3; |
| 482 | }; |
| 483 | |
Clarence Ip | 4ce5932 | 2016-06-26 22:27:51 -0400 | [diff] [blame] | 484 | /* |
| 485 | * Define bit masks for h/w logging. |
| 486 | */ |
| 487 | #define SDE_DBG_MASK_NONE (1 << 0) |
| 488 | #define SDE_DBG_MASK_CDM (1 << 1) |
| 489 | #define SDE_DBG_MASK_DSPP (1 << 2) |
| 490 | #define SDE_DBG_MASK_INTF (1 << 3) |
| 491 | #define SDE_DBG_MASK_LM (1 << 4) |
| 492 | #define SDE_DBG_MASK_CTL (1 << 5) |
| 493 | #define SDE_DBG_MASK_PINGPONG (1 << 6) |
| 494 | #define SDE_DBG_MASK_SSPP (1 << 7) |
| 495 | #define SDE_DBG_MASK_WB (1 << 8) |
Lloyd Atkinson | bb87b5b | 2016-06-13 18:31:15 -0400 | [diff] [blame] | 496 | #define SDE_DBG_MASK_TOP (1 << 9) |
Alan Kwong | 5d324e4 | 2016-07-28 22:56:18 -0400 | [diff] [blame] | 497 | #define SDE_DBG_MASK_VBIF (1 << 10) |
Jeykumar Sankaran | 5c2f070 | 2017-03-09 18:03:15 -0800 | [diff] [blame] | 498 | #define SDE_DBG_MASK_DSC (1 << 11) |
Alan Kwong | 4dd64c8 | 2017-02-04 18:41:51 -0800 | [diff] [blame] | 499 | #define SDE_DBG_MASK_ROT (1 << 12) |
Sravanthi Kollukuduru | acdc591 | 2017-06-22 14:53:00 +0530 | [diff] [blame] | 500 | #define SDE_DBG_MASK_DS (1 << 13) |
Clarence Ip | 4ce5932 | 2016-06-26 22:27:51 -0400 | [diff] [blame] | 501 | |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 502 | /** |
| 503 | * struct sde_hw_cp_cfg: hardware dspp/lm feature payload. |
| 504 | * @payload: Feature specific payload. |
| 505 | * @len: Length of the payload. |
Gopikrishnaiah Anandan | 7e3e3f5 | 2016-12-22 11:13:05 -0800 | [diff] [blame] | 506 | * @ctl: control pointer associated with dspp/lm. |
Gopikrishnaiah Anandan | f5818e0 | 2017-01-30 10:46:58 -0800 | [diff] [blame] | 507 | * @last_feature: last feature that will be set. |
Gopikrishnaiah Anandan | 9ba4378 | 2017-01-31 18:23:08 -0800 | [diff] [blame] | 508 | * @num_of_mixers: number of layer mixers for the display. |
| 509 | * @mixer_info: mixer info pointer associated with lm. |
| 510 | * @displayv: height of the display. |
| 511 | * @displayh: width of the display. |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 512 | */ |
| 513 | struct sde_hw_cp_cfg { |
| 514 | void *payload; |
| 515 | u32 len; |
Gopikrishnaiah Anandan | 7e3e3f5 | 2016-12-22 11:13:05 -0800 | [diff] [blame] | 516 | void *ctl; |
Gopikrishnaiah Anandan | f5818e0 | 2017-01-30 10:46:58 -0800 | [diff] [blame] | 517 | u32 last_feature; |
Gopikrishnaiah Anandan | 9ba4378 | 2017-01-31 18:23:08 -0800 | [diff] [blame] | 518 | u32 num_of_mixers; |
| 519 | void *mixer_info; |
| 520 | u32 displayv; |
| 521 | u32 displayh; |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 522 | }; |
| 523 | |
Veera Sundaram Sankaran | 3171ff8 | 2017-01-04 14:34:47 -0800 | [diff] [blame] | 524 | /** |
| 525 | * struct sde_hw_dim_layer: dim layer configs |
| 526 | * @flags: Flag to represent INCLUSIVE/EXCLUSIVE |
| 527 | * @stage: Blending stage of dim layer |
| 528 | * @color_fill: Color fill to be used for the layer |
| 529 | * @rect: Dim layer coordinates |
| 530 | */ |
| 531 | struct sde_hw_dim_layer { |
| 532 | uint32_t flags; |
| 533 | uint32_t stage; |
| 534 | struct sde_mdss_color color_fill; |
| 535 | struct sde_rect rect; |
| 536 | }; |
| 537 | |
Shashank Babu Chinta Venkata | 5d641d4 | 2017-09-29 12:16:28 -0700 | [diff] [blame] | 538 | /** |
| 539 | * struct sde_splash_lm_hw - Struct contains LM block properties |
| 540 | * @lm_id: stores the current LM ID |
| 541 | * @ctl_id: stores the current CTL ID associated with the LM. |
| 542 | * @lm_reg_value:Store the LM block register value |
| 543 | */ |
| 544 | struct sde_splash_lm_hw { |
| 545 | u8 lm_id; |
| 546 | u8 ctl_id; |
| 547 | u32 lm_reg_value; |
| 548 | }; |
| 549 | |
| 550 | /** |
| 551 | * struct ctl_top - Struct contains CTL block properties |
| 552 | * @value: Store the CTL block register value |
| 553 | * @mode_sel: stores the mode selected in the CTL block |
| 554 | * @dspp_sel: stores the dspp selected in the CTL block |
| 555 | * @pp_sel: stores the pp selected in the CTL block |
| 556 | * @intf_sel: stores the intf selected in the CTL block |
| 557 | * @lm: Pointer to store the list of LMs in the CTL block |
| 558 | * @ctl_lm_cnt: stores the active number of MDSS "LM" blocks in the CTL block |
| 559 | */ |
| 560 | struct ctl_top { |
| 561 | u32 value; |
| 562 | u8 mode_sel; |
| 563 | u8 dspp_sel; |
| 564 | u8 pp_sel; |
| 565 | u8 intf_sel; |
| 566 | struct sde_splash_lm_hw lm[LM_MAX - LM_0]; |
| 567 | u8 ctl_lm_cnt; |
| 568 | }; |
| 569 | |
| 570 | /** |
| 571 | * struct sde_splash_data - Struct contains details of continuous splash |
Chandan Uddaraju | 9bb109a | 2017-10-29 18:08:51 -0700 | [diff] [blame] | 572 | * memory region and initial pipeline configuration. |
| 573 | * @smmu_handoff_pending:boolean to notify handoff from splash memory to smmu |
| 574 | * @splash_base: Base address of continuous splash region reserved |
| 575 | * by bootloader |
| 576 | * @splash_size: Size of continuous splash region |
Shashank Babu Chinta Venkata | 5d641d4 | 2017-09-29 12:16:28 -0700 | [diff] [blame] | 577 | * @top: struct ctl_top objects |
| 578 | * @ctl_ids: stores the valid MDSS ctl block ids for the current mode |
| 579 | * @lm_ids: stores the valid MDSS layer mixer block ids for the current mode |
| 580 | * @dsc_ids: stores the valid MDSS DSC block ids for the current mode |
| 581 | * @ctl_top_cnt:stores the active number of MDSS "top" blks of the current mode |
| 582 | * @lm_cnt: stores the active number of MDSS "LM" blks for the current mode |
| 583 | * @dsc_cnt: stores the active number of MDSS "dsc" blks for the current mode |
| 584 | */ |
| 585 | struct sde_splash_data { |
Chandan Uddaraju | 9bb109a | 2017-10-29 18:08:51 -0700 | [diff] [blame] | 586 | bool smmu_handoff_pending; |
| 587 | unsigned long splash_base; |
| 588 | u32 splash_size; |
Shashank Babu Chinta Venkata | 5d641d4 | 2017-09-29 12:16:28 -0700 | [diff] [blame] | 589 | struct ctl_top top[CTL_MAX - CTL_0]; |
| 590 | u8 ctl_ids[CTL_MAX - CTL_0]; |
| 591 | u8 lm_ids[LM_MAX - LM_0]; |
| 592 | u8 dsc_ids[DSC_MAX - DSC_0]; |
| 593 | u8 ctl_top_cnt; |
| 594 | u8 lm_cnt; |
| 595 | u8 dsc_cnt; |
| 596 | }; |
| 597 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 598 | #endif /* _SDE_HW_MDSS_H */ |