msm_q6vdec.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. #ifndef _MSM_VDEC_H_
  2. #define _MSM_VDEC_H_
  3. #include <linux/types.h>
  4. #define VDEC_IOCTL_MAGIC 'v'
  5. #define VDEC_IOCTL_INITIALIZE _IOWR(VDEC_IOCTL_MAGIC, 1, struct vdec_init)
  6. #define VDEC_IOCTL_SETBUFFERS _IOW(VDEC_IOCTL_MAGIC, 2, struct vdec_buffer)
  7. #define VDEC_IOCTL_QUEUE _IOWR(VDEC_IOCTL_MAGIC, 3, \
  8. struct vdec_input_buf)
  9. #define VDEC_IOCTL_REUSEFRAMEBUFFER _IOW(VDEC_IOCTL_MAGIC, 4, unsigned int)
  10. #define VDEC_IOCTL_FLUSH _IOW(VDEC_IOCTL_MAGIC, 5, unsigned int)
  11. #define VDEC_IOCTL_EOS _IO(VDEC_IOCTL_MAGIC, 6)
  12. #define VDEC_IOCTL_GETMSG _IOR(VDEC_IOCTL_MAGIC, 7, struct vdec_msg)
  13. #define VDEC_IOCTL_CLOSE _IO(VDEC_IOCTL_MAGIC, 8)
  14. #define VDEC_IOCTL_FREEBUFFERS _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_buf_info)
  15. #define VDEC_IOCTL_GETDECATTRIBUTES _IOR(VDEC_IOCTL_MAGIC, 10, \
  16. struct vdec_dec_attributes)
  17. #define VDEC_IOCTL_GETVERSION _IOR(VDEC_IOCTL_MAGIC, 11, struct vdec_version)
  18. #define VDEC_IOCTL_SETPROPERTY _IOW \
  19. (VDEC_IOCTL_MAGIC, 12, struct vdec_property_info)
  20. #define VDEC_IOCTL_GETPROPERTY _IOR \
  21. (VDEC_IOCTL_MAGIC, 13, struct vdec_property_info)
  22. #define VDEC_IOCTL_PERFORMANCE_CHANGE_REQ _IOW(VDEC_IOCTL_MAGIC, 14, \
  23. unsigned int)
  24. enum {
  25. VDEC_FRAME_DECODE_OK,
  26. VDEC_FRAME_DECODE_ERR,
  27. VDEC_FATAL_ERR,
  28. VDEC_FLUSH_FINISH,
  29. VDEC_EOS,
  30. VDEC_FRAME_FLUSH,
  31. VDEC_STREAM_SWITCH,
  32. VDEC_SUSPEND_FINISH,
  33. VDEC_BUFFER_CONSUMED
  34. };
  35. enum {
  36. VDEC_FLUSH_INPUT,
  37. VDEC_FLUSH_OUTPUT,
  38. VDEC_FLUSH_ALL
  39. };
  40. enum {
  41. VDEC_BUFFER_TYPE_INPUT,
  42. VDEC_BUFFER_TYPE_OUTPUT,
  43. VDEC_BUFFER_TYPE_INTERNAL1,
  44. VDEC_BUFFER_TYPE_INTERNAL2,
  45. };
  46. enum {
  47. VDEC_QUEUE_SUCCESS,
  48. VDEC_QUEUE_FAILED,
  49. VDEC_QUEUE_BADSTATE,
  50. };
  51. enum {
  52. VDEC_COLOR_FORMAT_NV21 = 0x01,
  53. VDEC_COLOR_FORMAT_NV21_YAMOTO = 0x02
  54. };
  55. enum vdec_property_id {
  56. VDEC_FOURCC,
  57. VDEC_PROFILE,
  58. VDEC_LEVEL,
  59. VDEC_DIMENSIONS,
  60. VDEC_CWIN,
  61. VDEC_INPUT_BUF_REQ,
  62. VDEC_OUTPUT_BUF_REQ,
  63. VDEC_LUMA_CHROMA_STRIDE,
  64. VDEC_NUM_DAL_PORTS,
  65. VDEC_PRIORITY,
  66. VDEC_FRAME_ALIGNMENT
  67. };
  68. enum {
  69. PERF_REQUEST_SET_MIN = 0,
  70. PERF_REQUEST_LOWER,
  71. PERF_REQUEST_RAISE,
  72. PERF_REQUEST_SET_MAX
  73. };
  74. struct vdec_input_buf_info {
  75. u32 offset;
  76. u32 data;
  77. u32 size;
  78. int timestamp_lo;
  79. int timestamp_hi;
  80. int avsync_state;
  81. u32 flags;
  82. };
  83. struct vdec_buf_desc {
  84. u32 bufsize;
  85. u32 num_min_buffers;
  86. u32 num_max_buffers;
  87. };
  88. struct vdec_buf_req {
  89. u32 max_input_queue_size;
  90. struct vdec_buf_desc input;
  91. struct vdec_buf_desc output;
  92. struct vdec_buf_desc dec_req1;
  93. struct vdec_buf_desc dec_req2;
  94. };
  95. struct vdec_region_info {
  96. u32 src_id;
  97. u32 offset;
  98. u32 size;
  99. };
  100. struct vdec_config {
  101. u32 fourcc; /* video format */
  102. u32 width; /* source width */
  103. u32 height; /* source height */
  104. u32 order; /* render decoder order */
  105. u32 notify_enable; /* enable notify input buffer done event */
  106. u32 vc1_rowbase;
  107. u32 h264_startcode_detect;
  108. u32 h264_nal_len_size;
  109. u32 postproc_flag;
  110. u32 fruc_enable;
  111. u32 color_format; /* used to set YUV color format */
  112. };
  113. struct vdec_vc1_panscan_regions {
  114. int num;
  115. int width[4];
  116. int height[4];
  117. int xoffset[4];
  118. int yoffset[4];
  119. };
  120. struct vdec_cropping_window {
  121. u32 x1;
  122. u32 y1;
  123. u32 x2;
  124. u32 y2;
  125. };
  126. struct vdec_frame_info {
  127. u32 status; /* video decode status */
  128. u32 offset; /* buffer offset */
  129. u32 data1; /* user data field 1 */
  130. u32 data2; /* user data field 2 */
  131. int timestamp_lo; /* lower 32 bits timestamp, in msec */
  132. int timestamp_hi; /* higher 32 bits timestamp, in msec */
  133. int cal_timestamp_lo; /* lower 32 bits cal timestamp, in msec */
  134. int cal_timestamp_hi; /* higher 32 bits cal timestamp, in msec */
  135. u32 dec_width; /* frame roi width */
  136. u32 dec_height; /* frame roi height */
  137. struct vdec_cropping_window cwin; /* The frame cropping window */
  138. u32 picture_type[2]; /* picture coding type */
  139. u32 picture_format; /* picture coding format */
  140. u32 vc1_rangeY; /* luma range mapping */
  141. u32 vc1_rangeUV; /* chroma range mapping */
  142. u32 picture_resolution; /* scaling factor */
  143. u32 frame_disp_repeat; /* how often repeated by disp */
  144. u32 repeat_first_field; /* repeat 1st field after 2nd */
  145. u32 top_field_first; /* top field displayed first */
  146. u32 interframe_interp; /* not for inter-frame interp */
  147. struct vdec_vc1_panscan_regions panscan; /* pan region */
  148. u32 concealed_macblk_num; /* number of concealed macro blk */
  149. u32 flags; /* input flags */
  150. u32 performance_stats; /* performance statistics returned by decoder */
  151. u32 data3; /* user data field 3 */
  152. };
  153. struct vdec_buf_info {
  154. u32 buf_type;
  155. struct vdec_region_info region;
  156. u32 num_buf;
  157. u32 islast;
  158. };
  159. struct vdec_buffer {
  160. u32 pmem_id;
  161. struct vdec_buf_info buf;
  162. };
  163. struct vdec_sequence {
  164. u8 *header;
  165. u32 len;
  166. };
  167. struct vdec_config_sps {
  168. struct vdec_config cfg;
  169. struct vdec_sequence seq;
  170. };
  171. #define VDEC_MSG_REUSEINPUTBUFFER 1
  172. #define VDEC_MSG_FRAMEDONE 2
  173. struct vdec_msg {
  174. u32 id;
  175. union {
  176. /* id = VDEC_MSG_REUSEINPUTBUFFER */
  177. u32 buf_id;
  178. /* id = VDEC_MSG_FRAMEDONE */
  179. struct vdec_frame_info vfr_info;
  180. };
  181. };
  182. struct vdec_init {
  183. struct vdec_config_sps sps_cfg;
  184. struct vdec_buf_req *buf_req;
  185. };
  186. struct vdec_input_buf {
  187. u32 pmem_id;
  188. struct vdec_input_buf_info buffer;
  189. struct vdec_queue_status *queue_status;
  190. };
  191. struct vdec_queue_status {
  192. u32 status;
  193. };
  194. struct vdec_dec_attributes {
  195. u32 fourcc;
  196. u32 profile;
  197. u32 level;
  198. u32 dec_pic_width;
  199. u32 dec_pic_height;
  200. struct vdec_buf_desc input;
  201. struct vdec_buf_desc output;
  202. struct vdec_buf_desc dec_req1;
  203. struct vdec_buf_desc dec_req2;
  204. };
  205. struct vdec_version {
  206. u32 major;
  207. u32 minor;
  208. };
  209. struct dal_vdec_rectangle {
  210. u32 width;
  211. u32 height;
  212. };
  213. struct stride_type {
  214. u32 luma;
  215. u32 chroma;
  216. };
  217. struct frame_alignment_type {
  218. u32 luma_width;
  219. u32 luma_height;
  220. u32 chroma_width;
  221. u32 chroma_height;
  222. u32 chroma_offset;
  223. };
  224. union vdec_property {
  225. u32 fourcc;
  226. u32 profile;
  227. u32 level;
  228. struct dal_vdec_rectangle dim;
  229. struct vdec_cropping_window cw;
  230. struct vdec_buf_desc input_req;
  231. struct vdec_buf_desc output_req;
  232. struct stride_type stride;
  233. u32 num_dal_ports;
  234. u32 priority;
  235. struct frame_alignment_type frame_alignment;
  236. u32 def_type;
  237. };
  238. struct vdec_property_info {
  239. enum vdec_property_id id;
  240. union vdec_property property;
  241. };
  242. #endif /* _MSM_VDEC_H_ */