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