Performing Color Space Conversion on the fly on i.MX6 Display Processor

Document created by rogeriopimentel Employee on Oct 10, 2017
Version 1Show Document
  • View in full screen mode



Display Processor (DP) is a block inside IPU on i.MX6 processors. Its function is to process the image prior to sending it to the display. The processes includes:


  • Combining 2 video/graphics planes
  • Overlaying a simple HW cursor 32 x 32 pixels, uniform color; may be combined logically with the full plane.
  • Color conversion/correction - linear (multiplicative & additive) programmable including:
    • YUV <-> RGB, YUV<->YUV conversions where YUV stands for any one of the color formats defined in the MPEG-4 standard
    • Adjustments: brightness, contrast, color saturation, etc.
    • Special effects: gray-scale, color inversion, sephia, blue-tone, etc.
    • Color-preserving clipping, for gamut mapping
    • Hue-preserving gamut mapping - for minimal color distortion
  • Gamma correction and contrast stretching - programmable piecewise-linear map




Figure 1 - Internal blocks of Display Processor



Changing the Color Space Conversion (CSC) Parameters on the fly


The Framebuffer driver from NXP BSP has an IOCTL that permits to set the parameters of CSC block on the fly. 

This is the driver link: mxc_ipuv3_fb.c\mxc\fbdev\video\drivers - linux-imx - i.MX Linux Kernel 


The following steps show how to change the parameters on user space application:


1 - Create the parameters structure. This matrix has a size of 5x3. Where 0x00, add the appropriate matrix value.


struct mxcfb_csc_matrix csc_matrix;
csc_matrix.param[0][0] = 0x00;
csc_matrix.param[0][1] = 0x00;
csc_matrix.param[0][2] = 0x00;
csc_matrix.param[1][0] = 0x00;
csc_matrix.param[1][1] = 0x00;
csc_matrix.param[1][2] = 0x00;
csc_matrix.param[2][0] = 0x00;
csc_matrix.param[2][1] = 0x00;
csc_matrix.param[2][2] = 0x00;
csc_matrix.param[3][0] = 0x00;
csc_matrix.param[3][1] = 0x00;
csc_matrix.param[3][2] = 0x00;
csc_matrix.param[4][0] = 0x00;
csc_matrix.param[4][1] = 0x00;
csc_matrix.param[4][2] = 0x00;



2 - Open the framebuffer device


int fd;
fd = open("/dev/fb1",O_RDWR);


3 - Call Framebuffer IOCTL "MXCFB_CSC_UPDATE"


ret = ioctl(fd, MXCFB_CSC_UPDATE, &csc_matrix);


After calling the IOCTL, the image on display will change according the parameters on csc_matrix.param.