cvp_hfi.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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. struct cvp_hfi_cmd_session_flush_packet {
  191. u32 size;
  192. u32 packet_type;
  193. u32 session_id;
  194. u32 flush_type;
  195. };
  196. struct cvp_hfi_cmd_session_get_property_packet {
  197. u32 size;
  198. u32 packet_type;
  199. u32 session_id;
  200. u32 num_properties;
  201. u32 rg_property_data[1];
  202. };
  203. struct cvp_hfi_msg_sys_session_abort_done_packet {
  204. u32 size;
  205. u32 packet_type;
  206. u32 session_id;
  207. u32 error_type;
  208. };
  209. struct cvp_hfi_msg_sys_property_info_packet {
  210. u32 size;
  211. u32 packet_type;
  212. u32 num_properties;
  213. u32 rg_property_data[128];
  214. };
  215. enum session_flags {
  216. SESSION_PAUSE = BIT(1),
  217. };
  218. struct cvp_hal_session {
  219. struct list_head list;
  220. void *session_id;
  221. u32 flags;
  222. void *device;
  223. };
  224. struct msm_cvp_fw {
  225. int cookie;
  226. };
  227. int cvp_hfi_process_msg_packet(u32 device_id,
  228. void *msg_hdr, struct msm_cvp_cb_info *info);
  229. enum cvp_status cvp_hfi_process_sys_init_done_prop_read(
  230. struct cvp_hfi_msg_sys_init_done_packet *pkt,
  231. struct cvp_hal_sys_init_done *sys_init_done);
  232. enum cvp_status hfi_process_session_init_done_prop_read(
  233. struct cvp_hfi_msg_sys_session_init_done_packet *pkt,
  234. struct cvp_hal_session_init_done *session_init_done);
  235. #endif