iMX6Q display adjustment

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

iMX6Q display adjustment

跳至解决方案
9,426 次查看
taroyamamoto
Contributor III

Hi

I would like to control of display brightness, contrast, hue and color saturation on iMX6Q.

But I could not find the control interface on kernel sources.

Is there any sample source code or documents ?

Thanks,

Taro

标签 (4)
1 解答
3,293 次查看
qiang_li-mpu_se
NXP Employee
NXP Employee

    For brightness, contrast, hue and color saturation, they can only be implemented in CSC, the IPU has two module for CSC, the DP can be used to CSC the frame buffer to display, for example, if your frame buffer is YUV format and display device is RGB format, then CSC will be done before sent data from frame buffer to display device, the current CSC parameter was defined in kernel file "drivers/mxc/ipu3/ipu_disp.c", ycbcr2rgb_coeff[], to support brightness, contrast, hue and color saturation adjust, you can implemented ioctl in frame buffer driver and send some customerized CSC parameters into the driver. Freescale BSP has no reference code for such use case, and we also has no reference CSC parameters for such adjusting, you need implemented it by yourself. The detail formula can be found in reference manual "37.4.9.5 Color Space Conversion unit - CSC".

    By the way, if both of your frame buffer and display play device is RGB format, then you have to use two frame buffer, one RGB format frame buffer for application, and another YUV format frame buffer for display device, for each frame, you need CSC the RGB frame buffer to YUV frame buffer, this will impact performance.

在原帖中查看解决方案

12 回复数
3,293 次查看
rogerio_silva
NXP Employee
NXP Employee

You can check this code as example about how to change CSC on Display Processor.

https://community.nxp.com/docs/DOC-101053 

3,293 次查看
angelo_d
Senior Contributor I

Hi Taro,

mainly the code works, but i had to enable the csc ipu stage, that was disabled in my case.

0 项奖励
2,521 次查看
slimSHA
Contributor III

How did you enable the csc ipu stage ?

0 项奖励
3,293 次查看
taroyamamoto
Contributor III

Hi All,

I create the CSC setting sample code and uploaded.

It can calculating the CSC matrix and updates in real time from given parameters(Brightness,Contrast,Saturation,Hue).

Please refer to follows,

i.MX6 CSC setting sample source code

Thanks,

Taro

0 项奖励
3,293 次查看
angelo_d
Senior Contributor I

Hi,

i tested this code on linux 3.10.17. Seems that each change to the matrix is not producing any effect to the display contrast, brightness etc.

What could i do wrong ?

0 项奖励
3,293 次查看
taroyamamoto
Contributor III

Hi Angelo,

This code has the effect to the video only, not for graphics.

Thanks,

Taro

0 项奖励
3,293 次查看
qiang_li-mpu_se
NXP Employee
NXP Employee

Only GAMMA was supported at current display driver, it is implemented by frame buffer driver ioctl "MXCFB_SET_GAMMA". The reference application can be found from the ltib unit test package: imx-test-1.1.0/test/mxc_fb_test/mxc_fb_test.c.

3,292 次查看
taroyamamoto
Contributor III

Hi Qiang:

Thank you for reply.

I already know the gamma test function.

But, its function could not change the color separately(for example, R=2.0 G=2.2 B=2.2).

Is there a way to set separately?

Thanks,

Taro

3,294 次查看
qiang_li-mpu_se
NXP Employee
NXP Employee

    For brightness, contrast, hue and color saturation, they can only be implemented in CSC, the IPU has two module for CSC, the DP can be used to CSC the frame buffer to display, for example, if your frame buffer is YUV format and display device is RGB format, then CSC will be done before sent data from frame buffer to display device, the current CSC parameter was defined in kernel file "drivers/mxc/ipu3/ipu_disp.c", ycbcr2rgb_coeff[], to support brightness, contrast, hue and color saturation adjust, you can implemented ioctl in frame buffer driver and send some customerized CSC parameters into the driver. Freescale BSP has no reference code for such use case, and we also has no reference CSC parameters for such adjusting, you need implemented it by yourself. The detail formula can be found in reference manual "37.4.9.5 Color Space Conversion unit - CSC".

    By the way, if both of your frame buffer and display play device is RGB format, then you have to use two frame buffer, one RGB format frame buffer for application, and another YUV format frame buffer for display device, for each frame, you need CSC the RGB frame buffer to YUV frame buffer, this will impact performance.

3,292 次查看
qiang_li-mpu_se
NXP Employee
NXP Employee

It seems the CSC doesn’t care the color space, it just applied the CSC matrix that software sets.

 

In BSP, we only implemented the rgb2yuv and yuv2rgb matrix.

0 项奖励
3,293 次查看
taroyamamoto
Contributor III

Hi Qiang,

I will try to learn the CSC.

Thanks,

Taro

0 项奖励
3,292 次查看
taroyamamoto
Contributor III

Hi Qiang,

I use the BSP L3.0.35_4.0.0_130424_source and find patch for MXCFB_CSC_UPDATE on 2389-ENGR00251015-2-FB-IPU-Add-mxcfb-ioctrl-to-update-IPU.patch.

But it has a bug. It needs a "break" for "case MXCFB_CSC_UPDATE";

Please refer to red line of the following.

Thanks,

Taro

----------------------------------------------------------------------------------------------------------------------------

$ cat 2389-ENGR00251015-2-FB-IPU-Add-mxcfb-ioctrl-to-update-IPU.patch                                                                               
From 74dd3ca09cc25edebb59ecb698037f8aaf2743ec Mon Sep 17 00:00:00 2001
From: Wayne Zou <b36644@freescale.com>
Date: Wed, 20 Feb 2013 13:46:01 +0800
Subject: [PATCH 2389/2508] ENGR00251015-2 FB/IPU: Add mxcfb ioctrl to update
IPU DP CSC matrix

Add mxcfb ioctrl MXCFB_CSC_UPDATE to update IPU DP CSC matrix
for display adjustment.
This patch implements the ioctrl interface.

Signed-off-by: Wayne Zou <b36644@freescale.com>
---
drivers/video/mxc/mxc_ipuv3_fb.c |   14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/video/mxc/mxc_ipuv3_fb.c b/drivers/video/mxc/mxc_ipuv3_fb.c
index e8a3398..f8dd59e 100644
--- a/drivers/video/mxc/mxc_ipuv3_fb.c
+++ b/drivers/video/mxc/mxc_ipuv3_fb.c
@@ -1320,6 +1320,20 @@ static int mxcfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)

                        break;
                }
+       case MXCFB_CSC_UPDATE:
+               {
+                       struct mxcfb_csc_matrix csc;
+
+                       if (copy_from_user(&csc, (void *) arg, sizeof(csc)))
+                               return -EFAULT;
+
+                       if ((mxc_fbi->ipu_ch != MEM_FG_SYNC) &&
+                               (mxc_fbi->ipu_ch != MEM_BG_SYNC) &&
+                               (mxc_fbi->ipu_ch != MEM_BG_ASYNC0))
+                               return -EFAULT;
+                       ipu_set_csc_coefficients(mxc_fbi->ipu, mxc_fbi->ipu_ch,
+                                               csc.param);
+                       break;              <- Nothing in original patch

+               }
        default:
                retval = -EINVAL;
        }
--
1.7.7.4