diff --git a/CMakeLists.txt b/CMakeLists.txt index 667d42e0..b6e15e03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,10 @@ target_link_libraries(lvgl PUBLIC ${PKG_CONFIG_LIB} m pthread) add_executable(lvglsim src/main.c ${LV_LINUX_SRC} ${LV_LINUX_BACKEND_SRC}) target_link_libraries(lvglsim lvgl_linux lvgl) +if (CONFIG_LV_USE_DRAW_G2D) + target_link_libraries(lvglsim g2d) +endif() + # Install the lvgl_linux library and its headers install(DIRECTORY src/lib/ DESTINATION include/lvgl diff --git a/lv_conf.h b/lv_conf.h index 297a9e72..2892714a 100644 --- a/lv_conf.h +++ b/lv_conf.h @@ -1187,8 +1187,12 @@ /** Use Wayland to open a window and handle input on Linux or BSD desktops */ #define LV_USE_WAYLAND 0 #if LV_USE_WAYLAND - #define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME */ - #define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell */ + #define LV_WAYLAND_BUF_COUNT 1 /**< Use 1 for single buffer with partial render mode or 2 for double buffer with full render mode*/ + #define LV_WAYLAND_USE_DMABUF 0 /**< Use DMA buffers for frame buffers. Requires LV_DRAW_USE_G2D */ + #define LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL /**< DMABUF supports LV_DISPLAY_RENDER_MODE_FULL and LV_DISPLAY_RENDER_MODE_DIRECT*/ + /**< When LV_WAYLAND_USE_DMABUF is disabled, only LV_DISPLAY_RENDER_MODE_PARTIAL is supported*/ + #define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME. Not supported using DMABUF*/ + #define LV_WAYLAND_WL_SHELL 0 /**< Use the legacy wl_shell protocol instead of the default XDG shell*/ #endif /** Driver for /dev/fb */ diff --git a/scripts/gen_wl_protocols.sh b/scripts/gen_wl_protocols.sh index fa3e9950..0034bba0 100755 --- a/scripts/gen_wl_protocols.sh +++ b/scripts/gen_wl_protocols.sh @@ -2,7 +2,7 @@ # Generate wayland xdg shell protocol OUTPUT_DIR="$1" -PROTOCOL_ROOT="${SYSROOT:-}/usr/share/wayland-protocols" +PROTOCOL_ROOT="${SDKTARGETSYSROOT:-}/usr/share/wayland-protocols" if ! test -d $PROTOCOL_ROOT then @@ -16,6 +16,9 @@ then mkdir $OUTPUT_DIR wayland-scanner client-header "$PROTOCOL_ROOT/stable/xdg-shell/xdg-shell.xml" "$OUTPUT_DIR/wayland_xdg_shell.h" wayland-scanner private-code "$PROTOCOL_ROOT/stable/xdg-shell/xdg-shell.xml" "$OUTPUT_DIR/wayland_xdg_shell.c" + wayland-scanner client-header "$PROTOCOL_ROOT/stable/linux-dmabuf/linux-dmabuf-v1.xml" "$OUTPUT_DIR/wayland_linux_dmabuf.h" + wayland-scanner private-code "$PROTOCOL_ROOT/stable/linux-dmabuf/linux-dmabuf-v1.xml" "$OUTPUT_DIR/wayland_linux_dmabuf.c" fi echo "$OUTPUT_DIR/wayland_xdg_shell.c" +echo "$OUTPUT_DIR/wayland_linux_dmabuf.c" diff --git a/src/lib/display_backends/wayland.c b/src/lib/display_backends/wayland.c index 94cedf5a..9d93c32a 100644 --- a/src/lib/display_backends/wayland.c +++ b/src/lib/display_backends/wayland.c @@ -122,16 +122,15 @@ static lv_display_t *init_wayland(void) static void run_loop_wayland(void) { - bool completed; + uint32_t idle_time; /* Handle LVGL tasks */ while (true) { - completed = lv_wayland_timer_handler(); + idle_time = lv_wayland_timer_handler(); - if (completed) { - /* wait only if the cycle was completed */ - usleep(LV_DEF_REFR_PERIOD * 1000); + if(idle_time != 0) { + usleep(idle_time * 1000); } /* Run until the last window closes */