1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 */ 5 6 #ifndef __IRIS_HFI_GEN1_DEFINES_H__ 7 #define __IRIS_HFI_GEN1_DEFINES_H__ 8 9 #include <linux/types.h> 10 11 #define HFI_VIDEO_ARCH_OX 0x1 12 13 #define HFI_SESSION_TYPE_DEC 2 14 15 #define HFI_VIDEO_CODEC_H264 0x00000002 16 17 #define HFI_ERR_NONE 0x0 18 19 #define HFI_CMD_SYS_INIT 0x10001 20 #define HFI_CMD_SYS_PC_PREP 0x10002 21 #define HFI_CMD_SYS_SET_PROPERTY 0x10005 22 #define HFI_CMD_SYS_GET_PROPERTY 0x10006 23 #define HFI_CMD_SYS_SESSION_INIT 0x10007 24 #define HFI_CMD_SYS_SESSION_END 0x10008 25 26 #define HFI_CMD_SESSION_SET_PROPERTY 0x11001 27 #define HFI_CMD_SESSION_SET_BUFFERS 0x11002 28 29 #define HFI_CMD_SESSION_LOAD_RESOURCES 0x211001 30 #define HFI_CMD_SESSION_START 0x211002 31 #define HFI_CMD_SESSION_STOP 0x211003 32 #define HFI_CMD_SESSION_EMPTY_BUFFER 0x211004 33 #define HFI_CMD_SESSION_FILL_BUFFER 0x211005 34 #define HFI_CMD_SESSION_FLUSH 0x211008 35 #define HFI_CMD_SESSION_RELEASE_BUFFERS 0x21100b 36 #define HFI_CMD_SESSION_RELEASE_RESOURCES 0x21100c 37 #define HFI_CMD_SESSION_CONTINUE 0x21100d 38 39 #define HFI_ERR_SESSION_UNSUPPORTED_SETTING 0x1008 40 #define HFI_ERR_SESSION_UNSUPPORTED_STREAM 0x100d 41 #define HFI_ERR_SESSION_UNSUPPORT_BUFFERTYPE 0x1010 42 #define HFI_ERR_SESSION_INVALID_SCALE_FACTOR 0x1012 43 #define HFI_ERR_SESSION_UPSCALE_NOT_SUPPORTED 0x1013 44 45 #define HFI_EVENT_SYS_ERROR 0x1 46 #define HFI_EVENT_SESSION_ERROR 0x2 47 48 #define HFI_EVENT_DATA_SEQUENCE_CHANGED_SUFFICIENT_BUF_RESOURCES 0x1000001 49 #define HFI_EVENT_DATA_SEQUENCE_CHANGED_INSUFFICIENT_BUF_RESOURCES 0x1000002 50 #define HFI_EVENT_SESSION_SEQUENCE_CHANGED 0x1000003 51 52 #define HFI_BUFFERFLAG_EOS 0x00000001 53 #define HFI_BUFFERFLAG_TIMESTAMPINVALID 0x00000100 54 55 #define HFI_FLUSH_OUTPUT 0x1000002 56 #define HFI_FLUSH_OUTPUT2 0x1000003 57 #define HFI_FLUSH_ALL 0x1000004 58 59 #define HFI_INDEX_EXTRADATA_INPUT_CROP 0x0700000e 60 61 #define HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL 0x201001 62 #define HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO 0x201002 63 #define HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE 0x201008 64 #define HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL 0x20100c 65 66 #define HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS 0x202001 67 68 #define HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER 0x1200001 69 #define HFI_PROPERTY_PARAM_VDEC_DPB_COUNTS 0x120300e 70 #define HFI_PROPERTY_CONFIG_VDEC_ENTROPY 0x1204004 71 72 #define HFI_BUFFER_INPUT 0x1 73 #define HFI_BUFFER_OUTPUT 0x2 74 #define HFI_BUFFER_OUTPUT2 0x3 75 #define HFI_BUFFER_INTERNAL_PERSIST_1 0x5 76 #define HFI_BUFFER_INTERNAL_SCRATCH 0x6 77 #define HFI_BUFFER_INTERNAL_SCRATCH_1 0x7 78 79 #define HFI_PROPERTY_SYS_CODEC_POWER_PLANE_CTRL 0x5 80 #define HFI_PROPERTY_SYS_IMAGE_VERSION 0x6 81 82 #define HFI_PROPERTY_PARAM_FRAME_SIZE 0x1001 83 #define HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT 0x1003 84 #define HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT 0x1005 85 #define HFI_PROPERTY_PARAM_WORK_MODE 0x1015 86 #define HFI_PROPERTY_PARAM_WORK_ROUTE 0x1017 87 #define HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE 0x2002 88 89 #define HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM 0x1003001 90 #define HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH 0x1003007 91 #define HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT 0x1003009 92 #define HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE 0x100300a 93 #define HFI_CORE_ID_1 1 94 #define HFI_COLOR_FORMAT_NV12 0x02 95 #define HFI_COLOR_FORMAT_NV12_UBWC 0x8002 96 97 #define HFI_MSG_SYS_INIT 0x20001 98 #define HFI_MSG_SYS_SESSION_INIT 0x20006 99 #define HFI_MSG_SYS_SESSION_END 0x20007 100 #define HFI_MSG_SYS_COV 0x20009 101 #define HFI_MSG_SYS_PROPERTY_INFO 0x2000a 102 103 #define HFI_MSG_EVENT_NOTIFY 0x21001 104 #define HFI_MSG_SESSION_LOAD_RESOURCES 0x221001 105 #define HFI_MSG_SESSION_START 0x221002 106 #define HFI_MSG_SESSION_STOP 0x221003 107 #define HFI_MSG_SESSION_FLUSH 0x221006 108 #define HFI_MSG_SESSION_EMPTY_BUFFER 0x221007 109 #define HFI_MSG_SESSION_FILL_BUFFER 0x221008 110 #define HFI_MSG_SESSION_RELEASE_RESOURCES 0x22100a 111 #define HFI_MSG_SESSION_RELEASE_BUFFERS 0x22100c 112 113 #define HFI_PICTURE_I 0x00000001 114 #define HFI_PICTURE_P 0x00000002 115 #define HFI_PICTURE_B 0x00000004 116 #define HFI_PICTURE_IDR 0x00000008 117 #define HFI_FRAME_NOTCODED 0x7f002000 118 #define HFI_FRAME_YUV 0x7f004000 119 #define HFI_UNUSED_PICT 0x10000000 120 121 struct hfi_pkt_hdr { 122 u32 size; 123 u32 pkt_type; 124 }; 125 126 struct hfi_session_hdr_pkt { 127 struct hfi_pkt_hdr hdr; 128 u32 session_id; 129 }; 130 131 struct hfi_session_open_pkt { 132 struct hfi_session_hdr_pkt shdr; 133 u32 session_domain; 134 u32 session_codec; 135 }; 136 137 struct hfi_session_pkt { 138 struct hfi_session_hdr_pkt shdr; 139 }; 140 141 struct hfi_sys_init_pkt { 142 struct hfi_pkt_hdr hdr; 143 u32 arch_type; 144 }; 145 146 struct hfi_sys_set_property_pkt { 147 struct hfi_pkt_hdr hdr; 148 u32 num_properties; 149 u32 data[]; 150 }; 151 152 struct hfi_sys_get_property_pkt { 153 struct hfi_pkt_hdr hdr; 154 u32 num_properties; 155 u32 data; 156 }; 157 158 struct hfi_session_set_property_pkt { 159 struct hfi_session_hdr_pkt shdr; 160 u32 num_properties; 161 u32 data[]; 162 }; 163 164 struct hfi_sys_pc_prep_pkt { 165 struct hfi_pkt_hdr hdr; 166 }; 167 168 struct hfi_session_set_buffers_pkt { 169 struct hfi_session_hdr_pkt shdr; 170 u32 buffer_type; 171 u32 buffer_size; 172 u32 extradata_size; 173 u32 min_buffer_size; 174 u32 num_buffers; 175 u32 buffer_info[]; 176 }; 177 178 struct hfi_session_empty_buffer_compressed_pkt { 179 struct hfi_session_hdr_pkt shdr; 180 u32 time_stamp_hi; 181 u32 time_stamp_lo; 182 u32 flags; 183 u32 mark_target; 184 u32 mark_data; 185 u32 offset; 186 u32 alloc_len; 187 u32 filled_len; 188 u32 input_tag; 189 u32 packet_buffer; 190 u32 extradata_buffer; 191 u32 data; 192 }; 193 194 struct hfi_session_fill_buffer_pkt { 195 struct hfi_session_hdr_pkt shdr; 196 u32 stream_id; 197 u32 offset; 198 u32 alloc_len; 199 u32 filled_len; 200 u32 output_tag; 201 u32 packet_buffer; 202 u32 extradata_buffer; 203 u32 data; 204 }; 205 206 struct hfi_session_flush_pkt { 207 struct hfi_session_hdr_pkt shdr; 208 u32 flush_type; 209 }; 210 211 struct hfi_session_release_buffer_pkt { 212 struct hfi_session_hdr_pkt shdr; 213 u32 buffer_type; 214 u32 buffer_size; 215 u32 extradata_size; 216 u32 response_req; 217 u32 num_buffers; 218 u32 buffer_info[]; 219 }; 220 221 struct hfi_buffer_info { 222 u32 buffer_addr; 223 u32 extradata_addr; 224 }; 225 226 struct hfi_msg_event_notify_pkt { 227 struct hfi_session_hdr_pkt shdr; 228 u32 event_id; 229 u32 event_data1; 230 u32 event_data2; 231 u32 ext_event_data[]; 232 }; 233 234 struct hfi_msg_sys_init_done_pkt { 235 struct hfi_pkt_hdr hdr; 236 u32 error_type; 237 u32 num_properties; 238 u32 data[]; 239 }; 240 241 struct hfi_msg_session_hdr_pkt { 242 struct hfi_session_hdr_pkt shdr; 243 u32 error_type; 244 }; 245 246 struct hfi_msg_session_init_done_pkt { 247 struct hfi_msg_session_hdr_pkt shdr; 248 u32 num_properties; 249 u32 data[]; 250 }; 251 252 struct hfi_msg_sys_property_info_pkt { 253 struct hfi_pkt_hdr hdr; 254 u32 num_properties; 255 u32 property; 256 u8 data[]; 257 }; 258 259 struct hfi_msg_session_flush_done_pkt { 260 struct hfi_msg_session_hdr_pkt shdr; 261 u32 flush_type; 262 }; 263 264 struct hfi_enable { 265 u32 enable; 266 }; 267 268 struct hfi_profile_level { 269 u32 profile; 270 u32 level; 271 }; 272 273 struct hfi_framesize { 274 u32 buffer_type; 275 u32 width; 276 u32 height; 277 }; 278 279 struct hfi_videocores_usage_type { 280 u32 video_core_enable_mask; 281 }; 282 283 struct hfi_video_work_mode { 284 u32 video_work_mode; 285 }; 286 287 struct hfi_video_work_route { 288 u32 video_work_route; 289 }; 290 291 struct hfi_bit_depth { 292 u32 buffer_type; 293 u32 bit_depth; 294 }; 295 296 struct hfi_pic_struct { 297 u32 progressive_only; 298 }; 299 300 struct hfi_colour_space { 301 u32 colour_space; 302 }; 303 304 struct hfi_extradata_input_crop { 305 u32 size; 306 u32 version; 307 u32 port_index; 308 u32 left; 309 u32 top; 310 u32 width; 311 u32 height; 312 }; 313 314 struct hfi_dpb_counts { 315 u32 max_dpb_count; 316 u32 max_ref_frames; 317 u32 max_dec_buffering; 318 u32 max_reorder_frames; 319 u32 fw_min_count; 320 }; 321 322 struct hfi_uncompressed_format_select { 323 u32 buffer_type; 324 u32 format; 325 }; 326 327 struct hfi_uncompressed_plane_constraints { 328 u32 stride_multiples; 329 u32 max_stride; 330 u32 min_plane_buffer_height_multiple; 331 u32 buffer_alignment; 332 }; 333 334 struct hfi_uncompressed_plane_actual_constraints_info { 335 u32 buffer_type; 336 u32 num_planes; 337 struct hfi_uncompressed_plane_constraints plane_format[2]; 338 }; 339 340 struct hfi_buffer_count_actual { 341 u32 type; 342 u32 count_actual; 343 u32 count_min_host; 344 }; 345 346 struct hfi_buffer_size_actual { 347 u32 type; 348 u32 size; 349 }; 350 351 struct hfi_multi_stream { 352 u32 buffer_type; 353 u32 enable; 354 }; 355 356 struct hfi_buffer_requirements { 357 u32 type; 358 u32 size; 359 u32 region_size; 360 u32 hold_count; 361 u32 count_min; 362 u32 count_actual; 363 u32 contiguous; 364 u32 alignment; 365 }; 366 367 struct hfi_event_data { 368 u32 error; 369 u32 height; 370 u32 width; 371 u32 event_type; 372 u32 packet_buffer; 373 u32 extradata_buffer; 374 u32 tag; 375 u32 profile; 376 u32 level; 377 u32 bit_depth; 378 u32 pic_struct; 379 u32 colour_space; 380 u32 entropy_mode; 381 u32 buf_count; 382 struct { 383 u32 left, top; 384 u32 width, height; 385 } input_crop; 386 }; 387 388 struct hfi_msg_session_empty_buffer_done_pkt { 389 struct hfi_msg_session_hdr_pkt shdr; 390 u32 offset; 391 u32 filled_len; 392 u32 input_tag; 393 u32 packet_buffer; 394 u32 extradata_buffer; 395 u32 data[]; 396 }; 397 398 struct hfi_msg_session_fbd_uncompressed_plane0_pkt { 399 struct hfi_session_hdr_pkt shdr; 400 u32 stream_id; 401 u32 view_id; 402 u32 error_type; 403 u32 time_stamp_hi; 404 u32 time_stamp_lo; 405 u32 flags; 406 u32 mark_target; 407 u32 mark_data; 408 u32 stats; 409 u32 alloc_len; 410 u32 filled_len; 411 u32 offset; 412 u32 frame_width; 413 u32 frame_height; 414 u32 start_x_coord; 415 u32 start_y_coord; 416 u32 input_tag; 417 u32 input_tag2; 418 u32 output_tag; 419 u32 picture_type; 420 u32 packet_buffer; 421 u32 extradata_buffer; 422 u32 data[]; 423 }; 424 425 struct hfi_msg_session_release_buffers_done_pkt { 426 struct hfi_msg_session_hdr_pkt shdr; 427 u32 num_buffers; 428 u32 buffer_info[]; 429 }; 430 431 struct hfi_msg_sys_debug_pkt { 432 struct hfi_pkt_hdr hdr; 433 u32 msg_type; 434 u32 msg_size; 435 u32 time_stamp_hi; 436 u32 time_stamp_lo; 437 u8 msg_data[]; 438 }; 439 440 struct hfi_msg_sys_coverage_pkt { 441 struct hfi_pkt_hdr hdr; 442 u32 msg_size; 443 u32 time_stamp_hi; 444 u32 time_stamp_lo; 445 u8 msg_data[]; 446 }; 447 448 #endif 449