what`s the difference between fb_pix_fmt and interface_pix_fmt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

what`s the difference between fb_pix_fmt and interface_pix_fmt

1,146 Views
edwardfu
Contributor I

uboot中的lcd参数: video=mxcfb0:dev=lcd,HUD-WVGA,if=RGB24,bpp=24

设备树:mxcfb1: fb@0 {
        compatible = "fsl,mxc_sdc_fb";
        disp_dev = "lcd";
        interface_pix_fmt = "RGB24";
        mode_str ="HUD-WVGA";
        default_bpp = <24>;
        int_clk = <0>;
        late_init = <0>;
        status = "disabled";
    };

   lcd@0 {
        compatible = "fsl,lcd";
        ipu_id = <0>;
        disp_id = <0>;
        default_ifmt = "RGB24";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ipu1>;
        status = "okay";
    };

在结合驱动文件: mxc_ipuv3_fb.c中的mxcfb_option_setup函数解析, 可以知道uboot中传递的参数bpp = 24用于确定fb_pix_fmt, 而uboot中的if = RGB24用于确定 interface_pix_fmt, 请问这两个有什么区别, 这个lcd屏与imx6硬件连接有关系吗?

Labels (1)
0 Kudos
5 Replies

903 Views
igorpadykov
NXP Employee
NXP Employee

Hi Edward

relationship with i.MX6Q hardware connections can be found in

sect.4.11.10.4 IPU Display Interface Signal Mapping i.MX6DQ Datasheet
http://www.nxp.com/docs/en/data-sheet/IMX6DQCEC.pdf

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

903 Views
edwardfu
Contributor I

Hi Igorpadykov

as you mentioned, my board hardware interface is as follows:
         imx6 side               lcd side
       DISP0_DAT0 <--->  B0
       DISP0_DAT1 <--->  B1
       DISP0_DAT2 <--->  B2
       DISP0_DAT3 <--->  B3
       DISP0_DAT4 <--->  B4
       DISP0_DAT5 <--->  B5
       DISP0_DAT6 <--->  B6
       DISP0_DAT7 <--->  B7
       DISP0_DAT8 <--->  G0
       DISP0_DAT9 <--->  G1
       DISP0_DAT10 <---> G2
       DISP0_DAT11 <--->  G3
       DISP0_DAT12 <--->  G4
       DISP0_DAT13 <--->  G5
       DISP0_DAT14 <--->  G6
       DISP0_DAT15 <--->  G7
       DISP0_DAT16 <--->  R0
       DISP0_DAT17 <--->  R1
       DISP0_DAT18 <--->  R2
       DISP0_DAT19 <--->  R3
       DISP0_DAT20 <--->  R4
       DISP0_DAT21 <--->  R5
       DISP0_DAT22 <--->  R6
       DISP0_DAT23 <--->  R7
so in uboot args: video=mxcfb0:dev=lcd,HUD-WVGA,if=RGB24,bpp=24
if = RGB24 or if = BGR24?

0 Kudos

903 Views
igorpadykov
NXP Employee
NXP Employee

Hi Edward

RGB24

Best regards
igor

0 Kudos

903 Views
edwardfu
Contributor I

Hi Igor,

Yes, I pass the parameter(if = RGB) in uboot. But, I write a test program to display blue, actually it display red. I am doubt whether I wrote the test program wrongly. As I mark below in red color, I use rgb data( b = 0x11111111; g = 0; r = 0; ) to fill mapped memory (*(fbp + location) = b; *(fbp + location + 1) = g; *(fbp + location + 2) = r;).

The test program is as follow:

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <linux/fb.h>

int main(void)
{
    int fbfd = 0;
    struct fb_var_screeninfo vinfo;
    struct fb_fix_screeninfo finfo;
    struct fb_cmap cmapinfo;
    long int screensize = 0;
    char *fbp = 0;
    int x = 0, y = 0;
    long int location = 0;
    int b, g, r;

    /* open /dev/fb0 */
    fbfd = open("/dev/fb0", O_RDWR);
    if (fbfd < 0) {
        printf("ERR: open framebuffer device failed\n");
        return -1;
    }
    printf("open framebuffer device successfully\n");


    /* map the device to memory */
    fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
    if ((-1 == (int)fbp)) {
        printf("ERR: failed to map framebuffer device to memory\n");
        return -1;
    }
    printf("success to map framebuffer device to memory\n");


    b = 0x11111111; // blue
    g = 0; // green
    r = 0; // red

    /* display the whole screen, and the pix is 480x240 */
    vinfo.xoffset = 0; // Where we are going to put the pixel
    vinfo.yoffset = 0;
    // Figure out where in memory to put the pixel
    for ( y = 0; y < 240; y++ )               
        for ( x = 0; x < 480; x++ ) {            
         location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +  
             (y+vinfo.yoffset) * finfo.line_length;
    
         if ( vinfo.bits_per_pixel == 32 ) {          // 32bpp
                        *(fbp + location) = b;             //blue
                        *(fbp + location + 1) = g;             // green
                        *(fbp + location + 2) = r;             // red
                        *(fbp + location + 3) = 0;     // No transparency
         } else if (vinfo.bits_per_pixel == 24) {          //24bpp: r:g:b=8:8:8                                                
                        *(fbp + location) = b;
                        *(fbp + location + 1) = g;
                        *(fbp + location + 2) = r;
         }
    
        }

    munmap(fbp, screensize);
    close(fbfd);
    return 0;
}

Best regards

Edward

0 Kudos

903 Views
igorpadykov
NXP Employee
NXP Employee

Hi Edward

 

had you adjusted lcd timings, sone example can be found on

https://community.nxp.com/thread/373763 

 

Best regards
igor

0 Kudos