exynos_drm.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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. };
  155. enum drm_exynos_degree {
  156. EXYNOS_DRM_DEGREE_0,
  157. EXYNOS_DRM_DEGREE_90,
  158. EXYNOS_DRM_DEGREE_180,
  159. EXYNOS_DRM_DEGREE_270,
  160. };
  161. enum drm_exynos_planer {
  162. EXYNOS_DRM_PLANAR_Y,
  163. EXYNOS_DRM_PLANAR_CB,
  164. EXYNOS_DRM_PLANAR_CR,
  165. EXYNOS_DRM_PLANAR_MAX,
  166. };
  167. /**
  168. * A structure for ipp supported property list.
  169. *
  170. * @version: version of this structure.
  171. * @ipp_id: id of ipp driver.
  172. * @count: count of ipp driver.
  173. * @writeback: flag of writeback supporting.
  174. * @flip: flag of flip supporting.
  175. * @degree: flag of degree information.
  176. * @csc: flag of csc supporting.
  177. * @crop: flag of crop supporting.
  178. * @scale: flag of scale supporting.
  179. * @refresh_min: min hz of refresh.
  180. * @refresh_max: max hz of refresh.
  181. * @crop_min: crop min resolution.
  182. * @crop_max: crop max resolution.
  183. * @scale_min: scale min resolution.
  184. * @scale_max: scale max resolution.
  185. */
  186. struct drm_exynos_ipp_prop_list {
  187. __u32 version;
  188. __u32 ipp_id;
  189. __u32 count;
  190. __u32 writeback;
  191. __u32 flip;
  192. __u32 degree;
  193. __u32 csc;
  194. __u32 crop;
  195. __u32 scale;
  196. __u32 refresh_min;
  197. __u32 refresh_max;
  198. __u32 reserved;
  199. struct drm_exynos_sz crop_min;
  200. struct drm_exynos_sz crop_max;
  201. struct drm_exynos_sz scale_min;
  202. struct drm_exynos_sz scale_max;
  203. };
  204. /**
  205. * A structure for ipp config.
  206. *
  207. * @ops_id: property of operation directions.
  208. * @flip: property of mirror, flip.
  209. * @degree: property of rotation degree.
  210. * @fmt: property of image format.
  211. * @sz: property of image size.
  212. * @pos: property of image position(src-cropped,dst-scaler).
  213. */
  214. struct drm_exynos_ipp_config {
  215. enum drm_exynos_ops_id ops_id;
  216. enum drm_exynos_flip flip;
  217. enum drm_exynos_degree degree;
  218. __u32 fmt;
  219. struct drm_exynos_sz sz;
  220. struct drm_exynos_pos pos;
  221. };
  222. enum drm_exynos_ipp_cmd {
  223. IPP_CMD_NONE,
  224. IPP_CMD_M2M,
  225. IPP_CMD_WB,
  226. IPP_CMD_OUTPUT,
  227. IPP_CMD_MAX,
  228. };
  229. /**
  230. * A structure for ipp property.
  231. *
  232. * @config: source, destination config.
  233. * @cmd: definition of command.
  234. * @ipp_id: id of ipp driver.
  235. * @prop_id: id of property.
  236. * @refresh_rate: refresh rate.
  237. */
  238. struct drm_exynos_ipp_property {
  239. struct drm_exynos_ipp_config config[EXYNOS_DRM_OPS_MAX];
  240. enum drm_exynos_ipp_cmd cmd;
  241. __u32 ipp_id;
  242. __u32 prop_id;
  243. __u32 refresh_rate;
  244. };
  245. enum drm_exynos_ipp_buf_type {
  246. IPP_BUF_ENQUEUE,
  247. IPP_BUF_DEQUEUE,
  248. };
  249. /**
  250. * A structure for ipp buffer operations.
  251. *
  252. * @ops_id: operation directions.
  253. * @buf_type: definition of buffer.
  254. * @prop_id: id of property.
  255. * @buf_id: id of buffer.
  256. * @handle: Y, Cb, Cr each planar handle.
  257. * @user_data: user data.
  258. */
  259. struct drm_exynos_ipp_queue_buf {
  260. enum drm_exynos_ops_id ops_id;
  261. enum drm_exynos_ipp_buf_type buf_type;
  262. __u32 prop_id;
  263. __u32 buf_id;
  264. __u32 handle[EXYNOS_DRM_PLANAR_MAX];
  265. __u32 reserved;
  266. __u64 user_data;
  267. };
  268. enum drm_exynos_ipp_ctrl {
  269. IPP_CTRL_PLAY,
  270. IPP_CTRL_STOP,
  271. IPP_CTRL_PAUSE,
  272. IPP_CTRL_RESUME,
  273. IPP_CTRL_MAX,
  274. };
  275. /**
  276. * A structure for ipp start/stop operations.
  277. *
  278. * @prop_id: id of property.
  279. * @ctrl: definition of control.
  280. */
  281. struct drm_exynos_ipp_cmd_ctrl {
  282. __u32 prop_id;
  283. enum drm_exynos_ipp_ctrl ctrl;
  284. };
  285. #define DRM_EXYNOS_GEM_CREATE 0x00
  286. #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
  287. #define DRM_EXYNOS_GEM_MMAP 0x02
  288. /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
  289. #define DRM_EXYNOS_GEM_GET 0x04
  290. #define DRM_EXYNOS_VIDI_CONNECTION 0x07
  291. /* G2D */
  292. #define DRM_EXYNOS_G2D_GET_VER 0x20
  293. #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
  294. #define DRM_EXYNOS_G2D_EXEC 0x22
  295. /* IPP - Image Post Processing */
  296. #define DRM_EXYNOS_IPP_GET_PROPERTY 0x30
  297. #define DRM_EXYNOS_IPP_SET_PROPERTY 0x31
  298. #define DRM_EXYNOS_IPP_QUEUE_BUF 0x32
  299. #define DRM_EXYNOS_IPP_CMD_CTRL 0x33
  300. #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
  301. DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
  302. #define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
  303. DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
  304. #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
  305. DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
  306. #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
  307. DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
  308. #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
  309. DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
  310. #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
  311. DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
  312. #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
  313. DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
  314. #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
  315. DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
  316. #define DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
  317. DRM_EXYNOS_IPP_GET_PROPERTY, struct drm_exynos_ipp_prop_list)
  318. #define DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
  319. DRM_EXYNOS_IPP_SET_PROPERTY, struct drm_exynos_ipp_property)
  320. #define DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF DRM_IOWR(DRM_COMMAND_BASE + \
  321. DRM_EXYNOS_IPP_QUEUE_BUF, struct drm_exynos_ipp_queue_buf)
  322. #define DRM_IOCTL_EXYNOS_IPP_CMD_CTRL DRM_IOWR(DRM_COMMAND_BASE + \
  323. DRM_EXYNOS_IPP_CMD_CTRL, struct drm_exynos_ipp_cmd_ctrl)
  324. /* EXYNOS specific events */
  325. #define DRM_EXYNOS_G2D_EVENT 0x80000000
  326. #define DRM_EXYNOS_IPP_EVENT 0x80000001
  327. struct drm_exynos_g2d_event {
  328. struct drm_event base;
  329. __u64 user_data;
  330. __u32 tv_sec;
  331. __u32 tv_usec;
  332. __u32 cmdlist_no;
  333. __u32 reserved;
  334. };
  335. struct drm_exynos_ipp_event {
  336. struct drm_event base;
  337. __u64 user_data;
  338. __u32 tv_sec;
  339. __u32 tv_usec;
  340. __u32 prop_id;
  341. __u32 reserved;
  342. __u32 buf_id[EXYNOS_DRM_OPS_MAX];
  343. };
  344. #endif /* _UAPI_EXYNOS_DRM_H_ */