DirectFB2 is a new open-source project that brings back DirectFB, a graphics library optimized for Linux-based embedded systems that was popular several years ago for 2D user interfaces but has since mostly faded away. DirectFB2 attempts to preserve the original DirectFB backend while adding new features such as modern 3D APIs like Vulkan and OpenGL ES.
I personally used it in 2008-2009 while working with Sigma Designs media processors that relied on the DirectFB library to render the user interfaces for IPTV boxes, karaoke machines, and so on. I remember this forced me to switch from a MicroWindows + Framebuffer solution, but the DirectFB API was easy enough to use and allowed us to develop a nicer user interface.
I found out about the new project while checking out the FOSDEM 2022 schedule and a talk entitled “Back to DirectFB! The revival of DirectFB with DirectFB2” which will be presented by Nicolas Caramelli on the 5th of February. We still have a few details including some of the main changes include the Meson build system, a pure C implementation, and modularization of the source code.
DirectFB2 library (libdirectfb.so) can access the low-level display driver in one of two ways:
- Linux Framebuffer interface (/dev/fb0) handled with libdirectfb_fbdev.so plugin
- KMS/DRM interface (/dev/dri/card0) handled with libdirectfb_drmkms.so plugin
Hardware-accelerated graphics rendering can also be achieved using the architecture of the GFX driver modules. provided the platform is supported. Nicolas says the core library is very light without any external dependencies and provides basic font, image, and video rendering support as can be seen with the DirectFB examples shown above.
Besides basic support, DirectFB2 can be further enhanced with the DirectFB-media package adding FreeType library, rendering images with libpng or jpeg libraries, rendering videos with FFmpeg, or GStreamer libraries. Another new development is support for 3D graphics through OpenGL (ES) or Vulkan rendering, while 2D graphics rendering can be handled via Cairo or Evas libraries. DirectFB(2) can also handle user input (e.g. keyboard and mouse) through the console interface (/dev/tty0), the event device interface (/dev/input/event0/1, and/or the PS/2 mouse interface (/dev/psaux) .
If you want to find more information and get started check out the Github repo and documentation with samples programs such as dfbterm terminal emulator, various DirectFB examples, tests or benchmarks, compatible toolkits like LiTE (Lightweight Toolkit Enabler) and its extended Component Kit (LeCK), or on the ilixi toolkit.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.