Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,72 @@
From 1d92e1854c19c06c553243d29170bb4d1a9e3863 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marex@denx.de>
Date: Tue, 9 May 2023 02:57:30 +0200
Subject: [PATCH 1/2] wayland: Switch to custom timer tick
The OE LVGL is configured to obtain timer tick from system timer
instead of using ad-hoc mechanisms to emulate timer tick using
threads or such. Use system timer to provide the tick.
The tick handling implementation comes from:
https://github.com/lvgl/lv_port_linux_frame_buffer.git
as of commit adf2c4490e17a1b9ec1902cc412a24b3b8235c8e
Upstream-Status: Inappropriate [Upstream repo is archived]
Signed-off-by: Marek Vasut <marex@denx.de>
---
src/drivers/wayland.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/drivers/wayland.c b/src/drivers/wayland.c
index 633dc18..bcebf4d 100644
--- a/src/drivers/wayland.c
+++ b/src/drivers/wayland.c
@@ -6,6 +6,7 @@
#if defined(USE_WAYLAND) && USE_WAYLAND
#include <pthread.h>
+#include <sys/time.h>
#include <unistd.h>
#include <lv_drivers/wayland/wayland.h>
@@ -18,13 +19,22 @@
#define WAYLAND_VER_RES 320
#endif
-static void * tick_thread(void * data)
+uint32_t custom_tick_get(void)
{
- (void) data;
- while(true) {
- usleep(5 * 1000);
- lv_tick_inc(5);
- }
+ static uint64_t start_ms = 0;
+ if(start_ms == 0) {
+ struct timeval tv_start;
+ gettimeofday(&tv_start, NULL);
+ start_ms = (tv_start.tv_sec * 1000000 + tv_start.tv_usec) / 1000;
+ }
+
+ struct timeval tv_now;
+ gettimeofday(&tv_now, NULL);
+ uint64_t now_ms;
+ now_ms = (tv_now.tv_sec * 1000000 + tv_now.tv_usec) / 1000;
+
+ uint32_t time_ms = now_ms - start_ms;
+ return time_ms;
}
@@ -47,8 +57,6 @@ void hal_init(void)
lv_group_t * g = lv_group_create();
lv_group_set_default(g);
- static pthread_t hal_thread;
- pthread_create(&hal_thread, NULL, tick_thread, NULL);
}
#endif
--
2.39.2
@@ -0,0 +1,30 @@
From b7af695d79820adf53e7d612120bda12ed2886e2 Mon Sep 17 00:00:00 2001
From: Marek Vasut <marex@denx.de>
Date: Tue, 9 May 2023 02:57:38 +0200
Subject: [PATCH 2/2] wayland: Fix callback data type
The LVGL 8.3.y changed the callback data type, update it accordingly.
Upstream-Status: Inappropriate [Upstream repo is archived]
Signed-off-by: Marek Vasut <marex@denx.de>
---
src/drivers/wayland.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/drivers/wayland.c b/src/drivers/wayland.c
index bcebf4d..cfefa88 100644
--- a/src/drivers/wayland.c
+++ b/src/drivers/wayland.c
@@ -37,8 +37,7 @@ uint32_t custom_tick_get(void)
return time_ms;
}
-
-static lv_wayland_display_close_f_t close_cb()
+static bool close_cb(lv_disp_t * disp)
{
}
--
2.39.2
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: Huawei Inc.
# SPDX-License-Identifier: MIT
SRC_URI = "git://git.ostc-eu.org/rzr/dialog-lvgl;destsuffix=${S};protocol=https;nobranch=1 \
file://0001-wayland-Switch-to-custom-timer-tick.patch \
file://0002-wayland-Fix-callback-data-type.patch \
"
SRCREV = "cdf8d38acca87e871c3a488fd07f1e4779590f8e"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=8ce0a84e5276f01364119c873b712c4f"
AUTHOR = "Philippe Coval <philippe.coval.ext@huawei.com>"
DEPENDS += "lvgl"
DEPENDS += "lv-drivers"
SUMMARY = "Basic UI utility to be used in scripts"
DESCRIPTION = "Inspired by ncurses' dialog, implemented using LVGL"
HOMEPAGE = "https://git.ostc-eu.org/rzr/dialog-lvgl/-/wikis/"
REQUIRED_DISTRO_FEATURES = "wayland"
inherit pkgconfig
inherit features_check
EXTRA_OEMAKE += "sysroot=${RECIPE_SYSROOT}"
EXTRA_OEMAKE += "DESTDIR=${D}"
EXTRA_OEMAKE += "lvgl_driver=wayland"
do_install() {
oe_runmake install
}
@@ -0,0 +1,46 @@
PACKAGECONFIG[drm] = ",,libdrm"
PACKAGECONFIG[fbdev] = ",,"
PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
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"
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"
# 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 USE_FBDEV \).*|# define USE_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 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" \
\
-i "${S}/lv_drv_conf.h"
}
@@ -0,0 +1,28 @@
# 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/ \
"
@@ -0,0 +1,31 @@
# 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;nobranch=1"
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/ \
"
@@ -0,0 +1,46 @@
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}/
}
@@ -0,0 +1,42 @@
# 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 = "2b56e04205481daa6575bd5f7ab5df59d11676eb"
inherit cmake
EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib}"
S = "${WORKDIR}/git"
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/ \
"