vdin: hdr mode force 10bit mode [1/1]

PD#TV-7517

Problem:
hdmi hdr color deepth mode is auto, if input
is 8bit mode, output is 8bit mode

Solution:
when is hdr mode, force set 10bit mode to frame
buffer.

Verify:
tl1

Change-Id: If958f687e3923389277880e19d47f933421a8292
Signed-off-by: Yong Qin <yong.qin@amlogic.com>
This commit is contained in:
Yong Qin
2019-07-04 19:02:06 +08:00
committed by Luke Go
parent 57d31e8567
commit e7f25b093b
4 changed files with 58 additions and 7 deletions

View File

@@ -3500,13 +3500,13 @@ void vdin_set_bitdepth(struct vdin_dev_s *devp)
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);
@@ -4292,6 +4292,44 @@ void vdin_set_drm_data(struct vdin_dev_s *devp,
}
}
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;

View File

@@ -767,6 +767,7 @@ static void vdin_dump_state(struct vdin_dev_s *devp)
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);
@@ -1967,7 +1968,7 @@ start_chk:
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);
}

View File

@@ -540,8 +540,12 @@ void vdin_start_dec(struct vdin_dev_s *devp)
}
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);
@@ -3217,7 +3221,7 @@ static int vdin_drv_probe(struct platform_device *pdev)
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)

View File

@@ -117,6 +117,14 @@
#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)
{
@@ -322,7 +330,7 @@ struct vdin_dev_s {
*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