sunxi_display2.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971
  1. /*
  2. * Allwinner SoCs display driver.
  3. *
  4. * Copyright (C) 2016 Allwinner.
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #ifndef __SUNXI_DISPLAY2_H__
  11. #define __SUNXI_DISPLAY2_H__
  12. #include <typedef.h>
  13. #include <stdbool.h>
  14. struct disp_manager;
  15. struct disp_device;
  16. struct disp_smbl;
  17. struct disp_enhance;
  18. struct disp_capture;
  19. struct disp_color {
  20. unsigned char alpha;
  21. unsigned char red;
  22. unsigned char green;
  23. unsigned char blue;
  24. };
  25. struct disp_rect {
  26. int x;
  27. int y;
  28. unsigned int width;
  29. unsigned int height;
  30. };
  31. struct disp_rectsz {
  32. unsigned int width;
  33. unsigned int height;
  34. };
  35. struct disp_position {
  36. int x;
  37. int y;
  38. };
  39. typedef enum disp_pixel_format {
  40. DISP_FORMAT_ARGB_8888 = 0x00, /* MSB A-R-G-B LSB */
  41. DISP_FORMAT_ABGR_8888 = 0x01,
  42. DISP_FORMAT_RGBA_8888 = 0x02,
  43. DISP_FORMAT_BGRA_8888 = 0x03,
  44. DISP_FORMAT_XRGB_8888 = 0x04,
  45. DISP_FORMAT_XBGR_8888 = 0x05,
  46. DISP_FORMAT_RGBX_8888 = 0x06,
  47. DISP_FORMAT_BGRX_8888 = 0x07,
  48. DISP_FORMAT_RGB_888 = 0x08,
  49. DISP_FORMAT_BGR_888 = 0x09,
  50. DISP_FORMAT_RGB_565 = 0x0a,
  51. DISP_FORMAT_BGR_565 = 0x0b,
  52. DISP_FORMAT_ARGB_4444 = 0x0c,
  53. DISP_FORMAT_ABGR_4444 = 0x0d,
  54. DISP_FORMAT_RGBA_4444 = 0x0e,
  55. DISP_FORMAT_BGRA_4444 = 0x0f,
  56. DISP_FORMAT_ARGB_1555 = 0x10,
  57. DISP_FORMAT_ABGR_1555 = 0x11,
  58. DISP_FORMAT_RGBA_5551 = 0x12,
  59. DISP_FORMAT_BGRA_5551 = 0x13,
  60. DISP_FORMAT_A2R10G10B10 = 0x14,
  61. DISP_FORMAT_A2B10G10R10 = 0x15,
  62. DISP_FORMAT_R10G10B10A2 = 0x16,
  63. DISP_FORMAT_B10G10R10A2 = 0x17,
  64. DISP_FORMAT_1bpp_palette_LE = 0x18,
  65. DISP_FORMAT_2bpp_palette_LE = 0x19,
  66. DISP_FORMAT_4bpp_palette_LE = 0x1a,
  67. DISP_FORMAT_8bpp_palette_LE = 0x1b,
  68. /*
  69. * SP: semi-planar
  70. * P:planar
  71. * I:interleaved
  72. * UVUV: U in the LSBs;
  73. * VUVU: V in the LSBs
  74. */
  75. DISP_FORMAT_YUV444_I_AYUV = 0x40, /* MSB A-Y-U-V LSB */
  76. DISP_FORMAT_YUV444_I_VUYA = 0x41, /* MSB V-U-Y-A LSB */
  77. DISP_FORMAT_YUV422_I_YVYU = 0x42, /* MSB Y-V-Y-U LSB */
  78. DISP_FORMAT_YUV422_I_YUYV = 0x43, /* MSB Y-U-Y-V LSB */
  79. DISP_FORMAT_YUV422_I_UYVY = 0x44, /* MSB U-Y-V-Y LSB */
  80. DISP_FORMAT_YUV422_I_VYUY = 0x45, /* MSB V-Y-U-Y LSB */
  81. DISP_FORMAT_YUV444_P = 0x46, /* MSB P3-2-1-0 LSB, YYYY UUUU VVVV */
  82. DISP_FORMAT_YUV422_P = 0x47, /* MSB P3-2-1-0 LSB YYYY UU VV */
  83. DISP_FORMAT_YUV420_P = 0x48, /* MSB P3-2-1-0 LSB YYYY U V (yu12)*/
  84. DISP_FORMAT_YUV411_P = 0x49, /* MSB P3-2-1-0 LSB YYYY U V */
  85. DISP_FORMAT_YUV422_SP_UVUV = 0x4a, /* MSB V-U-V-U LSB */
  86. DISP_FORMAT_YUV422_SP_VUVU = 0x4b, /* MSB U-V-U-V LSB */
  87. DISP_FORMAT_YUV420_SP_UVUV = 0x4c,
  88. DISP_FORMAT_YUV420_SP_VUVU = 0x4d,
  89. DISP_FORMAT_YUV411_SP_UVUV = 0x4e,
  90. DISP_FORMAT_YUV411_SP_VUVU = 0x4f,
  91. DISP_FORMAT_8BIT_GRAY = 0x50,
  92. DISP_FORMAT_YUV444_I_AYUV_10BIT = 0x51,
  93. DISP_FORMAT_YUV444_I_VUYA_10BIT = 0x52,
  94. DISP_FORMAT_YUV422_I_YVYU_10BIT = 0x53,
  95. DISP_FORMAT_YUV422_I_YUYV_10BIT = 0x54,
  96. DISP_FORMAT_YUV422_I_UYVY_10BIT = 0x55,
  97. DISP_FORMAT_YUV422_I_VYUY_10BIT = 0x56,
  98. DISP_FORMAT_YUV444_P_10BIT = 0x57,
  99. DISP_FORMAT_YUV422_P_10BIT = 0x58,
  100. DISP_FORMAT_YUV420_P_10BIT = 0x59,
  101. DISP_FORMAT_YUV411_P_10BIT = 0x5a,
  102. DISP_FORMAT_YUV422_SP_UVUV_10BIT = 0x5b,
  103. DISP_FORMAT_YUV422_SP_VUVU_10BIT = 0x5c,
  104. DISP_FORMAT_YUV420_SP_UVUV_10BIT = 0x5d,
  105. DISP_FORMAT_YUV420_SP_VUVU_10BIT = 0x5e,
  106. DISP_FORMAT_YUV411_SP_UVUV_10BIT = 0x5f,
  107. DISP_FORMAT_YUV411_SP_VUVU_10BIT = 0x60,
  108. DISP_FORMAT_YUV420_P_YV12 = 0x61, /* MSB P3-2-1-0 LSB YYYY V U DISP_FORMAT_YUV420_P */
  109. DISP_FORMAT_YUV420_P_YU12 = 0x62, /* MSB P3-2-1-0 LSB YYYY U V DISP_FORMAT_YUV420_P*/
  110. DISP_FORMAT_CSIRGB,
  111. DISP_UNKNOWN_VALUE,
  112. DISP_FORMAT_MAX,
  113. }__disp_pixel_fmt_t;
  114. enum disp_3d_out_mode {
  115. DISP_3D_OUT_MODE_CI_1 = 0x5, /* column interlaved 1 */
  116. DISP_3D_OUT_MODE_CI_2 = 0x6, /* column interlaved 2 */
  117. DISP_3D_OUT_MODE_CI_3 = 0x7, /* column interlaved 3 */
  118. DISP_3D_OUT_MODE_CI_4 = 0x8, /* column interlaved 4 */
  119. DISP_3D_OUT_MODE_LIRGB = 0x9, /* line interleaved rgb */
  120. DISP_3D_OUT_MODE_TB = 0x0, /* top bottom */
  121. DISP_3D_OUT_MODE_FP = 0x1, /* frame packing */
  122. DISP_3D_OUT_MODE_SSF = 0x2, /* side by side full */
  123. DISP_3D_OUT_MODE_SSH = 0x3, /* side by side half */
  124. DISP_3D_OUT_MODE_LI = 0x4, /* line interleaved */
  125. DISP_3D_OUT_MODE_FA = 0xa, /* field alternative */
  126. };
  127. enum disp_color_space {
  128. DISP_UNDEF = 0x00,
  129. DISP_UNDEF_F = 0x01,
  130. DISP_GBR = 0x100,
  131. DISP_BT709 = 0x101,
  132. DISP_FCC = 0x102,
  133. DISP_BT470BG = 0x103,
  134. DISP_BT601 = 0x104,
  135. DISP_SMPTE240M = 0x105,
  136. DISP_YCGCO = 0x106,
  137. DISP_BT2020NC = 0x107,
  138. DISP_BT2020C = 0x108,
  139. DISP_GBR_F = 0x200,
  140. DISP_BT709_F = 0x201,
  141. DISP_FCC_F = 0x202,
  142. DISP_BT470BG_F = 0x203,
  143. DISP_BT601_F = 0x204,
  144. DISP_SMPTE240M_F = 0x205,
  145. DISP_YCGCO_F = 0x206,
  146. DISP_BT2020NC_F = 0x207,
  147. DISP_BT2020C_F = 0x208,
  148. DISP_RESERVED = 0x300,
  149. DISP_RESERVED_F = 0x301,
  150. };
  151. typedef enum disp_color_space __disp_cs_mode_t;
  152. enum disp_csc_type {
  153. DISP_CSC_TYPE_RGB = 0,
  154. DISP_CSC_TYPE_YUV444 = 1,
  155. DISP_CSC_TYPE_YUV422 = 2,
  156. DISP_CSC_TYPE_YUV420 = 3,
  157. };
  158. enum disp_data_bits {
  159. DISP_DATA_8BITS = 0,
  160. DISP_DATA_10BITS = 1,
  161. DISP_DATA_12BITS = 2,
  162. DISP_DATA_16BITS = 3,
  163. };
  164. enum disp_dvi_hdmi {
  165. DISP_DVI_HDMI_UNDEFINED = 0,
  166. DISP_DVI = 1,
  167. DISP_HDMI = 2,
  168. };
  169. enum disp_scan_info {
  170. DISP_SCANINFO_NO_DATA = 0,
  171. OVERSCAN = 1,
  172. UNDERSCAN = 2,
  173. };
  174. enum disp_color_range {
  175. DISP_COLOR_RANGE_DEFAULT = 0, /*default*/
  176. DISP_COLOR_RANGE_0_255 = 1,
  177. DISP_COLOR_RANGE_16_235 = 2,
  178. };
  179. enum disp_output_type {
  180. DISP_OUTPUT_TYPE_NONE = 0,
  181. DISP_OUTPUT_TYPE_LCD = 1,
  182. DISP_OUTPUT_TYPE_TV = 2,
  183. DISP_OUTPUT_TYPE_HDMI = 4,
  184. DISP_OUTPUT_TYPE_VGA = 8,
  185. DISP_OUTPUT_TYPE_VDPO = 16,
  186. DISP_OUTPUT_TYPE_EDP = 32, /*16 for vdpo*/
  187. };
  188. enum disp_tv_mode {
  189. DISP_TV_MOD_480I = 0,
  190. DISP_TV_MOD_576I = 1,
  191. DISP_TV_MOD_480P = 2,
  192. DISP_TV_MOD_576P = 3,
  193. DISP_TV_MOD_720P_50HZ = 4,
  194. DISP_TV_MOD_720P_60HZ = 5,
  195. DISP_TV_MOD_1080I_50HZ = 6,
  196. DISP_TV_MOD_1080I_60HZ = 7,
  197. DISP_TV_MOD_1080P_24HZ = 8,
  198. DISP_TV_MOD_1080P_50HZ = 9,
  199. DISP_TV_MOD_1080P_60HZ = 0xa,
  200. DISP_TV_MOD_1080P_24HZ_3D_FP = 0x17,
  201. DISP_TV_MOD_720P_50HZ_3D_FP = 0x18,
  202. DISP_TV_MOD_720P_60HZ_3D_FP = 0x19,
  203. DISP_TV_MOD_1080P_25HZ = 0x1a,
  204. DISP_TV_MOD_1080P_30HZ = 0x1b,
  205. DISP_TV_MOD_PAL = 0xb,
  206. DISP_TV_MOD_PAL_SVIDEO = 0xc,
  207. DISP_TV_MOD_NTSC = 0xe,
  208. DISP_TV_MOD_NTSC_SVIDEO = 0xf,
  209. DISP_TV_MOD_PAL_M = 0x11,
  210. DISP_TV_MOD_PAL_M_SVIDEO = 0x12,
  211. DISP_TV_MOD_PAL_NC = 0x14,
  212. DISP_TV_MOD_PAL_NC_SVIDEO = 0x15,
  213. DISP_TV_MOD_3840_2160P_30HZ = 0x1c,
  214. DISP_TV_MOD_3840_2160P_25HZ = 0x1d,
  215. DISP_TV_MOD_3840_2160P_24HZ = 0x1e,
  216. DISP_TV_MOD_4096_2160P_24HZ = 0x1f,
  217. DISP_TV_MOD_4096_2160P_25HZ = 0x20,
  218. DISP_TV_MOD_4096_2160P_30HZ = 0x21,
  219. DISP_TV_MOD_3840_2160P_60HZ = 0x22,
  220. DISP_TV_MOD_4096_2160P_60HZ = 0x23,
  221. DISP_TV_MOD_3840_2160P_50HZ = 0x24,
  222. DISP_TV_MOD_4096_2160P_50HZ = 0x25,
  223. DISP_TV_MOD_2560_1440P_60HZ = 0x26,
  224. DISP_TV_MOD_1440_2560P_70HZ = 0x27,
  225. DISP_TV_MOD_1080_1920P_60HZ = 0x28,
  226. DISP_TV_MOD_1280_1024P_60HZ = 0x41,
  227. DISP_TV_MOD_1024_768P_60HZ = 0x42,
  228. DISP_TV_MOD_900_540P_60HZ = 0x43,
  229. DISP_TV_MOD_1920_720P_60HZ = 0x44,
  230. /* vga */
  231. DISP_VGA_MOD_640_480P_60 = 0x50,
  232. DISP_VGA_MOD_800_600P_60 = 0x51,
  233. DISP_VGA_MOD_1024_768P_60 = 0x52,
  234. DISP_VGA_MOD_1280_768P_60 = 0x53,
  235. DISP_VGA_MOD_1280_800P_60 = 0x54,
  236. DISP_VGA_MOD_1366_768P_60 = 0x55,
  237. DISP_VGA_MOD_1440_900P_60 = 0x56,
  238. DISP_VGA_MOD_1920_1080P_60 = 0x57,
  239. DISP_VGA_MOD_1920_1200P_60 = 0x58,
  240. DISP_TV_MOD_3840_1080P_30 = 0x59,
  241. DISP_VGA_MOD_1280_720P_60 = 0x5a,
  242. DISP_VGA_MOD_1600_900P_60 = 0x5b,
  243. DISP_VGA_MOD_MAX_NUM = 0x5c,
  244. DISP_TV_MODE_NUM,
  245. };
  246. enum disp_exit_mode {
  247. DISP_EXIT_MODE_CLEAN_ALL = 0,
  248. DISP_EXIT_MODE_CLEAN_PARTLY = 1, /* only clean interrupt temply */
  249. };
  250. enum disp_buffer_flags {
  251. DISP_BF_NORMAL = 0, /* non-stereo */
  252. DISP_BF_STEREO_TB = 1 << 0, /* stereo top-bottom */
  253. DISP_BF_STEREO_FP = 1 << 1, /* stereo frame packing */
  254. DISP_BF_STEREO_SSH = 1 << 2, /* stereo side by side half */
  255. DISP_BF_STEREO_SSF = 1 << 3, /* stereo side by side full */
  256. DISP_BF_STEREO_LI = 1 << 4, /* stereo line interlace */
  257. /*
  258. * 2d plus depth to convert into 3d,
  259. * left and right image using the same frame buffer
  260. */
  261. DISP_BF_STEREO_2D_DEPTH = 1 << 5,
  262. };
  263. enum disp_layer_mode {
  264. LAYER_MODE_BUFFER = 0,
  265. LAYER_MODE_COLOR = 1,
  266. };
  267. enum disp_scan_flags {
  268. DISP_SCAN_PROGRESSIVE = 0,
  269. DISP_SCAN_INTERLACED_ODD_FLD_FIRST = 1 << 0,
  270. DISP_SCAN_INTERLACED_EVEN_FLD_FIRST = 1 << 1,
  271. };
  272. enum disp_eotf {
  273. DISP_EOTF_RESERVED = 0x000,
  274. DISP_EOTF_BT709 = 0x001,
  275. DISP_EOTF_UNDEF = 0x002,
  276. DISP_EOTF_GAMMA22 = 0x004, /* SDR */
  277. DISP_EOTF_GAMMA28 = 0x005,
  278. DISP_EOTF_BT601 = 0x006,
  279. DISP_EOTF_SMPTE240M = 0x007,
  280. DISP_EOTF_LINEAR = 0x008,
  281. DISP_EOTF_LOG100 = 0x009,
  282. DISP_EOTF_LOG100S10 = 0x00a,
  283. DISP_EOTF_IEC61966_2_4 = 0x00b,
  284. DISP_EOTF_BT1361 = 0x00c,
  285. DISP_EOTF_IEC61966_2_1 = 0X00d,
  286. DISP_EOTF_BT2020_0 = 0x00e,
  287. DISP_EOTF_BT2020_1 = 0x00f,
  288. DISP_EOTF_SMPTE2084 = 0x010, /* HDR10 */
  289. DISP_EOTF_SMPTE428_1 = 0x011,
  290. DISP_EOTF_ARIB_STD_B67 = 0x012, /* HLG */
  291. };
  292. /* disp_atw_mode - mode for asynchronous time warp
  293. *
  294. * @NORMAL_MODE: dual buffer, left eye and right eye buffer is individual
  295. * @LEFT_RIGHT_MODE: single buffer, the left half of each line buffer
  296. * is for left eye, the right half is for the right eye
  297. * @UP_DOWN_MODE: single buffer, the first half of the total buffer
  298. * is for the left eye, the second half is for the right eye
  299. */
  300. enum disp_atw_mode {
  301. NORMAL_MODE,
  302. LEFT_RIGHT_MODE,
  303. UP_DOWN_MODE,
  304. };
  305. struct disp_output {
  306. unsigned int type;
  307. unsigned int mode;
  308. };
  309. struct disp_rect64 {
  310. long long x;
  311. long long y;
  312. long long width;
  313. long long height;
  314. };
  315. struct disp_lbc_info {
  316. unsigned int is_lossy;
  317. unsigned int rc_en;
  318. unsigned int pitch;
  319. unsigned int seg_bit;
  320. };
  321. struct disp_fb_info {
  322. /* address of frame buffer,
  323. * single addr for interleaved fomart,
  324. * double addr for semi-planar fomart
  325. * triple addr for planar format
  326. */
  327. unsigned long long addr[3];
  328. struct disp_rectsz size[3];
  329. /* align for 3 comonent,unit: bytes */
  330. unsigned int align[3];
  331. enum disp_pixel_format format;
  332. enum disp_color_space color_space; /* color space */
  333. unsigned int trd_right_addr[3]; /* right address of 3d fb */
  334. bool pre_multiply; /* true: pre-multiply fb */
  335. struct disp_rect64 crop; /* crop rectangle boundaries */
  336. enum disp_buffer_flags flags;
  337. enum disp_scan_flags scan;
  338. unsigned int lbc_en;
  339. struct disp_lbc_info lbc_info;
  340. };
  341. struct disp_layer_info {
  342. enum disp_layer_mode mode;
  343. unsigned char zorder;
  344. /* 0: pixel alpha; 1: global alpha; 2: global pixel alpha */
  345. unsigned char alpha_mode;
  346. unsigned char alpha_value; /* global alpha value */
  347. struct disp_rect screen_win; /* display window on the screen */
  348. bool b_trd_out; /* 3d display */
  349. enum disp_3d_out_mode out_trd_mode; /* 3d display mode */
  350. union {
  351. unsigned int color; /* valid when LAYER_MODE_COLOR */
  352. struct disp_fb_info fb; /* valid when LAYER_MODE_BUFFER */
  353. };
  354. unsigned int id; /* frame id, the id of frame display currently */
  355. };
  356. struct disp_layer_config {
  357. struct disp_layer_info info;
  358. bool enable;
  359. unsigned int channel;
  360. unsigned int layer_id;
  361. };
  362. /* disp_atw_info - asynchronous time wrap infomation
  363. *
  364. * @used: indicate if the atw funtion is used
  365. * @mode: atw mode
  366. * @b_row: the row number of the micro block
  367. * @b_col: the column number of the micro block
  368. * @cof_fd: dma_buf fd for the buffer contaied coefficient for atw
  369. */
  370. struct disp_atw_info {
  371. bool used;
  372. enum disp_atw_mode mode;
  373. unsigned int b_row;
  374. unsigned int b_col;
  375. int cof_fd;
  376. };
  377. /**
  378. * disp_vdpo_config
  379. */
  380. struct disp_vdpo_config {
  381. unsigned int data_seq_sel;
  382. unsigned int dclk_invt;
  383. unsigned int dclk_dly_num;
  384. unsigned int spl_type_u;
  385. unsigned int spl_type_v;
  386. };
  387. /* disp_fb_info2 - image buffer info v2
  388. *
  389. * @fd: dma_buf fd for frame buffer
  390. * @size: size<width,height> for each buffer, unit:pixels
  391. * @align: align for each buffer, unit:bytes
  392. * @format: pixel format
  393. * @color_space: color space
  394. * @trd_right_fd: dma_buf fd for the right-eye frame buffer,
  395. * valid when frame-packing 3d buffer input
  396. * @pre_multiply: indicate the pixel use premultiplied alpha
  397. * @crop: crop rectangle for buffer to be display
  398. * @flag: indicate stereo/non-stereo buffer
  399. * @scan: indicate interleave/progressive scan type, and the scan order
  400. * @depth: depth perception for stereo image, only valid when stereo image input
  401. * unit: pixel
  402. * @fbd_en: indicate if enable fbd function
  403. * @lbc_en: indicate if enable lbc function
  404. * @metadata_fd: dma_buf fd for the buffer contained metadata for fbc/hdr
  405. * @metadata_size: the size of metadata buffer, unit:bytes
  406. * @metadata_flag: the flag to indicate the type of metadata buffer
  407. * 0 : no metadata
  408. * 1 << 0: hdr static metadata
  409. * 1 << 1: hdr dynamic metadata
  410. * 1 << 4: frame buffer compress(fbc) metadata
  411. * x : all type could be "or" together
  412. */
  413. struct disp_fb_info2 {
  414. int fd;
  415. struct disp_rectsz size[3];
  416. unsigned int align[3];
  417. enum disp_pixel_format format;
  418. enum disp_color_space color_space;
  419. int trd_right_fd;
  420. bool pre_multiply;
  421. struct disp_rect64 crop;
  422. enum disp_buffer_flags flags;
  423. enum disp_scan_flags scan;
  424. enum disp_eotf eotf;
  425. int depth;
  426. unsigned int fbd_en;
  427. unsigned int lbc_en;
  428. struct disp_lbc_info lbc_info;
  429. int metadata_fd;
  430. unsigned int metadata_size;
  431. unsigned int metadata_flag;
  432. };
  433. /* disp_layer_info2 - layer info v2
  434. *
  435. * @mode: buffer/clolor mode, when in color mode, the layer is widthout buffer
  436. * @zorder: the zorder of layer, 0~max-layer-number
  437. * @alpha_mode:
  438. * 0: pixel alpha;
  439. * 1: global alpha
  440. * 2: mixed alpha, compositing width pixel alpha before global alpha
  441. * @alpha_value: global alpha value, valid when alpha_mode is not pixel alpha
  442. * @screen_win: the rectangle on the screen for fb to be display
  443. * @b_trd_out: indicate if 3d display output
  444. * @out_trd_mode: 3d output mode, valid when b_trd_out is true
  445. * @color: the color value to be display, valid when layer is in color mode
  446. * @fb: the framebuffer info related width the layer, valid when in buffer mode
  447. * @id: frame id, the user could get the frame-id display currently by
  448. * DISP_LAYER_GET_FRAME_ID ioctl
  449. * @atw: asynchronous time wrap information
  450. */
  451. struct disp_layer_info2 {
  452. enum disp_layer_mode mode;
  453. unsigned char zorder;
  454. unsigned char alpha_mode;
  455. unsigned char alpha_value;
  456. struct disp_rect screen_win;
  457. bool b_trd_out;
  458. enum disp_3d_out_mode out_trd_mode;
  459. union {
  460. unsigned int color;
  461. struct disp_fb_info2 fb;
  462. };
  463. unsigned int id;
  464. struct disp_atw_info atw;
  465. };
  466. /* disp_layer_config2 - layer config v2
  467. *
  468. * @info: layer info
  469. * @enable: indicate to enable/disable the layer
  470. * @channel: the channel index of the layer, 0~max-channel-number
  471. * @layer_id: the layer index of the layer widthin it's channel
  472. */
  473. struct disp_layer_config2 {
  474. struct disp_layer_info2 info;
  475. bool enable;
  476. unsigned int channel;
  477. unsigned int layer_id;
  478. };
  479. /* disp_palette_config - palette config
  480. *
  481. * @num: the num of palette
  482. * @data: the palette data, each palette data takes 4 bytes,show as below
  483. * bits description
  484. * 31:24 alpha value
  485. * 23:16 red value
  486. * 15:8 green value
  487. * 7:0 blue value
  488. * @channel: the channel index of the layer, 0~max-channel-number
  489. */
  490. struct disp_palette_config {
  491. unsigned int num;
  492. void *data;
  493. unsigned int channel;
  494. };
  495. /**
  496. * match rule: 0/1:always match;
  497. * 2:match if min<=color<=max;
  498. * 3:match if color>max or color<min
  499. */
  500. struct disp_colorkey {
  501. struct disp_color ck_max;
  502. struct disp_color ck_min;
  503. unsigned int red_match_rule;
  504. unsigned int green_match_rule;
  505. unsigned int blue_match_rule;
  506. };
  507. struct disp_s_frame {
  508. enum disp_pixel_format format;
  509. struct disp_rectsz size[3];
  510. struct disp_rect crop;
  511. unsigned long long addr[3];
  512. };
  513. struct disp_capture_info {
  514. /* capture the whole screen if window eq ZERO */
  515. struct disp_rect window;
  516. struct disp_s_frame out_frame;
  517. };
  518. /* disp_s_frame2 - display simple frame buffer
  519. *
  520. * @format: pixel format of fb
  521. * @size: size for each plane
  522. * @crop: crop zone to be fill image data
  523. * @fd: dma_buf fd
  524. */
  525. struct disp_s_frame2 {
  526. enum disp_pixel_format format;
  527. struct disp_rectsz size[3];
  528. struct disp_rect crop;
  529. int fd;
  530. };
  531. /* disp_capture_info2 - display capture information
  532. *
  533. * @window: the rectange on the screen to be capture
  534. * @out_frame: the framebuffer to be restore capture image data
  535. */
  536. struct disp_capture_info2 {
  537. struct disp_rect window;
  538. struct disp_s_frame2 out_frame;
  539. };
  540. struct disp_capture_fmt {
  541. enum disp_pixel_format format; /* write-back ouput format, doson't support YUV ouput yet */
  542. struct disp_rect window; /* source crop */
  543. struct disp_rect crop; /* output crop */
  544. };
  545. struct disp_capture_buffer {
  546. int handle; /* Unique integer id represent this buffer */
  547. enum disp_pixel_format format; /* write-back ouput format */
  548. struct disp_rect window; /* source crop */
  549. struct disp_rect crop; /* output crop */
  550. struct disp_rectsz size[3];
  551. int fd;
  552. int width; /* buffer width in pixels */
  553. int height; /* buffer height in pixels */
  554. };
  555. struct disp_capture_handle {
  556. int handle; /* unique integer id represent a capture buffer */
  557. int fencefd; /* fence fd for this buffer */
  558. };
  559. enum disp_capture_extend_cmd {
  560. DISP_CAPTURE_E_SET_FMT,
  561. DISP_CAPTURE_E_BUFFER_LIST_INIT,
  562. DISP_CAPTURE_E_BUFFER_LIST_CLEAR,
  563. DISP_CAPTURE_E_ACQUIRE_BUFFER,
  564. DISP_CAPTURE_E_RELEASE_BUFFER,
  565. DISP_CAPTURE_E_CTRL,
  566. };
  567. /* disp_device_config - display deivce config
  568. *
  569. * @type: output type
  570. * @mode: output mode
  571. * @format: data format
  572. * @bits: data bits
  573. * @eotf: electro-optical transfer function
  574. * SDR : DISP_EOTF_GAMMA22
  575. * HDR10: DISP_EOTF_SMPTE2084
  576. * HLG : DISP_EOTF_ARIB_STD_B67
  577. * @cs: color space type
  578. * DISP_BT601: SDR for SD resolution(< 720P)
  579. * DISP_BT709: SDR for HD resolution(>= 720P)
  580. * DISP_BT2020NC: HDR10 or HLG or wide-color-gamut
  581. * @dvi_hdmi: output mode
  582. * DVI: DISP_DVI
  583. * HDMI: DISP_HDMI
  584. * @range: RGB/YUV quantization range
  585. * DEFUALT: limited range when sending a CE video format
  586. * full range when sending an IT video format
  587. * LIMITED: color limited range from 16 to 235
  588. * FULL: color full range from 0 to 255
  589. * @scan info:
  590. * DISP_SCANINFO_NO_DATA: overscan if it is a CE format,
  591. * underscan if it is an IT format
  592. * OVERSCAN: composed for overscan display
  593. * UNDERSCAN: composed for underscan display
  594. * @aspect_ratio: active format aspect ratio
  595. */
  596. struct disp_device_config {
  597. enum disp_output_type type;
  598. enum disp_tv_mode mode;
  599. enum disp_csc_type format;
  600. enum disp_data_bits bits;
  601. enum disp_eotf eotf;
  602. enum disp_color_space cs;
  603. enum disp_dvi_hdmi dvi_hdmi;
  604. enum disp_color_range range;
  605. enum disp_scan_info scan;
  606. unsigned int aspect_ratio;
  607. unsigned int reserve1;
  608. };
  609. /* disp_device_dynamic_config - display deivce dynamic config
  610. *
  611. * @metadata_fd: dma_buf fd for the buffer contained metadata for fbc/hdr
  612. * @metadata_size: the size of metadata buffer, unit:bytes
  613. * @metadata_flag: the flag to indicate the type of metadata buffer
  614. * 0 : no metadata
  615. * 1 << 0: hdr static metadata
  616. * 1 << 1: hdr dynamic metadata
  617. * 1 << 4: frame buffer compress(fbc) metadata
  618. * x : all type could be "or" together
  619. * @vmap:vmap a block contigous phys memory into virtual space
  620. * @vunmap: release virtual mapping obtained by vmap()
  621. */
  622. struct disp_device_dynamic_config {
  623. int metadata_fd;
  624. unsigned int metadata_size;
  625. unsigned int metadata_flag;
  626. void *(*vmap)(unsigned long phys_addr, unsigned long size);
  627. void (*vunmap)(const void *vaddr);
  628. };
  629. struct disp_video_timings {
  630. unsigned int vic; /* video information code */
  631. unsigned int tv_mode;
  632. unsigned int pixel_clk;
  633. unsigned int pixel_repeat; /* pixel repeat (pixel_repeat+1) times */
  634. unsigned int x_res;
  635. unsigned int y_res;
  636. unsigned int hor_total_time;
  637. unsigned int hor_back_porch;
  638. unsigned int hor_front_porch;
  639. unsigned int hor_sync_time;
  640. unsigned int ver_total_time;
  641. unsigned int ver_back_porch;
  642. unsigned int ver_front_porch;
  643. unsigned int ver_sync_time;
  644. unsigned int hor_sync_polarity; /* 0: negative, 1: positive */
  645. unsigned int ver_sync_polarity; /* 0: negative, 1: positive */
  646. bool b_interlace;
  647. unsigned int vactive_space;
  648. unsigned int trd_mode;
  649. unsigned long dclk_rate_set; /*unit: hz */
  650. unsigned long long frame_period; /* unit: ns */
  651. int start_delay; /* unit: line */
  652. };
  653. enum disp_fb_mode {
  654. FB_MODE_SCREEN0 = 0,
  655. FB_MODE_SCREEN1 = 1,
  656. FB_MODE_SCREEN2 = 2,
  657. FB_MODE_DUAL_SAME_SCREEN_TB = 3,/* two screen, top buffer for screen0, bottom buffer for screen1 */
  658. FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS = 4,/* two screen, they have same contents; */
  659. };
  660. struct disp_fb_create_info {
  661. enum disp_fb_mode fb_mode;
  662. enum disp_layer_mode mode;
  663. unsigned int buffer_num;
  664. unsigned int width;
  665. unsigned int height;
  666. unsigned int output_width; /* used when scaler mode */
  667. unsigned int output_height; /* used when scaler mode */
  668. };
  669. enum disp_init_mode {
  670. DISP_INIT_MODE_SCREEN0 = 0, /* fb0 for screen0 */
  671. DISP_INIT_MODE_SCREEN1 = 1, /* fb0 for screen1 */
  672. DISP_INIT_MODE_SCREEN2 = 2, /* fb0 for screen1 */
  673. DISP_INIT_MODE_TWO_DIFF_SCREEN = 3,/* fb0 for screen0 and fb1 for screen1 */
  674. DISP_INIT_MODE_TWO_SAME_SCREEN = 4,/* fb0(up buffer for screen0, down buffer for screen1) */
  675. DISP_INIT_MODE_TWO_DIFF_SCREEN_SAME_CONTENTS = 5,/* fb0 for two different screen(screen0 layer is normal layer, screen1 layer is scaler layer); */
  676. };
  677. struct disp_tv_func {
  678. int (*tv_enable)(u32 sel);
  679. int (*tv_disable)(u32 sel);
  680. int (*tv_suspend)(u32 sel);
  681. int (*tv_resume)(u32 sel);
  682. int (*tv_get_mode)(u32 sel);
  683. int (*tv_set_mode)(u32 sel, enum disp_tv_mode tv_mod);
  684. int (*tv_get_input_csc)(u32 sel);
  685. int (*tv_get_video_timing_info)(u32 sel,
  686. struct disp_video_timings **
  687. video_info);
  688. int (*tv_mode_support)(u32 sel, enum disp_tv_mode mode);
  689. int (*tv_hot_plugging_detect)(u32 state);
  690. int (*tv_set_enhance_mode)(u32 sel, u32 mode);
  691. int (*tv_irq_enable)(u32 sel, u32 irq_id, u32 en);
  692. int (*tv_irq_query)(u32 sel);
  693. unsigned int (*tv_get_cur_line)(u32 sel);
  694. int (*vdpo_set_config)(u32 sel, struct disp_vdpo_config *p_cfg);
  695. int (*tv_get_startdelay)(u32 sel);
  696. void (*tv_show_builtin_patten)(u32 sel, u32 patten);
  697. };
  698. /* disp_vdevice_interface_para - vdevice interaface parameter
  699. *
  700. * @intf:interface
  701. * 0:hv, 1:cpu, 3:lvds, 4:dsi
  702. * @sub_intf: sub interface
  703. * rgb interface: 0:parallel hv, 8:serial hv, 10:dummy rgb
  704. * 11: rgb dummy, 12: ccir656
  705. * cpu interface: 0:18 pin, 10:9pin, 12:6pin, 8:16pin, 14:8pin
  706. * lvds interface:0:single link, 1:dual link
  707. * dsi inerafce: 0:video mode, 1:command mode, 2: video burst mode
  708. * @sequence:output sequence
  709. * rgb output: 0:rgb rgb, 1:rgb brg, 2:rgb gbr, 4:brg rgb
  710. * 5:brg brg, 6:brg gbr
  711. * 8:grb rgb, 9:grb brg, 10:grb gbr
  712. * yuv output:0:yuyv, 1: yvyu, 2:uyvy, 3:vyuy
  713. * @fdelay:yuv eav/sav F line delay
  714. * 0: F toggle right after active video line
  715. * 1: delay 2 line(CCIR NTSC)
  716. * 2: delay 3 line(CCIR PAL)
  717. * @clk_phase:clk phase
  718. * 0: 0 degree, 1:90 degree, 2: 180 degree, 3:270 degree
  719. * @sync_polarity:sync signals polarity
  720. * 0: vsync active low,hsync active low
  721. * 1: vsync active high,hsync active low
  722. * 2: vsync active low,hsync active high
  723. * 3: vsync active high,hsync active high
  724. */
  725. struct disp_vdevice_interface_para {
  726. unsigned int intf;
  727. unsigned int sub_intf;
  728. unsigned int sequence;
  729. unsigned int fdelay;
  730. unsigned int clk_phase;
  731. unsigned int sync_polarity;
  732. unsigned int ccir_clk_div;
  733. unsigned int input_csc;/*not need to config for user*/
  734. };
  735. struct disp_vdevice_source_ops {
  736. int (*tcon_enable)(struct disp_device *dispdev);
  737. int (*tcon_disable)(struct disp_device *dispdev);
  738. int (*tcon_simple_enable)(struct disp_device *dispdev);
  739. int (*tcon_simple_disable)(struct disp_device *dispdev);
  740. };
  741. struct disp_device_func {
  742. int (*enable)(void);
  743. int (*smooth_enable)(void);
  744. int (*disable)(void);
  745. int (*set_mode)(u32 mode);
  746. int (*mode_support)(u32 mode);
  747. int (*get_HPD_status)(void);
  748. int (*get_input_csc)(void);
  749. int (*get_input_color_range)(void);
  750. int (*get_video_timing_info)(struct disp_video_timings **video_info);
  751. int (*suspend)(void);
  752. int (*resume)(void);
  753. int (*early_suspend)(void);
  754. int (*late_resume)(void);
  755. int (*get_interface_para)(void *para);
  756. int (*set_static_config)(struct disp_device_config *config);
  757. int (*get_static_config)(struct disp_device_config *config);
  758. int (*set_dynamic_config)(struct disp_device_dynamic_config *config);
  759. int (*get_dynamic_config)(struct disp_device_dynamic_config *config);
  760. /*for hdmi cec*/
  761. s32 (*cec_standby_request)(void);
  762. s32 (*cec_send_one_touch_play)(void);
  763. };
  764. struct disp_vdevice_init_data {
  765. char name[32];
  766. u32 disp;
  767. u32 fix_timing;
  768. enum disp_output_type type;
  769. struct disp_device_func func;
  770. };
  771. enum disp_tv_dac_source {
  772. DISP_TV_DAC_SRC_COMPOSITE = 0,
  773. DISP_TV_DAC_SRC_LUMA = 1,
  774. DISP_TV_DAC_SRC_CHROMA = 2,
  775. DISP_TV_DAC_SRC_Y = 4,
  776. DISP_TV_DAC_SRC_PB = 5,
  777. DISP_TV_DAC_SRC_PR = 6,
  778. DISP_TV_DAC_SRC_NONE = 7,
  779. };
  780. enum disp_tv_output {
  781. DISP_TV_NONE = 0,
  782. DISP_TV_CVBS = 1,
  783. DISP_TV_YPBPR = 2,
  784. DISP_TV_SVIDEO = 4,
  785. DISP_VGA = 5,
  786. };
  787. enum tag_DISP_CMD {
  788. /* ----disp global---- */
  789. DISP_SYS_SHOW = 0x00,
  790. DISP_RESERVE1 = 0x01,
  791. DISP_SET_BKCOLOR = 0x03,
  792. DISP_GET_BKCOLOR = 0x04,
  793. DISP_SET_COLORKEY = 0x05,
  794. DISP_GET_COLORKEY = 0x06,
  795. DISP_GET_SCN_WIDTH = 0x07,
  796. DISP_GET_SCN_HEIGHT = 0x08,
  797. DISP_GET_OUTPUT_TYPE = 0x09,
  798. DISP_SET_EXIT_MODE = 0x0A,
  799. DISP_VSYNC_EVENT_EN = 0x0B,
  800. DISP_BLANK = 0x0C,
  801. DISP_SHADOW_PROTECT = 0x0D,
  802. DISP_HWC_COMMIT = 0x0E,
  803. DISP_DEVICE_SWITCH = 0x0F,
  804. DISP_GET_OUTPUT = 0x10,
  805. DISP_SET_COLOR_RANGE = 0x11,
  806. DISP_GET_COLOR_RANGE = 0x12,
  807. DISP_HWC_CUSTOM = 0x13,
  808. DISP_DEVICE_SET_CONFIG = 0x14,
  809. DISP_DEVICE_GET_CONFIG = 0x15,
  810. /* ----layer---- */
  811. DISP_LAYER_ENABLE = 0x40,
  812. DISP_LAYER_DISABLE = 0x41,
  813. DISP_LAYER_SET_INFO = 0x42,
  814. DISP_LAYER_GET_INFO = 0x43,
  815. DISP_LAYER_TOP = 0x44,
  816. DISP_LAYER_BOTTOM = 0x45,
  817. DISP_LAYER_GET_FRAME_ID = 0x46,
  818. DISP_LAYER_SET_CONFIG = 0x47,
  819. DISP_LAYER_GET_CONFIG = 0x48,
  820. /*
  821. * LAYER_S(G)ET_CONFIG2 takes disp_layer_config2,
  822. * it will support more featuras
  823. */
  824. DISP_LAYER_SET_CONFIG2 = 0x49,
  825. DISP_LAYER_GET_CONFIG2 = 0x4a,
  826. DISP_CHN_SET_PALETTE = 0x4b,
  827. /* ----hdmi---- */
  828. DISP_HDMI_SUPPORT_MODE = 0xc4,
  829. DISP_SET_TV_HPD = 0xc5,
  830. DISP_HDMI_GET_EDID = 0xc6,
  831. DISP_CEC_ONE_TOUCH_PLAY = 0xc7,
  832. /* ----lcd---- */
  833. DISP_LCD_ENABLE = 0x100,
  834. DISP_LCD_DISABLE = 0x101,
  835. DISP_LCD_SET_BRIGHTNESS = 0x102,
  836. DISP_LCD_GET_BRIGHTNESS = 0x103,
  837. DISP_LCD_BACKLIGHT_ENABLE = 0x104,
  838. DISP_LCD_BACKLIGHT_DISABLE = 0x105,
  839. DISP_LCD_SET_SRC = 0x106,
  840. DISP_LCD_SET_FPS = 0x107,
  841. DISP_LCD_GET_FPS = 0x108,
  842. DISP_LCD_GET_SIZE = 0x109,
  843. DISP_LCD_GET_MODEL_NAME = 0x10a,
  844. DISP_LCD_SET_GAMMA_TABLE = 0x10b,
  845. DISP_LCD_GAMMA_CORRECTION_ENABLE = 0x10c,
  846. DISP_LCD_GAMMA_CORRECTION_DISABLE = 0x10d,
  847. DISP_LCD_USER_DEFINED_FUNC = 0x10e,
  848. DISP_LCD_CHECK_OPEN_FINISH = 0x10f,
  849. DISP_LCD_CHECK_CLOSE_FINISH = 0x110,
  850. /*tv*/
  851. DISP_TV_SET_GAMMA_TABLE = 0x111,
  852. /* ---- capture --- */
  853. DISP_CAPTURE_START = 0x140,/* caputre screen and scaler to dram */
  854. DISP_CAPTURE_STOP = 0x141,
  855. DISP_CAPTURE_COMMIT = 0x142,
  856. DISP_CAPTURE_COMMIT2 = 0x143,
  857. DISP_CAPTURE_QUERY = 0x144,
  858. DISP_CAPTURE_EXTEND = 0x145,
  859. /* ---enhance --- */
  860. DISP_ENHANCE_ENABLE = 0x180,
  861. DISP_ENHANCE_DISABLE = 0x181,
  862. DISP_ENHANCE_GET_EN = 0x182,
  863. DISP_ENHANCE_SET_WINDOW = 0x183,
  864. DISP_ENHANCE_GET_WINDOW = 0x184,
  865. DISP_ENHANCE_SET_MODE = 0x185,
  866. DISP_ENHANCE_GET_MODE = 0x186,
  867. DISP_ENHANCE_DEMO_ENABLE = 0x187,
  868. DISP_ENHANCE_DEMO_DISABLE = 0x188,
  869. DISP_ENHANCE_SET_BRIGHT = 0x190,
  870. DISP_ENHANCE_GET_BRIGHT = 0x191,
  871. DISP_ENHANCE_SET_CONTRAST = 0x192,
  872. DISP_ENHANCE_GET_CONTRAST = 0x193,
  873. DISP_ENHANCE_SET_SATURATION = 0x194,
  874. DISP_ENHANCE_GET_SATURATION = 0x195,
  875. /* ---smart backlight --- */
  876. DISP_SMBL_ENABLE = 0x200,
  877. DISP_SMBL_DISABLE = 0x201,
  878. DISP_SMBL_GET_EN = 0x202,
  879. DISP_SMBL_SET_WINDOW = 0x203,
  880. DISP_SMBL_GET_WINDOW = 0x204,
  881. /* ---- for test */
  882. DISP_FB_REQUEST = 0x280,
  883. DISP_FB_RELEASE = 0x281,
  884. DISP_MEM_REQUEST = 0x2c0,
  885. DISP_MEM_RELEASE = 0x2c1,
  886. DISP_MEM_GETADR = 0x2c2,
  887. DISP_VDPO_SET_CONFIG = 0x2c3,
  888. /* --- rotation sw --- */
  889. DISP_ROTATION_SW_SET_ROT = 0x300,
  890. DISP_ROTATION_SW_GET_ROT = 0x301,
  891. DISP_EINK_UPDATE = 0x402,
  892. DISP_EINK_SET_TEMP = 0x403,
  893. DISP_EINK_GET_TEMP = 0x404,
  894. DISP_EINK_OVERLAP_SKIP = 0x405,
  895. DISP_EINK_UPDATE2 = 0x406,
  896. };
  897. enum {
  898. ROTATION_SW_0 = 0,
  899. ROTATION_SW_90 = 1,
  900. ROTATION_SW_180 = 2,
  901. ROTATION_SW_270 = 3,
  902. };
  903. #define FBIOGET_LAYER_HDL_0 0x4700
  904. #define FBIOGET_LAYER_HDL_1 0x4701
  905. #endif