Contents
In LVGL, the Display (display device) is the hardware-level pixel output carrier (physical screen, virtual screen such as VNC), responsible for flushing UI rendering results to the screen;The Screen is a root container object at the UI level, one display device can be bound to multiple Screens, the Screen has no parent object, and its size completely matches the affiliated display device.
The differences between the two are as follows:
| Dimension | Display (display device) | Screen |
|---|---|---|
| Essence | Physical / virtual hardware, responsible for drawing pixels | Top-level root container of the UI, has no parent object |
| Size property | Fixed hardware resolution | Size = that of its display device; coordinates cannot be modified |
| Ownership | 1 display can have multiple Screens bound to it | 1 Screen belongs to only 1 display |
| Operation limits | Configure driver, buffers, background, etc. | Position / size cannot be changed; can be loaded / deleted |
4.1 Multi-display Device Support
LVGL natively supports multiple independent display devices, each of which can have its own dedicated driver, UI interface and color depth without interfering with each other:
- Creation and Configuration
- Create a new display device via
lv_display_create (), complete the display buffer configuration andflush_cbrefresh callback binding, and that's it; - Use
lv_display_set_default ()to specify the default display device, and all UI objects created subsequently will be automatically mounted to this default device.
- Create a new display device via
- Typical application scenarios
- Main TFT color display + on-demand VNC virtual screen;
- Large-size color screen paired with a small-size monochrome screen;
- Multiple small, simple display screens on large instruments/equipment;
- Dual large-screen scenario: customer display screen + store staff operation screen.
4.2 Use of a single display device
In most embedded scenarios, only a single display device is required, and LVGL will completely hide the complex logic related to multi-display in such cases:
- The last created display device automatically becomes the default display device;
- Common macros (
LV_HOR_RES/LV_VER_RES) and core functions (lv_screen_active ()/lv_screen_load (), etc.) act on the default display by default; - When the relevant function passes
NULLas the device parameter, the default device will be automatically operated and displayed.
4.3 Mirror Display and Split-Screen Splicing
- Mirror Display:
- There is no need to enable multi-display logic; directly in the
flush_cbcallback, forward the render buffer data of the current display device synchronously to another display device to achieve screen mirror.
- There is no need to enable multi-display logic; directly in the
- Split-screen splicing (virtual large display):
- Using multiple small-sized physical screens to splice together into a large-sized virtual display device, the core of the steps is as follows:
- Set the resolution of all small screens uniformly to the total resolution of the virtual large screen;
- Perform clipping correction on the rendering area within
flush_cb; - Flush the buffer data to the corresponding sub-screens respectively according to the cropped area.
- Using multiple small-sized physical screens to splice together into a large-sized virtual display device, the core of the steps is as follows:
4.4 Transparent Screen
- Basic Principle: The screen is opaque by default (LV_OPA_COVER), providing a solid-color background for child controls; if the screen transparency is lower than 100%, the bottom layer (bottom_layer) of the display device will be exposed.
- Core Use Case: To implement translucent overlay interfaces such as OSD menus (video playback at the bottom layer + UI menu overlaid on the upper layer).
- Prerequisite for activation:
- Set the screen background transparency to completely transparent;
- Set the transparency of the underlying layer of the display device to completely transparent;
- The color format of the display device is configured as a format with an Alpha channel (supporting transparency rendering).
Version Record
Version Number | Modifier | Time | Content |
v1.0 | Li Zisheng | 2026/03/23 | Initialize the document. |