exynos_drm.h 8.7 KB

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