diff --git a/arch/arm/boot/dts/amlogic/mesont6w.dtsi b/arch/arm/boot/dts/amlogic/mesont6w.dtsi index dad848cc9..bfb8b9aee 100644 --- a/arch/arm/boot/dts/amlogic/mesont6w.dtsi +++ b/arch/arm/boot/dts/amlogic/mesont6w.dtsi @@ -1019,7 +1019,7 @@ chk_wr_done_en; /* urgent_en; */ double_write_en; - vdin_function_sel = <0x20000>; + vdin_function_sel = <0x120000>; /* vdin v4l2 */ v4l_support_en = <0>; v4l_vd_num = <70>; diff --git a/arch/arm64/boot/dts/amlogic/mesont6w.dtsi b/arch/arm64/boot/dts/amlogic/mesont6w.dtsi index 001df29dc..a0bb7a05b 100644 --- a/arch/arm64/boot/dts/amlogic/mesont6w.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesont6w.dtsi @@ -1096,7 +1096,7 @@ chk_wr_done_en; /* urgent_en; */ double_write_en; - vdin_function_sel = <0x20000>; + vdin_function_sel = <0x120000>; /* vdin v4l2 */ v4l_support_en = <0>; v4l_vd_num = <70>; diff --git a/arch/arm64/boot/dts/amlogic/mesont6x.dtsi b/arch/arm64/boot/dts/amlogic/mesont6x.dtsi index a7bb446a3..a0df7d6b8 100644 --- a/arch/arm64/boot/dts/amlogic/mesont6x.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesont6x.dtsi @@ -1275,7 +1275,7 @@ chk_wr_done_en; /* urgent_en; */ double_write_en; - vdin_function_sel = <0x20000>; + vdin_function_sel = <0x120000>; /* vdin v4l2 */ v4l_support_en = <0>; v4l_vd_num = <70>; diff --git a/drivers/media/vin/tvin/vdin/vdin_afbce.c b/drivers/media/vin/tvin/vdin/vdin_afbce.c index 163a69a6c..2fc923eb9 100644 --- a/drivers/media/vin/tvin/vdin/vdin_afbce.c +++ b/drivers/media/vin/tvin/vdin/vdin_afbce.c @@ -710,7 +710,7 @@ void vdin_pause_afbce_write(struct vdin_dev_s *devp, unsigned int rdma_enable, b if (is_meson_t3x_cpu()) { vdin_pause_afbce_write_t3x(devp, rdma_enable, pause_en); return; - } else if (is_meson_t6w_cpu()) { + } else if (is_meson_t6w_cpu() || is_meson_t6x_cpu()) { vdin_vfce_pause_write(devp, rdma_enable, pause_en); return; } diff --git a/drivers/media/vin/tvin/vdin/vdin_ctl.c b/drivers/media/vin/tvin/vdin/vdin_ctl.c index ca8c7516d..ebe67d309 100644 --- a/drivers/media/vin/tvin/vdin/vdin_ctl.c +++ b/drivers/media/vin/tvin/vdin/vdin_ctl.c @@ -4852,7 +4852,7 @@ bool vdin_write_done_check(struct vdin_dev_s *devp) /* If write ddr paused,donot checking write done */ if (devp->debug.pause_mif_dec || devp->debug.pause_afbce_dec || - devp->pause_dec || devp->pause_dec_once) + devp->pause_dec) return true; #ifndef CONFIG_AMLOGIC_ZAPPER_CUT @@ -7631,11 +7631,14 @@ bool vdin_is_qms_state_chg(struct vdin_dev_s *devp) * but HDMI is DE start complete packet reception * So need check immediately status whether change prevent abnormal frame * return value: - * true: state change - * false: state not change + * bit0: VDIN needs to pause dec + * bit1: VDIN needs to mute */ -bool vdin_package_done_check_state(struct vdin_dev_s *devp) +int vdin_package_done_check_state(struct vdin_dev_s *devp) { + bool latency_changed = false; + int ret = 0; + if (devp->debug.vdin_isr_monitor) { pr_info("vdin%d,dv[%d %d],hdr[%d,%d],allm[%d %d],vrr[%d %d %d %d],[%d %d],%d\n", devp->index, devp->dv.dv_flag, devp->prop.dolby_vision, @@ -7646,15 +7649,31 @@ bool vdin_package_done_check_state(struct vdin_dev_s *devp) devp->prop.color_format, devp->pre_prop.color_format, devp->parm.info.status); } + latency_changed = + (devp->pre_prop.latency.cn_type != devp->prop.latency.cn_type) || + (!!devp->pre_prop.latency.allm_mode != !!devp->prop.latency.allm_mode); if (devp->dv.dv_flag != devp->prop.dolby_vision || devp->prop.vdin_hdr_flag != devp->pre_prop.vdin_hdr_flag || vdin_is_vrr_state_chg(devp) || devp->prop.color_format != devp->pre_prop.color_format || devp->parm.info.status != TVIN_SIG_STATUS_STABLE) - return true; - else - return false; + ret |= BIT0; + + if (devp->dv_hw5.is_auto_mute_needed) { + if (latency_changed) + ret |= BIT0; + if (vdin_is_vrr_state_chg(devp) && !devp->prop.vtem_data.vrr_en && + devp->game_mode) { //need mute + ret |= BIT1; + } + if (latency_changed && !devp->prop.latency.allm_mode && + devp->game_mode) { //need mute + ret |= BIT1; + } + } + + return ret; } void vdin_vs_proc_monitor(struct vdin_dev_s *devp) @@ -7680,14 +7699,18 @@ void vdin_vs_proc_monitor(struct vdin_dev_s *devp) devp->prop.hdr10p_info.hdr10p_check_cnt = 0; if (!!devp->prop.latency.allm_mode != !!devp->pre_prop.latency.allm_mode || - devp->prop.latency.it_content != devp->pre_prop.latency.it_content || - devp->prop.latency.cn_type != devp->pre_prop.latency.cn_type || devp->prop.filmmaker.fmm_flag != devp->pre_prop.filmmaker.fmm_flag || devp->prop.imax_flag != devp->pre_prop.imax_flag) devp->dv.allm_chg_cnt++; else devp->dv.allm_chg_cnt = 0; + if (devp->prop.latency.it_content != devp->pre_prop.latency.it_content || + devp->prop.latency.cn_type != devp->pre_prop.latency.cn_type) + devp->dv.allm1_chg_cnt++; + else + devp->dv.allm1_chg_cnt = 0; + /* hdmi/tvafe source afd check */ if ((devp->prop.aspect_ratio && devp->pre_prop.aspect_ratio != devp->prop.aspect_ratio) || diff --git a/drivers/media/vin/tvin/vdin/vdin_ctl.h b/drivers/media/vin/tvin/vdin/vdin_ctl.h index c5c32bc7b..e236e5c16 100644 --- a/drivers/media/vin/tvin/vdin/vdin_ctl.h +++ b/drivers/media/vin/tvin/vdin/vdin_ctl.h @@ -366,7 +366,7 @@ bool vdin_is_auto_pc_mode(struct vdin_dev_s *devp); enum tvin_port_type_e vdin_get_port_type(struct vdin_dev_s *devp); bool vdin_is_vrr_state(struct vdin_dev_s *devp); enum vdin_vrr_mode_e get_cur_vrr_status(struct vdin_dev_s *devp); -bool vdin_package_done_check_state(struct vdin_dev_s *devp); +int vdin_package_done_check_state(struct vdin_dev_s *devp); unsigned int vdin_get_rx_avi_colorimetry(struct vdin_dev_s *devp, unsigned int colorimetry); bool vdin_is_dv_supported(void); bool vdin_is_afbce_enabled(struct vdin_dev_s *devp); diff --git a/drivers/media/vin/tvin/vdin/vdin_debug.c b/drivers/media/vin/tvin/vdin/vdin_debug.c index 8133be763..4269f85ce 100644 --- a/drivers/media/vin/tvin/vdin/vdin_debug.c +++ b/drivers/media/vin/tvin/vdin/vdin_debug.c @@ -5045,6 +5045,19 @@ start_chk: devp->dts_config.sct_remain_size = temp; pr_info("vdin%d,sct_remain_size = %#x\n", devp->index, devp->dts_config.sct_remain_size); + } else if (!strcmp(parm[0], "vdin_mut_cnt")) { + if (parm[1] && (kstrtouint(parm[1], 0, &temp) == 0)) + devp->dts_config.vdin_mut_cnt = temp; + pr_info("vdin%d,vdin_mut_cnt = %#x\n", + devp->index, devp->dts_config.vdin_mut_cnt); + } else if (!strcmp(parm[0], "force_pause_en")) { + if (parm[1] && (kstrtouint(parm[1], 0, &temp) == 0)) { + if (temp) + devp->debug.force_pause_en = true; + else + devp->debug.force_pause_en = false; + pr_info("force_pause_en:%d\n", devp->debug.force_pause_en); + } } #endif else if (!strcmp(parm[0], "state")) { diff --git a/drivers/media/vin/tvin/vdin/vdin_drv.c b/drivers/media/vin/tvin/vdin/vdin_drv.c index 06df9a264..47f68c42c 100644 --- a/drivers/media/vin/tvin/vdin/vdin_drv.c +++ b/drivers/media/vin/tvin/vdin/vdin_drv.c @@ -280,6 +280,7 @@ EXPORT_SYMBOL(get_vdin_status); */ void tvin_update_vdin_prop(u8 port_type, u8 pkt_type) { + int ret; struct tvin_state_machine_ops_s *sm_ops; struct vframe_s *update_wr_vf = NULL; struct vdin_dev_s *devp = NULL; @@ -317,10 +318,29 @@ void tvin_update_vdin_prop(u8 port_type, u8 pkt_type) sm_ops->get_sig_property(devp->frontend, &devp->prop, devp->port_type); break; } - if (vdin_package_done_check_state(devp)) { - if (devp->game_mode) - vdin_pause_hw_write(devp, 0); - devp->frame_drop_num = 1; + + if (devp->mute_cnt) { + devp->mute_cnt--; + if (devp->mute_cnt == 0) + set_video_mute(VDIN_MUTE_SET, false); + } + ret = vdin_package_done_check_state(devp); + if (ret) { + if (devp->game_mode & VDIN_GAME_MODE_1_2) { + if ((ret & BIT1) && !devp->mute_cnt) { + if (devp->debug.vdin_isr_monitor) + pr_info("%s vdin%d,irq_cnt:%d,game:%d\n", __func__, + devp->index, devp->irq_cnt, devp->game_mode); + set_video_mute_vcbus(VDIN_MUTE_SET, true); + set_video_mute(VDIN_MUTE_SET, true); + devp->mute_cnt = devp->dts_config.vdin_mut_cnt; + } + /* t6w/t6x cannot pause afbce in active area */ + if (!(devp->dtdata->hw_ver == VDIN_HW_T6W || + devp->dtdata->hw_ver == VDIN_HW_T6X) || devp->debug.force_pause_en) + vdin_pause_hw_write(devp, 0); + } + vdin_vf_skip_all_disp(devp->vfp); vdin_drop_frame_info(devp, "de start state chg"); } @@ -908,6 +928,17 @@ static void vdin_handle_game_mode_chg(struct vdin_dev_s *devp) game_mode_pre = devp->game_mode; + if ((devp->vdin_function_sel & VDIN_AUTO_GAME_MODE) && + ((vdin_is_auto_game_mode(devp) && !game_mode) || + (!vdin_is_auto_game_mode(devp) && game_mode))) { + if (devp->debug.vdin_isr_monitor & VDIN_ISR_MONITOR_GAME) + pr_info("%s game:%d,game mode cur:0x%x\n", + __func__, game_mode, devp->game_mode); + game_mode = !game_mode; + devp->auto_game_flag = true; + devp->game_mode_chg = VDIN_GAME_MODE_CHK; + } + if (devp->game_mode_chg == VDIN_GAME_MODE_CHK) vdin_game_mode_check(devp); @@ -1247,6 +1278,9 @@ static void vdin_dv_hw5_init(struct vdin_dev_s *devp) (VDIN_AFBCE_EN_1080P | VDIN_AFBCE_EN_720P | VDIN_AFBCE_EN_SMALL); pr_info("t3x dv hw5 init %#x\n", devp->afbce_flag); } + if ((devp->dtdata->hw_ver == VDIN_HW_T6W || devp->dtdata->hw_ver == VDIN_HW_T6X) && + vdin_dv_is_source_led(devp) && devp->dbg_force_one_buffer != 3) + devp->dv_hw5.is_auto_mute_needed = true; } static void vdin_is_crop_valid(struct vdin_dev_s *devp, struct vdin_parm_s *para) @@ -1569,6 +1603,7 @@ static void vdin_start_param_init(struct vdin_dev_s *devp) devp->vdin_drop_ctl_cnt = 0; devp->dv.allm_chg_cnt = 0; + devp->dv.allm1_chg_cnt = 0; devp->sg_chg_fps_cnt = 0; devp->af_num = VDIN_CANVAS_MAX_CNT; /* write vframe as default */ @@ -1821,8 +1856,9 @@ int vdin_start_dec(struct vdin_dev_s *devp) devp->dv_is_not_std = true; if ((devp->vdin_function_sel & VDIN_AUTO_GAME_MODE) && - vdin_is_auto_game_mode(devp) && !game_mode) { - game_mode = 1; + ((vdin_is_auto_game_mode(devp) && !game_mode) || + (!vdin_is_auto_game_mode(devp) && game_mode))) { + game_mode = !game_mode; devp->auto_game_flag = true; } @@ -3285,6 +3321,7 @@ int vdin_vframe_put_and_recycle(struct vdin_dev_s *devp, struct vf_entry *vfe, } /*skip policy process*/ vdin_vf_disp_mode_update(vfe, devp->vfp); + vdin_update_vf_flag(devp, vfe); vfe->vf.duration = devp->cur_duration; /*force recycle one frame*/ @@ -3361,15 +3398,15 @@ int vdin_vframe_put_and_recycle(struct vdin_dev_s *devp, struct vf_entry *vfe, 1000)); if (devp->debug.vdin_isr_monitor & VDIN_ISR_MONITOR_VF) - pr_info("vdin%d cnt:%d vf(%px):%d sg_type:%#x %#x flag:%#x %#x\n", + pr_info("vdin%d cnt:%d vf(%px):%d sg_type:%#x %#x flag:%#x %#x;vrr:%d\n", devp->index, devp->irq_cnt, &devp->vfp->last_last_vfe->vf, devp->vfp->last_last_vfe->vf.index, devp->vfp->last_last_vfe->vf.signal_type, devp->vfp->last_last_vfe->vf.type, devp->vfp->last_last_vfe->flag, - devp->vfp->last_last_vfe->vf.flag); - + devp->vfp->last_last_vfe->vf.flag, + devp->vfp->last_last_vfe->vf.vf_vrr_param.frc_get_vrr); if (devp->debug.vdin_isr_monitor & VDIN_ISR_MONITOR_VF) pr_info("frm_irq:%d,fps:%d,dur:%u,disp:%d,wxh:[%d %d],canvas0_w:%d\n", devp->vfp->last_last_vfe->vf.frame_irq_cnt, @@ -3525,6 +3562,22 @@ static inline void vdin_dynamic_switch_vrr(struct vdin_dev_s *devp) } } +void vdin_update_vf_flag(struct vdin_dev_s *devp, struct vf_entry *vfe) +{ + if (devp->game_mode) + vfe->vf.flag |= VFRAME_FLAG_GAME_MODE; + else + vfe->vf.flag &= ~VFRAME_FLAG_GAME_MODE; + + if (devp->vdin_pc_mode) + vfe->vf.flag |= VFRAME_FLAG_PC_MODE; + else + vfe->vf.flag &= ~VFRAME_FLAG_PC_MODE; + + devp->vrr_data.cur_vrr_status = get_cur_vrr_status(devp); + vfe->vf.vf_vrr_param.frc_get_vrr = devp->vrr_data.cur_vrr_status; +} + static void vdin_set_vfe_info(struct vdin_dev_s *devp, struct vf_entry *vfe) { vfe->vf.type = devp->curr_field_type; @@ -3640,7 +3693,7 @@ static void vdin_set_one_buffer_mode(struct vdin_dev_s *devp, struct vf_entry *n if ((devp->game_mode & VDIN_GAME_MODE_2) && devp->dbg_force_one_buffer != 2 && (frame_lock_type_vrr_lock() && devp->dbg_force_one_buffer) && - g_disp_count <= 1) { + g_disp_count <= 1 && !devp->dv_hw5.is_auto_mute_needed) { /* all vf will use this phy address of current next_wr_vfe */ if (devp->af_num >= VDIN_CANVAS_MAX_CNT) { devp->af_num = next_wr_vfe->af_num; @@ -3998,17 +4051,29 @@ irqreturn_t vdin_isr(int irq, void *dev_id) spin_lock_irqsave(&devp->isr_lock, flags); + /* Check whether frame written done */ + if (devp->dts_config.chk_write_done_en && IS_HDMI_SRC(devp->parm.port)) { + if (!vdin_write_done_check(devp)) { + devp->vdin_irq_flag = VDIN_IRQ_FLG_SKIP_FRAME; + vdin_drop_frame_info(devp, "write done check"); + devp->vdin_drop_cnt++; + } + } + if (devp->dv.chg_cnt || (devp->dv.allm_chg_cnt && !vdin_is_vrr_state(devp) && !devp->vrr_data.vrr_chg_cnt) || devp->vrr_data.vrr_chg_cnt || devp->prop.hdr_info.hdr_check_cnt || devp->prop.hdr10p_info.hdr10p_check_cnt) { - if (devp->game_mode) - vdin_pause_hw_write(devp, devp->flags & VDIN_FLAG_RDMA_ENABLE); + if (devp->game_mode & VDIN_GAME_MODE_1_2) { + vdin_pause_hw_write(devp, 0); + devp->pause_dec_once = true; + } vdin_drop_frame_info(devp, "dv or vrr allm chg"); vdin_vf_skip_all_disp(devp->vfp); devp->vdin_drop_cnt++; - goto irq_handled; + devp->vdin_irq_flag = VDIN_IRQ_FLG_IGNORE_FRAME; +// goto irq_handled; } if (devp->afbce_mode == 1) { @@ -4035,7 +4100,7 @@ irqreturn_t vdin_isr(int irq, void *dev_id) if (devp->frame_drop_num) { devp->frame_drop_num--; - if (devp->game_mode && devp->mem_type != VDIN_MEM_TYPE_SCT) + if (devp->game_mode & VDIN_GAME_MODE_1_2) vdin_pause_hw_write(devp, 0); devp->vdin_irq_flag = VDIN_IRQ_FLG_DROP_FRAME; vdin_drop_frame_info(devp, "drop frame"); @@ -4177,15 +4242,6 @@ irqreturn_t vdin_isr(int irq, void *dev_id) next_wr_vfe = provider_vf_peek(devp->vfp); - /* Check whether frame written done */ - if (devp->dts_config.chk_write_done_en && IS_HDMI_SRC(devp->parm.port)) { - if (!vdin_write_done_check(devp)) { - devp->vdin_irq_flag = VDIN_IRQ_FLG_SKIP_FRAME; - vdin_drop_frame_info(devp, "write done check"); - devp->vdin_drop_cnt++; - } - } - #ifndef CONFIG_AMLOGIC_ZAPPER_CUT /* change afbce mode */ if (next_wr_vfe && devp->afbce_mode_pre != devp->afbce_mode) @@ -4195,7 +4251,7 @@ irqreturn_t vdin_isr(int irq, void *dev_id) dec_ops = devp->frontend->dec_ops; if (!dec_ops || !dec_ops->decode_isr || dec_ops->decode_isr(devp->frontend, devp->h_cnt64, devp->port_type) == TVIN_BUF_SKIP) { - if (devp->game_mode) + if (devp->game_mode & VDIN_GAME_MODE_1_2) vdin_pause_hw_write(devp, devp->flags & VDIN_FLAG_RDMA_ENABLE); devp->vdin_irq_flag = VDIN_IRQ_FLG_BUFF_SKIP; vdin_drop_frame_info(devp, "buf skip flg"); @@ -4408,6 +4464,11 @@ irqreturn_t vdin_isr(int irq, void *dev_id) /* game mode 2 */ vdin_vframe_put_and_recycle(devp, next_wr_vfe, put_md); } + if (devp->debug.vdin_isr_monitor & VDIN_ISR_MONITOR_VF) + pr_info("vdin%d,[%d %d]last_frame_idx:%d,cur_frame_idx:%d\n", + devp->index, devp->irq_cnt, devp->frame_cnt, + devp->msct_top.last_frame_idx, + devp->msct_top.cur_frame_idx); devp->msct_top.last_frame_idx = devp->msct_top.cur_frame_idx; devp->msct_top.cur_frame_idx = curr_wr_vf->index; @@ -4418,8 +4479,7 @@ irq_handled: //for debug vdin_dbg_access_reg(devp, 1); /*hdmi skip policy should adapt to all drop front vframe case*/ - if (devp->vfp->skip_vf_num > 0 && - vf_drop_cnt < devp->vdin_drop_cnt) + if (vf_drop_cnt < devp->vdin_drop_cnt) vdin_vf_disp_mode_skip(devp->vfp); devp->vdin_irq_flag = 0; @@ -7280,6 +7340,7 @@ static void vdin_get_dts_config(struct vdin_dev_s *devp, /* Enable aspect ratio by default */ devp->vdin_function_sel |= VDIN_SET_DISPLAY_RATIO; devp->dts_config.sct_remain_size = 2;/* Keep 2 pages to allocate the buffer faster.*/ + devp->dts_config.vdin_mut_cnt = 32; } static int vdin_drv_probe(struct platform_device *pdev) diff --git a/drivers/media/vin/tvin/vdin/vdin_drv.h b/drivers/media/vin/tvin/vdin/vdin_drv.h index 5d03d7e95..b32a0f4e4 100644 --- a/drivers/media/vin/tvin/vdin/vdin_drv.h +++ b/drivers/media/vin/tvin/vdin/vdin_drv.h @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef CONFIG_AMLOGIC_MEDIA_RDMA #include #include "../common/rdma/rdma.h" @@ -742,6 +743,7 @@ struct vdin_debug_s { unsigned int force_disp_mode; unsigned int reg_addr; bool bypass_game_dyn_fmt; + bool force_pause_en; }; struct vdin_dv_s { @@ -768,6 +770,7 @@ struct vdin_dv_s { bool low_latency; unsigned int chg_cnt; unsigned int allm_chg_cnt; + unsigned int allm1_chg_cnt; }; struct vdin_hdr_s { @@ -782,6 +785,7 @@ struct vdin_dv_hw5_s { unsigned int dw_out_w; unsigned int dw_out_h; unsigned int dw_dfmt; + bool is_auto_mute_needed; }; struct vdin_afbce_s { @@ -864,6 +868,7 @@ struct vdin_dts_config_s { unsigned int vdin_vrr_chg_cnt; unsigned int vdin_qms_chg_cnt; unsigned int sct_remain_size; + unsigned int vdin_mut_cnt; }; struct vdin_s5_s { @@ -1261,6 +1266,7 @@ struct vdin_dev_s { bool vinfo_over_pixel_clk; bool input_over_pixel_clk; bool pause_dec_once; + unsigned int mute_cnt; unsigned int ignore_frames; /*use frame rate to cal duration*/ unsigned int use_frame_rate; @@ -1485,6 +1491,8 @@ void vdin_pause_hw_write(struct vdin_dev_s *devp, bool rdma_en); void vdin_resume_hw_write(struct vdin_dev_s *devp, bool rdma_en); void vdin_reg_dmc_notifier(unsigned int index); void vdin_unreg_dmc_notifier(unsigned int index); +void vdin_update_vf_flag(struct vdin_dev_s *devp, struct vf_entry *vfe); + #ifndef CONFIG_AMLOGIC_ZAPPER_CUT int vdin_dump_one_buf_mem_user(void *output_buf, struct vdin_dev_s *devp, unsigned int buf_num); @@ -1496,5 +1504,6 @@ bool vdin_get_video_ready_state(enum tvin_port_e port); void vdin_dyn_fmt(struct vdin_dev_s *devp); void vdin_get_secure_state(struct vdin_dev_s *devp); unsigned int vdin_check_secure_write_error(struct vdin_dev_s *devp); +void rx_mute_vpp(u8 port_type); #endif /* __TVIN_VDIN_DRV_H */ diff --git a/drivers/media/vin/tvin/vdin/vdin_mem_scatter.c b/drivers/media/vin/tvin/vdin/vdin_mem_scatter.c index 02cb043d5..085e4b5bc 100644 --- a/drivers/media/vin/tvin/vdin/vdin_mem_scatter.c +++ b/drivers/media/vin/tvin/vdin/vdin_mem_scatter.c @@ -122,6 +122,8 @@ void vdin_sct_read_mmu_num(struct vdin_dev_s *devp, struct vf_entry *vfe) } else { vfe->vf.afbce_num = rd(devp->addr_offset, AFBCE_MMU_NUM); } + if (vfe->vf.afbce_num < VDIN_AFBCE_MIN_SIZE) + vfe->vf.afbce_num = 0; idx = devp->msct_top.cur_frame_idx; devp->msct_top.sct_stat[idx].compressed_page_cnt = vfe->vf.afbce_num; devp->msct_top.vfe = vfe; diff --git a/drivers/media/vin/tvin/vdin/vdin_mem_scatter.h b/drivers/media/vin/tvin/vdin/vdin_mem_scatter.h index ec92b7543..1d20575b8 100644 --- a/drivers/media/vin/tvin/vdin/vdin_mem_scatter.h +++ b/drivers/media/vin/tvin/vdin/vdin_mem_scatter.h @@ -22,6 +22,7 @@ #include "vdin_drv.h" #define DRIVER_NAME "vdin" +#define VDIN_AFBCE_MIN_SIZE 128 //pages int vdin_sct_init(struct vdin_dev_s *devp); void vdin_sct_worker(struct work_struct *work); diff --git a/drivers/media/vin/tvin/vdin/vdin_sm.c b/drivers/media/vin/tvin/vdin/vdin_sm.c index ca92ec70a..e8901650b 100644 --- a/drivers/media/vin/tvin/vdin/vdin_sm.c +++ b/drivers/media/vin/tvin/vdin/vdin_sm.c @@ -235,8 +235,8 @@ static enum tvin_sg_chg_flg vdin_hdmirx_fmt_chg_detect(struct vdin_dev_s *devp) } } - if (!!devp->prop.latency.allm_mode != - !!devp->pre_prop.latency.allm_mode) { + if (devp->prop.latency.allm_mode != + devp->pre_prop.latency.allm_mode) { if (devp->dv.allm_chg_cnt > devp->dts_config.vdin_dv_chg_cnt) { devp->dv.allm_chg_cnt = 0; signal_chg |= TVIN_SIG_CHG_DV_ALLM; @@ -287,7 +287,7 @@ static enum tvin_sg_chg_flg vdin_hdmirx_fmt_chg_detect(struct vdin_dev_s *devp) if (devp->pre_prop.latency.it_content != devp->prop.latency.it_content) { if (devp->dv.allm_chg_cnt > devp->dts_config.vdin_dv_chg_cnt) { - devp->dv.allm_chg_cnt = 0; + devp->dv.allm1_chg_cnt = 0; signal_chg |= TVIN_SIG_CHG_DV_ALLM; temp = devp->pre_prop.latency.it_content; if (signal_chg) @@ -303,7 +303,7 @@ static enum tvin_sg_chg_flg vdin_hdmirx_fmt_chg_detect(struct vdin_dev_s *devp) if (devp->pre_prop.latency.cn_type != devp->prop.latency.cn_type) { if (devp->dv.allm_chg_cnt > devp->dts_config.vdin_dv_chg_cnt) { - devp->dv.allm_chg_cnt = 0; + devp->dv.allm1_chg_cnt = 0; signal_chg |= TVIN_SIG_CHG_DV_ALLM; temp = devp->pre_prop.latency.cn_type; if (signal_chg)