exynos_drm.h 8.6 KB

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