dv: flash when start playing dv [1/1]
authorrobin zhu <robin.zhu@amlogic.com>
Tue, 1 Oct 2019 03:16:32 +0000 (20:16 -0700)
committerTao Zeng <tao.zeng@amlogic.com>
Wed, 9 Oct 2019 05:36:32 +0000 (22:36 -0700)
PD#SWPL-14836

Problem:
1) video enable flag is not update correctly
2) source format not update correctly,
which cause wrong dv control path reset
3) when start play video off and repeat frame,
triggers wrong fake sdr frame

Solution:
1) change video enable flag to use both
video_global_output and video_enabled
2) use latest src format insdead of using cur format
3) add repeat frame and video on to off flag to
prevent wrong fake sdr frame

Verify:
Verified on AC213

Change-Id: Ia8ee7bea0b8bcb33e18275611287e0b563caf978
Signed-off-by: robin zhu <robin.zhu@amlogic.com>
drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c
drivers/amlogic/media/video_sink/video.c

index 53185c9..8b05d72 100644 (file)
@@ -5871,6 +5871,8 @@ int dolby_vision_parse_metadata(
        enum signal_format_e src_format = FORMAT_SDR;
        enum signal_format_e check_format;
        enum signal_format_e dst_format;
+       enum signal_format_e cur_src_format;
+       enum signal_format_e cur_dst_format;
        int total_md_size = 0;
        int total_comp_size = 0;
        bool el_flag = 0;
@@ -6526,10 +6528,25 @@ int dolby_vision_parse_metadata(
                graphic_min = graphic_max = 0;
 
 #ifdef V2_4
-       if ((src_format != dovi_setting.src_format)
-               || (dst_format != dovi_setting.dst_format) ||
-               ((!(dolby_vision_flags & FLAG_CERTIFICAION))
-               && (frame_count == 0))) {
+       if (new_dovi_setting.video_width && new_dovi_setting.video_height) {
+       /* Toggle multiple frames in one vsync case: */
+       /* new_dovi_setting.video_width will be available, but not be applied */
+       /* So use new_dovi_setting as reference instead of dovi_setting. */
+       /* To avoid unnecessary reset control_path. */
+               cur_src_format = new_dovi_setting.src_format;
+               cur_dst_format = new_dovi_setting.dst_format;
+       } else {
+               cur_src_format = dovi_setting.src_format;
+               cur_dst_format = dovi_setting.dst_format;
+       }
+
+       if ((src_format != cur_src_format) ||
+           (dst_format != cur_dst_format)) {
+               pr_dolby_dbg(
+                       "reset control path: format changed: src:%d->%d, dst:%d-%d, frame_count:%d, dolby_vision_flags:0x%x\n",
+                       cur_src_format, src_format,
+                       cur_dst_format, dst_format,
+                       frame_count, dolby_vision_flags);
                p_funcs_stb->control_path(
                        FORMAT_INVALID, 0,
                        comp_buf[currentId], 0,
@@ -6539,11 +6556,6 @@ int dolby_vision_parse_metadata(
                        0,
                        &hdr10_param,
                        &new_dovi_setting);
-               pr_dolby_dbg(
-                       "reset control path: format changed: src:%d->%d, dst:%d-%d, frame_count:%d, dolby_vision_flags:0x%x\n",
-                       dovi_setting.src_format, src_format,
-                       dovi_setting.dst_format, dst_format,
-                       frame_count, dolby_vision_flags);
        }
        if (!vsvdb_config_set_flag) {
                memset(&new_dovi_setting.vsvdb_tbl[0],
@@ -7138,7 +7150,7 @@ int dolby_vision_process(
            get_hdr_module_status(VD1_PATH)
            != HDR_MODULE_ON) {
                vf = NULL;
-               rpt_vf = NULL;
+               /* rpt_vf = NULL; */
        }
 
        graphic_status = is_graphic_changed();
@@ -7182,7 +7194,8 @@ int dolby_vision_process(
                }
        }
 
-       if (!vf && video_turn_off) {
+       if ((!vf && !rpt_vf && video_turn_off) ||
+           (video_status == -1)) {
                if (dolby_vision_policy_process(&mode, FORMAT_SDR)) {
                        pr_dolby_dbg("Fake SDR, mode->%d\n", mode);
                        if (dolby_vision_policy == DOLBY_VISION_FOLLOW_SOURCE &&
@@ -7194,9 +7207,11 @@ int dolby_vision_process(
                        } else
                                dolby_vision_set_toggle_flag(1);
                }
-               if (dolby_vision_flags & FLAG_TOGGLE_FRAME)
+               if (dolby_vision_flags & FLAG_TOGGLE_FRAME) {
+                       pr_dolby_dbg("update when video off\n");
                        dolby_vision_parse_metadata(
                                NULL, 1, false, false);
+               }
        }
 
        if (dolby_vision_mode == DOLBY_VISION_OUTPUT_MODE_BYPASS) {
index 0f66745..3d39546 100644 (file)
@@ -1024,13 +1024,13 @@ static u32 hold_video;
 
 u32 get_video_enabled(void)
 {
-       return video_enabled;
+       return video_enabled && video_global_output;
 }
 EXPORT_SYMBOL(get_video_enabled);
 
 u32 get_videopip_enabled(void)
 {
-       return video2_enabled;
+       return video2_enabled && pip_global_output;
 }
 EXPORT_SYMBOL(get_videopip_enabled);