hfi_cmds.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*
  2. * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
  3. * Copyright (C) 2017 Linaro Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 and
  7. * only version 2 as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #ifndef __VENUS_HFI_CMDS_H__
  16. #define __VENUS_HFI_CMDS_H__
  17. #include "hfi.h"
  18. /* commands */
  19. #define HFI_CMD_SYS_INIT 0x10001
  20. #define HFI_CMD_SYS_PC_PREP 0x10002
  21. #define HFI_CMD_SYS_SET_RESOURCE 0x10003
  22. #define HFI_CMD_SYS_RELEASE_RESOURCE 0x10004
  23. #define HFI_CMD_SYS_SET_PROPERTY 0x10005
  24. #define HFI_CMD_SYS_GET_PROPERTY 0x10006
  25. #define HFI_CMD_SYS_SESSION_INIT 0x10007
  26. #define HFI_CMD_SYS_SESSION_END 0x10008
  27. #define HFI_CMD_SYS_SET_BUFFERS 0x10009
  28. #define HFI_CMD_SYS_TEST_SSR 0x10101
  29. #define HFI_CMD_SESSION_SET_PROPERTY 0x11001
  30. #define HFI_CMD_SESSION_SET_BUFFERS 0x11002
  31. #define HFI_CMD_SESSION_GET_SEQUENCE_HEADER 0x11003
  32. #define HFI_CMD_SYS_SESSION_ABORT 0x210001
  33. #define HFI_CMD_SYS_PING 0x210002
  34. #define HFI_CMD_SESSION_LOAD_RESOURCES 0x211001
  35. #define HFI_CMD_SESSION_START 0x211002
  36. #define HFI_CMD_SESSION_STOP 0x211003
  37. #define HFI_CMD_SESSION_EMPTY_BUFFER 0x211004
  38. #define HFI_CMD_SESSION_FILL_BUFFER 0x211005
  39. #define HFI_CMD_SESSION_SUSPEND 0x211006
  40. #define HFI_CMD_SESSION_RESUME 0x211007
  41. #define HFI_CMD_SESSION_FLUSH 0x211008
  42. #define HFI_CMD_SESSION_GET_PROPERTY 0x211009
  43. #define HFI_CMD_SESSION_PARSE_SEQUENCE_HEADER 0x21100a
  44. #define HFI_CMD_SESSION_RELEASE_BUFFERS 0x21100b
  45. #define HFI_CMD_SESSION_RELEASE_RESOURCES 0x21100c
  46. #define HFI_CMD_SESSION_CONTINUE 0x21100d
  47. #define HFI_CMD_SESSION_SYNC 0x21100e
  48. /* command packets */
  49. struct hfi_sys_init_pkt {
  50. struct hfi_pkt_hdr hdr;
  51. u32 arch_type;
  52. };
  53. struct hfi_sys_pc_prep_pkt {
  54. struct hfi_pkt_hdr hdr;
  55. };
  56. struct hfi_sys_set_resource_pkt {
  57. struct hfi_pkt_hdr hdr;
  58. u32 resource_handle;
  59. u32 resource_type;
  60. u32 resource_data[1];
  61. };
  62. struct hfi_sys_release_resource_pkt {
  63. struct hfi_pkt_hdr hdr;
  64. u32 resource_type;
  65. u32 resource_handle;
  66. };
  67. struct hfi_sys_set_property_pkt {
  68. struct hfi_pkt_hdr hdr;
  69. u32 num_properties;
  70. u32 data[1];
  71. };
  72. struct hfi_sys_get_property_pkt {
  73. struct hfi_pkt_hdr hdr;
  74. u32 num_properties;
  75. u32 data[1];
  76. };
  77. struct hfi_sys_set_buffers_pkt {
  78. struct hfi_pkt_hdr hdr;
  79. u32 buffer_type;
  80. u32 buffer_size;
  81. u32 num_buffers;
  82. u32 buffer_addr[1];
  83. };
  84. struct hfi_sys_ping_pkt {
  85. struct hfi_pkt_hdr hdr;
  86. u32 client_data;
  87. };
  88. struct hfi_session_init_pkt {
  89. struct hfi_session_hdr_pkt shdr;
  90. u32 session_domain;
  91. u32 session_codec;
  92. };
  93. struct hfi_session_end_pkt {
  94. struct hfi_session_hdr_pkt shdr;
  95. };
  96. struct hfi_session_abort_pkt {
  97. struct hfi_session_hdr_pkt shdr;
  98. };
  99. struct hfi_session_set_property_pkt {
  100. struct hfi_session_hdr_pkt shdr;
  101. u32 num_properties;
  102. u32 data[0];
  103. };
  104. struct hfi_session_set_buffers_pkt {
  105. struct hfi_session_hdr_pkt shdr;
  106. u32 buffer_type;
  107. u32 buffer_size;
  108. u32 extradata_size;
  109. u32 min_buffer_size;
  110. u32 num_buffers;
  111. u32 buffer_info[1];
  112. };
  113. struct hfi_session_get_sequence_header_pkt {
  114. struct hfi_session_hdr_pkt shdr;
  115. u32 buffer_len;
  116. u32 packet_buffer;
  117. };
  118. struct hfi_session_load_resources_pkt {
  119. struct hfi_session_hdr_pkt shdr;
  120. };
  121. struct hfi_session_start_pkt {
  122. struct hfi_session_hdr_pkt shdr;
  123. };
  124. struct hfi_session_stop_pkt {
  125. struct hfi_session_hdr_pkt shdr;
  126. };
  127. struct hfi_session_empty_buffer_compressed_pkt {
  128. struct hfi_session_hdr_pkt shdr;
  129. u32 time_stamp_hi;
  130. u32 time_stamp_lo;
  131. u32 flags;
  132. u32 mark_target;
  133. u32 mark_data;
  134. u32 offset;
  135. u32 alloc_len;
  136. u32 filled_len;
  137. u32 input_tag;
  138. u32 packet_buffer;
  139. u32 extradata_buffer;
  140. u32 data[1];
  141. };
  142. struct hfi_session_empty_buffer_uncompressed_plane0_pkt {
  143. struct hfi_session_hdr_pkt shdr;
  144. u32 view_id;
  145. u32 time_stamp_hi;
  146. u32 time_stamp_lo;
  147. u32 flags;
  148. u32 mark_target;
  149. u32 mark_data;
  150. u32 alloc_len;
  151. u32 filled_len;
  152. u32 offset;
  153. u32 input_tag;
  154. u32 packet_buffer;
  155. u32 extradata_buffer;
  156. u32 data[1];
  157. };
  158. struct hfi_session_empty_buffer_uncompressed_plane1_pkt {
  159. u32 flags;
  160. u32 alloc_len;
  161. u32 filled_len;
  162. u32 offset;
  163. u32 packet_buffer2;
  164. u32 data[1];
  165. };
  166. struct hfi_session_empty_buffer_uncompressed_plane2_pkt {
  167. u32 flags;
  168. u32 alloc_len;
  169. u32 filled_len;
  170. u32 offset;
  171. u32 packet_buffer3;
  172. u32 data[1];
  173. };
  174. struct hfi_session_fill_buffer_pkt {
  175. struct hfi_session_hdr_pkt shdr;
  176. u32 stream_id;
  177. u32 offset;
  178. u32 alloc_len;
  179. u32 filled_len;
  180. u32 output_tag;
  181. u32 packet_buffer;
  182. u32 extradata_buffer;
  183. u32 data[1];
  184. };
  185. struct hfi_session_flush_pkt {
  186. struct hfi_session_hdr_pkt shdr;
  187. u32 flush_type;
  188. };
  189. struct hfi_session_suspend_pkt {
  190. struct hfi_session_hdr_pkt shdr;
  191. };
  192. struct hfi_session_resume_pkt {
  193. struct hfi_session_hdr_pkt shdr;
  194. };
  195. struct hfi_session_get_property_pkt {
  196. struct hfi_session_hdr_pkt shdr;
  197. u32 num_properties;
  198. u32 data[1];
  199. };
  200. struct hfi_session_release_buffer_pkt {
  201. struct hfi_session_hdr_pkt shdr;
  202. u32 buffer_type;
  203. u32 buffer_size;
  204. u32 extradata_size;
  205. u32 response_req;
  206. u32 num_buffers;
  207. u32 buffer_info[1];
  208. };
  209. struct hfi_session_release_resources_pkt {
  210. struct hfi_session_hdr_pkt shdr;
  211. };
  212. struct hfi_session_parse_sequence_header_pkt {
  213. struct hfi_session_hdr_pkt shdr;
  214. u32 header_len;
  215. u32 packet_buffer;
  216. };
  217. struct hfi_sfr {
  218. u32 buf_size;
  219. u8 data[1];
  220. };
  221. struct hfi_sys_test_ssr_pkt {
  222. struct hfi_pkt_hdr hdr;
  223. u32 trigger_type;
  224. };
  225. void pkt_set_version(enum hfi_version version);
  226. void pkt_sys_init(struct hfi_sys_init_pkt *pkt, u32 arch_type);
  227. void pkt_sys_pc_prep(struct hfi_sys_pc_prep_pkt *pkt);
  228. void pkt_sys_idle_indicator(struct hfi_sys_set_property_pkt *pkt, u32 enable);
  229. void pkt_sys_power_control(struct hfi_sys_set_property_pkt *pkt, u32 enable);
  230. int pkt_sys_set_resource(struct hfi_sys_set_resource_pkt *pkt, u32 id, u32 size,
  231. u32 addr, void *cookie);
  232. int pkt_sys_unset_resource(struct hfi_sys_release_resource_pkt *pkt, u32 id,
  233. u32 size, void *cookie);
  234. void pkt_sys_debug_config(struct hfi_sys_set_property_pkt *pkt, u32 mode,
  235. u32 config);
  236. void pkt_sys_coverage_config(struct hfi_sys_set_property_pkt *pkt, u32 mode);
  237. void pkt_sys_ping(struct hfi_sys_ping_pkt *pkt, u32 cookie);
  238. void pkt_sys_image_version(struct hfi_sys_get_property_pkt *pkt);
  239. int pkt_sys_ssr_cmd(struct hfi_sys_test_ssr_pkt *pkt, u32 trigger_type);
  240. int pkt_session_init(struct hfi_session_init_pkt *pkt, void *cookie,
  241. u32 session_type, u32 codec);
  242. void pkt_session_cmd(struct hfi_session_pkt *pkt, u32 pkt_type, void *cookie);
  243. int pkt_session_set_buffers(struct hfi_session_set_buffers_pkt *pkt,
  244. void *cookie, struct hfi_buffer_desc *bd);
  245. int pkt_session_unset_buffers(struct hfi_session_release_buffer_pkt *pkt,
  246. void *cookie, struct hfi_buffer_desc *bd);
  247. int pkt_session_etb_decoder(struct hfi_session_empty_buffer_compressed_pkt *pkt,
  248. void *cookie, struct hfi_frame_data *input_frame);
  249. int pkt_session_etb_encoder(
  250. struct hfi_session_empty_buffer_uncompressed_plane0_pkt *pkt,
  251. void *cookie, struct hfi_frame_data *input_frame);
  252. int pkt_session_ftb(struct hfi_session_fill_buffer_pkt *pkt,
  253. void *cookie, struct hfi_frame_data *output_frame);
  254. int pkt_session_parse_seq_header(
  255. struct hfi_session_parse_sequence_header_pkt *pkt,
  256. void *cookie, u32 seq_hdr, u32 seq_hdr_len);
  257. int pkt_session_get_seq_hdr(struct hfi_session_get_sequence_header_pkt *pkt,
  258. void *cookie, u32 seq_hdr, u32 seq_hdr_len);
  259. int pkt_session_flush(struct hfi_session_flush_pkt *pkt, void *cookie,
  260. u32 flush_mode);
  261. int pkt_session_get_property(struct hfi_session_get_property_pkt *pkt,
  262. void *cookie, u32 ptype);
  263. int pkt_session_set_property(struct hfi_session_set_property_pkt *pkt,
  264. void *cookie, u32 ptype, void *pdata);
  265. #endif