4 bpp colors and static palette

Hi ,
I am putting together a small device using teensy 4.1 with an lcd with a 16 bit rgb interface. I have a few colors to display and 16 different color is enough.
As I need a 480x480 pixel frame buffer, that one will be located in a psram spi with spi clk at 88mhz.
To limit the psram bandwidth it would be good to have the frame buffer in 4bpp, and as I have to use the cpu to fill the lcd fifo interface I can de-index the 4bpp data to 16 bit rgb in the display flush routine. There is no color mixing in my application. Just display of text / canvas of one of the 16 color.

Can lvgl support this? I saw multiple posts about 4bpp but the answer is not clear to me.

Thank you.

Hi,

LVGL supports 4bpp images but doesn’t support 4bpp color format for rendering in general.

However, LVGL was designed to handle cases like yours very well.

LVGL needs only a smaller buffer to render the graphics (e.g. 1/10 screen sized). It’s called display buffer and because it’s small it can easily fit in the internal SRAM. During rendering LVGL reads and writes a pixel multiple times but it’s not a problem because the buffer is located in a fast memory. When the rendering is ready you only need to send this small display buffer to your display’s given position.

So probably the PSRAM is not required here at all.

Read more here: https://docs.lvgl.io/latest/en/html/porting/display.html

1 Like

Thank you for your reply. The trick here is the 480 x480 frame buffer is needed as my screen has no GRAM included, so CPU will be the one refreshing the screen at 60hz. the physical interface is Pclk, Hsync vsync + 16 bit RGB. Not a cpu interface.
I might actually fit the frame buffer inside the upper 512Kb SRAM, to be sure to be fast enough.

I will look in the options.

I see.

8 bit color depth is supported in LVGL. It might be useful in your case.

You can also use it as palette but there are some limitations. With color platette the color space is not linear (i.e. the adject color value can be totally different not just a little bit darker/lighter) so antialiasing and gradient won’t work properly.

HI. Thanks again for your quick replies. I will indeed use an 8bpp RGB frame buffer. This will be the best compromise. I will expand the 8bpp to 16bpp while the CPU will read the frame buffer and push the information into the 8 pixel ImxRT1062 Flexio LCD interface. As I cannot use the DMA for this task anyhow ( Flexio3 has no DMA), CPU will have to use a super small LUT to move from 2bit or 3 bit color to 5 or 6 bit color.