exynos_drm.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. /* exynos_drm.h
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * Authors:
  5. * Inki Dae <inki.dae@samsung.com>
  6. * Joonyoung Shim <jy0922.shim@samsung.com>
  7. * Seung-Woo Kim <sw0312.kim@samsung.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  14. #ifndef _UAPI_EXYNOS_DRM_H_
  15. #define _UAPI_EXYNOS_DRM_H_
  16. #include <drm/drm.h>
  17. /**
  18. * User-desired buffer creation information structure.
  19. *
  20. * @size: user-desired memory allocation size.
  21. * - this size value would be page-aligned internally.
  22. * @flags: user request for setting memory type or cache attributes.
  23. * @handle: returned a handle to created gem object.
  24. * - this handle will be set by gem module of kernel side.
  25. */
  26. struct drm_exynos_gem_create {
  27. uint64_t size;
  28. unsigned int flags;
  29. unsigned int handle;
  30. };
  31. /**
  32. * A structure for getting buffer offset.
  33. *
  34. * @handle: a pointer to gem object created.
  35. * @pad: just padding to be 64-bit aligned.
  36. * @offset: relatived offset value of the memory region allocated.
  37. * - this value should be set by user.
  38. */
  39. struct drm_exynos_gem_map_off {
  40. unsigned int handle;
  41. unsigned int pad;
  42. uint64_t offset;
  43. };
  44. /**
  45. * A structure for mapping buffer.
  46. *
  47. * @handle: a handle to gem object created.
  48. * @pad: just padding to be 64-bit aligned.
  49. * @size: memory size to be mapped.
  50. * @mapped: having user virtual address mmaped.
  51. * - this variable would be filled by exynos gem module
  52. * of kernel side with user virtual address which is allocated
  53. * by do_mmap().
  54. */
  55. struct drm_exynos_gem_mmap {
  56. unsigned int handle;
  57. unsigned int pad;
  58. uint64_t size;
  59. uint64_t mapped;
  60. };
  61. /**
  62. * A structure to gem information.
  63. *
  64. * @handle: a handle to gem object created.
  65. * @flags: flag value including memory type and cache attribute and
  66. * this value would be set by driver.
  67. * @size: size to memory region allocated by gem and this size would
  68. * be set by driver.
  69. */
  70. struct drm_exynos_gem_info {
  71. unsigned int handle;
  72. unsigned int flags;
  73. uint64_t size;
  74. };
  75. /**
  76. * A structure for user connection request of virtual display.
  77. *
  78. * @connection: indicate whether doing connetion or not by user.
  79. * @extensions: if this value is 1 then the vidi driver would need additional
  80. * 128bytes edid data.
  81. * @edid: the edid data pointer from user side.
  82. */
  83. struct drm_exynos_vidi_connection {
  84. unsigned int connection;
  85. unsigned int extensions;
  86. uint64_t edid;
  87. };
  88. /* memory type definitions. */
  89. enum e_drm_exynos_gem_mem_type {
  90. /* Physically Continuous memory and used as default. */
  91. EXYNOS_BO_CONTIG = 0 << 0,
  92. /* Physically Non-Continuous memory. */
  93. EXYNOS_BO_NONCONTIG = 1 << 0,
  94. /* non-cachable mapping and used as default. */
  95. EXYNOS_BO_NONCACHABLE = 0 << 1,
  96. /* cachable mapping. */
  97. EXYNOS_BO_CACHABLE = 1 << 1,
  98. /* write-combine mapping. */
  99. EXYNOS_BO_WC = 1 << 2,
  100. EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
  101. EXYNOS_BO_WC
  102. };
  103. struct drm_exynos_g2d_get_ver {
  104. __u32 major;
  105. __u32 minor;
  106. };
  107. struct drm_exynos_g2d_cmd {
  108. __u32 offset;
  109. __u32 data;
  110. };
  111. enum drm_exynos_g2d_buf_type {
  112. G2D_BUF_USERPTR = 1 << 31,
  113. };
  114. enum drm_exynos_g2d_event_type {
  115. G2D_EVENT_NOT,
  116. G2D_EVENT_NONSTOP,
  117. G2D_EVENT_STOP, /* not yet */
  118. };
  119. struct drm_exynos_g2d_userptr {
  120. unsigned long userptr;
  121. unsigned long size;
  122. };
  123. struct drm_exynos_g2d_set_cmdlist {
  124. __u64 cmd;
  125. __u64 cmd_buf;
  126. __u32 cmd_nr;
  127. __u32 cmd_buf_nr;
  128. /* for g2d event */
  129. __u64 event_type;
  130. __u64 user_data;
  131. };
  132. struct drm_exynos_g2d_exec {
  133. __u64 async;
  134. };
  135. enum drm_exynos_ops_id {
  136. EXYNOS_DRM_OPS_SRC,
  137. EXYNOS_DRM_OPS_DST,
  138. EXYNOS_DRM_OPS_MAX,
  139. };
  140. struct drm_exynos_sz {
  141. __u32 hsize;
  142. __u32 vsize;
  143. };
  144. struct drm_exynos_pos {
  145. __u32 x;
  146. __u32 y;
  147. __u32 w;
  148. __u32 h;
  149. };
  150. enum drm_exynos_flip {
  151. EXYNOS_DRM_FLIP_NONE = (0 << 0),
  152. EXYNOS_DRM_FLIP_VERTICAL = (1 << 0),
  153. EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1),
  154. EXYNOS_DRM_FLIP_BOTH = EXYNOS_DRM_FLIP_VERTICAL |
  155. EXYNOS_DRM_FLIP_HORIZONTAL,
  156. };
  157. enum drm_exynos_degree {
  158. EXYNOS_DRM_DEGREE_0,
  159. EXYNOS_DRM_DEGREE_90,
  160. EXYNOS_DRM_DEGREE_180,
  161. EXYNOS_DRM_DEGREE_270,
  162. };
  163. enum drm_exynos_planer {
  164. EXYNOS_DRM_PLANAR_Y,
  165. EXYNOS_DRM_PLANAR_CB,
  166. EXYNOS_DRM_PLANAR_CR,
  167. EXYNOS_DRM_PLANAR_MAX,
  168. };
  169. /**
  170. * A structure for ipp supported property list.
  171. *
  172. * @version: version of this structure.
  173. * @ipp_id: id of ipp driver.
  174. * @count: count of ipp driver.
  175. * @writeback: flag of writeback supporting.
  176. * @flip: flag of flip supporting.
  177. * @degree: flag of degree information.
  178. * @csc: flag of csc supporting.
  179. * @crop: flag of crop supporting.
  180. * @scale: flag of scale supporting.
  181. * @refresh_min: min hz of refresh.
  182. * @refresh_max: max hz of refresh.
  183. * @crop_min: crop min resolution.
  184. * @crop_max: crop max resolution.
  185. * @scale_min: scale min resolution.
  186. * @scale_max: scale max resolution.
  187. */
  188. struct drm_exynos_ipp_prop_list {
  189. __u32 version;
  190. __u32 ipp_id;
  191. __u32 count;
  192. __u32 writeback;
  193. __u32 flip;
  194. __u32 degree;
  195. __u32 csc;
  196. __u32 crop;
  197. __u32 scale;
  198. __u32 refresh_min;
  199. __u32 refresh_max;
  200. __u32 reserved;
  201. struct drm_exynos_sz crop_min;
  202. struct drm_exynos_sz crop_max;
  203. struct drm_exynos_sz scale_min;
  204. struct drm_exynos_sz scale_max;
  205. };
  206. /**
  207. * A structure for ipp config.
  208. *
  209. * @ops_id: property of operation directions.
  210. * @flip: property of mirror, flip.
  211. * @degree: property of rotation degree.
  212. * @fmt: property of image format.
  213. * @sz: property of image size.
  214. * @pos: property of image position(src-cropped,dst-scaler).
  215. */
  216. struct drm_exynos_ipp_config {
  217. enum drm_exynos_ops_id ops_id;
  218. enum drm_exynos_flip flip;
  219. enum drm_exynos_degree degree;
  220. __u32 fmt;
  221. struct drm_exynos_sz sz;
  222. struct drm_exynos_pos pos;
  223. };
  224. enum drm_exynos_ipp_cmd {
  225. IPP_CMD_NONE,
  226. IPP_CMD_M2M,
  227. IPP_CMD_WB,
  228. IPP_CMD_OUTPUT,
  229. IPP_CMD_MAX,
  230. };
  231. /**
  232. * A structure for ipp property.
  233. *
  234. * @config: source, destination config.
  235. * @cmd: definition of command.
  236. * @ipp_id: id of ipp driver.
  237. * @prop_id: id of property.
  238. * @refresh_rate: refresh rate.
  239. */
  240. struct drm_exynos_ipp_property {
  241. struct drm_exynos_ipp_config config[EXYNOS_DRM_OPS_MAX];
  242. enum drm_exynos_ipp_cmd cmd;
  243. __u32 ipp_id;
  244. __u32 prop_id;
  245. __u32 refresh_rate;
  246. };
  247. enum drm_exynos_ipp_buf_type {
  248. IPP_BUF_ENQUEUE,
  249. IPP_BUF_DEQUEUE,
  250. };
  251. /**
  252. * A structure for ipp buffer operations.
  253. *
  254. * @ops_id: operation directions.
  255. * @buf_type: definition of buffer.
  256. * @prop_id: id of property.
  257. * @buf_id: id of buffer.
  258. * @handle: Y, Cb, Cr each planar handle.
  259. * @user_data: user data.
  260. */
  261. struct drm_exynos_ipp_queue_buf {
  262. enum drm_exynos_ops_id ops_id;
  263. enum drm_exynos_ipp_buf_type buf_type;
  264. __u32 prop_id;
  265. __u32 buf_id;
  266. __u32 handle[EXYNOS_DRM_PLANAR_MAX];
  267. __u32 reserved;
  268. __u64 user_data;
  269. };
  270. enum drm_exynos_ipp_ctrl {
  271. IPP_CTRL_PLAY,
  272. IPP_CTRL_STOP,
  273. IPP_CTRL_PAUSE,
  274. IPP_CTRL_RESUME,
  275. IPP_CTRL_MAX,
  276. };
  277. /**
  278. * A structure for ipp start/stop operations.
  279. *
  280. * @prop_id: id of property.
  281. * @ctrl: definition of control.
  282. */
  283. struct drm_exynos_ipp_cmd_ctrl {
  284. __u32 prop_id;
  285. enum drm_exynos_ipp_ctrl ctrl;
  286. };
  287. #define DRM_EXYNOS_GEM_CREATE 0x00
  288. #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
  289. #define DRM_EXYNOS_GEM_MMAP 0x02
  290. /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
  291. #define DRM_EXYNOS_GEM_GET 0x04
  292. #define DRM_EXYNOS_VIDI_CONNECTION 0x07
  293. /* G2D */
  294. #define DRM_EXYNOS_G2D_GET_VER 0x20
  295. #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
  296. #define DRM_EXYNOS_G2D_EXEC 0x22
  297. /* IPP - Image Post Processing */
  298. #define DRM_EXYNOS_IPP_GET_PROPERTY 0x30
  299. #define DRM_EXYNOS_IPP_SET_PROPERTY 0x31
  300. #define DRM_EXYNOS_IPP_QUEUE_BUF 0x32
  301. #define DRM_EXYNOS_IPP_CMD_CTRL 0x33
  302. #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
  303. DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
  304. #define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
  305. DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
  306. #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
  307. DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
  308. #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
  309. DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
  310. #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
  311. DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
  312. #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
  313. DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
  314. #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
  315. DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
  316. #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
  317. DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
  318. #define DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
  319. DRM_EXYNOS_IPP_GET_PROPERTY, struct drm_exynos_ipp_prop_list)
  320. #define DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
  321. DRM_EXYNOS_IPP_SET_PROPERTY, struct drm_exynos_ipp_property)
  322. #define DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF DRM_IOWR(DRM_COMMAND_BASE + \
  323. DRM_EXYNOS_IPP_QUEUE_BUF, struct drm_exynos_ipp_queue_buf)
  324. #define DRM_IOCTL_EXYNOS_IPP_CMD_CTRL DRM_IOWR(DRM_COMMAND_BASE + \
  325. DRM_EXYNOS_IPP_CMD_CTRL, struct drm_exynos_ipp_cmd_ctrl)
  326. /* EXYNOS specific events */
  327. #define DRM_EXYNOS_G2D_EVENT 0x80000000
  328. #define DRM_EXYNOS_IPP_EVENT 0x80000001
  329. struct drm_exynos_g2d_event {
  330. struct drm_event base;
  331. __u64 user_data;
  332. __u32 tv_sec;
  333. __u32 tv_usec;
  334. __u32 cmdlist_no;
  335. __u32 reserved;
  336. };
  337. struct drm_exynos_ipp_event {
  338. struct drm_event base;
  339. __u64 user_data;
  340. __u32 tv_sec;
  341. __u32 tv_usec;
  342. __u32 prop_id;
  343. __u32 reserved;
  344. __u32 buf_id[EXYNOS_DRM_OPS_MAX];
  345. };
  346. #endif /* _UAPI_EXYNOS_DRM_H_ */