From 16ea7ce7720819b902d44a9aa1401f71e67d6734 Mon Sep 17 00:00:00 2001 From: MingLiang Dong Date: Mon, 29 Apr 2019 05:12:59 -0400 Subject: [PATCH] amvecm: optimize lc size config [1/1] PD#TV-4687 Problem: Set the screen mode of HDMI channel to 4:3 and restart to enter HDMI again. The screen displays abnormal Solution: optimize lc size config Verify: verify on TL1 Change-Id: I320f7476e09d900635767190748a4fbb486b5f6f Signed-off-by: MingLiang Dong --- drivers/amlogic/media/enhancement/amvecm/amvecm.c | 10 +++++++--- .../media/enhancement/amvecm/local_contrast.c | 21 ++++++++++++--------- .../media/enhancement/amvecm/local_contrast.h | 4 +++- drivers/amlogic/media/video_sink/video.c | 22 +++++++++++++++++++--- include/linux/amlogic/media/amvecm/amvecm.h | 4 +++- 5 files changed, 44 insertions(+), 17 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amvecm/amvecm.c b/drivers/amlogic/media/enhancement/amvecm/amvecm.c index a28d72c..f3d2644 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amvecm.c +++ b/drivers/amlogic/media/enhancement/amvecm/amvecm.c @@ -1069,7 +1069,9 @@ int amvecm_on_vs( struct vframe_s *toggle_vf, int flags, unsigned int sps_h_en, - unsigned int sps_v_en) + unsigned int sps_v_en, + unsigned int sps_w_in, + unsigned int sps_h_in) { int result = 0; @@ -1097,12 +1099,14 @@ int amvecm_on_vs( ioctrl_get_hdr_metadata(toggle_vf); if (toggle_vf) - lc_process(toggle_vf, sps_h_en, sps_v_en); + lc_process(toggle_vf, sps_h_en, sps_v_en, + sps_w_in, sps_h_in); } else { amvecm_reset_overscan(); result = amvecm_matrix_process(NULL, NULL, flags); ve_hist_gamma_reset(); - lc_process(NULL, sps_h_en, sps_v_en); + lc_process(NULL, sps_h_en, sps_v_en, + sps_w_in, sps_h_in); } if (!is_dolby_vision_on()) diff --git a/drivers/amlogic/media/enhancement/amvecm/local_contrast.c b/drivers/amlogic/media/enhancement/amvecm/local_contrast.c index b8c7181..5e0525f 100644 --- a/drivers/amlogic/media/enhancement/amvecm/local_contrast.c +++ b/drivers/amlogic/media/enhancement/amvecm/local_contrast.c @@ -539,16 +539,15 @@ static void lc_config(int enable, struct vframe_s *vf, unsigned int sps_h_en, unsigned int sps_v_en, + unsigned int sps_w_in, + unsigned int sps_h_in, int bitdepth) { int h_num, v_num; unsigned int height, width; static unsigned int vf_height, vf_width; unsigned int flag; - const struct vinfo_s *vinfo = get_current_vinfo(); - height = vinfo->height; - width = vinfo->width; h_num = 12; v_num = 8; @@ -566,16 +565,17 @@ static void lc_config(int enable, return; } + height = sps_h_in << sps_h_en; + width = sps_w_in << sps_v_en; + vf_height = vf->height; vf_width = vf->width; /*flag: 0 for 601; 1 for 709*/ flag = (vf_height > 720) ? 1 : 0; lc_top_config(enable, h_num, v_num, height, width, bitdepth, flag); - if (sps_h_en == 1) - width /= 2; - if (sps_v_en == 1) - height /= 2; + width = sps_w_in; + height = sps_h_in; lc_curve_ctrl_config(enable, height, width); lc_stts_blk_config(enable, height, width); @@ -1338,7 +1338,9 @@ void lc_init(int bitdepth) void lc_process(struct vframe_s *vf, unsigned int sps_h_en, - unsigned int sps_v_en) + unsigned int sps_v_en, + unsigned int sps_w_in, + unsigned int sps_h_in) { int blk_hnum, blk_vnum, dwTemp; int bitdepth; @@ -1376,7 +1378,8 @@ void lc_process(struct vframe_s *vf, dwTemp = READ_VPP_REG(LC_CURVE_HV_NUM); blk_hnum = (dwTemp >> 8) & 0x1f; blk_vnum = (dwTemp) & 0x1f; - lc_config(lc_en, vf, sps_h_en, sps_v_en, bitdepth); + lc_config(lc_en, vf, sps_h_en, sps_v_en, + sps_w_in, sps_h_in, bitdepth); /*get each block curve*/ read_lc_curve(blk_vnum, blk_hnum); lc_read_region(blk_vnum, blk_hnum); diff --git a/drivers/amlogic/media/enhancement/amvecm/local_contrast.h b/drivers/amlogic/media/enhancement/amvecm/local_contrast.h index f62bd3b..a566810 100644 --- a/drivers/amlogic/media/enhancement/amvecm/local_contrast.h +++ b/drivers/amlogic/media/enhancement/amvecm/local_contrast.h @@ -95,7 +95,9 @@ extern struct lc_alg_param_s lc_alg_parm; extern void lc_init(int bitdepth); extern void lc_process(struct vframe_s *vf, unsigned int sps_h_en, - unsigned int sps_v_en); + unsigned int sps_v_en, + unsigned int sps_w_in, + unsigned int sps_h_in); extern void lc_free(void); #endif diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index 271e097..34d8a0e 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -6849,7 +6849,6 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) #if ENABLE_UPDATE_HDR_FROM_USER set_hdr_to_frame(vf); #endif - /* *two special case: *case1:4k display case,input buffer not enough & @@ -6912,10 +6911,15 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) 0, cur_frame_par ? cur_frame_par->supsc1_vert_ratio : + 0, + cur_frame_par ? + cur_frame_par->spsc1_w_in : + 0, + cur_frame_par ? + cur_frame_par->spsc1_h_in : 0) == 1) break; #endif - vsync_toggle_frame(vf, __LINE__); toggle_frame = vf; #ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION @@ -7003,7 +7007,13 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) : 0, cur_frame_par ? cur_frame_par->supsc1_vert_ratio - : 0) == 1) + : 0, + cur_frame_par ? + cur_frame_par->spsc1_w_in : + 0, + cur_frame_par ? + cur_frame_par->spsc1_h_in : + 0) == 1) break; #endif vf = video_vf_get(); @@ -7113,6 +7123,12 @@ SET_FILTER: 0, cur_frame_par ? cur_frame_par->supsc1_vert_ratio : + 0, + cur_frame_par ? + cur_frame_par->spsc1_w_in : + 0, + cur_frame_par ? + cur_frame_par->spsc1_h_in : 0); #endif /* filter setting management */ diff --git a/include/linux/amlogic/media/amvecm/amvecm.h b/include/linux/amlogic/media/amvecm/amvecm.h index 1f8492b..683faa2 100644 --- a/include/linux/amlogic/media/amvecm/amvecm.h +++ b/include/linux/amlogic/media/amvecm/amvecm.h @@ -458,7 +458,9 @@ extern int amvecm_on_vs( struct vframe_s *toggle_vf, int flags, unsigned int sps_h_en, - unsigned int sps_v_en); + unsigned int sps_v_en, + unsigned int sps_w_in, + unsigned int sps_h_in); extern void refresh_on_vs(struct vframe_s *vf); extern void pc_mode_process(void); extern void pq_user_latch_process(void); -- 2.7.4