dv: fix the flickered problem [1/1]
authorYi Zhou <yi.zhou@amlogic.com>
Tue, 27 Nov 2018 02:31:16 +0000 (10:31 +0800)
committerLuan Yuan <luan.yuan@amlogic.com>
Thu, 29 Nov 2018 06:36:06 +0000 (14:36 +0800)
PD#SWPL-1207

Problem:
fix the filckered problem when playing transition
video in sdr tv

Solution:
when dv core2 don't run, the reset can't be executed

Verify:
r321

Change-Id: I719325f1722589e02a40d46442258b0d1e3feb17
Signed-off-by: Yi Zhou <yi.zhou@amlogic.com>
drivers/amlogic/media/enhancement/amdolby_vision/amdolby_vision.c
drivers/amlogic/media/osd/osd_hw.c
include/linux/amlogic/media/amdolbyvision/dolby_vision.h

index 56c7232..f95d717 100644 (file)
@@ -292,6 +292,10 @@ 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");
 
+/*these two parameters form OSD*/
+static unsigned int osd_graphic_width = 1920;
+static unsigned int osd_graphic_height = 1080;
+
 static unsigned int dv_cert_graphic_width = 1920;
 static unsigned int dv_cert_graphic_height = 1080;
 module_param(dv_cert_graphic_width, uint, 0664);
@@ -1763,8 +1767,7 @@ static int dolby_core2_set(
 
        VSYNC_WR_MPEG_REG(DOLBY_CORE2A_CLKGATE_CTRL, 0);
        VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL0, 0);
-       if (is_meson_gxm() ||
-               is_meson_g12() || reset) {
+       if (is_meson_gxm() || is_meson_g12() || reset) {
                VSYNC_WR_MPEG_REG(DOLBY_CORE2A_SWAP_CTRL1,
                        ((hsize + g_htotal_add) << 16)
                        | (vsize + g_vtotal_add + g_vsize_add));
@@ -2058,6 +2061,13 @@ static int dolby_core3_set(
        return 0;
 }
 
+void update_graphic_width_height(unsigned int width,
+       unsigned int height)
+{
+       osd_graphic_width = width;
+       osd_graphic_height = height;
+}
+
 static void apply_stb_core_settings(
        int enable, unsigned int mask,
        bool reset, u32 frame_size, u8 pps_state)
@@ -2070,15 +2080,15 @@ static void apply_stb_core_settings(
 #else
        u32 core1_dm_count = 24;
 #endif
-       u32 graphics_w = 1920;
-       u32 graphics_h = 1080;
+       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_package_962E()
+       if (is_meson_txlx_stbmode()
                || force_stb_mode) {
                if ((vinfo->width >= 1920) &&
                        (vinfo->height >= 1080) &&
@@ -2096,7 +2106,7 @@ static void apply_stb_core_settings(
                        g_vpotch = 0x20;
        }
        if (mask & 1) {
-               if (is_meson_txlx_package_962E()
+               if (is_meson_txlx_stbmode()
                        || force_stb_mode) {
                        stb_dolby_core1_set(
                                27, 173, 256 * 5,
index b342ff0..7f66ea5 100644 (file)
 #ifdef CONFIG_AMLOGIC_MEDIA_VIDEO
 #include <linux/amlogic/media/video_sink/video.h>
 #endif
+#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+#include <linux/amlogic/media/amdolbyvision/dolby_vision.h>
+#endif
+
 /* Local Headers */
 #include "osd_canvas.h"
 #include "osd_prot.h"
@@ -7862,6 +7866,10 @@ static void osd_basic_update_disp_geometry(u32 index)
                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;
@@ -7986,6 +7994,9 @@ static void osd1_basic_update_disp_geometry(void)
                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
        }
        if (osd_hw.osd_afbcd[OSD1].enable &&
                !osd_afbc_dec_enable &&
index bdb5638..370c010 100644 (file)
@@ -51,5 +51,7 @@ extern int enable_rgb_to_yuv_matrix_for_dvll(
        int32_t on, uint32_t *coeff_orig, uint32_t bits);
 
 extern bool is_dovi_frame(struct vframe_s *vf);
+extern void update_graphic_width_height(unsigned int width,
+       unsigned int height);
 
 #endif