From 71ba3b2b3ba316e5b34a107453600bbe862c530c Mon Sep 17 00:00:00 2001 From: Bencheng Jing Date: Thu, 25 Oct 2018 20:42:16 +0800 Subject: [PATCH] amvecm: fix flicker when change between Launcher and Signal Source [1/1] PD#SWPL-848 Problem: ioctrl set the same gamma value again Solution: if the gamma value is same as the ioctrl userspace value, do not set again Verify: txlx Change-Id: I6f17f5ff234513c5a886004aedea81b9945c5b98 Signed-off-by: Bencheng Jing --- drivers/amlogic/media/enhancement/amvecm/amve.c | 2 ++ drivers/amlogic/media/enhancement/amvecm/amve.h | 1 + drivers/amlogic/media/enhancement/amvecm/amvecm.c | 44 +++++++++++++++++++---- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/drivers/amlogic/media/enhancement/amvecm/amve.c b/drivers/amlogic/media/enhancement/amvecm/amve.c index 469c692..6ae7493 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amve.c +++ b/drivers/amlogic/media/enhancement/amvecm/amve.c @@ -76,6 +76,8 @@ struct tcon_gamma_table_s video_gamma_table_b; struct tcon_gamma_table_s video_gamma_table_r_adj; struct tcon_gamma_table_s video_gamma_table_g_adj; struct tcon_gamma_table_s video_gamma_table_b_adj; +struct tcon_gamma_table_s video_gamma_table_ioctl_set; + struct tcon_rgb_ogo_s video_rgb_ogo = { 0, /* wb enable */ 0, /* -1024~1023, r_pre_offset */ diff --git a/drivers/amlogic/media/enhancement/amvecm/amve.h b/drivers/amlogic/media/enhancement/amvecm/amve.h index 2b089f6..cbd8d09 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amve.h +++ b/drivers/amlogic/media/enhancement/amvecm/amve.h @@ -64,6 +64,7 @@ extern struct ve_dnlp_s am_ve_dnlp; extern struct tcon_gamma_table_s video_gamma_table_r; extern struct tcon_gamma_table_s video_gamma_table_g; extern struct tcon_gamma_table_s video_gamma_table_b; +extern struct tcon_gamma_table_s video_gamma_table_ioctl_set; extern struct tcon_gamma_table_s video_gamma_table_r_adj; extern struct tcon_gamma_table_s video_gamma_table_g_adj; extern struct tcon_gamma_table_s video_gamma_table_b_adj; diff --git a/drivers/amlogic/media/enhancement/amvecm/amvecm.c b/drivers/amlogic/media/enhancement/amvecm/amvecm.c index 1a8ba0a..38daf87 100644 --- a/drivers/amlogic/media/enhancement/amvecm/amvecm.c +++ b/drivers/amlogic/media/enhancement/amvecm/amvecm.c @@ -1205,6 +1205,20 @@ static int amvecm_set_saturation_hue_post(int val1, return 0; } +static int gamma_table_compare(struct tcon_gamma_table_s *table1, + struct tcon_gamma_table_s *table2) +{ + int i = 0, flag = 0; + + for (i = 0; i < 256; i++) + if (table1->data[i] != table2->data[i]) { + flag = 1; + break; + } + + return flag; +} + static long amvecm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -1300,34 +1314,52 @@ static long amvecm_ioctl(struct file *file, if (!gamma_en) return -EINVAL; - if (copy_from_user(&video_gamma_table_r, + if (copy_from_user(&video_gamma_table_ioctl_set, (void __user *)arg, sizeof(struct tcon_gamma_table_s))) ret = -EFAULT; - else + else if (gamma_table_compare(&video_gamma_table_ioctl_set, + &video_gamma_table_r)) { + memcpy(&video_gamma_table_r, + &video_gamma_table_ioctl_set, + sizeof(struct tcon_gamma_table_s)); vecm_latch_flag |= FLAG_GAMMA_TABLE_R; + } else + pr_amvecm_dbg("load same gamma_r table,no need to change\n"); break; case AMVECM_IOC_GAMMA_TABLE_G: if (!gamma_en) return -EINVAL; - if (copy_from_user(&video_gamma_table_g, + if (copy_from_user(&video_gamma_table_ioctl_set, (void __user *)arg, sizeof(struct tcon_gamma_table_s))) ret = -EFAULT; - else + else if (gamma_table_compare(&video_gamma_table_ioctl_set, + &video_gamma_table_g)) { + memcpy(&video_gamma_table_g, + &video_gamma_table_ioctl_set, + sizeof(struct tcon_gamma_table_s)); vecm_latch_flag |= FLAG_GAMMA_TABLE_G; + } else + pr_amvecm_dbg("load same gamma_g table,no need to change\n"); break; case AMVECM_IOC_GAMMA_TABLE_B: if (!gamma_en) return -EINVAL; - if (copy_from_user(&video_gamma_table_b, + if (copy_from_user(&video_gamma_table_ioctl_set, (void __user *)arg, sizeof(struct tcon_gamma_table_s))) ret = -EFAULT; - else + else if (gamma_table_compare(&video_gamma_table_ioctl_set, + &video_gamma_table_b)) { + memcpy(&video_gamma_table_b, + &video_gamma_table_ioctl_set, + sizeof(struct tcon_gamma_table_s)); vecm_latch_flag |= FLAG_GAMMA_TABLE_B; + } else + pr_amvecm_dbg("load same gamma_b table,no need to change\n"); break; case AMVECM_IOC_S_RGB_OGO: if (!wb_en) -- 2.7.4