Exemple #1
0
static struct vinfo_s *update_tv_info_duration(
	enum vmode_e target_vmode, enum fine_tune_mode_e fine_tune_mode)
{
	struct vinfo_s *vinfo;
	if ((target_vmode&VMODE_MODE_BIT_MASK) > VMODE_MAX)
		return NULL;
	vinfo = get_tv_info(target_vmode & VMODE_MODE_BIT_MASK);
	if (!vinfo) {
		vout_log_err("don't get tv_info, mode is %d\n", target_vmode);
		return NULL;
	}
	if (fine_tune_mode == DOWN_HPLL) {
		if ((target_vmode == VMODE_720P)
			|| (target_vmode == VMODE_1080I)
			|| (target_vmode == VMODE_1080P)
			|| (target_vmode == VMODE_4K2K_60HZ)
			|| (target_vmode == VMODE_4K2K_60HZ_Y420)) {
			vinfo->sync_duration_den = 1001;
			vinfo->sync_duration_num = 60000;
		} else if ((target_vmode == VMODE_1080P_24HZ)
			|| (target_vmode == VMODE_4K2K_24HZ)) {
			vinfo->sync_duration_den = 1001;
			vinfo->sync_duration_num = 24000;
		} else if (target_vmode == VMODE_4K2K_30HZ) {
			vinfo->sync_duration_den = 1001;
			vinfo->sync_duration_num = 30000;
		} else if (target_vmode == VMODE_480P) {
			if ((get_cpu_type() == MESON_CPU_MAJOR_ID_M8) ||
				(get_cpu_type() == MESON_CPU_MAJOR_ID_M8B) ||
				(get_cpu_type() == MESON_CPU_MAJOR_ID_M8M2)) {
				vinfo->sync_duration_den = 1001;
				vinfo->sync_duration_num = 60000;
			}
		}
	}  else if (fine_tune_mode == UP_HPLL) {
		if ((target_vmode == VMODE_720P)
			|| (target_vmode == VMODE_1080I)
			|| (target_vmode == VMODE_1080P)
			|| (target_vmode == VMODE_4K2K_60HZ)
			|| (target_vmode == VMODE_4K2K_60HZ_Y420)) {
			vinfo->sync_duration_den = 1;
			vinfo->sync_duration_num = 60;
		} else if ((target_vmode == VMODE_1080P_24HZ)
		|| (target_vmode == VMODE_4K2K_24HZ)) {
			vinfo->sync_duration_den = 1;
			vinfo->sync_duration_num = 24;
		} else if (target_vmode == VMODE_4K2K_30HZ) {
			vinfo->sync_duration_den = 1;
			vinfo->sync_duration_num = 30;
		} else if (target_vmode == VMODE_480P) {
			if ((get_cpu_type() == MESON_CPU_MAJOR_ID_M8) ||
				(get_cpu_type() == MESON_CPU_MAJOR_ID_M8B) ||
				(get_cpu_type() == MESON_CPU_MAJOR_ID_M8M2)) {
				vinfo->sync_duration_den = 1;
				vinfo->sync_duration_num = 60;
			}
		}
	}
	return vinfo;
}
Exemple #2
0
static int tv_set_current_vmode(enum vmode_e mode)
{
	if ((mode & VMODE_MODE_BIT_MASK) > VMODE_MAX)
		return -EINVAL;
#ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION
	/*
	 * if plug hdmi during fps (stream is playing)
	 * then adjust mode to fps vmode
	 */
	if (!want_hdmi_mode(mode)) {
		if (DOWN_HPLL == fine_tune_mode)
			update_tv_info_duration(fps_target_mode, UP_HPLL);
	}
	fps_auto_adjust_mode(&mode);
	update_vmode_status(get_name_from_vmode(mode));
	vout_log_info("%s[%d]fps_target_mode=%d\n",
		      __func__, __LINE__, mode);

	info->vinfo = update_tv_info_duration(mode, fine_tune_mode);
#else
	info->vinfo = get_tv_info(mode & VMODE_MODE_BIT_MASK);
#endif
	if (!info->vinfo) {
		vout_log_info("don't get tv_info, mode is %d\n", mode);
		return 1;
	}
	vout_log_info("mode is %d,sync_duration_den=%d,sync_duration_num=%d\n",
		      mode, info->vinfo->sync_duration_den,
		      info->vinfo->sync_duration_num);
	if (mode & VMODE_LOGO_BIT_MASK)
		return 0;

	vout_change_mode_preprocess(mode);

#ifdef CONFIG_AML_VPU
	switch_vpu_mem_pd_vmod(info->vinfo->mode, VPU_MEM_POWER_ON);
	request_vpu_clk_vmod(info->vinfo->video_clk, info->vinfo->mode);
#endif
	tv_out_reg_write(VPP_POSTBLEND_H_SIZE, info->vinfo->width);
	tv_out_setmode(vmode_to_tvmode(mode));

#ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION
	vout_log_info("new mode =%s set ok\n", get_name_from_vmode(mode));
#endif

	return 0;
}
Exemple #3
0
static int tv_set_current_vmode(vmode_t mod)
{
    if ((mod&VMODE_MODE_BIT_MASK)> VMODE_MAX)
	return -EINVAL;
    info->vinfo = get_tv_info(mod & VMODE_MODE_BIT_MASK);
    if(!info->vinfo) {
        printk("don't get tv_info, mode is %d\n", mod);
        return 1;
    }
//	info->vinfo = &tv_info[mod & VMODE_MODE_BIT_MASK];
    printk("mode is %d,sync_duration_den=%d,sync_duration_num=%d\n", mod,info->vinfo->sync_duration_den,info->vinfo->sync_duration_num);
    if(mod&VMODE_LOGO_BIT_MASK)  return 0;
#if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8
    switch_vpu_mem_pd_vmod(info->vinfo->mode, VPU_MEM_POWER_ON);
    request_vpu_clk_vmod(info->vinfo->video_clk, info->vinfo->mode);
#endif
    tvoutc_setmode(vmode_to_tvmode(mod));
//	change_vdac_setting(get_current_vdac_setting(),mod);
    return 0;
}
Exemple #4
0
static int framerate_automation_set_mode(
	enum vmode_e mode_target, enum hint_mode_e hint_mode)
{
	const struct vinfo_s *pvinfo;
	enum vmode_e mode_current = VMODE_INIT_NULL;
	if ((mode_target&VMODE_MODE_BIT_MASK) > VMODE_MAX)
		return 1;
	pvinfo = tv_get_current_info();
	if (!pvinfo) {
		vout_log_err("don't get tv_info, mode is %d\n", mode_target);
		return 1;
	}
	mode_current = pvinfo->mode;
	if (!want_hdmi_mode(mode_current)) {
		vout_log_info("not in valid HDMI mode!\n");
		return 1;
	}

	if (mode_current == mode_target) {
		if (fine_tune_mode == KEEP_HPLL)
			return 0;
	}
	vout_log_info("vout [%s] mode_target = %d\n", __func__, mode_target);
	if (START_HINT == hint_mode) {
		info->vinfo = update_tv_info_duration(mode_target,
			fine_tune_mode);
	} else if (END_HINT == hint_mode) {
		/*recovery tv_info array, e.g. 1080p59hz->1080p50hz
		or 1080p59hz->1080p60hz, recovery 1080p60hz vinfo*/
		update_tv_info_duration(fps_target_mode, fine_tune_mode);
		/*get current vinfo, maybe change is 1080p->1080p50,
		then get info->vinfo  for 1080p50hz*/
		info->vinfo = get_tv_info(mode_target & VMODE_MODE_BIT_MASK);
	}
	update_vmode_status(get_name_from_vmode(mode_target));
	vout_notifier_call_chain(VOUT_EVENT_MODE_CHANGE, &mode_target);
	return 0;
}