dolby: TM2 black screen on 4k60hz [1/1]
authoryao liu <yao.liu@amlogic.com>
Thu, 1 Aug 2019 06:52:53 +0000 (02:52 -0400)
committerYao Liu <yao.liu@amlogic.com>
Fri, 2 Aug 2019 11:26:22 +0000 (04:26 -0700)
PD#SWPL-11431

Problem:
black screen on 4k60hz
display abnormal on 1080p24hz/1080i/576p/480p

Solution:
1.Adjust potch according to resolution
2.Add tm2 in is_graphics_output_off
3.Move osd sc to the back of core2

Verify:
Verified on TM2

Change-Id: Ida1b4a67b3a7233d3a03b0536d246a0bd677e90c
Signed-off-by: yao liu <yao.liu@amlogic.com>
drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c
drivers/amlogic/media/osd/osd_fb.c

index 72ff32d..b93c426 100644 (file)
@@ -278,8 +278,12 @@ MODULE_PARM_DESC(vtotal_add, "\n vtotal_add\n");
 module_param(vpotch, uint, 0664);
 MODULE_PARM_DESC(vpotch, "\n vpotch\n");
 
-module_param(g_vpotch, uint, 0664);
-MODULE_PARM_DESC(g_vpotch, "\n vpotch\n");
+/* for core2 timing setup tuning */
+/* g_vtotal_add << 24 | g_vsize_add << 16 */
+/* | g_vwidth << 8 | g_vpotch */
+static unsigned int g_vtiming;
+module_param(g_vtiming, uint, 0664);
+MODULE_PARM_DESC(g_vtiming, "\n vpotch\n");
 
 static unsigned int dolby_vision_target_min = 50; /* 0.0001 */
 #ifdef V2_4
@@ -1024,7 +1028,7 @@ MODULE_PARM_DESC(debug_dolby_frame, "\n debug_dolby_frame\n");
        (debug_dolby_frame + 1 == frame_count))
 static int is_graphics_output_off(void)
 {
-       if (is_meson_g12())
+       if (is_meson_g12() || is_meson_tm2_stbmode())
                return !(READ_VPP_REG(OSD1_BLEND_SRC_CTRL) & (0xf<<8))
                && !(READ_VPP_REG(OSD2_BLEND_SRC_CTRL) & (0xf<<8));
        else
@@ -1148,6 +1152,7 @@ bool is_meson_tm2(void)
        else
                return false;
 }
+
 bool is_meson_tm2_tvmode(void)
 {
        if ((is_meson_tm2()) && (tv_mode == 1))
@@ -2241,18 +2246,25 @@ static int dolby_core2_set(
        VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL0, 0);
        if (is_meson_box() || is_meson_tm2_stbmode()  || reset) {
                VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL1,
-                       ((hsize + g_htotal_add) << 16)
-                       | (vsize + g_vtotal_add + g_vsize_add));
+                       ((hsize + g_htotal_add) << 16) | (vsize
+                       + ((g_vtiming & 0xff000000) ?
+                               ((g_vtiming >> 24) & 0xff) : g_vtotal_add)
+                       + ((g_vtiming & 0xff0000) ?
+                               ((g_vtiming >> 16) & 0xff) : g_vsize_add)));
                VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL2,
-                       (hsize << 16) | (vsize + g_vsize_add));
+                       (hsize << 16) | (vsize
+                       + ((g_vtiming & 0xff0000) ?
+                               ((g_vtiming >> 16) & 0xff) : g_vsize_add)));
        }
        if (debug_dolby & 2)
                pr_dolby_dbg("g_hpotch %x, g_vpotch %x\n",
                g_hpotch, g_vpotch);
        VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL3,
-               (g_hwidth << 16) | g_vwidth);
+               (g_hwidth << 16) | ((g_vtiming & 0xff00) ?
+                               ((g_vtiming >> 8) & 0xff) : g_vwidth));
        VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL4,
-               (g_hpotch << 16) | g_vpotch);
+               (g_hpotch << 16) | ((g_vtiming & 0xff) ?
+                               (g_vtiming & 0xff) : g_vpotch));
        if (is_meson_txlx_stbmode() || force_stb_mode)
                VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL5, 0xf8000000);
        else if (is_meson_g12() || is_meson_tm2_stbmode())
@@ -2585,27 +2597,10 @@ static int is_graphic_changed(void)
        }
        return ret;
 }
-
-static void apply_stb_core_settings(
-       int enable, unsigned int mask,
-       bool reset, u32 frame_size, u8 pps_state)
+static void adjust_vpotch(void)
 {
        const struct vinfo_s *vinfo = get_current_vinfo();
-       u32 h_size = (frame_size >> 16) & 0xffff;
-       u32 v_size = frame_size & 0xffff;
-#ifdef V2_4
-       u32 core1_dm_count = 27;
-#else
-       u32 core1_dm_count = 24;
-#endif
-       u32 graphics_w = osd_graphic_width;
-       u32 graphics_h = osd_graphic_height;
 
-       if (is_dolby_vision_stb_mode()
-               && (dolby_vision_flags & FLAG_CERTIFICAION)) {
-               graphics_w = dv_cert_graphic_width;
-               graphics_h = dv_cert_graphic_height;
-       }
        if (is_meson_txlx_stbmode()
                || force_stb_mode) {
                if ((vinfo->width >= 1920) &&
@@ -2622,7 +2617,7 @@ static void apply_stb_core_settings(
                        g_vpotch = 0x60;
                else
                        g_vpotch = 0x20;
-       } else if (is_meson_g12() || is_meson_tm2_stbmode()) {
+       } else if (is_meson_g12()) {
                if (vinfo) {
                        if (debug_dolby & 2)
                                pr_dolby_dbg("vinfo %d %d %d\n",
@@ -2637,8 +2632,50 @@ static void apply_stb_core_settings(
                                g_vpotch = 0x20;
                } else
                        g_vpotch = 0x20;
+       } else if (is_meson_tm2_stbmode()) {
+               if (vinfo) {
+                       if (debug_dolby & 2)
+                               pr_dolby_dbg("vinfo %d %d %d\n",
+                                       vinfo->width,
+                                       vinfo->height,
+                                       vinfo->field_height);
+                       if ((vinfo->width < 1280) &&
+                               (vinfo->height < 720) &&
+                               (vinfo->field_height < 720))
+                               g_vpotch = 0x60;
+                       else if ((vinfo->width <= 1920) &&
+                               (vinfo->height <= 1080) &&
+                               (vinfo->field_height <= 1080))
+                               g_vpotch = 0x50;
+                       else
+                               g_vpotch = 0x20;
+               } else
+                       g_vpotch = 0x20;
        }
 
+}
+
+static void apply_stb_core_settings(
+       int enable, unsigned int mask,
+       bool reset, u32 frame_size, u8 pps_state)
+{
+       const struct vinfo_s *vinfo = get_current_vinfo();
+       u32 h_size = (frame_size >> 16) & 0xffff;
+       u32 v_size = frame_size & 0xffff;
+#ifdef V2_4
+       u32 core1_dm_count = 27;
+#else
+       u32 core1_dm_count = 24;
+#endif
+       u32 graphics_w = osd_graphic_width;
+       u32 graphics_h = osd_graphic_height;
+
+       if (is_dolby_vision_stb_mode()
+               && (dolby_vision_flags & FLAG_CERTIFICAION)) {
+               graphics_w = dv_cert_graphic_width;
+               graphics_h = dv_cert_graphic_height;
+       }
+       adjust_vpotch();
        if (mask & 1) {
                if (is_meson_txlx_stbmode()
                        || force_stb_mode) {
@@ -3979,11 +4016,15 @@ static int sink_support_dolby_vision(const struct vinfo_s *vinfo)
                return 0;
        if (dolby_vision_flags & FLAG_DISABLE_DOVI_OUT)
                return 0;
+       /* for sink not support 60 dovi */
        if ((strstr(vinfo->name, "2160p60hz") != NULL) ||
                (strstr(vinfo->name, "2160p50hz") != NULL)) {
                if (!vinfo->vout_device->dv_info->sup_2160p60hz)
                        return 0;
        }
+       /* for interlace output */
+       if (vinfo->height != vinfo->field_height)
+               return 0;
        return 1;
 }
 
@@ -7102,8 +7143,7 @@ int register_dv_functions(const struct dolby_vision_func_s *func)
        int ret = -1;
        unsigned int reg_clk;
        unsigned int reg_value;
-        struct pq_config_s *pq_config;
-        const struct vinfo_s *vinfo = get_current_vinfo();
+       struct pq_config_s *pq_config;
 
        if ((!p_funcs_stb || !p_funcs_tv) && func) {
                if (func->control_path && !p_funcs_stb) {
@@ -7156,21 +7196,7 @@ int register_dv_functions(const struct dolby_vision_func_s *func)
                        if (!tv_dovi_setting)
                        return -ENOMEM;
                }
-               /* adjust core2 setting to work around fixing with 1080p24hz */
-               if (is_meson_txlx())
-                       g_vpotch = 0x20;
-               else if (is_meson_g12() || is_meson_tm2_stbmode()) {
-                       if (vinfo) {
-                               if ((vinfo->width < 1280) &&
-                                       (vinfo->height < 720) &&
-                                       (vinfo->field_height < 720))
-                                       g_vpotch = 0x60;
-                               else
-                                       g_vpotch = 0x20;
-                       } else
-                               g_vpotch = 0x20;
-               } else
-                       g_vpotch = 0x8;
+               adjust_vpotch();
        }
        return ret;
 }
index 45f1ba6..a3deb76 100644 (file)
@@ -4055,7 +4055,7 @@ static struct osd_device_data_s osd_tm2 = {
        .vpp_fifo_len = 0xfff,/* 2048 */
        .dummy_data = 0x00808000,
        .has_viu2 = 1,
-       .osd0_sc_independ = 1,
+       .osd0_sc_independ = 0,
 };
 
 static struct osd_device_data_s osd_a1 = {