EVE External GPU rendering issue

Hi, I am using the EVE GPU renderer to draw the UI on an FT813 display. So far everything has been working correctly, but I am running into an issue: when I try to draw a menu on top of other items, it does not render properly. I read the documentation especially the limitations section and noticed that layers are not supported. The same code works fine on Window Codeblocks. Can someone please confirm whether this issue is directly related to that limitation mentioned in the documentation or am I doing something wrong? If yes, could someone guide me on how to resolve it? I would also like to contribute to the driver to add layer support using the EVE GPU renderer.

Code to reproduce

lv_obj_t* menuExtContainer;
lv_obj_t* mainAreaContainer;


#define EXT_COLS        2
#define EXT_CELL_W      250
#define EXT_CELL_H      50
#define EXT_COL_GAP     50
#define EXT_ROW_GAP     10
#define EXT_OUTER_PAD   5
#define COLS            4
#define ROWS            7

void CreateMainAreaLayout()
{
	if(mainAreaContainer == NULL)
	{
		mainAreaContainer = lv_obj_create(lv_scr_act());
	}

	lv_obj_clean(mainAreaContainer);
	lv_obj_remove_style_all(mainAreaContainer);
	lv_obj_set_style_bg_color(mainAreaContainer, lv_palette_main(LV_PALETTE_CYAN), 0);
	lv_obj_set_style_bg_opa(mainAreaContainer, LV_OPA_20, 0);

    lv_obj_set_size(mainAreaContainer, LV_PCT(100), 420);
    lv_obj_align(mainAreaContainer, LV_ALIGN_TOP_MID, 0, 0 );

	lv_obj_set_style_radius(mainAreaContainer, 0, 0);
	lv_obj_set_style_border_width(mainAreaContainer, 2, 0);
    lv_obj_set_style_border_color(mainAreaContainer, lv_color_black(), 0);
	lv_obj_set_style_pad_all(mainAreaContainer, 1, 0);

    static lv_coord_t col_dsc[10];
    static lv_coord_t row_dsc[10];

    for(int i = 0; i < COLS; i++)
    {
    	col_dsc[i] = LV_GRID_FR(1);
    }
    col_dsc[COLS] = LV_GRID_TEMPLATE_LAST;

    for(uint8_t i = 0; i < ROWS; i++)
    {
        row_dsc[i] = LV_GRID_FR(1);
    }
    row_dsc[ROWS] = LV_GRID_TEMPLATE_LAST;

    lv_obj_set_style_grid_column_dsc_array(mainAreaContainer, col_dsc, 0);
    lv_obj_set_style_grid_row_dsc_array(mainAreaContainer, row_dsc, 0);
    lv_obj_set_style_pad_column(mainAreaContainer, 20, 0);
    lv_obj_set_style_pad_row(mainAreaContainer, 5, 0);
    lv_obj_set_layout(mainAreaContainer, LV_LAYOUT_GRID);
    lv_obj_set_scroll_dir(mainAreaContainer, LV_DIR_NONE);
    lv_obj_set_scrollbar_mode(mainAreaContainer, LV_SCROLLBAR_MODE_OFF);

    lv_obj_t * label;
    lv_obj_t * obj;

    uint8_t i;
    for(i = 0; i < COLS*ROWS; i++) {
        uint8_t col = i % COLS;
        uint8_t row = i / COLS;

        obj = lv_button_create(mainAreaContainer);
        lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
                             LV_GRID_ALIGN_STRETCH, row, 1);

        label = lv_label_create(obj);
        lv_label_set_text_fmt(label, "c%d, r%d", col, row);
        lv_obj_center(label);
    }
}

static void create_extended_menu(void)
{
    int num_of_buttons = 12;
    menuExtContainer = lv_obj_create(lv_scr_act());
    lv_obj_set_style_radius(menuExtContainer, 0, 0);
    lv_obj_set_style_border_width(menuExtContainer, 1, 0);
	lv_obj_set_style_border_color(menuExtContainer, lv_color_black(), 0);
    lv_obj_set_style_bg_color(menuExtContainer, lv_palette_main(LV_PALETTE_GREY), 0);
    lv_obj_align(menuExtContainer, LV_ALIGN_BOTTOM_MID, 0, 0);
    lv_obj_set_scrollbar_mode(menuExtContainer, LV_SCROLLBAR_MODE_OFF);
    lv_obj_remove_flag(menuExtContainer, LV_OBJ_FLAG_GESTURE_BUBBLE);

    const uint32_t rows = (num_of_buttons + EXT_COLS - 1) / EXT_COLS;
    const int32_t grid_w = EXT_COLS * EXT_CELL_W + (EXT_COLS - 1) * EXT_COL_GAP;
    const int32_t grid_h = rows * EXT_CELL_H + (rows - 1) * EXT_ROW_GAP;
    const int32_t total_h = grid_h + 2 * EXT_OUTER_PAD;

    static int32_t col_dsc[EXT_COLS + 1];
    static int32_t row_dsc[9];

    for (uint32_t i = 0; i < EXT_COLS; i++)
    {
    	col_dsc[i] = EXT_CELL_W;
    }
    col_dsc[EXT_COLS] = LV_GRID_TEMPLATE_LAST;

    for (uint32_t i = 0; i < rows; i++)
    {
    	row_dsc[i] = EXT_CELL_H;
    }
    row_dsc[rows] = LV_GRID_TEMPLATE_LAST;

    lv_obj_set_layout(menuExtContainer, LV_LAYOUT_GRID);
    lv_obj_set_style_grid_column_dsc_array(menuExtContainer, col_dsc, 0);
    lv_obj_set_style_grid_row_dsc_array(menuExtContainer, row_dsc, 0);
    lv_obj_set_style_pad_column(menuExtContainer, EXT_COL_GAP, 0);
    lv_obj_set_style_pad_row(menuExtContainer, EXT_ROW_GAP, 0);


    int32_t scr_w = lv_disp_get_hor_res(NULL);
    int32_t left_pad = (scr_w - grid_w) / 2;
    if (left_pad < 0)
	{
    	left_pad = 0;
	}

    lv_obj_set_style_pad_left(menuExtContainer, left_pad, 0);
    lv_obj_set_style_pad_right(menuExtContainer, left_pad, 0);
    lv_obj_set_style_pad_top(menuExtContainer, EXT_OUTER_PAD, 0);
    lv_obj_set_style_pad_bottom(menuExtContainer, EXT_OUTER_PAD, 0);

    lv_obj_set_size(menuExtContainer, LV_PCT(100), total_h);
    lv_obj_set_scroll_dir(menuExtContainer, LV_DIR_NONE);
    lv_obj_set_scrollbar_mode(menuExtContainer, LV_SCROLLBAR_MODE_OFF);

    for (int32_t i = 0; i < num_of_buttons ; i++)
    {
        uint32_t col = i % EXT_COLS;
        uint32_t row = i / EXT_COLS;

        lv_obj_t * btn = lv_btn_create(menuExtContainer);
        lv_obj_set_grid_cell(btn,
            LV_GRID_ALIGN_STRETCH, col, 1,
            LV_GRID_ALIGN_STRETCH, row, 1);

        lv_obj_set_style_bg_color(btn, lv_palette_darken(LV_PALETTE_BLUE, 4), 0);
        lv_obj_set_style_text_font(btn, &lv_font_montserrat_20, 0);

        lv_obj_t * lbl = lv_label_create(btn);
        lv_label_set_text_fmt(lbl, "c%d, r%d", col, row);
        lv_obj_center(lbl);
    }
}

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
{
     // Initialize LVGL
     lv_init();

     // Create display window
     lv_display_t* display = lv_windows_create_display(title, 800, 480, 100, FALSE, FALSE);
     lv_windows_acquire_pointer_indev(display);
     CreateMainAreaLayout();
     create_extended_menu();

     while(1) {
         lv_task_handler();
         usleep(500);
     }
     return 0;
 }

Screenshot and/or video

Windows Codeblocks

FT813 display and NXP MCXN947

Environment

  • MCU/MPU/Boad: NXP MCXN947
  • LVGL version: 9.4.0

Can confirm that this looks like an issue with rendering layers. The gray part is probably the “lower” layer.

Hi, thanks for reporting it. Do you know if it’s definitely using a layer for that area? You can enable LV_USE_LAYER_DEBUG to see layers highlighted in red when you test in Windows Codeblocks.

No red highlighted observed after enabling LV_USE_LAYER_DEBUG in Codeblocks. However, I found something interesting during my testing. If I try to render fewer items with same layout, I don’t encounter any rendering issue. I thought maybe I was exhausting the RAM_DL (8k). To further debug, I started printing the REG_CMD_DL value after each flush_cb and I noticed if the DL offset is greater than ~5500, rendering issues occur. No issues observed below this value.

Another hypothesis was that I was overwriting the command FIFO. Perhaps I was sending >4kB data in one burst. I tried sending the data in consecutive calls as explained in the README of this repo, but that didn’t help either.