From 4c607090052713e41570dd9a73e210cf4d7442fa Mon Sep 17 00:00:00 2001 From: Cao Jian Date: Thu, 14 Nov 2019 10:27:35 +0800 Subject: [PATCH] osd: modify register table update area [1/1] 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 (cherry picked from commit 6e8f000c86613d0c63712152c9fec3b219464fe6) --- drivers/amlogic/media/osd/osd_hw.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index 88c53af454ff..c9aed1c9c66a 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -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); -- 2.20.1