diff --git a/drivers/media/vin/tvin/vdin/vdin_ctl.c b/drivers/media/vin/tvin/vdin/vdin_ctl.c index 57ba6ee05..b1bb49dce 100644 --- a/drivers/media/vin/tvin/vdin/vdin_ctl.c +++ b/drivers/media/vin/tvin/vdin/vdin_ctl.c @@ -770,9 +770,15 @@ void vdin_get_format_convert(struct vdin_dev_s *devp) /*rx will tunneled to 444*/ format_convert = VDIN_FORMAT_CONVERT_YUV_YUV444; } else if (devp->prop.color_format == TVIN_RGB444) { - format_convert = VDIN_FORMAT_CONVERT_RGB_RGB; + if (vdin_dv_is_not_std_source_led(devp)) + format_convert = VDIN_FORMAT_CONVERT_BRG_YUV422; + else + format_convert = VDIN_FORMAT_CONVERT_RGB_RGB; } else { - format_convert = VDIN_FORMAT_CONVERT_YUV_YUV444; + if (vdin_dv_is_not_std_source_led(devp)) + format_convert = VDIN_FORMAT_CONVERT_YUV_YUV422; + else + format_convert = VDIN_FORMAT_CONVERT_YUV_YUV444; } } #endif @@ -1949,7 +1955,7 @@ void vdin_set_matrix(struct vdin_dev_s *devp) } else { matrix_sel = VDIN_SEL_MATRIX0; } - if (!devp->dv.dv_flag) { + if (!devp->dv.dv_flag || vdin_dv_is_not_std_source_led(devp)) { devp->csc_idx = vdin_set_color_matrix(matrix_sel, devp->addr_offset, devp->fmt_info_p, diff --git a/drivers/media/vin/tvin/vdin/vdin_drv.c b/drivers/media/vin/tvin/vdin/vdin_drv.c index ced41a939..e12135718 100644 --- a/drivers/media/vin/tvin/vdin/vdin_drv.c +++ b/drivers/media/vin/tvin/vdin/vdin_drv.c @@ -882,6 +882,10 @@ static void vdin_vf_init(struct vdin_dev_s *devp) vf->flag |= VFRAME_FLAG_GAME_MODE; if (devp->vdin_pc_mode) vf->flag |= VFRAME_FLAG_PC_MODE; + if (vdin_dv_is_not_std_source_led(devp) || devp->debug.bypass_tunnel) + vf->type_ext |= VIDTYPE_EXT_BYPASS_DETUNNEL; + else + vf->type_ext &= ~VIDTYPE_EXT_BYPASS_DETUNNEL; scan_mode = devp->fmt_info_p->scan_mode; if ((scan_mode == TVIN_SCAN_MODE_INTERLACED && (!(devp->parm.flag & TVIN_PARM_FLAG_2D_TO_3D) && @@ -1282,7 +1286,8 @@ int vdin_start_dec(struct vdin_dev_s *devp) vdin_dolby_addr_alloc(devp, devp->vfp->size); #ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION if (vdin_is_dolby_signal_in(devp) && - devp->index == devp->dv.dv_path_idx) { + devp->index == devp->dv.dv_path_idx && + !vdin_dv_is_not_std_source_led(devp)) { /* config dolby vision */ vdin_dolby_config(devp); #ifndef VDIN_BRINGUP_NO_VF @@ -1587,7 +1592,8 @@ void vdin_stop_dec(struct vdin_dev_s *devp) vdin_set_def_wr_canvas(devp); if (devp->work_mode == VDIN_WORK_MD_NORMAL) { - if (devp->dv.dv_config && devp->index == devp->dv.dv_path_idx) { + if (devp->dv.dv_config && devp->index == devp->dv.dv_path_idx && + !vdin_dv_is_not_std_source_led(devp)) { devp->dv.dv_config = 0; vf_unreg_provider(&devp->dv.dv_vf_provider); pr_info("vdin%d provider: dv unreg\n", devp->index); diff --git a/drivers/media/vin/tvin/vdin/vdin_drv.h b/drivers/media/vin/tvin/vdin/vdin_drv.h index 5b40836ef..b2cb11d59 100644 --- a/drivers/media/vin/tvin/vdin/vdin_drv.h +++ b/drivers/media/vin/tvin/vdin/vdin_drv.h @@ -212,7 +212,8 @@ enum vdin_hw_ver_e { /* 20230725: notify fps change event when not game mode */ /* 20230727: drop the first frame for vdin1 was not write finished */ /* 20230803: pc and game mode switch optimization */ -#define VDIN_VER_V1 "20230803: pc and game mode switch optimization" +/* 20231013: dv 444 low-latency need convert to 422 */ +#define VDIN_VER_V1 "20231013: dv 444 low-latency need convert to 422" enum vdin_irq_flg_e { VDIN_IRQ_FLG_NO_END = 1, diff --git a/drivers/media/vin/tvin/vdin/vdin_dv.c b/drivers/media/vin/tvin/vdin/vdin_dv.c index 5e177836b..e49cab084 100644 --- a/drivers/media/vin/tvin/vdin/vdin_dv.c +++ b/drivers/media/vin/tvin/vdin/vdin_dv.c @@ -296,3 +296,21 @@ bool vdin_dv_not_manual_game(struct vdin_dev_s *devp) else return false; } + +/* some device force send dv 444 source-led need convert to 422 and bypass detunnel + * return value: + * true: dv is not standard source-led + * false: dv is yuv422/420 12bit source-led + */ +bool vdin_dv_is_not_std_source_led(struct vdin_dev_s *devp) +{ + if (devp->dv.dv_flag && + (devp->dv.low_latency || devp->prop.latency.allm_mode || + devp->vrr_data.vrr_mode) && + ((devp->prop.color_format == TVIN_RGB444 || + devp->prop.color_format == TVIN_YUV444) || + devp->prop.colordepth == 8)) + return true; + else + return false; +} diff --git a/drivers/media/vin/tvin/vdin/vdin_dv.h b/drivers/media/vin/tvin/vdin/vdin_dv.h index 93a7e424d..ca8675106 100644 --- a/drivers/media/vin/tvin/vdin/vdin_dv.h +++ b/drivers/media/vin/tvin/vdin/vdin_dv.h @@ -30,6 +30,7 @@ irqreturn_t vdin_wrmif2_dv_meta_wr_done_isr(int irq, void *dev_id); bool vdin_dv_is_need_tunnel(struct vdin_dev_s *devp); bool vdin_dv_is_visf_data(struct vdin_dev_s *devp); bool vdin_dv_not_manual_game(struct vdin_dev_s *devp); +bool vdin_dv_is_not_std_source_led(struct vdin_dev_s *devp); #else static inline bool vdin_dv_is_need_tunnel(struct vdin_dev_s *devp) { @@ -46,6 +47,9 @@ static inline bool vdin_dv_not_manual_game(struct vdin_dev_s *devp) return false; } +static inline bool vdin_dv_is_not_std_source_led(struct vdin_dev_s *devp) +{ + return false; +} #endif - #endif diff --git a/include/linux/amlogic/media/vfm/vframe.h b/include/linux/amlogic/media/vfm/vframe.h index 89cea803f..24a649358 100644 --- a/include/linux/amlogic/media/vfm/vframe.h +++ b/include/linux/amlogic/media/vfm/vframe.h @@ -64,6 +64,7 @@ #define VIDTYPE_EXT_VDIN_SCATTER 0x1 #define VIDTYPE_EXT_MOSAIC_22 0x2 +#define VIDTYPE_EXT_BYPASS_DETUNNEL 0x4 #define DISP_RATIO_FORCECONFIG 0x80000000 #define DISP_RATIO_FORCE_NORMALWIDE 0x40000000