Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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_ENC 1
14#define HFI_SESSION_TYPE_DEC 2
15
16#define HFI_VIDEO_CODEC_H264 0x00000002
17#define HFI_VIDEO_CODEC_HEVC 0x00002000
18#define HFI_VIDEO_CODEC_VP9 0x00004000
19
20#define HFI_ERR_NONE 0x0
21
22#define HFI_CMD_SYS_INIT 0x10001
23#define HFI_CMD_SYS_PC_PREP 0x10002
24#define HFI_CMD_SYS_SET_PROPERTY 0x10005
25#define HFI_CMD_SYS_GET_PROPERTY 0x10006
26#define HFI_CMD_SYS_SESSION_INIT 0x10007
27#define HFI_CMD_SYS_SESSION_END 0x10008
28
29#define HFI_CMD_SESSION_SET_PROPERTY 0x11001
30#define HFI_CMD_SESSION_SET_BUFFERS 0x11002
31
32#define HFI_CMD_SESSION_LOAD_RESOURCES 0x211001
33#define HFI_CMD_SESSION_START 0x211002
34#define HFI_CMD_SESSION_STOP 0x211003
35#define HFI_CMD_SESSION_EMPTY_BUFFER 0x211004
36#define HFI_CMD_SESSION_FILL_BUFFER 0x211005
37#define HFI_CMD_SESSION_FLUSH 0x211008
38#define HFI_CMD_SESSION_RELEASE_BUFFERS 0x21100b
39#define HFI_CMD_SESSION_RELEASE_RESOURCES 0x21100c
40#define HFI_CMD_SESSION_CONTINUE 0x21100d
41
42#define HFI_ERR_SESSION_UNSUPPORTED_SETTING 0x1008
43#define HFI_ERR_SESSION_UNSUPPORTED_STREAM 0x100d
44#define HFI_ERR_SESSION_UNSUPPORT_BUFFERTYPE 0x1010
45#define HFI_ERR_SESSION_INVALID_SCALE_FACTOR 0x1012
46#define HFI_ERR_SESSION_UPSCALE_NOT_SUPPORTED 0x1013
47
48#define HFI_EVENT_SYS_ERROR 0x1
49#define HFI_EVENT_SESSION_ERROR 0x2
50
51#define HFI_EVENT_DATA_SEQUENCE_CHANGED_SUFFICIENT_BUF_RESOURCES 0x1000001
52#define HFI_EVENT_DATA_SEQUENCE_CHANGED_INSUFFICIENT_BUF_RESOURCES 0x1000002
53#define HFI_EVENT_SESSION_SEQUENCE_CHANGED 0x1000003
54
55#define HFI_BUFFERFLAG_EOS 0x00000001
56#define HFI_BUFFERFLAG_TIMESTAMPINVALID 0x00000100
57
58#define HFI_FLUSH_OUTPUT 0x1000002
59#define HFI_FLUSH_OUTPUT2 0x1000003
60#define HFI_FLUSH_ALL 0x1000004
61
62#define HFI_INDEX_EXTRADATA_INPUT_CROP 0x0700000e
63
64#define HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL 0x201001
65#define HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO 0x201002
66#define HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE 0x201008
67#define HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL 0x20100c
68
69#define HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS 0x202001
70
71#define HFI_PROPERTY_PARAM_VDEC_DPB_COUNTS 0x120300e
72#define HFI_PROPERTY_CONFIG_VDEC_ENTROPY 0x1204004
73
74#define HFI_BUFFER_INPUT 0x1
75#define HFI_BUFFER_OUTPUT 0x2
76#define HFI_BUFFER_OUTPUT2 0x3
77#define HFI_BUFFER_INTERNAL_PERSIST 0x4
78#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5
79#define HFI_BUFFER_INTERNAL_SCRATCH 0x6
80#define HFI_BUFFER_INTERNAL_SCRATCH_1 0x7
81#define HFI_BUFFER_INTERNAL_SCRATCH_2 0x8
82
83#define HFI_PROPERTY_SYS_CODEC_POWER_PLANE_CTRL 0x5
84#define HFI_PROPERTY_SYS_IMAGE_VERSION 0x6
85
86#define HFI_PROPERTY_PARAM_FRAME_SIZE 0x1001
87#define HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO 0x1002
88#define HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT 0x1003
89#define HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT 0x1005
90#define HFI_PROPERTY_PARAM_WORK_MODE 0x1015
91#define HFI_PROPERTY_PARAM_WORK_ROUTE 0x1017
92#define HFI_PROPERTY_CONFIG_FRAME_RATE 0x2001
93#define HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE 0x2002
94
95#define HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM 0x1003001
96#define HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH 0x1003007
97#define HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT 0x1003009
98#define HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE 0x100300a
99#define HFI_CORE_ID_1 1
100#define HFI_COLOR_FORMAT_NV12 0x02
101#define HFI_COLOR_FORMAT_NV12_UBWC 0x8002
102
103#define HFI_MSG_SYS_INIT 0x20001
104#define HFI_MSG_SYS_SESSION_INIT 0x20006
105#define HFI_MSG_SYS_SESSION_END 0x20007
106#define HFI_MSG_SYS_COV 0x20009
107#define HFI_MSG_SYS_PROPERTY_INFO 0x2000a
108
109#define HFI_MSG_EVENT_NOTIFY 0x21001
110#define HFI_MSG_SESSION_LOAD_RESOURCES 0x221001
111#define HFI_MSG_SESSION_START 0x221002
112#define HFI_MSG_SESSION_STOP 0x221003
113#define HFI_MSG_SESSION_FLUSH 0x221006
114#define HFI_MSG_SESSION_EMPTY_BUFFER 0x221007
115#define HFI_MSG_SESSION_FILL_BUFFER 0x221008
116#define HFI_MSG_SESSION_RELEASE_RESOURCES 0x22100a
117#define HFI_MSG_SESSION_RELEASE_BUFFERS 0x22100c
118
119#define HFI_GEN1_PICTURE_I 0x00000001
120#define HFI_GEN1_PICTURE_P 0x00000002
121#define HFI_GEN1_PICTURE_B 0x00000004
122#define HFI_GEN1_PICTURE_IDR 0x00000008
123#define HFI_FRAME_NOTCODED 0x7f002000
124#define HFI_FRAME_YUV 0x7f004000
125#define HFI_UNUSED_PICT 0x10000000
126#define HFI_BUFFERFLAG_DATACORRUPT 0x00000008
127#define HFI_BUFFERFLAG_DROP_FRAME 0x20000000
128#define HFI_RATE_CONTROL_OFF 0x1000001
129#define HFI_RATE_CONTROL_VBR_VFR 0x1000002
130#define HFI_RATE_CONTROL_VBR_CFR 0x1000003
131#define HFI_RATE_CONTROL_CBR_VFR 0x1000004
132#define HFI_RATE_CONTROL_CBR_CFR 0x1000005
133#define HFI_RATE_CONTROL_CQ 0x1000008
134
135#define HFI_H264_ENTROPY_CAVLC 0x1
136#define HFI_H264_ENTROPY_CABAC 0x2
137
138#define HFI_PROPERTY_PARAM_VENC_H264_ENTROPY_CONTROL 0x2005002
139#define HFI_PROPERTY_PARAM_VENC_H264_DEBLOCK_CONTROL 0x2005003
140#define HFI_PROPERTY_PARAM_VENC_RATE_CONTROL 0x2005004
141#define HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE_V2 0x2005009
142#define HFI_PROPERTY_PARAM_VENC_MAX_NUM_B_FRAMES 0x2005020
143#define HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE 0x2006001
144#define HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER 0x2006008
145
146struct hfi_pkt_hdr {
147 u32 size;
148 u32 pkt_type;
149};
150
151struct hfi_session_hdr_pkt {
152 struct hfi_pkt_hdr hdr;
153 u32 session_id;
154};
155
156struct hfi_session_open_pkt {
157 struct hfi_session_hdr_pkt shdr;
158 u32 session_domain;
159 u32 session_codec;
160};
161
162struct hfi_session_pkt {
163 struct hfi_session_hdr_pkt shdr;
164};
165
166struct hfi_sys_init_pkt {
167 struct hfi_pkt_hdr hdr;
168 u32 arch_type;
169};
170
171struct hfi_sys_set_property_pkt {
172 struct hfi_pkt_hdr hdr;
173 u32 num_properties;
174 u32 data[];
175};
176
177struct hfi_sys_get_property_pkt {
178 struct hfi_pkt_hdr hdr;
179 u32 num_properties;
180 u32 data;
181};
182
183struct hfi_session_set_property_pkt {
184 struct hfi_session_hdr_pkt shdr;
185 u32 num_properties;
186 u32 data[];
187};
188
189struct hfi_sys_pc_prep_pkt {
190 struct hfi_pkt_hdr hdr;
191};
192
193struct hfi_session_set_buffers_pkt {
194 struct hfi_session_hdr_pkt shdr;
195 u32 buffer_type;
196 u32 buffer_size;
197 u32 extradata_size;
198 u32 min_buffer_size;
199 u32 num_buffers;
200 u32 buffer_info[];
201};
202
203struct hfi_session_empty_buffer_compressed_pkt {
204 struct hfi_session_hdr_pkt shdr;
205 u32 time_stamp_hi;
206 u32 time_stamp_lo;
207 u32 flags;
208 u32 mark_target;
209 u32 mark_data;
210 u32 offset;
211 u32 alloc_len;
212 u32 filled_len;
213 u32 input_tag;
214 u32 packet_buffer;
215 u32 extradata_buffer;
216 u32 data;
217};
218
219struct hfi_session_empty_buffer_uncompressed_pkt {
220 struct hfi_session_hdr_pkt shdr;
221 u32 view_id;
222 u32 time_stamp_hi;
223 u32 time_stamp_lo;
224 u32 flags;
225 u32 mark_target;
226 u32 mark_data;
227 u32 alloc_len;
228 u32 filled_len;
229 u32 offset;
230 u32 input_tag;
231 u32 packet_buffer;
232 u32 extradata_buffer;
233 u32 data;
234};
235
236struct hfi_session_fill_buffer_pkt {
237 struct hfi_session_hdr_pkt shdr;
238 u32 stream_id;
239 u32 offset;
240 u32 alloc_len;
241 u32 filled_len;
242 u32 output_tag;
243 u32 packet_buffer;
244 u32 extradata_buffer;
245 u32 data;
246};
247
248struct hfi_session_flush_pkt {
249 struct hfi_session_hdr_pkt shdr;
250 u32 flush_type;
251};
252
253struct hfi_session_release_buffer_pkt {
254 struct hfi_session_hdr_pkt shdr;
255 u32 buffer_type;
256 u32 buffer_size;
257 u32 extradata_size;
258 u32 response_req;
259 u32 num_buffers;
260 u32 buffer_info[];
261};
262
263struct hfi_buffer_info {
264 u32 buffer_addr;
265 u32 extradata_addr;
266};
267
268struct hfi_msg_event_notify_pkt {
269 struct hfi_session_hdr_pkt shdr;
270 u32 event_id;
271 u32 event_data1;
272 u32 event_data2;
273 u32 ext_event_data[];
274};
275
276struct hfi_msg_sys_init_done_pkt {
277 struct hfi_pkt_hdr hdr;
278 u32 error_type;
279 u32 num_properties;
280 u32 data[];
281};
282
283struct hfi_msg_session_hdr_pkt {
284 struct hfi_session_hdr_pkt shdr;
285 u32 error_type;
286};
287
288struct hfi_msg_session_init_done_pkt {
289 struct hfi_msg_session_hdr_pkt shdr;
290 u32 num_properties;
291 u32 data[];
292};
293
294struct hfi_msg_sys_property_info_pkt {
295 struct hfi_pkt_hdr hdr;
296 u32 num_properties;
297 u32 property;
298 u8 data[];
299};
300
301struct hfi_msg_session_flush_done_pkt {
302 struct hfi_msg_session_hdr_pkt shdr;
303 u32 flush_type;
304};
305
306struct hfi_enable {
307 u32 enable;
308};
309
310struct hfi_profile_level {
311 u32 profile;
312 u32 level;
313};
314
315struct hfi_framesize {
316 u32 buffer_type;
317 u32 width;
318 u32 height;
319};
320
321struct hfi_videocores_usage_type {
322 u32 video_core_enable_mask;
323};
324
325struct hfi_video_work_mode {
326 u32 video_work_mode;
327};
328
329struct hfi_video_work_route {
330 u32 video_work_route;
331};
332
333struct hfi_bit_depth {
334 u32 buffer_type;
335 u32 bit_depth;
336};
337
338struct hfi_pic_struct {
339 u32 progressive_only;
340};
341
342struct hfi_colour_space {
343 u32 colour_space;
344};
345
346struct hfi_extradata_input_crop {
347 u32 size;
348 u32 version;
349 u32 port_index;
350 u32 left;
351 u32 top;
352 u32 width;
353 u32 height;
354};
355
356struct hfi_dpb_counts {
357 u32 max_dpb_count;
358 u32 max_ref_frames;
359 u32 max_dec_buffering;
360 u32 max_reorder_frames;
361 u32 fw_min_count;
362};
363
364struct hfi_uncompressed_format_select {
365 u32 buffer_type;
366 u32 format;
367};
368
369struct hfi_uncompressed_plane_constraints {
370 u32 stride_multiples;
371 u32 max_stride;
372 u32 min_plane_buffer_height_multiple;
373 u32 buffer_alignment;
374};
375
376struct hfi_uncompressed_plane_actual_constraints_info {
377 u32 buffer_type;
378 u32 num_planes;
379 struct hfi_uncompressed_plane_constraints plane_format[2];
380};
381
382struct hfi_uncompressed_plane_actual {
383 int actual_stride;
384 u32 actual_plane_buffer_height;
385};
386
387struct hfi_uncompressed_plane_actual_info {
388 u32 buffer_type;
389 u32 num_planes;
390 struct hfi_uncompressed_plane_actual plane_format[2];
391};
392
393struct hfi_buffer_count_actual {
394 u32 type;
395 u32 count_actual;
396 u32 count_min_host;
397};
398
399struct hfi_buffer_size_actual {
400 u32 type;
401 u32 size;
402};
403
404struct hfi_multi_stream {
405 u32 buffer_type;
406 u32 enable;
407};
408
409struct hfi_buffer_requirements {
410 u32 type;
411 u32 size;
412 u32 region_size;
413 u32 hold_count;
414 u32 count_min;
415 u32 count_actual;
416 u32 contiguous;
417 u32 alignment;
418};
419
420struct hfi_bitrate {
421 u32 bitrate;
422 u32 layer_id;
423};
424
425#define HFI_H264_CABAC_MODEL_0 0x1
426
427struct hfi_h264_entropy_control {
428 u32 entropy_mode;
429 u32 cabac_model;
430};
431
432struct hfi_quantization_v2 {
433 u32 qp_packed;
434 u32 layer_id;
435 u32 enable;
436 u32 reserved[3];
437};
438
439struct hfi_quantization_range_v2 {
440 struct hfi_quantization_v2 min_qp;
441 struct hfi_quantization_v2 max_qp;
442 u32 reserved[4];
443};
444
445struct hfi_framerate {
446 u32 buffer_type;
447 u32 framerate;
448};
449
450struct hfi_event_data {
451 u32 error;
452 u32 height;
453 u32 width;
454 u32 event_type;
455 u32 packet_buffer;
456 u32 extradata_buffer;
457 u32 tag;
458 u32 profile;
459 u32 level;
460 u32 bit_depth;
461 u32 pic_struct;
462 u32 colour_space;
463 u32 entropy_mode;
464 u32 buf_count;
465 struct {
466 u32 left, top;
467 u32 width, height;
468 } input_crop;
469};
470
471struct hfi_msg_session_empty_buffer_done_pkt {
472 struct hfi_msg_session_hdr_pkt shdr;
473 u32 offset;
474 u32 filled_len;
475 u32 input_tag;
476 u32 packet_buffer;
477 u32 extradata_buffer;
478 u32 data[];
479};
480
481struct hfi_msg_session_fbd_compressed_pkt {
482 struct hfi_session_hdr_pkt shdr;
483 u32 time_stamp_hi;
484 u32 time_stamp_lo;
485 u32 error_type;
486 u32 flags;
487 u32 mark_target;
488 u32 mark_data;
489 u32 stats;
490 u32 offset;
491 u32 alloc_len;
492 u32 filled_len;
493 u32 input_tag;
494 u32 output_tag;
495 u32 picture_type;
496 u32 packet_buffer;
497 u32 extradata_buffer;
498 u32 data[];
499};
500
501struct hfi_msg_session_fbd_uncompressed_plane0_pkt {
502 struct hfi_session_hdr_pkt shdr;
503 u32 stream_id;
504 u32 view_id;
505 u32 error_type;
506 u32 time_stamp_hi;
507 u32 time_stamp_lo;
508 u32 flags;
509 u32 mark_target;
510 u32 mark_data;
511 u32 stats;
512 u32 alloc_len;
513 u32 filled_len;
514 u32 offset;
515 u32 frame_width;
516 u32 frame_height;
517 u32 start_x_coord;
518 u32 start_y_coord;
519 u32 input_tag;
520 u32 input_tag2;
521 u32 output_tag;
522 u32 picture_type;
523 u32 packet_buffer;
524 u32 extradata_buffer;
525 u32 data[];
526};
527
528struct hfi_msg_session_release_buffers_done_pkt {
529 struct hfi_msg_session_hdr_pkt shdr;
530 u32 num_buffers;
531 u32 buffer_info[];
532};
533
534struct hfi_msg_sys_debug_pkt {
535 struct hfi_pkt_hdr hdr;
536 u32 msg_type;
537 u32 msg_size;
538 u32 time_stamp_hi;
539 u32 time_stamp_lo;
540 u8 msg_data[];
541};
542
543struct hfi_msg_sys_coverage_pkt {
544 struct hfi_pkt_hdr hdr;
545 u32 msg_size;
546 u32 time_stamp_hi;
547 u32 time_stamp_lo;
548 u8 msg_data[];
549};
550
551#endif