diff --git a/drivers/media/video_sink/vpp.c b/drivers/media/video_sink/vpp.c index 1f6f198c9..8cd8d44cc 100644 --- a/drivers/media/video_sink/vpp.c +++ b/drivers/media/video_sink/vpp.c @@ -937,6 +937,21 @@ static unsigned int aisr_debug_flag; MODULE_PARM_DESC(aisr_debug_flag, "aisr_debug_flag"); module_param(aisr_debug_flag, uint, 0664); +static bool is_video_output_4k120hz(int freq_ratio, + const struct vinfo_s *vinfo, + u32 slice_num, + u32 pi_enable) +{ + if (vinfo->width >= 3840 && + vinfo->height >= 2160 && + freq_ratio >= 2 && + slice_num == 1 && + !pi_enable) + return true; + else + return false; +} + /* *test on txlx: *Time_out = (V_out/V_screen_total)/FPS_out; @@ -994,7 +1009,7 @@ static int vpp_process_speed_check #ifdef CONFIG_AMLOGIC_MEDIA_FRC frc_enable = frc_n2m_worked(); #endif - if (frc_enable) + if (frc_enable && layer_id == 0) sync_duration_num = vinfo->sync_duration_num / 2; else sync_duration_num = vinfo->sync_duration_num; @@ -1161,7 +1176,9 @@ static int vpp_process_speed_check *the clac height is 1119;which is bigger than 1080! */ if (height_in > height_out && - ((height_in - height_out) < height_in / 20)) + ((height_in - height_out) < height_in / 20) && + !is_video_output_4k120hz(freq_ratio, + vinfo, slice_num, pi_enable)) return SPEED_CHECK_DONE; if (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXBB) { @@ -1189,12 +1206,13 @@ static int vpp_process_speed_check (vpp_flags & VPP_FLAG_FROM_TOGGLE_FRAME)) cur_skip_ratio = cur_ratio; if (super_debug) - pr_info("%s:line=%d,cur_ratio=%d, min_ratio_1000=%d, type:%x, max_height:%d\n", + pr_info("%s:line=%d,cur_ratio=%d, min_ratio_1000=%d, type:%x, max_height:%d, freq_ratio=%d\n", __func__, __LINE__, cur_ratio, min_ratio_1000, - vf->type, max_height); + vf->type, max_height, + freq_ratio); if (cur_ratio > min_ratio_1000 && vf->source_type != VFRAME_SOURCE_TYPE_TUNER && @@ -1281,10 +1299,18 @@ static int vpp_process_speed_check } } else if (next_frame_par->hscale_skip_count == 0) { /*TODO vpu */ - if (div_u64(VPP_SPEED_FACTOR * width_in * + clk_calc = div_u64(VPP_SPEED_FACTOR * width_in * sync_duration_num * height_screen, - sync_duration_den * 256) - > vpu_clk_get()) + sync_duration_den * 256); + if (super_debug) + pr_info("%s:line=%d,sync_duration_num=%d, clk_calc=%d, clk_in_pps=%d, height_in=%d, height_out=%d\n", + __func__, + __LINE__, + sync_duration_num, + clk_calc, + vpu_clk_get(), + height_in, height_out); + if (clk_calc > vpu_clk_get()) return SPEED_CHECK_HSKIP; else return SPEED_CHECK_DONE; @@ -1686,9 +1712,9 @@ static int vpp_set_filters_internal next_frame_par->vscale_skip_count++; #endif if (cur_super_debug) - pr_info("layer_id=%d, next_frame_par->vscale_skip_count=%d\n", + pr_info("layer_id=%d, next_frame_par->vscale_skip_count=%d, vpp_flags=0x%x\n", input->layer_id, - next_frame_par->vscale_skip_count); + next_frame_par->vscale_skip_count, vpp_flags); if (get_pi_enabled(input->layer_id)) { width_out >>= 1; @@ -1809,8 +1835,11 @@ RESTART: } if (cur_super_debug) - pr_info("%s(line:%d): vscale_skip_count=%d\n", - __func__, __LINE__, next_frame_par->vscale_skip_count); + pr_info("%s(line:%d): vscale_skip_count=%d, hscale_skip_count=%d, hskip_adjust=%d\n", + __func__, __LINE__, + next_frame_par->vscale_skip_count, + next_frame_par->hscale_skip_count, + hskip_adjust); aspect_factor = (vpp_flags & VPP_FLAG_AR_MASK) >> VPP_FLAG_AR_BITS; /* don't use input->wide_mode */ @@ -2481,9 +2510,15 @@ RESTART: goto RESTART; } else { next_frame_par->hscale_skip_count = 1; + /* hskip =1, w_in must aligned */ + if (w_in & 1) + goto RESTART; } } else if (skip == SPEED_CHECK_HSKIP) { next_frame_par->hscale_skip_count = 1; + /* hskip =1, w_in must aligned */ + if (w_in & 1) + goto RESTART; } }