summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2023-06-25 15:49:01 +0200
committerKhem Raj <raj.khem@gmail.com>2023-06-26 05:12:55 -0700
commit32905ebacc59b925e120ad0d60007109e128a4a0 (patch)
tree2b922bd5f16ee696014c8743278e37f79047b64b
parent01989effad3096f0e818ba51a53877ac1555d3cd (diff)
downloadmeta-openembedded-32905ebacc59b925e120ad0d60007109e128a4a0.tar.gz
lvgl: Factor out and unify lv-drivers configuration
The configuration of lv_drivers is the same in lv-drivers and lvgl-demo-fb, the later just pulls in its own already preconfigured variant of lv-drivers as git submodule. Pull out the lv-drivers configuration into separate file lv-drivers.inc, so it can be shared by lv-drivers and lvgl-demo-fb recipes. Furthermore, as the configuration support in both recipes diverged already, merge support for both sets of configuration options. This way, lv-drivers grows support for DRM and SDL backend, and lvgl-demo-fb for WL backend. The PACKAGECONFIG of each recipe is left unchanged so far to avoid breaking of existing users. Note that LVGL_CONFIG_USE_EVDEV is new and activated for both fbdev and drm, since both of those backends need EVDEV support right now. The libinput input support is not available yet. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-graphics/lvgl/lv-drivers.inc44
-rw-r--r--meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb26
-rw-r--r--meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb17
3 files changed, 46 insertions, 41 deletions
diff --git a/meta-oe/recipes-graphics/lvgl/lv-drivers.inc b/meta-oe/recipes-graphics/lvgl/lv-drivers.inc
new file mode 100644
index 0000000000..284d8421b3
--- /dev/null
+++ b/meta-oe/recipes-graphics/lvgl/lv-drivers.inc
@@ -0,0 +1,44 @@
1PACKAGECONFIG[drm] = ",,libdrm"
2PACKAGECONFIG[fbdev] = ",,"
3PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
4PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
5
6LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}"
7LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
8
9LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}"
10
11LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}"
12
13LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}"
14
15LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', '1', '0', d)}"
16LVGL_CONFIG_WAYLAND_HOR_RES ?= "480"
17LVGL_CONFIG_WAYLAND_VER_RES ?= "320"
18
19EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
20
21do_configure:append() {
22 # If there is a configuration template, start from that
23 [ -r "${S}/lv_drv_conf_template.h" ] && cp -Lv "${S}/lv_drv_conf_template.h" "${S}/lv_drv_conf.h"
24
25 # Configure the software using sed
26 sed -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // Enabled by ${PN}|g" \
27 \
28 -e "s|\(^# define USE_DRM \).*|# define USE_DRM ${LVGL_CONFIG_USE_DRM}|g" \
29 -e "s|\(^# define DRM_CARD \).*|# define DRM_CARD \"${LVGL_CONFIG_DRM_CARD}\"|g" \
30 \
31 -e "s|\(^# define USE_EVDEV \).*|# define USE_EVDEV ${LVGL_CONFIG_USE_EVDEV}|g" \
32 \
33 -e "s|\(^# define USE_FBDEV \).*|# define USE_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
34 \
35 -e "s|\(^# define USE_SDL \).*|# define USE_SDL ${LVGL_CONFIG_USE_SDL}|g" \
36 -e "s|\(^# define USE_SDL_GPU \).*|# define USE_SDL_GPU 1|g" \
37 -e "s|\(^# define SDL_DOUBLE_BUFFERED \).*|# define SDL_DOUBLE_BUFFERED 1|g" \
38 \
39 -e "s|\(^# define USE_WAYLAND \).*|# define USE_WAYLAND ${LVGL_CONFIG_USE_WAYLAND}|g" \
40 -e "s|\(^ *# *define *WAYLAND_HOR_RES *\).*|\1${LVGL_CONFIG_WAYLAND_HOR_RES}|g" \
41 -e "s|\(^ *# *define *WAYLAND_VER_RES *\).*|\1${LVGL_CONFIG_WAYLAND_VER_RES}|g" \
42 \
43 -i "${S}/lv_drv_conf.h"
44}
diff --git a/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb b/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb
index a0a2ee0aa9..e2c5a342a1 100644
--- a/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb
+++ b/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb
@@ -14,39 +14,15 @@ SRCREV = "71830257710f430b6d8d1c324f89f2eab52488f1"
14DEPENDS = "lvgl" 14DEPENDS = "lvgl"
15 15
16PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland fbdev', d)}" 16PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland fbdev', d)}"
17PACKAGECONFIG[fbdev] = ",," 17require lv-drivers.inc
18PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
19LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}"
20LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', '1', '0', d)}"
21 18
22inherit cmake 19inherit cmake
23 20
24S = "${WORKDIR}/git" 21S = "${WORKDIR}/git"
25 22
26LVGL_CONFIG_WAYLAND_HOR_RES ?= "480"
27LVGL_CONFIG_WAYLAND_VER_RES ?= "320"
28
29EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
30
31TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1" 23TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1"
32TARGET_CFLAGS += "-I${STAGING_INCDIR}/lvgl" 24TARGET_CFLAGS += "-I${STAGING_INCDIR}/lvgl"
33 25
34# Upstream does not support a default configuration
35# but propose a default "disabled" template, which is used as reference
36# More configuration can be done using external configuration variables
37do_configure:append() {
38 [ -r "${S}/lv_drv_conf.h" ] \
39 || sed -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // Enabled by ${PN}|g" \
40 \
41 -e "s|\(^# define USE_FBDEV \).*|# define USE_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
42 -e "s|\(^# define USE_EVDEV \).*|# define USE_EVDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
43 \
44 -e "s|\(^# define USE_WAYLAND \).*|# define USE_WAYLAND ${LVGL_CONFIG_USE_WAYLAND}|g" \
45 -e "s|\(^ *# *define *WAYLAND_HOR_RES *\).*|\1${LVGL_CONFIG_WAYLAND_HOR_RES}|g" \
46 -e "s|\(^ *# *define *WAYLAND_VER_RES *\).*|\1${LVGL_CONFIG_WAYLAND_VER_RES}|g" \
47 < "${S}/lv_drv_conf_template.h" > "${S}/lv_drv_conf.h"
48}
49
50FILES:${PN}-dev += "\ 26FILES:${PN}-dev += "\
51 ${includedir}/lvgl/lv_drivers/ \ 27 ${includedir}/lvgl/lv_drivers/ \
52 " 28 "
diff --git a/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb b/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb
index 33e7c94e68..32f833a026 100644
--- a/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb
+++ b/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb
@@ -11,30 +11,15 @@ SRCREV = "adf2c4490e17a1b9ec1902cc412a24b3b8235c8e"
11EXTRA_OEMAKE = "DESTDIR=${D}" 11EXTRA_OEMAKE = "DESTDIR=${D}"
12 12
13PACKAGECONFIG ??= "drm" 13PACKAGECONFIG ??= "drm"
14PACKAGECONFIG[drm] = ",,libdrm" 14require lv-drivers.inc
15PACKAGECONFIG[fbdev] = ",,"
16PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
17LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}"
18LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
19LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}"
20LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}"
21 15
22inherit cmake 16inherit cmake
23 17
24S = "${WORKDIR}/git" 18S = "${WORKDIR}/git"
25 19
26EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
27TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm" 20TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
28 21
29do_configure:prepend() { 22do_configure:prepend() {
30 sed -i -e "s|\(^# define USE_FBDEV \).*|# define USE_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
31 -e "s|\(^# define USE_DRM \).*|# define USE_DRM ${LVGL_CONFIG_USE_DRM}|g" \
32 -e "s|\(^# define DRM_CARD \).*|# define DRM_CARD \"${LVGL_CONFIG_DRM_CARD}\"|g" \
33 -e "s|\(^# define USE_SDL \).*|# define USE_SDL ${LVGL_CONFIG_USE_SDL}|g" \
34 -e "s|\(^# define USE_SDL_GPU \).*|# define USE_SDL_GPU 1|g" \
35 -e "s|\(^# define SDL_DOUBLE_BUFFERED \).*|# define SDL_DOUBLE_BUFFERED 1|g" \
36 "${S}/lv_drv_conf.h"
37
38 if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then 23 if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then
39 # Add libdrm build dependency 24 # Add libdrm build dependency
40 sed -i '/^target_link_libraries/ s@lvgl::drivers@& drm@' "${S}/CMakeLists.txt" 25 sed -i '/^target_link_libraries/ s@lvgl::drivers@& drm@' "${S}/CMakeLists.txt"