SDL Draw Unit
The SDL draw unit renders widgets in software, caches them as SDL textures, and lets SDL's renderer composite them on the GPU.
Overview
The SDL draw unit renders widgets in software, caches the result as an SDL texture, and lets SDL's own renderer blend those textures into the final frame. It is a hybrid: software rasterization, hardware compositing.
It is the natural choice when your application already uses SDL and you want cheap acceleration without introducing an OpenGL dependency. It works best with static or slowly-changing UIs, where most textures are reused between frames, and offers little for content that changes every frame.
For genuinely GPU-accelerated rendering, use NanoVG through the SDL driver's EGL backend instead. It rasterizes on the GPU rather than only compositing there.
Configuration
Enable LV_USE_DRAW_SDL and LV_USE_SDL and select LV_SDL_BACKEND_TEXTURE
as your LV_SDL_BACKEND
Building
The renderer requires sdl2_image.
LVGL's CMake integration resolves it for you. It can be fetched at compile time by LVGL so it doesn't have to be present on your system.
See Also
- SDL Driver - the display driver this draw unit pairs with
- NanoVG Draw Unit - true GPU rasterization, via SDL's EGL backend
- OpenGL Overview - how drivers and draw units fit together
- Dependency Management - how LVGL resolves or fetches SDL2_image
Last updated on