VPP_VD1_CLIP_MISC1,
0);
video_effect_bypass(0);
- VSYNC_WR_DV_REG(VPP_DOLBY_CTRL,
- dolby_ctrl_backup);
/* always vd2 to vpp and bypass core 1 */
viu_misc_ctrl_backup |=
(VSYNC_RD_DV_REG(VIU_MISC_CTRL1) & 2);
static bool vf_is_hdr10_plus(struct vframe_s *vf);
static bool vf_is_hdr10(struct vframe_s *vf);
static bool vf_is_hlg(struct vframe_s *vf);
-
-static const char *input_str[7] = {
+static bool is_mvc_frame(struct vframe_s *vf);
+static const char *input_str[8] = {
"NONE",
"HDR",
"HDR+",
"DOVI",
"PRIME",
"HLG",
- "SDR"
+ "SDR",
+ "MVC"
};
static void update_src_format(
dolby_vision_src_format = 1;
else if (vf_is_hlg(vf))
dolby_vision_src_format = 5;
+ else if (is_mvc_frame(vf))
+ dolby_vision_src_format = 7;
else
dolby_vision_src_format = 6;
}
}
vinfo = get_current_vinfo();
+ if (src_format == FORMAT_MVC) {
+ if (dolby_vision_mode !=
+ DOLBY_VISION_OUTPUT_MODE_BYPASS) {
+ if (debug_dolby & 2)
+ pr_dolby_dbg(
+ "mvc, dovi output -> DOLBY_VISION_OUTPUT_MODE_BYPASS\n");
+ *mode = DOLBY_VISION_OUTPUT_MODE_BYPASS;
+ mode_change = 1;
+ } else {
+ mode_change = 0;
+ }
+ return mode_change;
+ }
if (dolby_vision_policy == DOLBY_VISION_FOLLOW_SINK) {
/* bypass dv_mode with efuse */
if ((efuse_mode == 1) && !dolby_vision_efuse_bypass) {
return false;
}
+static bool is_mvc_frame(struct vframe_s *vf)
+{
+ if (!vf)
+ return false;
+ if (vf->type & VIDTYPE_MVC)
+ return true;
+ return false;
+}
+
+int dolby_vision_check_mvc(struct vframe_s *vf)
+{
+ int mode;
+
+ if (is_mvc_frame(vf) && dolby_vision_on) {
+ /* mvc source, but dovi enabled, need bypass dv */
+ mode = dolby_vision_mode;
+ if (dolby_vision_policy_process(
+ &mode, FORMAT_MVC)) {
+ if ((mode == DOLBY_VISION_OUTPUT_MODE_BYPASS) &&
+ (dolby_vision_mode !=
+ DOLBY_VISION_OUTPUT_MODE_BYPASS))
+ dolby_vision_wait_on = true;
+ return 1;
+ }
+ }
+ return 0;
+}
+EXPORT_SYMBOL(dolby_vision_check_mvc);
+
int dolby_vision_check_hlg(struct vframe_s *vf)
{
int mode;
src_format = FORMAT_HDR10PLUS;
}
+ if ((src_format != FORMAT_DOVI) &&
+ is_mvc_frame(vf)) {
+ src_format = FORMAT_MVC;
+ }
+
#ifdef V2_4
/* TODO: need 962e ? */
if ((src_format == FORMAT_SDR)
check_format = FORMAT_HLG;
else if (is_hdr10plus_frame(vf))
check_format = FORMAT_HDR10PLUS;
+ else if (is_mvc_frame(vf))
+ check_format = FORMAT_MVC;
else
check_format = FORMAT_SDR;
if (dolby_vision_policy_process(
dolby_vision_wait_on = false;
dolby_vision_wait_init = false;
dolby_vision_on_in_uboot = 0;
+ last_dst_format = FORMAT_DOVI;
}
if ((!p_funcs_stb || !p_funcs_tv) && func) {
FORMAT_DOVI_LL = 3,
FORMAT_HLG = 4,
FORMAT_HDR10PLUS = 5,
- FORMAT_SDR_2020 = 6
+ FORMAT_SDR_2020 = 6,
+ FORMAT_MVC = 7
};
enum priority_mode_e {
uint debug_csc;
+static int cur_mvc_type[2];
module_param(debug_csc, uint, 0664);
MODULE_PARM_DESC(debug_csc, "\n debug_csc\n");
HDR_BYPASS, cur_hdr_process);
}
+void hdr_vd2_off(void)
+{
+ enum hdr_process_sel cur_hdr_process;
+
+ cur_hdr_process = hdr_func(VD2_HDR, HDR_BYPASS, get_current_vinfo());
+ pr_csc(8, "am_vecm: module=VD2_HDR, process=HDR_BYPASS(%d, %d)\n",
+ HDR_BYPASS, cur_hdr_process);
+}
+
static struct hdr_data_t *phdr;
struct hdr_data_t *hdr_get_data(void)
if (!vf)
return 0;
-
+ if (vf->type & VIDTYPE_MVC) {
+ if (cur_mvc_type[vd_path] != (vf->type & VIDTYPE_MVC)) {
+ change_flag |= SIG_SRC_CHG;
+ cur_mvc_type[vd_path] = vf->type & VIDTYPE_MVC;
+ return change_flag;
+ }
+ } else
+ cur_mvc_type[vd_path] = 0;
if ((vf->source_type == VFRAME_SOURCE_TYPE_TUNER) ||
(vf->source_type == VFRAME_SOURCE_TYPE_CVBS) ||
(vf->source_type == VFRAME_SOURCE_TYPE_COMP) ||
static enum hdr_type_e get_source_type(enum vd_path_e vd_path)
{
get_cur_vd_signal_type(vd_path);
+ if (cur_mvc_type[vd_path] == VIDTYPE_MVC)
+ return HDRTYPE_MVC;
if (vd_path == VD1_PATH &&
is_dolby_vision_enable() &&
get_dolby_vision_src_format()
get_hdr_policy());
signal_change_flag |= SIG_HDR_MODE;
}
+
source_format[VD1_PATH] = get_source_type(VD1_PATH);
source_format[VD2_PATH] = get_source_type(VD2_PATH);
get_cur_vd_signal_type(vd_path);
+
signal_change_flag |=
hdr_policy_process(vinfo, source_format, vd_path);
if (signal_change_flag & SIG_OUTPUT_MODE_CHG) {
get_source_type(VD1_PATH) ==
HDRTYPE_HDR10PLUS ||
get_source_type(VD1_PATH)
- == HDRTYPE_HLG))) {
+ == HDRTYPE_HLG ||
+ get_source_type(VD1_PATH)
+ == HDRTYPE_MVC))) {
/* and VD1 adaptive or VD2 */
/* or always hdr hdr+/hlg bypass */
/* faked vframe to switch matrix */
extern void hdr_set_cfg_osd_100(int val);
extern void hdr_osd_off(void);
extern void hdr_vd1_off(void);
+void hdr_vd2_off(void);
extern bool is_video_layer_on(enum vd_path_e vd_path);
#define HDR_MODULE_OFF 0
hdr10_plus_process_mode[vd_path] = PROC_BYPASS;
target_format[vd_path] = BT709;
} else if (cur_hdr_policy == 0) {
- if (vd_path == VD1_PATH &&
+ if (source_format[vd_path] == HDRTYPE_MVC) {
+ /* hdr bypass output need sdr */
+ sdr_process_mode[vd_path] = PROC_BYPASS;
+ hdr_process_mode[vd_path] = PROC_BYPASS;
+ hlg_process_mode[vd_path] = PROC_BYPASS;
+ hdr10_plus_process_mode[vd_path] = PROC_BYPASS;
+ sdr_process_mode[oth_path] = PROC_BYPASS;
+ hdr_process_mode[oth_path] = PROC_BYPASS;
+ hlg_process_mode[oth_path] = PROC_BYPASS;
+ hdr10_plus_process_mode[oth_path] = PROC_BYPASS;
+ target_format[vd_path] = BT709;
+ target_format[oth_path] = BT709;
+ } else if (vd_path == VD1_PATH &&
is_dolby_vision_enable() &&
!is_dolby_vision_on() &&
(source_format[vd_path]
#endif
}
} else if (cur_hdr_policy == 1) {
- if (vd_path == VD1_PATH &&
+ if (source_format[vd_path] == HDRTYPE_MVC) {
+ /* hdr bypass output need sdr */
+ sdr_process_mode[vd_path] = PROC_BYPASS;
+ hdr_process_mode[vd_path] = PROC_BYPASS;
+ hlg_process_mode[vd_path] = PROC_BYPASS;
+ hdr10_plus_process_mode[vd_path] = PROC_BYPASS;
+ sdr_process_mode[oth_path] = PROC_BYPASS;
+ hdr_process_mode[oth_path] = PROC_BYPASS;
+ hlg_process_mode[oth_path] = PROC_BYPASS;
+ hdr10_plus_process_mode[oth_path] = PROC_BYPASS;
+ target_format[vd_path] = BT709;
+ target_format[oth_path] = BT709;
+ } else if (vd_path == VD1_PATH &&
is_dolby_vision_enable() &&
!is_dolby_vision_on() &&
source_format[vd_path]
case HDRTYPE_SDR:
cur_sdr_process_mode[oth_path] = PROC_OFF;
break;
+ case HDRTYPE_MVC:
+ cur_sdr_process_mode[oth_path] = PROC_BYPASS;
+ cur_hdr_process_mode[oth_path] = PROC_BYPASS;
+ cur_hlg_process_mode[oth_path] = PROC_BYPASS;
+ cur_hdr10_plus_process_mode[oth_path] = PROC_BYPASS;
+ break;
default:
break;
}
hdr_proc(VD2_HDR, HDR_HLG, vinfo);
hdr_proc(OSD1_HDR, SDR_HLG, vinfo);
}
-
+ break;
+ case HDRTYPE_MVC:
+ hdr_osd_off();
+ hdr_vd1_off();
+ hdr_vd2_off();
break;
default:
break;
vd_path + 1,
cur_sdr_process_mode[vd_path],
sdr_process_mode[vd_path]);
+ if (cur_source_format[vd_path] == HDRTYPE_MVC)
+ pr_csc(1,
+ "am_vecm: vd%d: mvc_process_mode %d to %d\n",
+ vd_path + 1,
+ cur_sdr_process_mode[vd_path],
+ sdr_process_mode[vd_path]);
cur_sdr_process_mode[vd_path] =
sdr_process_mode[vd_path];
}
}
vd1_path_select(true, false);
-
+ if (is_mvc)
+ vd2_path_select(true, false);
VSYNC_WR_MPEG_REG(
VD1_IF0_GEN_REG + cur_dev->viu_off, 0);
return;
vd1_path_select(false, true);
} else {
vd1_path_select(false, false);
+ if (is_mvc)
+ vd2_path_select(false, false);
VSYNC_WR_MPEG_REG(
AFBC_ENABLE, 0);
}
}
#endif
+int is_3d_enable(struct vframe_s *vf)
+{
+ if (!vf && !process_3d_type)
+ return VFRAME_NONE;
+ if (process_3d_type ||
+ (vf->type & VIDTYPE_MVC))
+ return VFRAME_MVC;
+ return VFRAME_NO_MVC;
+}
+
#ifdef FIQ_VSYNC
void vsync_fisr_in(void)
#else
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
/* check video frame before VECM process */
if (is_dolby_vision_enable() && vf) {
+ dolby_vision_check_mvc(vf);
dolby_vision_check_hdr10(vf);
dolby_vision_check_hdr10plus(vf);
dolby_vision_check_hlg(vf);
break;
else
frame_skip_check_cnt = 0;
-
+#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
+ if (amvecm_on_vs(
+ (cur_dispbuf != &vf_local)
+ ? cur_dispbuf : NULL,
+ vf, CSC_FLAG_CHECK_OUTPUT,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ VD1_PATH) == 1)
+ break;
+#endif
vf = video_vf_get();
if (!vf) {
ATRACE_COUNTER(MODULE_NAME, __LINE__);
video_3d_format = vf->trans_fmt;
}
}
-
-#if defined(CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_VECM)
- if (amvecm_on_vs(
- (cur_dispbuf != &vf_local)
- ? cur_dispbuf : NULL,
- vf, CSC_FLAG_CHECK_OUTPUT,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- VD1_PATH) == 1)
- break;
-#endif
vsync_toggle_frame(vf, __LINE__);
toggle_frame = vf;
if (cur_pipbuf && (video2_enabled == 1)
&& ((vpp_misc_save & VPP_VD2_POSTBLEND) == 0)
&& (video2_onoff_state == VIDEO_ENABLE_STATE_IDLE)) {
- vpp_misc_set |=
- VPP_VD2_POSTBLEND |
- VPP_POSTBLEND_EN;
+ if (is_3d_enable(cur_dispbuf) != VFRAME_MVC)
+ vpp_misc_set |=
+ VPP_VD2_POSTBLEND |
+ VPP_POSTBLEND_EN;
}
#endif
if ((video_enabled == 1) && ((vpp_misc_save & VPP_VD1_POSTBLEND) == 0)
&& (video_onoff_state == VIDEO_ENABLE_STATE_IDLE)) {
- vpp_misc_set |=
- VPP_VD1_PREBLEND |
- VPP_VD1_POSTBLEND |
- VPP_POSTBLEND_EN;
+ if (is_3d_enable(cur_dispbuf) == VFRAME_MVC)
+ vpp_misc_set |= VPP_VD1_PREBLEND | VPP_VD2_PREBLEND |
+ VPP_PREBLEND_EN | VPP_VD1_POSTBLEND;
+ else
+ vpp_misc_set |=
+ VPP_VD1_PREBLEND |
+ VPP_VD1_POSTBLEND |
+ VPP_POSTBLEND_EN;
}
if ((video_enabled == 1) && cur_frame_par
&& (cur_dispbuf != &vf_local) && (first_set == 0)
video2_onoff_state = VIDEO_ENABLE_STATE_ON_PENDING;
} else if (video2_onoff_state ==
VIDEO_ENABLE_STATE_ON_PENDING) {
- if (is_dolby_vision_on() &&
+ if (is_3d_enable(cur_dispbuf) == VFRAME_MVC) {
+ vpp_misc_set |= VPP_VD2_PREBLEND |
+ VPP_PREBLEND_EN;
+ } else if (is_dolby_vision_on() &&
(!is_dolby_vision_el_disable() ||
- for_dolby_vision_certification()))
+ for_dolby_vision_certification())) {
vpp_misc_set &= ~(VPP_VD2_PREBLEND |
VPP_VD2_POSTBLEND | VPP_PREBLEND_EN);
- else if (process_3d_type ||
- (cur_dispbuf &&
- (cur_dispbuf->type & VIDTYPE_MVC)))
- vpp_misc_set |= VPP_VD2_PREBLEND |
- VPP_PREBLEND_EN;
- else if (!legacy_vpp)
- vpp_misc_set |= VPP_VD2_POSTBLEND |
- VPP_POSTBLEND_EN;
- else
- vpp_misc_set |= VPP_VD2_PREBLEND |
- VPP_PREBLEND_EN;
+ } else if (cur_pipbuf) {
#ifdef VIDEO_PIP
- if (cur_pipbuf) {
vpp_misc_set &=
~(VPP_PREBLEND_EN | VPP_VD2_PREBLEND);
vpp_misc_set |= VPP_VD2_POSTBLEND;
- }
#endif
+ } else if (!legacy_vpp) {
+ vpp_misc_set |= VPP_VD2_POSTBLEND |
+ VPP_POSTBLEND_EN;
+ } else {
+ vpp_misc_set |= VPP_VD2_PREBLEND |
+ VPP_PREBLEND_EN;
+ }
/* g12a has no alpha overflow check in hardware */
if (!legacy_vpp)
vpp_misc_set |= (0x100 << VPP_VD2_ALPHA_BIT);
VPP_VD2_POSTBLEND |
VPP_VD1_POSTBLEND |
VPP_PREBLEND_EN);
+ if (is_3d_enable(cur_dispbuf) != VFRAME_MVC) {
#ifdef VIDEO_PIP
/* should keep video2 display */
if (cur_pipbuf && video2_enabled)
vpp_misc_set |= VPP_VD2_POSTBLEND;
#endif
+ }
} else {
video_enabled = video_status_saved;
}
if (!video_enabled &&
- (vpp_misc_set & VPP_VD1_POSTBLEND))
+ ((vpp_misc_set & VPP_VD1_POSTBLEND) ||
+ (vpp_misc_set & VPP_VD1_PREBLEND)))
vpp_misc_set &= ~(VPP_VD1_PREBLEND |
VPP_VD1_POSTBLEND |
VPP_PREBLEND_EN);
}
if (!video2_enabled &&
- (vpp_misc_set & VPP_VD2_POSTBLEND))
+ ((vpp_misc_set & VPP_VD2_POSTBLEND) ||
+ (vpp_misc_set & VPP_VD2_PREBLEND)))
vpp_misc_set &= ~(VPP_VD2_PREBLEND |
VPP_VD2_POSTBLEND);
#endif
0xf);
/* if vd2 is bottom layer, need remove alpha for vd2 */
- if (((vpp_misc_set & VPP_VD1_POSTBLEND) == 0)
- && (vpp_misc_set & VPP_VD2_POSTBLEND)) {
+ /* 3d case vd2 preblend, need remove alpha for vd2 */
+ if ((((vpp_misc_set & VPP_VD1_POSTBLEND) == 0) &&
+ (vpp_misc_set & VPP_VD2_POSTBLEND)) ||
+ (vpp_misc_set & VPP_VD2_PREBLEND)) {
vpp_misc_set &= ~(0x1ff << VPP_VD2_ALPHA_BIT);
vpp_misc_set |= (0x100 << VPP_VD2_ALPHA_BIT);
}
}
+static void update_current_para(struct hdmitx_dev *hdev)
+{
+ struct vinfo_s *info = NULL;
+ unsigned char mode[32];
+
+ info = hdmitx_get_current_vinfo();
+ if (!info)
+ return;
+
+ strncpy(mode, info->name, sizeof(mode));
+ if (strstr(hdev->fmt_attr, "420")) {
+ if (!strstr(mode, "420"))
+ strncat(mode, "420", 3);
+ }
+ hdev->para = hdmi_get_fmt_name(mode, hdev->fmt_attr);
+}
+
static void hdmitx_set_vsif_pkt(enum eotf_type type,
enum mode_type tunnel_mode, struct dv_vsif_para *data, bool signal_sdr)
{
HDMI_PACKET_VEND, NULL, NULL);
if (signal_sdr) {
pr_info("hdmitx: H14b VSIF, switching signal to SDR\n");
+ update_current_para(hdev);
hdev->HWOp.CntlConfig(hdev,
CONF_AVI_RGBYCC_INDIC, hdev->para->cs);
hdev->HWOp.CntlConfig(hdev,
extern bool is_dolby_vision_el_disable(void);
extern bool is_dovi_dual_layer_frame(struct vframe_s *vf);
void dolby_vision_set_provider(char *prov_name);
+int dolby_vision_check_mvc(struct vframe_s *vf);
#endif
#define PRIMESL_SOURCE 4
#define HLG_SOURCE 5
#define SDR_SOURCE 6
+#define MVC_SOURCE 7
enum cm_hist_e {
CM_HUE_HIST = 0,
HDRTYPE_HDR10 = HDR10_SOURCE,
HDRTYPE_HLG = HLG_SOURCE,
HDRTYPE_HDR10PLUS = HDR10PLUS_SOURCE,
- HDRTYPE_DOVI = DOVI_SOURCE
+ HDRTYPE_DOVI = DOVI_SOURCE,
+ HDRTYPE_MVC = MVC_SOURCE,
};
enum pd_comb_fix_lvl_e {
VIDEO_WIDEOPTION_MAX = 16
};
+enum {
+ VFRAME_NONE,
+ VFRAME_MVC,
+ VFRAME_NO_MVC
+};
+
/* TODO: move to register headers */
#define VPP_VADJ2_BLMINUS_EN (1 << 3)
#define VPP_VADJ2_EN (1 << 2)