LVGL UI only appears on 1/4th of the Display

Description

I am trying to create a UI using LVGL library (version 8.3.0) on a 7 inch capacitive touch screen (from Waveshare) running 32-bit Raspbian lite OS. The UI appears only on top half of the screen and that too repeated twice (screen shot attached).

Following is the screen configuration:

  • Resolution: 800 x 480
  • Pixel Depth: 32

“Fbset” command output is:
mode “800x480”
geometry 800 480 800 480 32
timings 0 0 0 0 0 0 0
rgba 8/16,8/8,8/0,8/24
endmode

What am I missing?

What MCU/Processor/Board and compiler are you using?

RPi 4 with 4GB RAM.

What LVGL version are you using?

LVGL Version 8.3.0

What do you want to achieve?

Full screen UI.

What have you tried so far?

I have tried many things:

  1. Change the LV_COLOR_DEPTH to 16 from 32. But did not work.
  2. Tried to change other parameters like LV_COLOR_16_SWAP, LV_COLOR_SCREEN_TRANSP etc… but did not work
  3. Tried to compile several other examples as well but same issue.

Code to reproduce

I am running this code
GitHub - Varanda-Labs/lvgl-rpi

with following configuration differences:

/*  lvgl-port/lv_conf.h */

#define LV_HOR_RES_MAX (800)
#define LV_VER_RES_MAX (480)

#define LV_COLOR_DEPTH 32

Screenshot and/or video

Screenshot attached above.

Found the issue. It was in the above mentioned Varanda-Labs/lvgl-rpi code.

static void disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
bool last = lv_disp_flush_is_last( disp);
updateDisplay(area, color_p, last);
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
}

static void updateDisplay (const lv_area_t * area, lv_color_t * color_p, bool last)
{
int32_t x, y;

uint16_t * p = (uint16_t *) fbp;    **<--------- THIS LINE. It should be uint32_t for 32 pixel depth**
uint16_t pixel_output = 0;
for(y = area->y1; y <= area->y2; y++) {
    for(x = area->x1; x <= area->x2; x++) {
        *(p + (x + y * LV_HOR_RES_MAX)) = (*color_p).full; 
        color_p++;
    }
}

}

Thanks