cvp_hfi.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __H_CVP_HFI_H__
  6. #define __H_CVP_HFI_H__
  7. #include <media/msm_media_info.h>
  8. #include "cvp_hfi_helper.h"
  9. #include "cvp_hfi_api.h"
  10. #include "cvp_comm_def.h"
  11. #define HFI_CMD_SESSION_CVP_START \
  12. (HFI_DOMAIN_BASE_CVP + HFI_ARCH_COMMON_OFFSET + \
  13. HFI_CMD_START_OFFSET + 0x1000)
  14. #define HFI_CMD_SESSION_CVP_SET_BUFFERS\
  15. (HFI_CMD_SESSION_CVP_START + 0x001)
  16. #define HFI_CMD_SESSION_CVP_RELEASE_BUFFERS\
  17. (HFI_CMD_SESSION_CVP_START + 0x002)
  18. #define HFI_CMD_SESSION_CVP_DS\
  19. (HFI_CMD_SESSION_CVP_START + 0x003)
  20. #define HFI_CMD_SESSION_CVP_HCD_FRAME\
  21. (HFI_CMD_SESSION_CVP_START + 0x004)
  22. #define HFI_CMD_SESSION_CVP_HCD_CONFIG\
  23. (HFI_CMD_SESSION_CVP_START + 0x005)
  24. #define HFI_CMD_SESSION_CVP_CV_HOG_FRAME\
  25. (HFI_CMD_SESSION_CVP_START + 0x006)
  26. #define HFI_CMD_SESSION_CVP_CV_HOG_CONFIG\
  27. (HFI_CMD_SESSION_CVP_START + 0x007)
  28. #define HFI_CMD_SESSION_CVP_SVM\
  29. (HFI_CMD_SESSION_CVP_START + 0x008)
  30. #define HFI_CMD_SESSION_CVP_NCC_FRAME\
  31. (HFI_CMD_SESSION_CVP_START + 0x009)
  32. #define HFI_CMD_SESSION_CVP_NCC_CONFIG\
  33. (HFI_CMD_SESSION_CVP_START + 0x00A)
  34. #define HFI_CMD_SESSION_CVP_DFS_FRAME\
  35. (HFI_CMD_SESSION_CVP_START + 0x00B)
  36. #define HFI_CMD_SESSION_CVP_DFS_CONFIG\
  37. (HFI_CMD_SESSION_CVP_START + 0x00C)
  38. #define HFI_CMD_SESSION_CVP_FTEXT\
  39. (HFI_CMD_SESSION_CVP_START + 0x00F)
  40. /* ==========CHAINED OPERATIONS===================*/
  41. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_FRAME\
  42. (HFI_CMD_SESSION_CVP_START + 0x010)
  43. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_CONFIG\
  44. (HFI_CMD_SESSION_CVP_START + 0x011)
  45. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_HCD_FRAME\
  46. (HFI_CMD_SESSION_CVP_START + 0x012)
  47. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_HCD_CONFIG\
  48. (HFI_CMD_SESSION_CVP_START + 0x013)
  49. #define HFI_CMD_SESSION_CVP_OPTICAL_FLOW\
  50. (HFI_CMD_SESSION_CVP_START + 0x014)
  51. /* ===========USECASE OPERATIONS===============*/
  52. #define HFI_CMD_SESSION_CVP_DC_FRAME\
  53. (HFI_CMD_SESSION_CVP_START + 0x030)
  54. #define HFI_CMD_SESSION_CVP_DC_CONFIG\
  55. (HFI_CMD_SESSION_CVP_START + 0x031)
  56. #define HFI_CMD_SESSION_CVP_DCM_FRAME\
  57. (HFI_CMD_SESSION_CVP_START + 0x034)
  58. #define HFI_CMD_SESSION_CVP_DCM_CONFIG\
  59. (HFI_CMD_SESSION_CVP_START + 0x035)
  60. #define HFI_CMD_SESSION_CVP_DME_CONFIG\
  61. (HFI_CMD_SESSION_CVP_START + 0x039)
  62. #define HFI_CMD_SESSION_CVP_DME_BASIC_CONFIG\
  63. (HFI_CMD_SESSION_CVP_START + 0x03B)
  64. #define HFI_CMD_SESSION_CVP_DME_FRAME\
  65. (HFI_CMD_SESSION_CVP_START + 0x03A)
  66. #define HFI_CMD_SESSION_CVP_CV_TME_CONFIG\
  67. (HFI_CMD_SESSION_CVP_START + 0x047)
  68. #define HFI_CMD_SESSION_CVP_CV_TME_FRAME\
  69. (HFI_CMD_SESSION_CVP_START + 0x048)
  70. #define HFI_CMD_SESSION_CVP_CV_OD_CONFIG\
  71. (HFI_CMD_SESSION_CVP_START + 0x049)
  72. #define HFI_CMD_SESSION_CVP_CV_OD_FRAME\
  73. (HFI_CMD_SESSION_CVP_START + 0x04A)
  74. #define HFI_CMD_SESSION_CVP_CV_ODT_CONFIG\
  75. (HFI_CMD_SESSION_CVP_START + 0x04B)
  76. #define HFI_CMD_SESSION_CVP_CV_ODT_FRAME\
  77. (HFI_CMD_SESSION_CVP_START + 0x04C)
  78. #define HFI_CMD_SESSION_CVP_SET_PERSIST_BUFFERS\
  79. (HFI_CMD_SESSION_CVP_START + 0x04D)
  80. #define HFI_CMD_SESSION_CVP_PYS_HCD_CONFIG\
  81. (HFI_CMD_SESSION_CVP_START + 0x050)
  82. #define HFI_CMD_SESSION_CVP_PYS_HCD_FRAME\
  83. (HFI_CMD_SESSION_CVP_START + 0x051)
  84. #define HFI_CMD_SESSION_CVP_SET_MODEL_BUFFERS\
  85. (HFI_CMD_SESSION_CVP_START + 0x052)
  86. #define HFI_CMD_SESSION_CVP_FD_CONFIG\
  87. (HFI_CMD_SESSION_CVP_START + 0x053)
  88. #define HFI_CMD_SESSION_CVP_FD_FRAME\
  89. (HFI_CMD_SESSION_CVP_START + 0x054)
  90. #define HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS\
  91. (HFI_CMD_SESSION_CVP_START + 0x055)
  92. #define HFI_CMD_SESSION_CVP_RELEASE_MODEL_BUFFERS\
  93. (HFI_CMD_SESSION_CVP_START + 0x056)
  94. #define HFI_CMD_SESSION_CVP_SGM_DFS_CONFIG\
  95. (HFI_CMD_SESSION_CVP_START + 0x057)
  96. #define HFI_CMD_SESSION_CVP_SGM_DFS_FRAME\
  97. (HFI_CMD_SESSION_CVP_START + 0x058)
  98. #define HFI_CMD_SESSION_CVP_SGM_OF_CONFIG\
  99. (HFI_CMD_SESSION_CVP_START + 0x059)
  100. #define HFI_CMD_SESSION_CVP_SGM_OF_FRAME\
  101. (HFI_CMD_SESSION_CVP_START + 0x05A)
  102. #define HFI_CMD_SESSION_CVP_GCE_CONFIG\
  103. (HFI_CMD_SESSION_CVP_START + 0x05B)
  104. #define HFI_CMD_SESSION_CVP_GCE_FRAME\
  105. (HFI_CMD_SESSION_CVP_START + 0x05C)
  106. #define HFI_CMD_SESSION_CVP_WARP_NCC_CONFIG\
  107. (HFI_CMD_SESSION_CVP_START + 0x05D)
  108. #define HFI_CMD_SESSION_CVP_WARP_NCC_FRAME\
  109. (HFI_CMD_SESSION_CVP_START + 0x05E)
  110. #define HFI_CMD_SESSION_CVP_DMM_CONFIG\
  111. (HFI_CMD_SESSION_CVP_START + 0x05F)
  112. #define HFI_CMD_SESSION_CVP_DMM_FRAME\
  113. (HFI_CMD_SESSION_CVP_START + 0x060)
  114. #define HFI_CMD_SESSION_CVP_FLUSH\
  115. (HFI_CMD_SESSION_CVP_START + 0x061)
  116. #define HFI_CMD_SESSION_CVP_WARP_CONFIG\
  117. (HFI_CMD_SESSION_CVP_START + 0x062)
  118. #define HFI_CMD_SESSION_CVP_WARP_FRAME\
  119. (HFI_CMD_SESSION_CVP_START + 0x063)
  120. #define HFI_CMD_SESSION_CVP_DMM_PARAMS\
  121. (HFI_CMD_SESSION_CVP_START + 0x064)
  122. #define HFI_CMD_SESSION_CVP_WARP_DS_PARAMS\
  123. (HFI_CMD_SESSION_CVP_START + 0x065)
  124. #define HFI_CMD_SESSION_CVP_ICA_FRAME\
  125. (HFI_CMD_SESSION_CVP_START + 0x100)
  126. #define HFI_CMD_SESSION_CVP_ICA_CONFIG\
  127. (HFI_CMD_SESSION_CVP_START + 0x101)
  128. #define HFI_MSG_SESSION_CVP_START \
  129. (HFI_DOMAIN_BASE_CVP + HFI_ARCH_COMMON_OFFSET + \
  130. HFI_MSG_START_OFFSET + 0x1000)
  131. #define HFI_MSG_SESSION_CVP_SET_BUFFERS\
  132. (HFI_MSG_SESSION_CVP_START + 0x001)
  133. #define HFI_MSG_SESSION_CVP_RELEASE_BUFFERS \
  134. (HFI_MSG_SESSION_CVP_START + 0x002)
  135. #define HFI_MSG_SESSION_CVP_DS\
  136. (HFI_MSG_SESSION_CVP_START + 0x003)
  137. #define HFI_MSG_SESSION_CVP_HCD\
  138. (HFI_MSG_SESSION_CVP_START + 0x004)
  139. #define HFI_MSG_SESSION_CVP_CV_HOG\
  140. (HFI_MSG_SESSION_CVP_START + 0x005)
  141. #define HFI_MSG_SESSION_CVP_SVM\
  142. (HFI_MSG_SESSION_CVP_START + 0x006)
  143. #define HFI_MSG_SESSION_CVP_NCC\
  144. (HFI_MSG_SESSION_CVP_START + 0x007)
  145. #define HFI_MSG_SESSION_CVP_DFS\
  146. (HFI_MSG_SESSION_CVP_START + 0x008)
  147. #define HFI_MSG_SESSION_CVP_TME\
  148. (HFI_MSG_SESSION_CVP_START + 0x009)
  149. #define HFI_MSG_SESSION_CVP_FTEXT\
  150. (HFI_MSG_SESSION_CVP_START + 0x00A)
  151. #define HFI_MSG_SESSION_CVP_ICA\
  152. (HFI_MSG_SESSION_CVP_START + 0x014)
  153. #define HFI_MSG_SESSION_CVP_DME\
  154. (HFI_MSG_SESSION_CVP_START + 0x023)
  155. #define HFI_MSG_SESSION_CVP_OPERATION_CONFIG (HFI_MSG_SESSION_CVP_START + 0x030)
  156. #define HFI_MSG_SESSION_CVP_SET_PERSIST_BUFFERS\
  157. (HFI_MSG_SESSION_CVP_START + 0x034)
  158. #define HFI_MSG_SESSION_CVP_SET_MODEL_BUFFERS\
  159. (HFI_MSG_SESSION_CVP_START + 0x036)
  160. #define HFI_MSG_SESSION_CVP_FD\
  161. (HFI_MSG_SESSION_CVP_START + 0x037)
  162. #define HFI_MSG_SESSION_CVP_RELEASE_PERSIST_BUFFERS\
  163. (HFI_MSG_SESSION_CVP_START + 0x038)
  164. #define HFI_MSG_SESSION_CVP_RELEASE_MODEL_BUFFERS\
  165. (HFI_MSG_SESSION_CVP_START + 0x039)
  166. #define HFI_MSG_SESSION_CVP_SGM_OF\
  167. (HFI_MSG_SESSION_CVP_START + 0x03A)
  168. #define HFI_MSG_SESSION_CVP_GCE\
  169. (HFI_MSG_SESSION_CVP_START + 0x03B)
  170. #define HFI_MSG_SESSION_CVP_WARP_NCC\
  171. (HFI_MSG_SESSION_CVP_START + 0x03C)
  172. #define HFI_MSG_SESSION_CVP_DMM\
  173. (HFI_MSG_SESSION_CVP_START + 0x03D)
  174. #define HFI_MSG_SESSION_CVP_SGM_DFS\
  175. (HFI_MSG_SESSION_CVP_START + 0x03E)
  176. #define HFI_MSG_SESSION_CVP_WARP\
  177. (HFI_MSG_SESSION_CVP_START + 0x03F)
  178. #define HFI_MSG_SESSION_CVP_DMM_PARAMS\
  179. (HFI_MSG_SESSION_CVP_START + 0x040)
  180. #define HFI_MSG_SESSION_CVP_WARP_DS_PARAMS\
  181. (HFI_MSG_SESSION_CVP_START + 0x041)
  182. #define HFI_MSG_SESSION_CVP_FLUSH\
  183. (HFI_MSG_SESSION_CVP_START + 0x004A)
  184. #define CVP_IFACEQ_MAX_PKT_SIZE 1024
  185. #define CVP_IFACEQ_MED_PKT_SIZE 768
  186. #define CVP_IFACEQ_MIN_PKT_SIZE 8
  187. #define CVP_IFACEQ_VAR_SMALL_PKT_SIZE 100
  188. #define CVP_IFACEQ_VAR_LARGE_PKT_SIZE 512
  189. #define CVP_IFACEQ_VAR_HUGE_PKT_SIZE (1024*12)
  190. /* HFI packet info needed for sanity check */
  191. #define HFI_DFS_CONFIG_CMD_SIZE 38
  192. #define HFI_DFS_FRAME_CMD_SIZE 16
  193. #define HFI_DMM_CONFIG_CMD_SIZE 194
  194. #define HFI_DMM_BASIC_CONFIG_CMD_SIZE 51
  195. #define HFI_DMM_FRAME_CMD_SIZE 28
  196. #define HFI_PERSIST_CMD_SIZE 11
  197. #define HFI_DS_CMD_SIZE 50
  198. #define HFI_OF_CONFIG_CMD_SIZE 34
  199. #define HFI_OF_FRAME_CMD_SIZE 24
  200. #define HFI_ODT_CONFIG_CMD_SIZE 23
  201. #define HFI_ODT_FRAME_CMD_SIZE 33
  202. #define HFI_OD_CONFIG_CMD_SIZE 24
  203. #define HFI_OD_FRAME_CMD_SIZE 12
  204. #define HFI_NCC_CONFIG_CMD_SIZE 47
  205. #define HFI_NCC_FRAME_CMD_SIZE 22
  206. #define HFI_ICA_CONFIG_CMD_SIZE 127
  207. #define HFI_ICA_FRAME_CMD_SIZE 14
  208. #define HFI_HCD_CONFIG_CMD_SIZE 46
  209. #define HFI_HCD_FRAME_CMD_SIZE 18
  210. #define HFI_DCM_CONFIG_CMD_SIZE 20
  211. #define HFI_DCM_FRAME_CMD_SIZE 19
  212. #define HFI_PYS_HCD_CONFIG_CMD_SIZE 461
  213. #define HFI_PYS_HCD_FRAME_CMD_SIZE 66
  214. #define HFI_FD_CONFIG_CMD_SIZE 28
  215. #define HFI_FD_FRAME_CMD_SIZE 10
  216. struct cvp_hfi_cmd_session_flush_packet {
  217. u32 size;
  218. u32 packet_type;
  219. u32 session_id;
  220. u32 flush_type;
  221. };
  222. struct cvp_hfi_cmd_session_get_property_packet {
  223. u32 size;
  224. u32 packet_type;
  225. u32 session_id;
  226. u32 num_properties;
  227. u32 rg_property_data[1];
  228. };
  229. struct cvp_hfi_msg_sys_session_abort_done_packet {
  230. u32 size;
  231. u32 packet_type;
  232. u32 session_id;
  233. u32 error_type;
  234. };
  235. struct cvp_hfi_msg_sys_property_info_packet {
  236. u32 size;
  237. u32 packet_type;
  238. u32 num_properties;
  239. u32 rg_property_data[128];
  240. };
  241. enum session_flags {
  242. SESSION_PAUSE = BIT(1),
  243. };
  244. struct cvp_hal_session {
  245. struct list_head list;
  246. void *session_id;
  247. u32 flags;
  248. void *device;
  249. };
  250. enum buf_map_type {
  251. MAP_PERSIST = 1,
  252. UNMAP_PERSIST = 2,
  253. MAP_FRAME = 3,
  254. MAP_INVALID,
  255. };
  256. static inline enum buf_map_type cvp_find_map_type(int pkt_type)
  257. {
  258. if (pkt_type == HFI_CMD_SESSION_CVP_SET_PERSIST_BUFFERS ||
  259. pkt_type == HFI_CMD_SESSION_CVP_SET_MODEL_BUFFERS ||
  260. pkt_type == HFI_CMD_SESSION_CVP_DMM_PARAMS ||
  261. pkt_type == HFI_CMD_SESSION_CVP_WARP_DS_PARAMS)
  262. return MAP_PERSIST;
  263. else if (pkt_type == HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS)
  264. return UNMAP_PERSIST;
  265. else
  266. return MAP_FRAME;
  267. }
  268. #endif