From c62207ef53987660d6f6b70a79907072516e60c8 Mon Sep 17 00:00:00 2001 From: yao liu Date: Tue, 22 Oct 2019 19:07:25 +0800 Subject: [PATCH] dv: graphic blend test failed on HDR TV [1/1] PD#SWPL-15631 Problem: 1.HDR Luminance 375 is too large 2.osd osd_h_filter_mode is not update Solution: 1.set gmax to 300 for HDR output 2.update osd_h_filter_mode Verify: SM1 Change-Id: Ic6f1b02703341d01235a2081bd9ac7ee46b989e7 Signed-off-by: yao liu --- .../enhancement/amdolby_vision/amdolby_vision.c | 26 +++++++++++++++++++++- drivers/amlogic/media/osd/osd_fb.c | 2 ++ drivers/amlogic/media/osd/osd_hw.c | 3 +-- drivers/amlogic/media/vout/vout_serve/vout_serve.c | 2 -- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c index 5c657fb..0beb1c6 100644 --- a/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c +++ b/drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c @@ -277,6 +277,7 @@ static bool is_osd_off; static bool force_reset_core2; static int core1_switch; static int core3_switch; +static bool force_set_lut; module_param(vtotal_add, uint, 0664); MODULE_PARM_DESC(vtotal_add, "\n vtotal_add\n"); @@ -313,11 +314,17 @@ static unsigned int dolby_vision_default_max[3][3] = { static unsigned int dolby_vision_graphic_min = 50; /* 0.0001 */ static unsigned int dolby_vision_graphic_max; /* 100 */ +static unsigned int old_dolby_vision_graphic_max; module_param(dolby_vision_graphic_min, uint, 0664); MODULE_PARM_DESC(dolby_vision_graphic_min, "\n dolby_vision_graphic_min\n"); module_param(dolby_vision_graphic_max, uint, 0664); MODULE_PARM_DESC(dolby_vision_graphic_max, "\n dolby_vision_graphic_max\n"); +static unsigned int dv_HDR10_graphics_max = 300; +static unsigned int dv_graphic_blend_test; +module_param(dv_graphic_blend_test, uint, 0664); +MODULE_PARM_DESC(dv_graphic_blend_test, "\n dv_graphic_blend_test\n"); + static unsigned int dv_target_graphics_max[3][3] = { { 300, 375, 380 }, /* DOVI => DOVI/HDR/SDR */ { 300, 375, 100 }, /* HDR => DOVI/HDR/SDR */ @@ -2346,7 +2353,7 @@ static int dolby_core2_set( count = 256 * 5; else count = lut_count; - if (count && (set_lut || reset)) { + if (count && (set_lut || reset || force_set_lut)) { if (dolby_vision_flags & FLAG_CLKGATE_WHEN_LOAD_LUT) VSYNC_WR_DV_REG_BITS(DOLBY_CORE2A_CLKGATE_CTRL, 2, 2, 2); @@ -2371,6 +2378,7 @@ static int dolby_core2_set( VSYNC_WR_DV_REG_BITS( DOLBY_CORE2A_CLKGATE_CTRL, 0, 2, 2); } + force_set_lut = false; /* enable core2 */ VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL0, dolby_enable << 0); @@ -2653,6 +2661,19 @@ static int is_graphic_changed(void) ret |= 2; } } + if (old_dolby_vision_graphic_max != + dolby_vision_graphic_max) { + if (debug_dolby & 0x10) + pr_dolby_dbg("graphic max changed %d-%d\n", + old_dolby_vision_graphic_max, + dolby_vision_graphic_max); + if (!is_osd_off) { + old_dolby_vision_graphic_max = + dolby_vision_graphic_max; + ret |= 2; + force_set_lut = true; + } + } return ret; } @@ -6484,6 +6505,9 @@ int dolby_vision_parse_metadata( dv_target_graphics_max [src_format][dst_format]; } + if (dv_graphic_blend_test && dst_format == FORMAT_HDR10) { + graphic_max = dv_HDR10_graphics_max; + } } if (dolby_vision_flags & FLAG_USE_SINK_MIN_MAX) { diff --git a/drivers/amlogic/media/osd/osd_fb.c b/drivers/amlogic/media/osd/osd_fb.c index 5e765a1..f21ca44 100644 --- a/drivers/amlogic/media/osd/osd_fb.c +++ b/drivers/amlogic/media/osd/osd_fb.c @@ -4281,6 +4281,7 @@ static int osd_probe(struct platform_device *pdev) prop = of_get_property(pdev->dev.of_node, "scale_mode", NULL); if (prop) prop_idx = of_read_ulong(prop, 1); + prop_idx = 0; /* Todo: only osd0 */ osd_set_free_scale_mode_hw(DEV_OSD0, prop_idx); prop = of_get_property(pdev->dev.of_node, "4k2k_fb", NULL); @@ -4290,6 +4291,7 @@ static int osd_probe(struct platform_device *pdev) /* get default display mode from dt */ ret = of_property_read_string(pdev->dev.of_node, "display_mode_default", &str); + prop_idx = 0; prop = of_get_property(pdev->dev.of_node, "pxp_mode", NULL); if (prop) prop_idx = of_read_ulong(prop, 1); diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index 871fc6e..d2304eb 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -8604,10 +8604,9 @@ static int osd_setting_order(u32 output_index) osd_hw.reg[DISP_GEOMETRY].update_func(i); osd_hw.reg[OSD_GBL_ALPHA].update_func(i); osd_hw.reg[DISP_OSD_REVERSE].update_func(i); + osd_hw.reg[OSD_FREESCALE_COEF].update_func(i); if (update || osd_update_window_axis) { osd_set_scan_mode(i); - osd_hw.reg - [OSD_FREESCALE_COEF].update_func(i); osd_hw.reg[DISP_FREESCALE_ENABLE] .update_func(i); osd_update_window_axis = false; diff --git a/drivers/amlogic/media/vout/vout_serve/vout_serve.c b/drivers/amlogic/media/vout/vout_serve/vout_serve.c index acfbf18..b784b34 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout_serve.c +++ b/drivers/amlogic/media/vout/vout_serve/vout_serve.c @@ -901,8 +901,6 @@ static int refresh_tvout_mode(void) * When systemcontrol bootup, it will set the correct mode and * colorspace according to current EDID from kernel. */ - VOUTPR("hdmichecksum [%s], kernel hdmichecksum [%s]\n", - hdmichecksum, info->hdmichecksum); if ((memcmp(hdmichecksum, info->hdmichecksum, 10)) && (memcmp(emptychecksum, info->hdmichecksum, 10)) && (memcmp(invalidchecksum, hdmichecksum, 10))) { -- 2.7.4