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