osd: modify register table update area [1/1]
authorCao Jian <jian.cao@amlogic.com>
Thu, 14 Nov 2019 02:27:35 +0000 (10:27 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 28 Nov 2019 15:07:20 +0000 (08:07 -0700)
PD#SWPL-16663

Problem:
display freezes and becomes slow/lags
while selecting PIP mode options in VLC app

Solution:
remove wait-vsync nearly vsync coming
use polling to avoid  long time waiting

Verify:
W400

Change-Id: I7498a68de3f6c45e0cd48aad2805f73a23adb7e6
Signed-off-by: Cao Jian <jian.cao@amlogic.com>
(cherry picked from commit 6e8f000c86613d0c63712152c9fec3b219464fe6)

drivers/amlogic/media/osd/osd_hw.c

index 88c53af454ffa82647a3a04d00839e65c72f06f6..c9aed1c9c66aea3b241c7f03995ef75b6cd340ef 100644 (file)
@@ -94,6 +94,8 @@
 #define osd_tprintk(...)
 
 #define FREE_SCALE_MAX_WIDTH    1920
+#define WAIT_CNT_MAX            20
+
 struct hw_para_s osd_hw;
 static DEFINE_MUTEX(osd_mutex);
 static DECLARE_WAIT_QUEUE_HEAD(osd_vsync_wq);
@@ -8514,7 +8516,8 @@ static int osd_setting_order(u32 output_index)
        int line1;
        int line2;
        int active_begin_line;
-       u32 val;
+       int vinfo_height;
+       u32 val, wait_cnt = 0;
 
        blending = &osd_blending;
        blend_reg = &(blending->blend_reg);
@@ -8556,11 +8559,20 @@ static int osd_setting_order(u32 output_index)
        active_begin_line = get_active_begin_line(VIU1);
        line1 = get_enter_encp_line(VIU1);
        /* if nearly vsync signal, wait vsync here */
-       if (line1 <= active_begin_line * line_threshold / 100) {
+       vinfo_height = osd_hw.field_out_en[output_index] ?
+               (osd_hw.vinfo_height[output_index] * 2) :
+               osd_hw.vinfo_height[output_index];
+       while (line1 >= vinfo_height + active_begin_line *
+                       (100 - line_threshold) / 100 ||
+                       line1 <= active_begin_line * line_threshold / 100) {
                osd_log_dbg(MODULE_RENDER,
                        "enter osd_setting_order:encp line=%d\n",
                        line1);
-               osd_wait_vsync_hw_viu1();
+               /* 0.5ms */
+               usleep_range(500, 600);
+               wait_cnt++;
+               if (wait_cnt >= WAIT_CNT_MAX)
+                       break;
                line1 = get_enter_encp_line(VIU1);
        }
        spin_lock_irqsave(&osd_lock, lock_flags);