2025-02-07 13:24:43 +05:30
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IRIS_INSTANCE_H__
|
|
|
|
#define __IRIS_INSTANCE_H__
|
|
|
|
|
2025-02-07 13:24:49 +05:30
|
|
|
#include <media/v4l2-ctrls.h>
|
|
|
|
|
|
|
|
#include "iris_buffer.h"
|
2025-02-07 13:24:43 +05:30
|
|
|
#include "iris_core.h"
|
2025-02-07 13:24:49 +05:30
|
|
|
#include "iris_utils.h"
|
2025-02-07 13:24:43 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* struct iris_inst - holds per video instance parameters
|
|
|
|
*
|
2025-02-07 13:24:49 +05:30
|
|
|
* @list: used for attach an instance to the core
|
2025-02-07 13:24:43 +05:30
|
|
|
* @core: pointer to core structure
|
2025-02-07 13:24:49 +05:30
|
|
|
* @session_id: id of current video session
|
2025-02-07 13:24:43 +05:30
|
|
|
* @ctx_q_lock: lock to serialize queues related ioctls
|
|
|
|
* @lock: lock to seralise forward and reverse threads
|
|
|
|
* @fh: reference of v4l2 file handler
|
2025-02-07 13:24:49 +05:30
|
|
|
* @fmt_src: structure of v4l2_format for source
|
|
|
|
* @fmt_dst: structure of v4l2_format for destination
|
2025-02-07 13:24:54 +05:30
|
|
|
* @ctrl_handler: reference of v4l2 ctrl handler
|
2025-02-07 13:24:49 +05:30
|
|
|
* @crop: structure of crop info
|
|
|
|
* @completion: structure of signal completions
|
2025-02-07 13:24:56 +05:30
|
|
|
* @flush_completion: structure of signal completions for flush cmd
|
2025-05-09 14:08:58 +05:30
|
|
|
* @flush_responses_pending: counter to track number of pending flush responses
|
2025-02-07 13:24:54 +05:30
|
|
|
* @fw_caps: array of supported instance firmware capabilities
|
2025-02-07 13:24:49 +05:30
|
|
|
* @buffers: array of different iris buffers
|
|
|
|
* @fw_min_count: minimnum count of buffers needed by fw
|
2025-02-07 13:24:56 +05:30
|
|
|
* @state: instance state
|
2025-02-07 13:25:01 +05:30
|
|
|
* @sub_state: instance sub state
|
2025-02-07 13:24:49 +05:30
|
|
|
* @once_per_session_set: boolean to set once per session property
|
2025-02-07 13:25:05 +05:30
|
|
|
* @max_input_data_size: max size of input data
|
|
|
|
* @power: structure of power info
|
|
|
|
* @icc_data: structure of interconnect data
|
2025-02-07 13:24:43 +05:30
|
|
|
* @m2m_dev: a reference to m2m device structure
|
|
|
|
* @m2m_ctx: a reference to m2m context structure
|
2025-02-07 13:25:00 +05:30
|
|
|
* @sequence_cap: a sequence counter for capture queue
|
|
|
|
* @sequence_out: a sequence counter for output queue
|
|
|
|
* @tss: timestamp metadata
|
|
|
|
* @metadata_idx: index for metadata buffer
|
2025-05-09 14:09:08 +05:30
|
|
|
* @codec: codec type
|
2025-05-09 14:09:05 +05:30
|
|
|
* @last_buffer_dequeued: a flag to indicate that last buffer is sent by driver
|
2025-02-07 13:24:43 +05:30
|
|
|
*/
|
|
|
|
|
|
|
|
struct iris_inst {
|
2025-02-07 13:24:49 +05:30
|
|
|
struct list_head list;
|
2025-02-07 13:24:43 +05:30
|
|
|
struct iris_core *core;
|
2025-02-07 13:24:49 +05:30
|
|
|
u32 session_id;
|
2025-02-07 13:24:43 +05:30
|
|
|
struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */
|
|
|
|
struct mutex lock; /* lock to serialize forward and reverse threads */
|
|
|
|
struct v4l2_fh fh;
|
2025-02-07 13:24:49 +05:30
|
|
|
struct v4l2_format *fmt_src;
|
|
|
|
struct v4l2_format *fmt_dst;
|
2025-02-07 13:24:54 +05:30
|
|
|
struct v4l2_ctrl_handler ctrl_handler;
|
2025-02-07 13:24:49 +05:30
|
|
|
struct iris_hfi_rect_desc crop;
|
|
|
|
struct completion completion;
|
2025-02-07 13:24:56 +05:30
|
|
|
struct completion flush_completion;
|
2025-05-09 14:08:58 +05:30
|
|
|
u32 flush_responses_pending;
|
2025-02-07 13:24:54 +05:30
|
|
|
struct platform_inst_fw_cap fw_caps[INST_FW_CAP_MAX];
|
2025-02-07 13:24:49 +05:30
|
|
|
struct iris_buffers buffers[BUF_TYPE_MAX];
|
|
|
|
u32 fw_min_count;
|
2025-02-07 13:24:56 +05:30
|
|
|
enum iris_inst_state state;
|
2025-02-07 13:25:01 +05:30
|
|
|
enum iris_inst_sub_state sub_state;
|
2025-02-07 13:24:49 +05:30
|
|
|
bool once_per_session_set;
|
2025-02-07 13:25:05 +05:30
|
|
|
size_t max_input_data_size;
|
|
|
|
struct iris_inst_power power;
|
|
|
|
struct icc_vote_data icc_data;
|
2025-02-07 13:24:43 +05:30
|
|
|
struct v4l2_m2m_dev *m2m_dev;
|
|
|
|
struct v4l2_m2m_ctx *m2m_ctx;
|
2025-02-07 13:25:00 +05:30
|
|
|
u32 sequence_cap;
|
|
|
|
u32 sequence_out;
|
|
|
|
struct iris_ts_metadata tss[VIDEO_MAX_FRAME];
|
|
|
|
u32 metadata_idx;
|
2025-05-09 14:09:08 +05:30
|
|
|
u32 codec;
|
2025-05-09 14:09:05 +05:30
|
|
|
bool last_buffer_dequeued;
|
2025-02-07 13:24:43 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|