struct _mct_module {
mct_object_t object;
mct_list_t *type_list;
mct_list_t *srcports; ---àdata里面是mct_port_t
unsigned short numsrcports;
mct_list_t *sinkports; ---àdata里面是mct_port_t
unsigned short numsinkports;
void *module_private;
pthread_mutex_t type_list_lock;
/* virtual functions - MUST be implemented by each module */
mct_module_process_event_func process_event;
mct_module_set_mod_func set_mod;
mct_module_query_mod_func query_mod;
mct_module_request_port_function request_new_port;
mct_module_start_session start_session;
mct_module_stop_session stop_session;
mct_module_set_session_data set_session_data;
mct_module_get_session_data get_session_data;
};
typedef struct {
mct_module_t *module;
pthread_mutex_t mutex;
iface_buf_mgr_t buf_mgr;
iface_ispif_data_t ispif_data;
iface_isp_axi_data_t isp_axi_data;
iface_session_t sessions[IFACE_MAX_SESSIONS];
int fd;
int num_active_streams;
int frame_cnt;
int skip_meta;
int used_resource_mask;
uint32_t used_wm[VFE_MAX];
iface_hvx_singleton_t hvx_singleton;
} iface_t
typedef struct {
uint32_t num_subdev;
char subdev_name[32]; //entity.type == MEDIA_ENT_T_V4L2_SUBDEV &&entity.group_id == MSM_CAMERA_SUBDEV_ISPIF的节点
iface_ispif_t ispif_hw;
} iface_ispif_data_t;
typedef struct {
uint32_t num_subdev;
iface_isp_subdevs_t isp_subdev[IFACE_ISP_SD_NODE_ID_MAX_NUM];// entity.type == MEDIA_ENT_T_V4L2_SUBDEV&& entity.group_id ==
//MSM_CAMERA_SUBDEV_VFE的节点
iface_axi_t axi_data[VFE_MAX];
} iface_isp_axi_data_t;
typedef struct {
mct_port_t *port;
void *iface;
iface_port_state_t state;
uint32_t session_id;
int num_active_streams;
union {
iface_src_port_t src_port;
iface_sink_port_t sink_port;
} u;
} iface_port_t;
struct _mct_port {
mct_object_t object; ->name是iface_sink0-7 or iface_src0-7; ->parant指向mct_module_t
mct_port_caps_t caps; ->port_caps_type =MCT_PORT_CAPS_OPAQUE(sink) or MCT_PORT_CAPS_FRAME(src)
mct_port_direction_t direction; MCT_PORT_SINK or MCT_PORT_SRC
mct_port_t *peer; //也叫做intra_port
mct_port_t *internal_peer[MAX_PORT_CONNECTIONS]; //也叫做intra_port
mct_inter_peer_entity_t inter_session_peer[MAX_PORT_CONNECTIONS];
void *port_private;
/* virtual functions to be defined by individual ports */
mct_port_event_func event_func;
mct_port_intra_event_func intra_event_func;
mct_port_int_link_func int_link;
mct_port_ext_link_func ext_link;
mct_port_intra_link_func intra_link;
mct_port_unlink_func un_link;
mct_port_intra_unlink_func intra_unlink;
mct_port_set_caps_func set_caps;
mct_port_check_caps_reserve_func check_caps_reserve;
mct_port_check_caps_unreserve_func check_caps_unreserve;
}
typedef struct {
void *iface;
uint32_t session_id;
uint32_t peer_session_id;
enum msm_vfe_dual_hw_ms_type ms_type;
uint32_t num_hw_stream;
uint32_t sof_frame_id;
uint32_t recovery_done_sof_frame_id;
uint32_t active_count;
sensor_out_info_t sensor_out_info;
iface_hw_stream_t hw_streams[IFACE_MAX_STREAMS];
uint32_t num_stats_stream;
iface_stats_stream_t stats_streams[MSM_ISP_STATS_MAX];
iface_stats_stream_t offline_stats_streams[MSM_ISP_STATS_MAX];
iface_resource_t session_resource;
int ion_fd; // 节点/dev/ion
uint32_t num_bundled_streamon;
uint32_t num_bundled_streamoff;
cam_bundle_config_t hal_bundle_parm;
enum msm_vfe_frame_skip_pattern hal_skip_pattern;
enum msm_vfe_frame_skip_pattern stats_skip_pattern;
enum msm_vfe_frame_skip_pattern bracketing_frame_skip_pattern; /* pattern sent by sensor during bracketing */
iface_hfr_param_t hfr_param;
boolean cds_feature_enable;
boolean dynamic_stats_skip_feature_enb;
uint32_t cds_curr_enb;
uint32_t cds_saved_state;
iface_cds_info_t cds_info;
iface_cds_status_t cds_status;
cam_cds_mode_type_t cds_mode;
mct_bracketing_state_t bracketing_state;
uint32_t fast_aec_mode;
uint32_t num_bundle_meta;
uint32_t num_pdaf_meta;
iface_bundle_meta_info_t bundle_meta_info[IFACE_MAX_STREAMS];
iface_bundle_pdaf_info_t bundle_pdaf_info[IFACE_MAX_STREAMS];
pdaf_data_buffer_info_t camif_info;
enum smmu_attach_mode security_mode;
modulesChromatix_t chromatix_param;
iface_axi_recovery_state_t overflow_recovery_state;
pthread_mutex_t mutex;
/* thread in session*/
iface_session_thread_t session_thread;
uint32_t prev_sent_streamids[MAX_STREAMS_NUM];
uint32_t prev_sent_streamids_cnt;
cam_hal_version_t hal_version;
uint32_t max_apply_delay;
uint32_t max_reporting_delay;
pthread_mutex_t parm_q_lock[IFACE_FRAME_CTRL_SIZE];
mct_queue_t *parm_q[IFACE_FRAME_CTRL_SIZE];
uint32_t session_streams_identity;
uint32_t vt_enable;
uint32_t hal_max_buffer;
iface_offline_isp_info_t offline_info;
boolean dual_vfe_notify[IFACE_AXI_NOTIFY_MAX][VFE_MAX];
iface_sw_frameskip sw_skip_info;
int skip_cds_timeout; /*ignore CDS switches for next x frames*/
boolean cds_skip_disable;
isp_preferred_streams preferred_mapping;
iface_batch_info_t batch_info;
uint8_t initial_frame_skip;
int create_axi_count[VFE_MAX];
iface_hvx_t hvx;
uint32_t num_pix_streamon;
boolean first_pix_stream_on_off;
iface_buf_alloc_t nativbuf_alloc_info;
iface_frame_buffer_t image_bufs[VFE_AXI_SRC_MAX][IFACE_MAX_IMG_BUF];
uint8_t dis_enabled;
uint32_t hw_version;
cam_sensor_hdr_type_t hdr_mode;
boolean zzhdr_hw_available;
isp_camif_caps_info camif_cap;
boolean use_testgen; /* Indicates whether input is from CAMIF testgen */
struct timeval time_stamp;
struct timeval delta_time_stamp;
uint8_t fe_done_cnt;
} iface_session_t;
typedef struct {
pthread_mutex_t mutex;
pthread_mutex_t req_mutex;
uint32_t use_cnt;
int ion_fd; //指向:/dev/ion
uint32_t bufq_handle_count;
iface_bufq_t bufq[IFACE_MAX_NUM_BUF_QUEUE];
} iface_buf_mgr_t;
Mct_port->parent 是 mct_module , mct_module->parent ====mct_stream_t
主要文件:module_iface.c mct_module.c iface.c port_iface.c mct_port.c
开始session:
函数int iface_start_session(iface_t *iface, uint32_t session_id)
主要做以下事情:
1 启动线程:iface_session_sem_thread_start(): 处理处理来自pipe的命令
联系客服