This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Displaying BMP image on LCD, on OMAP4470 in u-boot

Hi

I'm facing issue with displaying a .bmp image in u-boot.

I'm getting the image with a bad color and inverted and garbled.

I read from the TRM that I can set the GFX_ATTRIBUTES to display BITMAP8 images, but for this I have to configure the CLUT.

The DISPC_GAMMMA_TABLE registers have fields that I'm not able to understand. Please give me direction on what registers I
should configure to display a .BMP image on my LCD. 

  • Hi user :-)

    I juts got interested and started to investigate your issue described in http://e2e.ti.com/support/omap/f/849/t/254609.aspx
    and now I see that you have probably moved further, but have this one here...

    Can you please provide me some info about the environment variables you set and a bit more info of what exactly you are doing.
    Suppose you are looking at the u-boot code as far as 4470's TRM.

    Yordan

  • Also do you have the same inverted colors with 16bit depth images?
    Isn't it possible that your CFG_INVERT_COLORS flag is raised ??

  • How can we configure OMAP to display BMP images ?

    I have 24bit BMP images.

  • There are some register's that might be relevant to what you're trying to accomplish:

    DISPC_CONFIG1:GAMATABLEENABLE -> to gamma table for LCD2 and TV, LCD1 is always enabled.

    DISPC_CONFIG1:PALETTEGAMMATABLE -> select between palette and gamma table, bitmap is 0.

    DISPC_CONFIG1:LOADMODE -> it controls the way tables are loaded.

    DISPC_CONTROL2:GOWB -> mentioned for LOADMODE when using WB

    DISPC_GFX_TABLE_BA:TABLEBA -> used to store the DISPC_GAMMA_TABLE0[31:0], it is an equivalent with DISPC_GFX_TABLE_BA.

    The TRM, section 10.2.4.9.3, describes the Color Look-Up Table (CLUT). Figure 10-44 describes the 1024 byte memory area where that table is stored. The table is divided into an array with 256 rows with 4 bytes each.

    There is a note at the end of section "10.2.4.12.1 Overlay Manager" where it indicates that CLUT is shared for Graphics Pipeline and LCD1, when using it in in BITMAP for Graphics Pipeline it is not going in LCD.

    Graphics pipeline only handles BITMAP8 that is 8bpp, is the 24bits file format that you mention 24bpp?

    The following links might be relevant as well:

    Contains a patch to add CLUT in DSS and a binary to create the table, read comments about warnings and use. http://e2e.ti.com/support/omap/f/849/p/215055/759621.aspx

    One of your previous posts http://e2e.ti.com/support/omap/f/849/p/255009/892546.aspx

  • Thanks a lot for that direction.

    I have done the following, from the the link you directed me to,
    (patch to add CLUT in DSS and a binary to create the table)

    I added the same CLUT(clut.h) and loaded it into a memory location
    (0x88000000), and I set DISPC_GFX_TABLE_BA to 0x88000000

    for (i=0; i<1024; i++) {
    *((unsigned char *)(0x88000000 + i)) = clut_array[i];
    }

    __raw_writel(0x88000000, DISPC_GFX_TABLE_BA);
    __raw_writel(0x02004086, DISPC_GFX_ATTRIBUTES);

    DISPC_CONFIG1[9]:GAMMATABLEENABLE is set to 0.
    I don't use LCD2, TV or the WB pipeline so they are all disabled.

    DISPC_CONFIG1[2:1]:LOADMODE is set to 0x0, Palette/Gamma Table and
    data are loaded every frame.

    ------------------------------------------------------------------
    If I set DISPC_CONFIG1[3]:PALETTEGAMMATABLE to 1, and DISPC_GFX_ATTRIBUTES[4:1] to BITMAP8
    As you've said I won't see anything on the screen

    If I set DISPC_CONFIG1[3]:PALETTEGAMMATABLE to 0, then I see the
    BMP image on the screenbut it has hardly any colors, it looks like it has just grayscale. They are just black, gray, light gray, dark gray etc.,

    Please give me your suggestions.

  • Hi

     

    Were you able to solve this issue?

    I do not think you need to use CLUT.

    I think you are familiar with the u-boot splash application.

    http://review.omapzoom.org/23975

    It uses an image stored as a header file and uses a macro to fetch the pixels. The image is 24-bit color, but the GFX Overlay is configured to 32 bit ARGB color, so we clear (0x00) every fourth byte like this.

     for (i = 0; i < logo_width*logo_height*4; i+=4) {
    HEADER_PIXEL(header_data, pixel);
    *((unsigned char *)(0x80500000 + i)) = pixel[2];
    *((unsigned char *)(0x80500000 + i+1)) = pixel[1];
    *((unsigned char *)(0x80500000 + i+2)) = pixel[0];
    *((unsigned char *)(0x80500000 + i+3)) = 0x00;
    }

    This copies the image to the framebuffer. Later on, we define the framebuffer start address to 0x80500000.

    Here we configured the GFX overlay for 32-bit ARGB, that is we set the register DISPC_GFX_ATTRIBUTES[4:1] to 0xC

     

    I think it is easier to use header files, because you do not have a filesystem, but if you already figured a way to use .bmp images, which is the harder part, then for 24-bit bmp file, it contains a header, so you need to skip that, and start fetching the pixel data.

    Here is the fbtestbmp application, you could use to test displaying a bmp image on the display. This is a userspace Linux command line application. Here you will see how to manage the bmp application, skip the header and fetch the pixels.

    http://www.omappedia.com/wiki/File:Fbtestbmp.tar.gz

     

     

     

  • Hi Rafael

    Yes I was able to solve this issue. I have been able to display a .bmp on the LCD now.

    I converted it to RGB888, with the help of generic u-boot implementation which is in lcd.c.
    I just used one function from the lcd.c "lcd_display_bitmap" (from the latest denx-de u-boot) which converts an
    uncompressed bmp to rgb888 and displayed it on the sceen, by configuring  DISPC_GFX_ATTRIBUTES[4:1] to 0x09.

    It works awesome. We are also uncompressing a gzip(ed) bmp image runtime, and the gzip is part of the compilation 
    process of u-boot (its inside the u-boot.bin and not in any partition in the eMMC/NAND/NOR etc).

    Can you please help me out with http://e2e.ti.com/support/omap/f/849/t/262303.aspx
    it would be of great help.