dv: fix the error hsize and vsize of dv core 2 [1/1]
authorYi Zhou <yi.zhou@amlogic.com>
Wed, 5 Dec 2018 06:21:03 +0000 (14:21 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 6 Dec 2018 10:56:46 +0000 (02:56 -0800)
PD#OTT-776

Problem:
dv core 2 get the error hsize and vsize from OSD module

Solution:
when opening 3 osd paths. we get the accurate the parameters again

Verify:
g12b s922

Change-Id: Ib6af084910c8cf1896060295c7cea75971cd86b6
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
drivers/amlogic/media/osd/osd_hw.c

index f7a1517..5b3ac85 100644 (file)
@@ -7392,6 +7392,8 @@ static void set_blend_reg(struct layer_blend_reg_s *blend_reg)
 #else
        u32 osd_count = osd_hw.osd_meson_dev.viu1_osd_count;
 #endif
+       u32 dv_core2_hsize;
+       u32 dv_core2_vsize;
 
        if (!blend_reg)
                return;
@@ -7463,6 +7465,23 @@ static void set_blend_reg(struct layer_blend_reg_s *blend_reg)
                }
 #endif
        }
+       dv_core2_vsize = (blend_reg->vpp_osd1_blend_v_scope & 0xfff)
+               - ((blend_reg->vpp_osd1_blend_v_scope >> 16) & 0xfff) + 1;
+       dv_core2_hsize = (blend_reg->vpp_osd1_blend_h_scope & 0xfff)
+               - ((blend_reg->vpp_osd1_blend_h_scope >> 16) & 0xfff) + 1;
+       if (osd_hw.osd_meson_dev.has_dolby_vision) {
+               VSYNCOSD_WR_MPEG_REG(
+                       DOLBY_CORE2A_SWAP_CTRL1,
+                       ((dv_core2_vsize + 0x40) << 16)
+                       | (dv_core2_hsize + 0x80 + 0));
+               VSYNCOSD_WR_MPEG_REG(
+                       DOLBY_CORE2A_SWAP_CTRL2,
+                       (dv_core2_vsize << 16) | (dv_core2_hsize + 0));
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+               update_graphic_width_height(dv_core2_vsize, dv_core2_hsize);
+#endif
+       }
+
 }
 
 static void uniformization_fb(u32 index,
@@ -8094,19 +8113,6 @@ static void osd_basic_update_disp_geometry(u32 index)
                osd_hw.src_data[index].h - 1) & 0x1fff) << 16;
        VSYNCOSD_WR_MPEG_REG(osd_reg->osd_blk0_cfg_w2, data32);
        buffer_h = ((data32 >> 16) & 0x1fff) - (data32 & 0x1fff) + 1;
-       if (osd_hw.osd_meson_dev.has_dolby_vision) {
-               VSYNCOSD_WR_MPEG_REG(
-                       DOLBY_CORE2A_SWAP_CTRL1,
-                       ((buffer_w + 0x40) << 16)
-                       | (buffer_h + 0x80 + 0));
-               VSYNCOSD_WR_MPEG_REG(
-                       DOLBY_CORE2A_SWAP_CTRL2,
-                       (buffer_w << 16) | (buffer_h + 0));
-
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
-               update_graphic_width_height(buffer_w, buffer_h);
-#endif
-       }
        data32 = VSYNCOSD_RD_MPEG_REG(osd_reg->osd_ctrl_stat);
        data32 &= ~0x1ff008;//0x1ff00e;
        data32 |= osd_hw.gbl_alpha[index] << 12;