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_INSTANCE_H__ 7 #define __IRIS_INSTANCE_H__ 8 9 #include <media/v4l2-ctrls.h> 10 11 #include "iris_buffer.h" 12 #include "iris_core.h" 13 #include "iris_utils.h" 14 15 #define DEFAULT_WIDTH 320 16 #define DEFAULT_HEIGHT 240 17 18 enum iris_fmt_type_out { 19 IRIS_FMT_H264, 20 IRIS_FMT_HEVC, 21 IRIS_FMT_VP9, 22 IRIS_FMT_AV1, 23 }; 24 25 enum iris_fmt_type_cap { 26 IRIS_FMT_NV12, 27 IRIS_FMT_QC08C, 28 }; 29 30 struct iris_fmt { 31 u32 pixfmt; 32 u32 type; 33 }; 34 35 /** 36 * struct iris_inst - holds per video instance parameters 37 * 38 * @list: used for attach an instance to the core 39 * @core: pointer to core structure 40 * @session_id: id of current video session 41 * @ctx_q_lock: lock to serialize queues related ioctls 42 * @lock: lock to seralise forward and reverse threads 43 * @fh: reference of v4l2 file handler 44 * @fmt_src: structure of v4l2_format for source 45 * @fmt_dst: structure of v4l2_format for destination 46 * @ctrl_handler: reference of v4l2 ctrl handler 47 * @domain: domain type: encoder or decoder 48 * @crop: structure of crop info 49 * @compose: structure of compose info 50 * @completion: structure of signal completions 51 * @flush_completion: structure of signal completions for flush cmd 52 * @flush_responses_pending: counter to track number of pending flush responses 53 * @fw_caps: array of supported instance firmware capabilities 54 * @buffers: array of different iris buffers 55 * @fw_min_count: minimnum count of buffers needed by fw 56 * @state: instance state 57 * @sub_state: instance sub state 58 * @once_per_session_set: boolean to set once per session property 59 * @max_input_data_size: max size of input data 60 * @power: structure of power info 61 * @icc_data: structure of interconnect data 62 * @m2m_dev: a reference to m2m device structure 63 * @m2m_ctx: a reference to m2m context structure 64 * @sequence_cap: a sequence counter for capture queue 65 * @sequence_out: a sequence counter for output queue 66 * @tss: timestamp metadata 67 * @metadata_idx: index for metadata buffer 68 * @codec: codec type 69 * @last_buffer_dequeued: a flag to indicate that last buffer is sent by driver 70 * @frame_rate: frame rate of current instance 71 * @operating_rate: operating rate of current instance 72 * @hfi_rc_type: rate control type 73 */ 74 75 struct iris_inst { 76 struct list_head list; 77 struct iris_core *core; 78 u32 session_id; 79 struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ 80 struct mutex lock; /* lock to serialize forward and reverse threads */ 81 struct v4l2_fh fh; 82 struct v4l2_format *fmt_src; 83 struct v4l2_format *fmt_dst; 84 struct v4l2_ctrl_handler ctrl_handler; 85 enum domain_type domain; 86 struct iris_hfi_rect_desc crop; 87 struct iris_hfi_rect_desc compose; 88 struct completion completion; 89 struct completion flush_completion; 90 u32 flush_responses_pending; 91 struct platform_inst_fw_cap fw_caps[INST_FW_CAP_MAX]; 92 struct iris_buffers buffers[BUF_TYPE_MAX]; 93 u32 fw_min_count; 94 enum iris_inst_state state; 95 enum iris_inst_sub_state sub_state; 96 bool once_per_session_set; 97 size_t max_input_data_size; 98 struct iris_inst_power power; 99 struct icc_vote_data icc_data; 100 struct v4l2_m2m_dev *m2m_dev; 101 struct v4l2_m2m_ctx *m2m_ctx; 102 u32 sequence_cap; 103 u32 sequence_out; 104 struct iris_ts_metadata tss[VIDEO_MAX_FRAME]; 105 u32 metadata_idx; 106 u32 codec; 107 bool last_buffer_dequeued; 108 u32 frame_rate; 109 u32 operating_rate; 110 u32 hfi_rc_type; 111 }; 112 113 #endif 114