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