lvgl: Upgrade to LVGL 9 series

Upgrade LVGL and matching recipes to LVGL 9 series. Use latest git HEAD
instead of 9.0.0 release to pull in fixes which landed after the 9.0.0
release and which are of interest to Linux deployments.

There are significant breaking changes, which are listed below.

The lv-drivers and lv-lib-png PNG library seem to be part of the main LVGL
repository, drop the now unnecessary recipes.

Configuration is now done in lv_conf.h only, there is no more lv_drv_conf.h,
rework lv-drivers.inc accordingly. USE_SDL_GPU support has been renamed to
LV_USE_DRAW_SDL and newly depends on libsdl2-image, SDL_DOUBLE_BUFFERED to
LV_SDL_BUF_COUNT=2 .

All configuration options from lvgl_%.bb, LV_COLOR_DEPTH, LV_MEM_CUSTOM as
well as LV_TICK_CUSTOM, LV_TICK_CUSTOM_INCLUDE, LV_TICK_CUSTOM_SYS_TIME_EX
are all moved into lv-drivers.inc , so the configuration is done in one
place, using the same set of configuration options.

Wayland support is gone, drop it from lv-drivers.inc. Evdev input device
selection via EVDEV_NAME is also gone, the selection is now done using
API call lv_evdev_create(). DRM card selection via DRM_CARD is also gone,
the selection is now done using API call lv_linux_drm_set_file(). Move
LVGL_CONFIG_DRM_CARD into lvgl-demo-fb, which calls lv_linux_drm_set_file().

The lvgl-demo-fb recipe is adjusted to be compatible with LVGL 9 again,
this makes some of the sed adjustments really awful, so this part will
be replaced by upstream patches in a separate commit to avoid growing
this commit even more.

The lvgl-demo-fb recipe is also no longer using git submodules, but
instead fetches both its source and LVGL using git fetcher separately.
This is needed to build the SDL backend successfully, which requires
newer LVGL than what the repository points to via its submodule.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Marek Vasut 2024-03-13 05:40:05 +01:00 committed by Khem Raj
parent e4865f3ee0
commit f7fedd1563
No known key found for this signature in database
GPG Key ID: BB053355919D3314
7 changed files with 95 additions and 171 deletions

View File

@ -1,21 +1,17 @@
PACKAGECONFIG[drm] = ",,libdrm"
PACKAGECONFIG[fbdev] = ",,"
PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
PACKAGECONFIG[sdl] = ",,virtual/libsdl2 libsdl2-image"
LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}"
LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}"
LVGL_CONFIG_EVDEV_INPUT ?= "/dev/input/touchscreen"
LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}"
LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}"
LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', '1', '0', d)}"
LVGL_CONFIG_WAYLAND_HOR_RES ?= "480"
LVGL_CONFIG_WAYLAND_VER_RES ?= "320"
LVGL_CONFIG_LV_MEM_CUSTOM ?= "0"
LVGL_CONFIG_LV_COLOR_DEPTH ?= "32"
ALLOW_EMPTY:${PN} = "1"
@ -23,26 +19,26 @@ EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
do_configure:append() {
# If there is a configuration template, start from that
[ -r "${S}/lv_drv_conf_template.h" ] && cp -Lv "${S}/lv_drv_conf_template.h" "${S}/lv_drv_conf.h"
[ -r "${S}/lv_conf_template.h" ] && cp -Lv "${S}/lv_conf_template.h" "${S}/lv_conf.h"
# Configure the software using sed
sed -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // Enabled by ${PN}|g" \
\
-e "s|\(^# define USE_DRM \).*|# define USE_DRM ${LVGL_CONFIG_USE_DRM}|g" \
-e "s|\(^# define DRM_CARD \).*|# define DRM_CARD \"${LVGL_CONFIG_DRM_CARD}\"|g" \
\
-e "s|\(^# define USE_EVDEV \).*|# define USE_EVDEV ${LVGL_CONFIG_USE_EVDEV}|g" \
-e "s|\(^# define EVDEV_NAME \).*|# define EVDEV_NAME \"${LVGL_CONFIG_EVDEV_INPUT}\"|g" \
-e "s|\(^#define LV_USE_LINUX_DRM \).*|#define LV_USE_LINUX_DRM ${LVGL_CONFIG_USE_DRM}|g" \
\
-e "s|\(^# define USE_FBDEV \).*|# define USE_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
-e "s|\(^#define LV_USE_LINUX_FBDEV \).*|#define LV_USE_LINUX_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
\
-e "s|\(^# define USE_SDL \).*|# define USE_SDL ${LVGL_CONFIG_USE_SDL}|g" \
-e "s|\(^# define USE_SDL_GPU \).*|# define USE_SDL_GPU 1|g" \
-e "s|\(^# define SDL_DOUBLE_BUFFERED \).*|# define SDL_DOUBLE_BUFFERED 1|g" \
-e "s|\(^#define LV_USE_SDL \).*|#define LV_USE_SDL ${LVGL_CONFIG_USE_SDL}|g" \
-e "s|\(^#define LV_USE_DRAW_SDL \).*|#define LV_USE_DRAW_SDL ${LVGL_CONFIG_USE_SDL}|g" \
-e "s|\(^ #define LV_SDL_BUF_COUNT \).*| #define LV_SDL_BUF_COUNT 2|g" \
\
-e "s|\(^# define USE_WAYLAND \).*|# define USE_WAYLAND ${LVGL_CONFIG_USE_WAYLAND}|g" \
-e "s|\(^ *# *define *WAYLAND_HOR_RES *\).*|\1${LVGL_CONFIG_WAYLAND_HOR_RES}|g" \
-e "s|\(^ *# *define *WAYLAND_VER_RES *\).*|\1${LVGL_CONFIG_WAYLAND_VER_RES}|g" \
-e "s|\(^#define LV_COLOR_DEPTH \).*|#define LV_COLOR_DEPTH ${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
-e "s|\(#define LV_MEM_CUSTOM .*\)0|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
\
-i "${S}/lv_drv_conf.h"
-e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
-e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
-e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
\
-e "s|\(^#define LV_USE_EVDEV \).*|#define LV_USE_EVDEV ${LVGL_CONFIG_USE_EVDEV}|g" \
\
-i "${S}/lv_conf.h"
}

View File

@ -1,28 +0,0 @@
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: MIT
HOMEPAGE = "https://docs.lvgl.io/latest/en/html/porting/index.html"
SUMMARY = "LVGL's Display and Touch pad drivers"
DESCRIPTION = "Collection of drivers: SDL, framebuffer, wayland and more..."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d6fc0df890c5270ef045981b516bb8f2"
SRC_URI = "git://github.com/lvgl/lv_drivers;protocol=https;branch=release/v8.3"
SRCREV = "71830257710f430b6d8d1c324f89f2eab52488f1"
DEPENDS = "lvgl"
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland fbdev', d)}"
require lv-drivers.inc
inherit cmake
S = "${WORKDIR}/git"
TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1"
TARGET_CFLAGS += "-I${STAGING_INCDIR}/lvgl"
FILES:${PN}-dev += "\
${includedir}/lvgl/lv_drivers/ \
"

View File

@ -1,31 +0,0 @@
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: MIT
HOMEPAGE = "https://docs.lvgl.io"
SUMMARY = "PNG decoder for LVGL"
DESCRIPTION = "Allow the use of PNG images in LVGL. This implementation uses lodepng"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d6fc0df890c5270ef045981b516bb8f2"
SRC_URI = "git://github.com/lvgl/lv_lib_png;;protocol=https;branch=master"
SRCREV = "bf1531afe07c9f861107559e29ab8a2d83e4715a"
S = "${WORKDIR}/git"
# because of lvgl dependency
REQUIRED_DISTRO_FEATURES = "wayland"
DEPENDS += "lvgl"
EXTRA_OECMAKE += "-DLIB_INSTALL_DIR=${baselib}"
inherit cmake
inherit features_check
TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1"
TARGET_CFLAGS += "-I${STAGING_INCDIR}/lvgl"
FILES:${PN}-dev = "\
${includedir}/lvgl/lv_lib_png/ \
"

View File

@ -1,46 +0,0 @@
SUMMARY = "LVGL Demo Application for Framebuffer"
HOMEPAGE = "https://github.com/lvgl/lv_port_linux_frame_buffer"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=802d3d83ae80ef5f343050bf96cce3a4 \
file://lv_drivers/LICENSE;md5=d6fc0df890c5270ef045981b516bb8f2 \
file://lvgl/LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "gitsm://github.com/lvgl/lv_port_linux_frame_buffer.git;branch=master;protocol=https"
SRCREV = "adf2c4490e17a1b9ec1902cc412a24b3b8235c8e"
EXTRA_OEMAKE = "DESTDIR=${D}"
PACKAGECONFIG ??= "drm"
require lv-drivers.inc
inherit cmake
S = "${WORKDIR}/git"
TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
do_configure:prepend() {
if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then
# Add libdrm build dependency
sed -i '/^target_link_libraries/ s@lvgl::drivers@& drm@' "${S}/CMakeLists.txt"
# Switch from fbdev to drm usage
sed -i 's@fbdev@drm@g' "${S}/main.c"
# Pull resolution from DRM instead of hardcoding it
sed -i '/disp_drv.hor_res/ d' "${S}/main.c"
sed -i '/disp_drv.ver_res/ s@disp_drv.ver_res.*@drm_get_sizes(\&disp_drv.hor_res, \&disp_drv.ver_res, NULL);@' "${S}/main.c"
fi
if [ "${LVGL_CONFIG_USE_SDL}" -eq 1 ] ; then
# Add libsdl build dependency
sed -i '/^target_link_libraries/ s@lvgl::drivers@& SDL2@' "${S}/CMakeLists.txt"
# Switch from fbdev to sdl usage
sed -i 's@fbdev_flush@sdl_display_flush@g' "${S}/main.c"
sed -i 's@lv_drivers/display/fbdev.h@lv_drivers/sdl/sdl.h@g' "${S}/main.c"
sed -i 's@fbdev@sdl@g' "${S}/main.c"
fi
}
do_install:append() {
install -d ${D}${bindir}
install -m 0755 ${B}/lvgl_fb ${D}${bindir}/
}

View File

@ -0,0 +1,49 @@
SUMMARY = "LVGL Demo Application for Framebuffer"
HOMEPAGE = "https://github.com/lvgl/lv_port_linux_frame_buffer"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=802d3d83ae80ef5f343050bf96cce3a4 \
file://lvgl/LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "\
git://github.com/lvgl/lv_port_linux_frame_buffer.git;protocol=https;branch=master;name=demo \
git://github.com/lvgl/lvgl;protocol=https;branch=master;name=lvgl;subdir=git/lvgl \
"
SRCREV_demo = "dccc6a1ca48372aa993dbea7a8e17dec6f42df6a"
SRCREV_lvgl = "e29d35b43c509b6d7189f5dac87139441669ae66"
SRCREV_FORMAT = "demo_lvgl"
PV .= "+git${SRCPV}"
EXTRA_OEMAKE = "DESTDIR=${D}"
PACKAGECONFIG ??= "drm"
LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
require lv-drivers.inc
inherit cmake
S = "${WORKDIR}/git"
TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
do_configure:prepend() {
if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then
# Add libdrm build dependency
sed -i '/^target_link_libraries/ s@pthread@& drm@' "${S}/CMakeLists.txt"
# Switch from fbdev to drm usage
sed -i "s@lv_linux_fbdev_set_file.*@lv_linux_drm_set_file(disp, \"${LVGL_CONFIG_DRM_CARD}\", -1);@g" "${S}/main.c"
sed -i 's@fbdev@drm@g' "${S}/main.c"
fi
if [ "${LVGL_CONFIG_USE_SDL}" -eq 1 ] ; then
# Add libsdl build dependency
sed -i '/^target_link_libraries/ s@pthread@& SDL2 SDL2_image@' "${S}/CMakeLists.txt"
# Switch from fbdev to sdl usage
sed -i 's@lv_linux_fbdev_create()@lv_sdl_window_create(atoi(getenv("LV_VIDEO_WIDTH") ? : "800"), atoi(getenv("LV_VIDEO_HEIGHT") ? : "480"))@g' "${S}/main.c"
sed -i '/lv_linux_fbdev_set_file/ d' "${S}/main.c"
fi
}
do_install:append() {
install -d ${D}${bindir}
install -m 0755 ${S}/bin/main ${D}${bindir}/lvgl
}

View File

@ -1,44 +0,0 @@
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: MIT
HOMEPAGE = "https://lvgl.io/"
DESCRIPTION = "LVGL is an OSS graphics library to create embedded GUI"
SUMMARY = "Light and Versatile Graphics Library"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "git://github.com/lvgl/lvgl;protocol=https;branch=release/v8.3"
SRCREV = "74d0a816a440eea53e030c4f1af842a94f7ce3d3"
inherit cmake
EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib}"
S = "${WORKDIR}/git"
ALLOW_EMPTY:${PN} = "1"
LVGL_CONFIG_LV_MEM_CUSTOM ?= "0"
LVGL_CONFIG_LV_COLOR_DEPTH ?= "32"
# Upstream does not support a default configuration
# but propose a default "disabled" template, which is used as reference
# More configuration can be done using external configuration variables
do_configure:prepend() {
[ -r "${S}/lv_conf.h" ] \
|| sed -e 's|#if 0 .*Set it to "1" to enable .*|#if 1 // Enabled|g' \
-e "s|\(#define LV_COLOR_DEPTH \).*|\1 ${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
\
-e "s|\(#define LV_MEM_CUSTOM .*\)0|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
\
-e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
-e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
-e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
\
< "${S}/lv_conf_template.h" > "${S}/lv_conf.h"
}
FILES:${PN}-dev += "\
${includedir}/${PN}/ \
${includedir}/${PN}/lvgl/ \
"

View File

@ -0,0 +1,28 @@
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: MIT
HOMEPAGE = "https://lvgl.io/"
DESCRIPTION = "LVGL is an OSS graphics library to create embedded GUI"
SUMMARY = "Light and Versatile Graphics Library"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
SRC_URI = "git://github.com/lvgl/lvgl;protocol=https;branch=master"
SRCREV = "e29d35b43c509b6d7189f5dac87139441669ae66"
PV .= "+git${SRCPV}"
inherit cmake
EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib}"
S = "${WORKDIR}/git"
ALLOW_EMPTY:${PN} = "1"
PACKAGECONFIG ??= "drm"
require lv-drivers.inc
FILES:${PN}-dev += "\
${includedir}/${PN}/ \
${includedir}/${PN}/lvgl/ \
"