| 1 |
|
| 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 | struct iris_hfi_session_ops;
|
| 19 |
|
| 20 | enum iris_fmt_type_out {
|
| 21 | IRIS_FMT_H264,
|
| 22 | IRIS_FMT_HEVC,
|
| 23 | IRIS_FMT_VP9,
|
| 24 | IRIS_FMT_AV1,
|
| 25 | };
|
| 26 |
|
| 27 | enum iris_fmt_type_cap {
|
| 28 | IRIS_FMT_NV12,
|
| 29 | IRIS_FMT_QC08C,
|
| 30 | IRIS_FMT_TP10,
|
| 31 | IRIS_FMT_QC10C,
|
| 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 | * @hfi_session_ops: iris HFI session ops
|
| 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 | * @last_buf_ns: start time of received input buffer for current one second FPS window
|
| 71 | * @frame_counter: input buffer counter for current one second FPS window
|
| 72 | * @frame_rate: frame rate of current instance
|
| 73 | * @operating_rate: operating rate of current instance
|
| 74 | * @hfi_rc_type: rate control type
|
| 75 | * @enc_raw_width: source image width for encoder instance
|
| 76 | * @enc_raw_height: source image height for encoder instance
|
| 77 | * @enc_scale_width: scale width for encoder instance
|
| 78 | * @enc_scale_height: scale height for encoder instance
|
| 79 | * @hfi_layer_type: hierarchical coding layer type
|
| 80 | * @hfi_layer_count: hierarchical coding layer count
|
| 81 |
|
| 82 |
|
| 83 | struct iris_inst {
|
| 84 | struct list_head list;
|
| 85 | struct iris_core *core;
|
| 86 | u32 session_id;
|
| 87 | const struct iris_hfi_session_ops *hfi_session_ops;
|
| 88 | struct mutex ctx_q_lock;
|
| 89 | struct mutex lock;
|
| 90 | struct v4l2_fh fh;
|
| 91 | struct v4l2_format *fmt_src;
|
| 92 | struct v4l2_format *fmt_dst;
|
| 93 | struct v4l2_ctrl_handler ctrl_handler;
|
| 94 | enum domain_type domain;
|
| 95 | struct iris_hfi_rect_desc crop;
|
| 96 | struct iris_hfi_rect_desc compose;
|
| 97 | struct completion completion;
|
| 98 | struct completion flush_completion;
|
| 99 | u32 flush_responses_pending;
|
| 100 | struct platform_inst_fw_cap fw_caps[INST_FW_CAP_MAX];
|
| 101 | struct iris_buffers buffers[BUF_TYPE_MAX];
|
| 102 | u32 fw_min_count;
|
| 103 | enum iris_inst_state state;
|
| 104 | enum iris_inst_sub_state sub_state;
|
| 105 | bool once_per_session_set;
|
| 106 | size_t max_input_data_size;
|
| 107 | struct iris_inst_power power;
|
| 108 | struct icc_vote_data icc_data;
|
| 109 | struct v4l2_m2m_dev *m2m_dev;
|
| 110 | struct v4l2_m2m_ctx *m2m_ctx;
|
| 111 | u32 sequence_cap;
|
| 112 | u32 sequence_out;
|
| 113 | struct iris_ts_metadata tss[VIDEO_MAX_FRAME];
|
| 114 | u32 metadata_idx;
|
| 115 | u32 codec;
|
| 116 | bool last_buffer_dequeued;
|
| 117 | u64 last_buf_ns;
|
| 118 | u32 frame_counter;
|
| 119 | u32 frame_rate;
|
| 120 | u32 operating_rate;
|
| 121 | u32 hfi_rc_type;
|
| 122 | u32 enc_raw_width;
|
| 123 | u32 enc_raw_height;
|
| 124 | u32 enc_scale_width;
|
| 125 | u32 enc_scale_height;
|
| 126 | u32 hfi_layer_type;
|
| 127 | u32 hfi_layer_count;
|
| 128 | };
|
| 129 |
|
| 130 | #endif
|