backends: make the framebuffer backend optional

The framebuffer is a legacy backend and we know that at least OpenSUSE disabled it in the kernel configuration, so let's make it optional.
This commit is contained in:
Vladimir Stoiakin 2026-01-26 14:37:37 +03:00
parent 6c3eca8fb6
commit 1840f10f62
13 changed files with 51 additions and 32 deletions

View file

@ -56,7 +56,7 @@ On distributions based on systemd, `unl0kr` can be used as a [password agent](ht
# systemd-ask-password --no-tty # Unl0kr is started # systemd-ask-password --no-tty # Unl0kr is started
``` ```
**Note**: SDL2 can be used as display backend for development purposes by setting the Meson option `developer` and use `backend=sdl` in the configuration file. **Note**: SDL can be used as a display backend for development purposes by setting the Meson option `lvgl_backends=sdl` and using `backend=sdl` in the configuration file.
Other uses besides development are not supported by Buffybox. Other uses besides development are not supported by Buffybox.
## Packaging ## Packaging
@ -121,3 +121,4 @@ For the license of bundled images and fonts, see [shared/cursor] and [shared/fon
[shared/fonts]: ./shared/fonts [shared/fonts]: ./shared/fonts
[unl0kr]: ./unl0kr [unl0kr]: ./unl0kr
[unl0kr#42]: https://gitlab.com/cherrypicker/unl0kr/-/issues/42 [unl0kr#42]: https://gitlab.com/cherrypicker/unl0kr/-/issues/42
[f0rmz]: ./f0rmz

View file

@ -11,8 +11,7 @@ buffyboard_sources = files(
) )
buffyboard_dependencies = [ buffyboard_dependencies = [
common_dependencies, common_dependencies
meson.get_compiler('c').find_library('m', required: false)
] ]
buffyboard_args = [ buffyboard_args = [

View file

@ -1,9 +1,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# Manual post-processing steps for the generated lv_conf.h # Manual post-processing steps for the generated lv_conf.h
# 1. Comment LV_USE_LINUX_DRM (handled by meson.build) # 1. Comment LV_USE_SDL
# 2. Comment LV_BIG_ENDIAN_SYSTEM (handled by meson.build) # LV_USE_LINUX_FBDEV
# 3. Add `#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)` (a bug in generate_lv_conf.py) # LV_USE_LINUX_DRM
# LV_BIG_ENDIAN_SYSTEM (handled by meson.build)
# 2. Add `#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)` (a bug in generate_lv_conf.py)
LV_COLOR_DEPTH 32 LV_COLOR_DEPTH 32
LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB
@ -106,7 +108,9 @@ LV_USE_GRID 0
LV_USE_OBSERVER 0 LV_USE_OBSERVER 0
LV_USE_LINUX_FBDEV 1 LV_USE_SDL 0
LV_USE_LINUX_FBDEV 0
LV_LINUX_FBDEV_BSD 0 LV_LINUX_FBDEV_BSD 0
LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT

View file

@ -1251,7 +1251,7 @@
*==================*/ *==================*/
/** Use SDL to open window on PC and handle mouse and keyboard. */ /** Use SDL to open window on PC and handle mouse and keyboard. */
#define LV_USE_SDL 0 //#define LV_USE_SDL 0
#if LV_USE_SDL #if LV_USE_SDL
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h> #define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */
@ -1280,7 +1280,7 @@
#endif #endif
/** Driver for /dev/fb */ /** Driver for /dev/fb */
#define LV_USE_LINUX_FBDEV 1 //#define LV_USE_LINUX_FBDEV 0
#if LV_USE_LINUX_FBDEV #if LV_USE_LINUX_FBDEV
#define LV_LINUX_FBDEV_BSD 0 #define LV_LINUX_FBDEV_BSD 0
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT

View file

@ -15,16 +15,21 @@ f0rmz_dependencies = [
f0rmz_args = [] f0rmz_args = []
deplibdrm = dependency('libdrm', required: get_option('with-drm')) if get_option('lvgl_backends').contains('framebuffer')
if deplibdrm.found() f0rmz_args += '-DLV_USE_LINUX_FBDEV=1'
f0rmz_dependencies += deplibdrm else
f0rmz_args += '-DLV_USE_LINUX_FBDEV=0'
endif
if get_option('lvgl_backends').contains('drm')
f0rmz_dependencies += dependency('libdrm')
f0rmz_args += '-DLV_USE_LINUX_DRM=1' f0rmz_args += '-DLV_USE_LINUX_DRM=1'
else else
f0rmz_args += '-DLV_USE_LINUX_DRM=0' f0rmz_args += '-DLV_USE_LINUX_DRM=0'
endif endif
if deplibsdl.found() if get_option('lvgl_backends').contains('sdl')
f0rmz_dependencies += deplibsdl f0rmz_dependencies += dependency('sdl2')
f0rmz_args += '-DLV_USE_SDL=1' f0rmz_args += '-DLV_USE_SDL=1'
else else
f0rmz_args += '-DLV_USE_SDL=0' f0rmz_args += '-DLV_USE_SDL=0'

View file

@ -29,8 +29,8 @@ for and, if found, merged in the following order:
*animations* = <true|false> *animations* = <true|false>
Enable or disable animations. Useful for slower devices. Default: false. Enable or disable animations. Useful for slower devices. Default: false.
*backend* = <fbdev|drm> *backend* = <fbdev|drm|sdl>
The rendering backend to use. Default: fbdev. The rendering backend to use. Default: the first compiled backend from the list above.
*timeout* = <value> *timeout* = <value>
The time in seconds before unl0kr will consider the entry a failure The time in seconds before unl0kr will consider the entry a failure

View file

@ -14,7 +14,6 @@ depinih = dependency('inih')
deplibinput = dependency('libinput') deplibinput = dependency('libinput')
deplibudev = dependency('libudev') deplibudev = dependency('libudev')
depxkbcommon = dependency('xkbcommon') # For unl0kr and f0rmz only depxkbcommon = dependency('xkbcommon') # For unl0kr and f0rmz only
deplibsdl = dependency('sdl2', required: get_option('developer'))
if get_option('man') if get_option('man')
depscdoc = dependency('scdoc', native: true) depscdoc = dependency('scdoc', native: true)

View file

@ -1,5 +1,7 @@
option('with-drm', type: 'feature', value: 'auto', description: 'Enable DRM backend') option('lvgl_backends', type: 'array', choices: ['framebuffer', 'drm', 'sdl'], value: ['framebuffer', 'drm'])
option('developer', type: 'feature', value: 'auto', description: 'Enable developer features')
option('man', type: 'boolean', value: true, description: 'Install manual pages') option('man', type: 'boolean', value: true, description: 'Install manual pages')
option('systemd-buffyboard-service', type: 'feature', value: 'auto', description: 'Install systemd service file for buffyboard') option('systemd-buffyboard-service', type: 'feature', value: 'auto', description: 'Install systemd service file for buffyboard')
option('systemd-password-agent', type: 'feature', value: 'auto', description: 'Build a systemd password agent for touchscreens') option('systemd-password-agent', type: 'feature', value: 'auto', description: 'Build a systemd password agent for touchscreens')

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
rm -rf _build rm -rf _build
meson _build meson setup _build -Dlvgl_backends=framebuffer,drm
meson compile -C _build meson compile -C _build

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
rm -rf _build rm -rf _build
meson _build -Dwith-drm=disabled meson setup _build -Dlvgl_backends=framebuffer
meson compile -C _build meson compile -C _build

View file

@ -1,9 +1,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# Manual post-processing steps for the generated lv_conf.h # Manual post-processing steps for the generated lv_conf.h
# 1. Comment LV_USE_LINUX_DRM (handled by meson.build) # 1. Comment LV_USE_SDL
# 2. Comment LV_BIG_ENDIAN_SYSTEM (handled by meson.build) # LV_USE_LINUX_FBDEV
# 3. Add `#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)` (a bug in generate_lv_conf.py) # LV_USE_LINUX_DRM
# LV_BIG_ENDIAN_SYSTEM (handled by meson.build)
# 2. Add `#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bbx_font_32)` (a bug in generate_lv_conf.py)
LV_COLOR_DEPTH 32 LV_COLOR_DEPTH 32
LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB LV_USE_STDLIB_MALLOC LV_STDLIB_CLIB
@ -106,7 +108,9 @@ LV_USE_GRID 0
LV_USE_OBSERVER 0 LV_USE_OBSERVER 0
LV_USE_LINUX_FBDEV 1 LV_USE_SDL 0
LV_USE_LINUX_FBDEV 0
LV_LINUX_FBDEV_BSD 0 LV_LINUX_FBDEV_BSD 0
LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT

View file

@ -1251,7 +1251,7 @@
*==================*/ *==================*/
/** Use SDL to open window on PC and handle mouse and keyboard. */ /** Use SDL to open window on PC and handle mouse and keyboard. */
#define LV_USE_SDL 0 //#define LV_USE_SDL 0
#if LV_USE_SDL #if LV_USE_SDL
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h> #define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */
@ -1280,7 +1280,7 @@
#endif #endif
/** Driver for /dev/fb */ /** Driver for /dev/fb */
#define LV_USE_LINUX_FBDEV 1 //#define LV_USE_LINUX_FBDEV 0
#if LV_USE_LINUX_FBDEV #if LV_USE_LINUX_FBDEV
#define LV_LINUX_FBDEV_BSD 0 #define LV_LINUX_FBDEV_BSD 0
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT

View file

@ -15,16 +15,21 @@ unl0kr_dependencies = [
unl0kr_args = [] unl0kr_args = []
deplibdrm = dependency('libdrm', required: get_option('with-drm')) if get_option('lvgl_backends').contains('framebuffer')
if deplibdrm.found() unl0kr_args += '-DLV_USE_LINUX_FBDEV=1'
unl0kr_dependencies += deplibdrm else
unl0kr_args += '-DLV_USE_LINUX_FBDEV=0'
endif
if get_option('lvgl_backends').contains('drm')
unl0kr_dependencies += dependency('libdrm')
unl0kr_args += '-DLV_USE_LINUX_DRM=1' unl0kr_args += '-DLV_USE_LINUX_DRM=1'
else else
unl0kr_args += '-DLV_USE_LINUX_DRM=0' unl0kr_args += '-DLV_USE_LINUX_DRM=0'
endif endif
if deplibsdl.found() if get_option('lvgl_backends').contains('sdl')
unl0kr_dependencies += deplibsdl unl0kr_dependencies += dependency('sdl2')
unl0kr_args += '-DLV_USE_SDL=1' unl0kr_args += '-DLV_USE_SDL=1'
else else
unl0kr_args += '-DLV_USE_SDL=0' unl0kr_args += '-DLV_USE_SDL=0'