exynos_drm.h 10 KB

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