How to implement multi-displays

This is a follow up to a post I made here.

The documentation for Displays states that it is possible to send output to two displays (physical displays.)

I’m creating an app that represents dashboards. While I can create different screens and link them to displays, that is not my goal. I’m hoping to create Dashboard A that is always shown on Display 1 and can be updated. At the same time in the same app, I would like Dashboard B to always be shown on Display2 and be continuously updated.

I think I would need to modify fbdev to expose and register my second framebuffer. I wrote some ugly code to do that and it worked.

What I’m hoping the community has is an example of how to implement multiple displays. I’ve searched but I’ve found nothing that I understand on how to address 2 different displays with lvgl.

Thank you!

You need to register two separate display drivers. lv_disp_drv_register returns lv_disp_t * handles which you’ll want to hold on to.

To create an object on a particular display, you’ll need to retrieve its “screen”. With a single display, you could just use lv_scr_act(), or lv_disp_get_scr_act(NULL). With multiple displays, you’ll need to use lv_disp_get_scr_act and pass it the lv_disp_t * handle you saved from initialization.

Thanks @embeddedt. Am I correct in assuming that I would also need to modify fbdev to point towards /dev/fb0 for Display 1 and /dev/fb1 for Display 2?

Yes; that’s right.