xref: /linux/drivers/media/platform/qcom/iris/iris_instance.h (revision 22c55fb9eb92395d999b8404d73e58540d11bdd8)
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  * @flush_responses_pending: counter to track number of pending flush responses
31  * @fw_caps: array of supported instance firmware capabilities
32  * @buffers: array of different iris buffers
33  * @fw_min_count: minimnum count of buffers needed by fw
34  * @state: instance state
35  * @sub_state: instance sub state
36  * @once_per_session_set: boolean to set once per session property
37  * @max_input_data_size: max size of input data
38  * @power: structure of power info
39  * @icc_data: structure of interconnect data
40  * @m2m_dev:	a reference to m2m device structure
41  * @m2m_ctx:	a reference to m2m context structure
42  * @sequence_cap: a sequence counter for capture queue
43  * @sequence_out: a sequence counter for output queue
44  * @tss: timestamp metadata
45  * @metadata_idx: index for metadata buffer
46  * @codec: codec type
47  * @last_buffer_dequeued: a flag to indicate that last buffer is sent by driver
48  */
49 
50 struct iris_inst {
51 	struct list_head		list;
52 	struct iris_core		*core;
53 	u32				session_id;
54 	struct mutex			ctx_q_lock;/* lock to serialize queues related ioctls */
55 	struct mutex			lock; /* lock to serialize forward and reverse threads */
56 	struct v4l2_fh			fh;
57 	struct v4l2_format		*fmt_src;
58 	struct v4l2_format		*fmt_dst;
59 	struct v4l2_ctrl_handler	ctrl_handler;
60 	struct iris_hfi_rect_desc	crop;
61 	struct completion		completion;
62 	struct completion		flush_completion;
63 	u32				flush_responses_pending;
64 	struct platform_inst_fw_cap	fw_caps[INST_FW_CAP_MAX];
65 	struct iris_buffers		buffers[BUF_TYPE_MAX];
66 	u32				fw_min_count;
67 	enum iris_inst_state		state;
68 	enum iris_inst_sub_state	sub_state;
69 	bool				once_per_session_set;
70 	size_t				max_input_data_size;
71 	struct iris_inst_power		power;
72 	struct icc_vote_data		icc_data;
73 	struct v4l2_m2m_dev		*m2m_dev;
74 	struct v4l2_m2m_ctx		*m2m_ctx;
75 	u32				sequence_cap;
76 	u32				sequence_out;
77 	struct iris_ts_metadata		tss[VIDEO_MAX_FRAME];
78 	u32				metadata_idx;
79 	u32				codec;
80 	bool				last_buffer_dequeued;
81 };
82 
83 #endif
84