diff options
| author | Marek Vasut <marex@denx.de> | 2023-06-25 15:49:01 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-06-26 05:12:55 -0700 |
| commit | 32905ebacc59b925e120ad0d60007109e128a4a0 (patch) | |
| tree | 2b922bd5f16ee696014c8743278e37f79047b64b | |
| parent | 01989effad3096f0e818ba51a53877ac1555d3cd (diff) | |
| download | meta-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.inc | 44 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb | 26 | ||||
| -rw-r--r-- | meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb | 17 |
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 @@ | |||
| 1 | PACKAGECONFIG[drm] = ",,libdrm" | ||
| 2 | PACKAGECONFIG[fbdev] = ",," | ||
| 3 | PACKAGECONFIG[sdl] = ",,virtual/libsdl2" | ||
| 4 | PACKAGECONFIG[wayland] = ",,libxkbcommon wayland" | ||
| 5 | |||
| 6 | LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}" | ||
| 7 | LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0" | ||
| 8 | |||
| 9 | LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm fbdev', '1', '0', d)}" | ||
| 10 | |||
| 11 | LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}" | ||
| 12 | |||
| 13 | LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}" | ||
| 14 | |||
| 15 | LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', '1', '0', d)}" | ||
| 16 | LVGL_CONFIG_WAYLAND_HOR_RES ?= "480" | ||
| 17 | LVGL_CONFIG_WAYLAND_VER_RES ?= "320" | ||
| 18 | |||
| 19 | EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}" | ||
| 20 | |||
| 21 | do_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" | |||
| 14 | DEPENDS = "lvgl" | 14 | DEPENDS = "lvgl" |
| 15 | 15 | ||
| 16 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland fbdev', d)}" | 16 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland fbdev', d)}" |
| 17 | PACKAGECONFIG[fbdev] = ",," | 17 | require lv-drivers.inc |
| 18 | PACKAGECONFIG[wayland] = ",,libxkbcommon wayland" | ||
| 19 | LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}" | ||
| 20 | LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', '1', '0', d)}" | ||
| 21 | 18 | ||
| 22 | inherit cmake | 19 | inherit cmake |
| 23 | 20 | ||
| 24 | S = "${WORKDIR}/git" | 21 | S = "${WORKDIR}/git" |
| 25 | 22 | ||
| 26 | LVGL_CONFIG_WAYLAND_HOR_RES ?= "480" | ||
| 27 | LVGL_CONFIG_WAYLAND_VER_RES ?= "320" | ||
| 28 | |||
| 29 | EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}" | ||
| 30 | |||
| 31 | TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1" | 23 | TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1" |
| 32 | TARGET_CFLAGS += "-I${STAGING_INCDIR}/lvgl" | 24 | TARGET_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 | ||
| 37 | do_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 | |||
| 50 | FILES:${PN}-dev += "\ | 26 | FILES:${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" | |||
| 11 | EXTRA_OEMAKE = "DESTDIR=${D}" | 11 | EXTRA_OEMAKE = "DESTDIR=${D}" |
| 12 | 12 | ||
| 13 | PACKAGECONFIG ??= "drm" | 13 | PACKAGECONFIG ??= "drm" |
| 14 | PACKAGECONFIG[drm] = ",,libdrm" | 14 | require lv-drivers.inc |
| 15 | PACKAGECONFIG[fbdev] = ",," | ||
| 16 | PACKAGECONFIG[sdl] = ",,virtual/libsdl2" | ||
| 17 | LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}" | ||
| 18 | LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0" | ||
| 19 | LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', '0', d)}" | ||
| 20 | LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', d)}" | ||
| 21 | 15 | ||
| 22 | inherit cmake | 16 | inherit cmake |
| 23 | 17 | ||
| 24 | S = "${WORKDIR}/git" | 18 | S = "${WORKDIR}/git" |
| 25 | 19 | ||
| 26 | EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}" | ||
| 27 | TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm" | 20 | TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm" |
| 28 | 21 | ||
| 29 | do_configure:prepend() { | 22 | do_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" |
