Add multi-display support in Zephyr ontop of LVGL which already supports
it.
This change allows for creating buffers and structures for each display
statically and automatically from deviceTree info, and call LV init
routines for each display
Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
In some cases, pixel inversion is managed by the display hardware
and software inversion is not required.
Signed-off-by: Robin-Charles Guihéneuf <robin-charles@hotmail.fr>
The LVGL OSAL also tries to set the name of threads. Adjust the function
signature accordingly. Also deal with the fact that the type
`lv_thread_prio_t` is not part of the private api and requires a
LV_USE_PRIVATE_API symbol to be enabled.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
In lvgl_transform_buffer() the pixel map buffer start address is
modified to skip the library color palette header but the memcpy size
argument was not modified accordingly thus causing writes beyond buffer
reserved space.
Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
There are 4 Kconfig names about the "Draw Buffer". Rename 'VBD' to 'VDB'
in Kconfig option 'LV_Z_*VBD*_CUSTOM_SECTION' to make name consistent.
config LV_Z_VDB_ALIGN
int "Rending buffer alignment"
config LV_Z_VBD_CUSTOM_SECTION
bool "Link rendering buffers to custom section"
config LV_Z_DOUBLE_VDB
bool "Use two rendering buffers"
config LV_Z_VDB_SIZE
int "Rendering buffer size"
default 100 if LV_Z_FULL_REFRESH
And the draw buffer definition is now:
static uint8_t buf0[BUFFER_SIZE]
#ifdef CONFIG_LV_Z_VDB_CUSTOM_SECTION
Z_GENERIC_SECTION(.lvgl_buf)
#endif
__aligned(CONFIG_LV_Z_VDB_ALIGN);
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
Adds support for the NXP PXP engine. LVGL changed
the Kconfig symbol from LV_USE_GPU_NXP_PXP to
LV_USE_PXP, but hal_nxp still relies on
LV_USE_GPU_NXP_PXP, so add a temporary symbol for it.
Additionally the drawing engines need to invalidate
ranges in the dcache, the method needs to be provided
via a lvgl_support.h file.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This patch adds the OSAL implementation of dynamic thread creation, mutex
and thread syncronization primitive (semaphore) enabling the use of the
parallel rendering architecture provided with LVGL 9.0. To use it, set
`CONFIG_LV_Z_USE_OSAL` and your preferred dynamic thread stack allocation
method (pool or heap).
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This patch updates the module gluecode to be compatible with LVGL version
9.2. This includes changes done to display and input driver initialization
and draw buffer handling.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Use configdefault when enabling LV_COLOR_SWAP_16 within boards and
shield definitions, to avoid OR'ing the dependencies for the Kconfig
symbol. Otherwise, a user manually selecting LV_COLOR_DEPTH will
encounter build errors as LV_COLOR_SWAP_16 may be enabled when
LV_COLOR_DEPTH_16 is not selected
Fixes#81546
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
The LVGL flush thread was hard-coded to be cooperative.
For long-running actions like data transfer to the display,
this is problematic as it might block high-frequency actions like
USB or input events.
Hence, make it configurable to be preemptive, and rename it to match the
similar Kconfig values like CONFIG_SDL_THREAD_PRIORITY.
Signed-off-by: Martin Stumpf <finomnis@gmail.com>
In frames with multiple writes (officially supported through
`CONFIG_LV_Z_VDB_SIZE`) the display needs to be signalled that the
current frame is over and the content should be displayed.
This allows displays to present the UI without tearing artifacts.
Signed-off-by: Martin Stumpf <finomnis@gmail.com>
The LVGL input callback does not use an instance specific name, so we
can only ever have one instance of this type. This issue was evident by
a build error, e.g., when using "zephyr,lvgl-keypad-input" nodes twice:
error: redefinition of '_input_callback__lvgl_keypad_process_event'
Signed-off-by: Gero Schwäricke <gero.schwaericke@posteo.de>
For some systems, the display peripheral or GPU requires that buffers be
aligned on a boundary for optimal performance. We already align display
buffers using CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE, but some applications
will rely on the definition of LV_ATTRIBUTE_MEM_ALIGN. Provide this
definition so those buffers will be aligned as well.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add a void *user_data pointer to the input callback structure. This is
useful for driver to get back the driver data structure and avoid
defining wrapper functions.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Adding a semicolon after the do-while loop in the LV_DEV_INIT()
macro also supports multiple instantiation.
Signed-off-by: Stephan Linz <linz@li-pro.net>
This patch adds a kconfig option `LV_Z_MEMORY_POOL_CUSTOM_SECTION`
which allows to place the buffer the memory pool is backed by into a
section with the label ".lvgl_heap".
Resolves issue: #66494.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Removes the wrapper code of the kscan based pointer input device. It was
implemented during the transitioning phase until all intree drivers were
converted to the input subsystem.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
The following heap-related Kconfigs shared by the picolibc &
minimal libc have been deprecated for more than 2 releases,
remove them and update the Kconfigs accordingly:
- `CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE`
- `CONFIG_MINIMAL_LIBC_REALLOCARRAY`
Cleanup the handling to support the deprecated malloc arena
size configuration values.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
When the encoder button was pressed, it would send a LV_KEY_LEFT/RIGHT
instead of a LV_KEY_ENTER event.
This clears the enc_diff field, and set the key field to LV_KEY_ENTER
for button events.
Fixes#73529
Signed-off-by: Lorenz Clijnen <lorenz_reclame@outlook.be>
Add missing call to LV_MEM_CUSTOM_FREE when closing a file to prevent
memory from leaking.
Resolves issue #73148.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
https://github.com/zephyrproject-rtos/zephyr/pull/70541 has an
issue where if the screen has been rotated, values calculated if
invert-x or invert-y are set will be overwritten.
This breaks the adafruit_2_8_tft_touch_v2 touchscreen as the
display is rotated by 90 degrees but uses invert-x and invert-y.
This change makes the invert-x and invert-y options independent
of screen rotation.
Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
This patch fixes two issues in the coordinate handling of the
`zephyr,lvgl-pointer-input` compatible:
- If the swap-xy flag is set the coordinates need to be swapped even
before the sync event is received.
- The coordinates are stored into an additional variable instead of the
pending_event. This is done to prevent the double inversion for touch
release events.
Resolves issue #70539.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Adds the missing stubs for DMA2D kconfig symbol to fix the Kconfig warning
produced by checkpatch.
Resolves#70859
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Add support for LVGL rounder callback function. Sometimes,
either the underlying display controller and/or the LCD host
controller might impose restrictions on frame resolution.
For instance, the E1394AA65A display model should impose that
either axis of a frame be multiple of 2 pixels or the Renesas
LCD controller of the DA1469x SoC, should impose that the
stride value, number of bytes between consecutive frame lines,
be multiple of 4 bytes.
Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
Compilation error "undefined reference to log_const_lvgl"
happened in lvgl_keypad_input.c when trying to get logs with
lvgl keypad module. Fixed by adding log level parameter
in log module macro.
Signed-off-by: Eve Redero <eve.redero@gmail.com>
Changes the default of `LV_Z_VDB_SIZE` to 100 percent if
`LV_Z_FULL_REFRESH` is set. Reason is that LVGL will reset the full
refresh flag if the buffer is not equal to the screen size.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Introduces a Kconfig symbol `LV_Z_LOG_LEVEL` because contrary to Zephyr the
numerical value of log levels in LVGL increases with severity. Also support
for the `LV_LOG_LEVEL_USER` is added.
Resolves issue #64351.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Changes the Kconfig symbols for the sys_heap based memory management option
and removes the notion of `BLOCKS` with a more concise single
`LV_Z_MEM_POOL_SIZE` option. Also adds `LV_MEM_CUSTOM` to the lv_conf.h,
since in any option the memory management is considered to be custom.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Adds saving of the last lv_indev_data_t for button and pointer type
devices. This is needed because there is currently no way to tell LVGL in
the read callback that no event is pending. Preservation of the last state
is expected to happen in the port layer for the input devices.
This resolves issue #62512.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Removes the pseudo device prerequisite that the LVGL setup routine has been
executed before initialization. The pseudo devices are now registered at
the end of the LVGL setup routine, the driver is not concerned with
configuring the devices anymore. This also removes the need for enforcing
certain priorities within the same init level.
This resolves issue #62753.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Add a pseudo device which can be used to hook into qdec events and
optionally a button and relay the input_event to lvgl.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Call lvgl_heap_init from lvgl_init rather than using two separate
SYS_INIT, this sensures that the heap is initialized correctly
regardless of the relation between CONFIG_KERNEL_INIT_PRIORITY_DEFAULT
and CONFIG_APPLICATION_INIT_PRIORITY.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add a pseudo device which can be used to hook into gpio-keys input_events
and relay the events to a lv_indev.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Moves lvgl pointer driver handling based on kscan to its own file, to ease
deletion when the usage of kscan for display touch input has been
deprecated.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Add the scaffolding to create input lvgl pseudo devices which route zephyr
input_event to their lvgl `indev` equivalent. As a first cut also add a
`zephyr,lvgl-pointer-input compatible which can be a drop-in replacement
for the existing kscan solution.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Enable offloading of display_write call to background thread for color
displays. This feature is opt-in, as it may offer significant
performance gains for every display pipeline.
When enabled display_write and lv_disp_flush_ready will be called from a
background thread. This means that while the display driver waits on the
hardware to render the framebuffer, the LVGL rendering thread will not
be blocked.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Changes the lvgl filesystem `tell()` wrapper to check for errors returned
by zephyr filesystem subsystem.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Changes the memory management for the lvgl filesystem wrapper to use the
memory management strategy selected by kconfig. Additionally fixes memory
leaks if fs_{file,dir}_t initialization failed.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>