Display with multi framebuffer on embedded Linux system

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

I have suceessfuly running widget demo of v8.3 lvgl on my embedded linux system with MIPS arch, but the mouse’s cursor and UI are displayed on the same fb0.
But what I want is displaying mouse’s cursor on fb1 and UI on fb0. So I read and updated lvgl with V9.0 for it have better upgrade about framebuffer and lv_display, but I am not sure it’s OK. Please let me know if anybody knows about it, thank you

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

mips with embedded Linux system

What LVGL version are you using?

V9.0

What do you want to achieve?

Display UI and mouse cursor in different framebuffer

What have you tried so far?

coding

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

lvgl v9.0

/*Linux frame buffer device init*/
lv_display_t * disp = lv_linux_fbdev_create();
lv_linux_fbdev_set_file(disp, "/dev/fb0");

lv_display_t * cursor_disp = lv_linux_fbdev_create();
lv_linux_fbdev_set_file(cursor_disp, "/dev/fb1");

lv_display_set_default(disp);

/*Create mouse evdev*/
lv_indev_t *mouse = lv_evdev_create(LV_INDEV_TYPE_POINTER, "/dev/input/event0");
lv_indev_set_display(mouse, cursor_disp);

/*Set a cursor for the mouse*/
LV_IMG_DECLARE(mouse_cursor_icon)
lv_obj_t * cursor_obj = lv_img_create(lv_display_get_screen_active(cursor_disp)); /*Create an image object for the cursor */
lv_img_set_src(cursor_obj, &mouse_cursor_icon);           /*Set the image source*/
lv_indev_set_cursor(mouse, cursor_obj);             /*Connect the image  object to the driver*/

/*Create a Demo*/
lv_demo_widgets();

lvgl v8.3

/*Linux frame buffer device init*/
fbdev_init();

/*A small buffer for LittlevGL to draw the screen's content*/
static lv_color_t buf[DISP_BUF_SIZE];

/*Initialize a descriptor for the buffer*/
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);

/*Initialize and register a display driver*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf   = &disp_buf;
disp_drv.flush_cb   = fbdev_flush;
disp_drv.hor_res    = WIN_HOR_RES;
disp_drv.ver_res    = WIN_VER_RES;
lv_disp_drv_register(&disp_drv);

evdev_init();
static lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1); /*Basic initialization*/
indev_drv_1.type = LV_INDEV_TYPE_POINTER;

/*This function will be called periodically (by the library) to get the mouse position and state*/
indev_drv_1.read_cb = evdev_read;
lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1);


/*Set a cursor for the mouse*/
LV_IMG_DECLARE(mouse_cursor_icon)
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
lv_img_set_src(cursor_obj, &mouse_cursor_icon);           /*Set the image source*/
lv_indev_set_cursor(mouse_indev, cursor_obj);             /*Connect the image  object to the driver*/


/*Create a Demo*/
lv_demo_widgets();

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

I would be happy to help with that.

What is problem in case of the v9?

  • crash?
  • black screens?
  • rendering issue?
  • the demo is in the wrong frame buffer?
  • the cursor is in the wrong frame buffer?

Thank you for your help,
I want to display GUI on frambuffer0, and the mouse cursor displaying on framebuffer1, I have no idea how to do this. Please let me know if you have any idea on it, thankyou.

Your code looks good, I wonder what’s the problem with that.