cvp_hfi.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2020, 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. #define HFI_CMD_SESSION_CVP_START \
  11. (HFI_DOMAIN_BASE_CVP + HFI_ARCH_COMMON_OFFSET + \
  12. HFI_CMD_START_OFFSET + 0x1000)
  13. #define HFI_CMD_SESSION_CVP_SET_BUFFERS\
  14. (HFI_CMD_SESSION_CVP_START + 0x001)
  15. #define HFI_CMD_SESSION_CVP_RELEASE_BUFFERS\
  16. (HFI_CMD_SESSION_CVP_START + 0x002)
  17. #define HFI_CMD_SESSION_CVP_DS\
  18. (HFI_CMD_SESSION_CVP_START + 0x003)
  19. #define HFI_CMD_SESSION_CVP_HCD_FRAME\
  20. (HFI_CMD_SESSION_CVP_START + 0x004)
  21. #define HFI_CMD_SESSION_CVP_HCD_CONFIG\
  22. (HFI_CMD_SESSION_CVP_START + 0x005)
  23. #define HFI_CMD_SESSION_CVP_CV_HOG_FRAME\
  24. (HFI_CMD_SESSION_CVP_START + 0x006)
  25. #define HFI_CMD_SESSION_CVP_CV_HOG_CONFIG\
  26. (HFI_CMD_SESSION_CVP_START + 0x007)
  27. #define HFI_CMD_SESSION_CVP_SVM\
  28. (HFI_CMD_SESSION_CVP_START + 0x008)
  29. #define HFI_CMD_SESSION_CVP_NCC_FRAME\
  30. (HFI_CMD_SESSION_CVP_START + 0x009)
  31. #define HFI_CMD_SESSION_CVP_NCC_CONFIG\
  32. (HFI_CMD_SESSION_CVP_START + 0x00A)
  33. #define HFI_CMD_SESSION_CVP_DFS_FRAME\
  34. (HFI_CMD_SESSION_CVP_START + 0x00B)
  35. #define HFI_CMD_SESSION_CVP_DFS_CONFIG\
  36. (HFI_CMD_SESSION_CVP_START + 0x00C)
  37. #define HFI_CMD_SESSION_CVP_FTEXT\
  38. (HFI_CMD_SESSION_CVP_START + 0x00F)
  39. /* ==========CHAINED OPERATIONS===================*/
  40. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_FRAME\
  41. (HFI_CMD_SESSION_CVP_START + 0x010)
  42. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_CONFIG\
  43. (HFI_CMD_SESSION_CVP_START + 0x011)
  44. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_HCD_FRAME\
  45. (HFI_CMD_SESSION_CVP_START + 0x012)
  46. #define HFI_CMD_SESSION_CVP_CV_HOG_SVM_HCD_CONFIG\
  47. (HFI_CMD_SESSION_CVP_START + 0x013)
  48. #define HFI_CMD_SESSION_CVP_OPTICAL_FLOW\
  49. (HFI_CMD_SESSION_CVP_START + 0x014)
  50. /* ===========USECASE OPERATIONS===============*/
  51. #define HFI_CMD_SESSION_CVP_DC_FRAME\
  52. (HFI_CMD_SESSION_CVP_START + 0x030)
  53. #define HFI_CMD_SESSION_CVP_DC_CONFIG\
  54. (HFI_CMD_SESSION_CVP_START + 0x031)
  55. #define HFI_CMD_SESSION_CVP_DCM_FRAME\
  56. (HFI_CMD_SESSION_CVP_START + 0x034)
  57. #define HFI_CMD_SESSION_CVP_DCM_CONFIG\
  58. (HFI_CMD_SESSION_CVP_START + 0x035)
  59. #define HFI_CMD_SESSION_CVP_DME_CONFIG\
  60. (HFI_CMD_SESSION_CVP_START + 0x039)
  61. #define HFI_CMD_SESSION_CVP_DME_BASIC_CONFIG\
  62. (HFI_CMD_SESSION_CVP_START + 0x03B)
  63. #define HFI_CMD_SESSION_CVP_DME_FRAME\
  64. (HFI_CMD_SESSION_CVP_START + 0x03A)
  65. #define HFI_CMD_SESSION_CVP_CV_TME_CONFIG\
  66. (HFI_CMD_SESSION_CVP_START + 0x047)
  67. #define HFI_CMD_SESSION_CVP_CV_TME_FRAME\
  68. (HFI_CMD_SESSION_CVP_START + 0x048)
  69. #define HFI_CMD_SESSION_CVP_CV_OD_CONFIG\
  70. (HFI_CMD_SESSION_CVP_START + 0x049)
  71. #define HFI_CMD_SESSION_CVP_CV_OD_FRAME\
  72. (HFI_CMD_SESSION_CVP_START + 0x04A)
  73. #define HFI_CMD_SESSION_CVP_CV_ODT_CONFIG\
  74. (HFI_CMD_SESSION_CVP_START + 0x04B)
  75. #define HFI_CMD_SESSION_CVP_CV_ODT_FRAME\
  76. (HFI_CMD_SESSION_CVP_START + 0x04C)
  77. #define HFI_CMD_SESSION_CVP_SET_PERSIST_BUFFERS\
  78. (HFI_CMD_SESSION_CVP_START + 0x04D)
  79. #define HFI_CMD_SESSION_CVP_PYS_HCD_CONFIG\
  80. (HFI_CMD_SESSION_CVP_START + 0x050)
  81. #define HFI_CMD_SESSION_CVP_PYS_HCD_FRAME\
  82. (HFI_CMD_SESSION_CVP_START + 0x051)
  83. #define HFI_CMD_SESSION_CVP_SET_MODEL_BUFFERS\
  84. (HFI_CMD_SESSION_CVP_START + 0x052)
  85. #define HFI_CMD_SESSION_CVP_FD_CONFIG\
  86. (HFI_CMD_SESSION_CVP_START + 0x053)
  87. #define HFI_CMD_SESSION_CVP_FD_FRAME\
  88. (HFI_CMD_SESSION_CVP_START + 0x054)
  89. #define HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS\
  90. (HFI_CMD_SESSION_CVP_START + 0x055)
  91. #define HFI_CMD_SESSION_CVP_FLUSH\
  92. (HFI_CMD_SESSION_CVP_START + 0x057)
  93. #define HFI_CMD_SESSION_CVP_ICA_FRAME\
  94. (HFI_CMD_SESSION_CVP_START + 0x100)
  95. #define HFI_CMD_SESSION_CVP_ICA_CONFIG\
  96. (HFI_CMD_SESSION_CVP_START + 0x101)
  97. #define HFI_MSG_SESSION_CVP_START \
  98. (HFI_DOMAIN_BASE_CVP + HFI_ARCH_COMMON_OFFSET + \
  99. HFI_MSG_START_OFFSET + 0x1000)
  100. #define HFI_MSG_SESSION_CVP_SET_BUFFERS\
  101. (HFI_MSG_SESSION_CVP_START + 0x001)
  102. #define HFI_MSG_SESSION_CVP_RELEASE_BUFFERS \
  103. (HFI_MSG_SESSION_CVP_START + 0x002)
  104. #define HFI_MSG_SESSION_CVP_DS\
  105. (HFI_MSG_SESSION_CVP_START + 0x003)
  106. #define HFI_MSG_SESSION_CVP_HCD\
  107. (HFI_MSG_SESSION_CVP_START + 0x004)
  108. #define HFI_MSG_SESSION_CVP_CV_HOG\
  109. (HFI_MSG_SESSION_CVP_START + 0x005)
  110. #define HFI_MSG_SESSION_CVP_SVM\
  111. (HFI_MSG_SESSION_CVP_START + 0x006)
  112. #define HFI_MSG_SESSION_CVP_NCC\
  113. (HFI_MSG_SESSION_CVP_START + 0x007)
  114. #define HFI_MSG_SESSION_CVP_DFS\
  115. (HFI_MSG_SESSION_CVP_START + 0x008)
  116. #define HFI_MSG_SESSION_CVP_TME\
  117. (HFI_MSG_SESSION_CVP_START + 0x009)
  118. #define HFI_MSG_SESSION_CVP_FTEXT\
  119. (HFI_MSG_SESSION_CVP_START + 0x00A)
  120. #define HFI_MSG_SESSION_CVP_ICA\
  121. (HFI_MSG_SESSION_CVP_START + 0x014)
  122. #define HFI_MSG_SESSION_CVP_DME\
  123. (HFI_MSG_SESSION_CVP_START + 0x023)
  124. #define HFI_MSG_SESSION_CVP_OPERATION_CONFIG (HFI_MSG_SESSION_CVP_START + 0x030)
  125. #define HFI_MSG_SESSION_CVP_SET_PERSIST_BUFFERS\
  126. (HFI_MSG_SESSION_CVP_START + 0x034)
  127. #define HFI_MSG_SESSION_CVP_SET_MODEL_BUFFERS\
  128. (HFI_MSG_SESSION_CVP_START + 0x036)
  129. #define HFI_MSG_SESSION_CVP_FD\
  130. (HFI_MSG_SESSION_CVP_START + 0x037)
  131. #define HFI_MSG_SESSION_CVP_RELEASE_PERSIST_BUFFERS\
  132. (HFI_MSG_SESSION_CVP_START + 0x038)
  133. #define HFI_MSG_SESSION_CVP_FLUSH_DEPRECATE\
  134. (HFI_CMD_SESSION_CVP_START + 0x03A)
  135. #define HFI_MSG_SESSION_CVP_FLUSH\
  136. (HFI_MSG_SESSION_CVP_START + 0x03A)
  137. #define CVP_IFACEQ_MAX_PKT_SIZE 1024
  138. #define CVP_IFACEQ_MED_PKT_SIZE 768
  139. #define CVP_IFACEQ_MIN_PKT_SIZE 8
  140. #define CVP_IFACEQ_VAR_SMALL_PKT_SIZE 100
  141. #define CVP_IFACEQ_VAR_LARGE_PKT_SIZE 512
  142. #define CVP_IFACEQ_VAR_HUGE_PKT_SIZE (1024*12)
  143. struct cvp_hfi_cmd_session_flush_packet {
  144. u32 size;
  145. u32 packet_type;
  146. u32 session_id;
  147. u32 flush_type;
  148. };
  149. struct cvp_hfi_cmd_session_get_property_packet {
  150. u32 size;
  151. u32 packet_type;
  152. u32 session_id;
  153. u32 num_properties;
  154. u32 rg_property_data[1];
  155. };
  156. struct cvp_hfi_msg_sys_session_abort_done_packet {
  157. u32 size;
  158. u32 packet_type;
  159. u32 session_id;
  160. u32 error_type;
  161. };
  162. struct cvp_hfi_msg_sys_property_info_packet {
  163. u32 size;
  164. u32 packet_type;
  165. u32 num_properties;
  166. u32 rg_property_data[128];
  167. };
  168. enum session_flags {
  169. SESSION_PAUSE = BIT(1),
  170. };
  171. struct cvp_hal_session {
  172. struct list_head list;
  173. void *session_id;
  174. u32 flags;
  175. void *device;
  176. };
  177. struct msm_cvp_fw {
  178. void *cookie;
  179. };
  180. int cvp_hfi_process_msg_packet(u32 device_id,
  181. void *msg_hdr, struct msm_cvp_cb_info *info);
  182. enum cvp_status cvp_hfi_process_sys_init_done_prop_read(
  183. struct cvp_hfi_msg_sys_init_done_packet *pkt,
  184. struct cvp_hal_sys_init_done *sys_init_done);
  185. enum cvp_status hfi_process_session_init_done_prop_read(
  186. struct cvp_hfi_msg_sys_session_init_done_packet *pkt,
  187. struct cvp_hal_session_init_done *session_init_done);
  188. #endif