amcsc: need force to send fake frame for matrix updating [1/1]
authorBrian Zhu <brian.zhu@amlogic.com>
Thu, 10 Oct 2019 11:44:46 +0000 (19:44 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Sat, 12 Oct 2019 07:12:50 +0000 (00:12 -0700)
PD#SWPL-14947

Problem:
When switch the display mode of VIU1 from panel to hdmi. The
csc matrix did not update  correctly without video on.

Solution:
Force to trigger a fake frame to update csc matrix correctly.

Verify:
Verified on u202

Change-Id: I3e75a2d396ee1c752ed30bf01852afc8b9499f41
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
drivers/amlogic/media/enhancement/amvecm/amcsc.c

index aa2f6d2..4095f69 100644 (file)
@@ -7291,10 +7291,15 @@ int amvecm_matrix_process(
        bool send_fake_frame = false;
 
        if ((get_cpu_type() < MESON_CPU_MAJOR_ID_GXTVBB) ||
-           is_meson_gxl_package_905M2() || (csc_en == 0) ||
-           !vinfo || vinfo->mode == VMODE_NULL ||
-           vinfo->mode == VMODE_INVALID)
+           is_meson_gxl_package_905M2() || (csc_en == 0) || !vinfo)
+               return 0;
+
+       if (vinfo->mode == VMODE_NULL ||
+           vinfo->mode == VMODE_INVALID) {
+               current_hdr_cap[vd_path] = 0;
+               current_sink_available[vd_path] = 0;
                return 0;
+       }
 
        if (reload_mtx) {
                for (i = 0; i < NUM_MATRIX; i++)
@@ -7427,6 +7432,8 @@ int amvecm_matrix_process(
                null_vf_cnt[vd_path] = 0;
                fg_vf_sw_dbg = 3;
        } else {
+               bool force_fake = false;
+
                last_vf[vd_path] = NULL;
 
                if (null_vf_cnt[vd_path] <= null_vf_max)
@@ -7436,6 +7443,8 @@ int amvecm_matrix_process(
                if (cap_changed) {
                        if (is_video_layer_on(vd_path))
                                null_vf_cnt[vd_path] = 0;
+                       else
+                               force_fake = true;
                        pr_csc(4, "vd%d: sink cap changed when idle\n",
                               vd_path + 1);
                }
@@ -7444,6 +7453,8 @@ int amvecm_matrix_process(
                if (prev_color_fmt != vinfo->viu_color_fmt) {
                        if (is_video_layer_on(vd_path))
                                null_vf_cnt[vd_path] = 0;
+                       else
+                               force_fake = true;
                        prev_color_fmt = vinfo->viu_color_fmt;
                        pr_csc(4, "vd%d: output color format changed\n",
                               vd_path + 1);
@@ -7451,9 +7462,11 @@ int amvecm_matrix_process(
 
                /* handle eye protect mode */
                if ((cur_eye_protect_mode != wb_val[0]) &&
-                   (vd_path == VD1_PATH) &&
-                   is_video_layer_on(vd_path)) {
-                       null_vf_cnt[vd_path] = 0;
+                   (vd_path == VD1_PATH)) {
+                       if (is_video_layer_on(vd_path))
+                               null_vf_cnt[vd_path] = 0;
+                       else
+                               force_fake = true;
                        pr_csc(4, "vd%d: eye_protect_mode changed\n",
                               vd_path + 1);
                }
@@ -7494,6 +7507,9 @@ int amvecm_matrix_process(
                        == HDR_MODULE_ON)) {
                        null_vf_cnt[vd_path] = 1;
                        toggle_frame = 1;
+               } else if (force_fake) {
+                       null_vf_cnt[vd_path] = 1;
+                       toggle_frame = 1;
                } else if (csc_en & 0x10) {
                        toggle_frame = null_vf_max;
                } else {