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 /** 16 * struct iris_inst - holds per video instance parameters 17 * 18 * @list: used for attach an instance to the core 19 * @core: pointer to core structure 20 * @session_id: id of current video session 21 * @ctx_q_lock: lock to serialize queues related ioctls 22 * @lock: lock to seralise forward and reverse threads 23 * @fh: reference of v4l2 file handler 24 * @fmt_src: structure of v4l2_format for source 25 * @fmt_dst: structure of v4l2_format for destination 26 * @ctrl_handler: reference of v4l2 ctrl handler 27 * @crop: structure of crop info 28 * @completion: structure of signal completions 29 * @flush_completion: structure of signal completions for flush cmd 30 * @fw_caps: array of supported instance firmware capabilities 31 * @buffers: array of different iris buffers 32 * @fw_min_count: minimnum count of buffers needed by fw 33 * @state: instance state 34 * @sub_state: instance sub state 35 * @once_per_session_set: boolean to set once per session property 36 * @max_input_data_size: max size of input data 37 * @power: structure of power info 38 * @icc_data: structure of interconnect data 39 * @m2m_dev: a reference to m2m device structure 40 * @m2m_ctx: a reference to m2m context structure 41 * @sequence_cap: a sequence counter for capture queue 42 * @sequence_out: a sequence counter for output queue 43 * @tss: timestamp metadata 44 * @metadata_idx: index for metadata buffer 45 */ 46 47 struct iris_inst { 48 struct list_head list; 49 struct iris_core *core; 50 u32 session_id; 51 struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ 52 struct mutex lock; /* lock to serialize forward and reverse threads */ 53 struct v4l2_fh fh; 54 struct v4l2_format *fmt_src; 55 struct v4l2_format *fmt_dst; 56 struct v4l2_ctrl_handler ctrl_handler; 57 struct iris_hfi_rect_desc crop; 58 struct completion completion; 59 struct completion flush_completion; 60 struct platform_inst_fw_cap fw_caps[INST_FW_CAP_MAX]; 61 struct iris_buffers buffers[BUF_TYPE_MAX]; 62 u32 fw_min_count; 63 enum iris_inst_state state; 64 enum iris_inst_sub_state sub_state; 65 bool once_per_session_set; 66 size_t max_input_data_size; 67 struct iris_inst_power power; 68 struct icc_vote_data icc_data; 69 struct v4l2_m2m_dev *m2m_dev; 70 struct v4l2_m2m_ctx *m2m_ctx; 71 u32 sequence_cap; 72 u32 sequence_out; 73 struct iris_ts_metadata tss[VIDEO_MAX_FRAME]; 74 u32 metadata_idx; 75 }; 76 77 #endif 78