pr_info("set output color depth %d bit from dts\n", set_width);
}
- switch (devp->color_depth_config) {
- case 8:
+ switch (devp->color_depth_config & 0xff) {
+ case COLOR_DEEPS_8BIT:
devp->source_bitdepth = 8;
wr_bits(offset, VDIN_WR_CTRL2, 0,
VDIN_WR_10BIT_MODE_BIT, VDIN_WR_10BIT_MODE_WID);
break;
- case 10:
+ case COLOR_DEEPS_10BIT:
devp->source_bitdepth = 10;
wr_bits(offset, VDIN_WR_CTRL2, 1,
VDIN_WR_10BIT_MODE_BIT, VDIN_WR_10BIT_MODE_WID);
break;
- case 0:
+ case COLOR_DEEPS_AUTO:
/* vdin_bit_depth is set to 0 by defaut, in this case,
devp->source_bitdepth is controlled by colordepth
change default to 10bit for 8in8out detail maybe lost
devp->parm.info.signal_type = vf->signal_type;
}
+void vdin_check_hdmi_hdr(struct vdin_dev_s *devp)
+{
+ struct tvin_state_machine_ops_s *sm_ops;
+ enum tvin_port_e port = TVIN_PORT_NULL;
+ struct tvin_sig_property_s *prop;
+
+ if (!devp)
+ return;
+
+ if (devp->color_depth_config & COLOR_DEEPS_MANUAL)
+ return;
+
+ devp->color_depth_config = COLOR_DEEPS_AUTO;
+ port = devp->parm.port;
+ if ((port < TVIN_PORT_HDMI0) || (port > TVIN_PORT_HDMI7))
+ return;
+
+ prop = &devp->prop;
+ sm_ops = devp->frontend->sm_ops;
+ if (sm_ops->get_sig_property) {
+ sm_ops->get_sig_property(devp->frontend, prop);
+ pr_info("vdin hdmi hdr eotf:0x%x\n",
+ devp->prop.hdr_info.hdr_data.eotf);
+ if (devp->prop.hdr_info.hdr_state == HDR_STATE_GET) {
+ if ((devp->prop.hdr_info.hdr_data.eotf ==
+ EOTF_HDR) ||
+ (devp->prop.hdr_info.hdr_data.eotf ==
+ EOTF_SMPTE_ST_2048) ||
+ (devp->prop.hdr_info.hdr_data.eotf ==
+ EOTF_HLG)) {
+ pr_info("vdin is hdr mode,force 10bit\n");
+ devp->color_depth_config = COLOR_DEEPS_10BIT;
+ }
+ }
+ devp->prop.hdr_info.hdr_data.eotf = 0;
+ }
+}
+
u32 vdin_get_curr_field_type(struct vdin_dev_s *devp)
{
u32 field_status;
pr_info("cma_mem_size:0x%x\n", devp->cma_mem_size);
pr_info("cma_mem_mode:%d\n", devp->cma_mem_mode);
pr_info("force_yuv444_malloc:%d\n", devp->force_yuv444_malloc);
+ vdin_check_hdmi_hdr(devp);
vdin_dump_vf_state(devp->vfp);
if (vf) {
pr_info("current vframe index(%u):\n", vf->index);
if (!parm[1])
pr_err("miss parameters .\n");
else if (kstrtoul(parm[1], 10, &val) == 0) {
- devp->color_depth_config = val;
+ devp->color_depth_config = val | COLOR_DEEPS_MANUAL;
pr_info("color_depth(%d):%d\n\n", devp->index,
devp->color_depth_config);
}
}
vdin_set_cutwin(devp);
vdin_set_hvscale(devp);
- if (cpu_after_eq(MESON_CPU_MAJOR_ID_GXTVBB))
+
+ if (cpu_after_eq(MESON_CPU_MAJOR_ID_GXTVBB)) {
+ vdin_check_hdmi_hdr(devp);
vdin_set_bitdepth(devp);
+ }
+
/* txl new add fix for hdmi switch resolution cause cpu holding */
if (get_cpu_type() >= MESON_CPU_MAJOR_ID_TXL)
vdin_fix_nonstd_vsync(devp);
pr_info("no bit mode found, set 8bit as default\n");
vdevp->color_depth_support = bit_mode & 0xff;
- vdevp->color_depth_config = 0;
+ vdevp->color_depth_config = COLOR_DEEPS_AUTO;
ret = (bit_mode >> 8) & 0xff;
if (ret == 0)
#define VDIN_AFBCE_EN_720P (1 << 6)
#define VDIN_AFBCE_EN_SMALL (1 << 7)
+enum COLOR_DEEPS_CFGe {
+ COLOR_DEEPS_AUTO = 0,
+ COLOR_DEEPS_8BIT = 8,
+ COLOR_DEEPS_10BIT = 10,
+ COLOR_DEEPS_12BIT = 12,
+ COLOR_DEEPS_MANUAL = 0x100,
+};
+
static inline const char *vdin_fmt_convert_str(
enum vdin_format_convert_e fmt_cvt)
{
*10:force config as 10bit
*12:force config as 12bit
*/
- unsigned int color_depth_config;
+ enum COLOR_DEEPS_CFGe color_depth_config;
/* new add from txl:color depth mode for 10bit
*1: full pack mode;config 10bit as 10bit
*0: config 10bit as 12bit