What do you want to achieve?
Does LVGL support creating 16-byte aligned buffers?
Because the ESP modules enable secure mode and flash encryption, the LCD buffer size requires 16-byte alignment.
What have you tried so far?
/** Align stride of all layers and images to this bytes */
#define LV_DRAW_BUF_STRIDE_ALIGN 16
/** Align start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 16
lv_display_set_buffers(display, buf1, NULL, 480* 320* sizeof(lv_color_t), LV_DISPLAY_RENDER_MODE_PARTIAL);
Code to reproduce
/**
* @file lv_conf.h
* Configuration file for v9.3.0
*/
/*
* Copy this file as `lv_conf.h`
* 1. simply next to `lvgl` folder
* 2. or to any other place and
* - define `LV_CONF_INCLUDE_SIMPLE`;
* - add the path as an include path.
*/
/* clang-format off */
#if 1 /* Enable content */
#ifndef LV_CONF_H
#define LV_CONF_H
/* If you need to include anything here, do it inside the `__ASSEMBLY__` guard */
#if 0 && defined(__ASSEMBLY__)
#include "my_include.h"
#endif
/*====================
COLOR SETTINGS
*====================*/
/** Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888) */
#define LV_COLOR_DEPTH 16
/*=========================
STDLIB WRAPPER SETTINGS
*=========================*/
/** Possible values
* - LV_STDLIB_BUILTIN: LVGL's built in implementation
* - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc
* - LV_STDLIB_MICROPYTHON: MicroPython implementation
* - LV_STDLIB_RTTHREAD: RT-Thread implementation
* - LV_STDLIB_CUSTOM: Implement the functions externally
*/
#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN
/** Possible values
* - LV_STDLIB_BUILTIN: LVGL's built in implementation
* - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc
* - LV_STDLIB_MICROPYTHON: MicroPython implementation
* - LV_STDLIB_RTTHREAD: RT-Thread implementation
* - LV_STDLIB_CUSTOM: Implement the functions externally
*/
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
/** Possible values
* - LV_STDLIB_BUILTIN: LVGL's built in implementation
* - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc
* - LV_STDLIB_MICROPYTHON: MicroPython implementation
* - LV_STDLIB_RTTHREAD: RT-Thread implementation
* - LV_STDLIB_CUSTOM: Implement the functions externally
*/
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#define LV_STDINT_INCLUDE <stdint.h>
#define LV_STDDEF_INCLUDE <stddef.h>
#define LV_STDBOOL_INCLUDE <stdbool.h>
#define LV_INTTYPES_INCLUDE <inttypes.h>
#define LV_LIMITS_INCLUDE <limits.h>
#define LV_STDARG_INCLUDE <stdarg.h>
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/** Size of memory available for `lv_malloc()` in bytes (>= 2kB) */
#define LV_MEM_SIZE (1024 * 128)
/** Size of the memory expand for `lv_malloc()` in bytes */
#define LV_MEM_POOL_EXPAND_SIZE 0
/** Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */
#define LV_MEM_ADR 0 /**< 0: unused*/
/* Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc */
#if LV_MEM_ADR == 0
#undef LV_MEM_POOL_INCLUDE
#undef LV_MEM_POOL_ALLOC
#endif
#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/
/*====================
HAL SETTINGS
*====================*/
/** Default display refresh, input device read and animation step period. */
#define LV_DEF_REFR_PERIOD 10 /**< [ms] */
/** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
* (Not so important, you can adjust it to modify default sizes and spaces.) */
#define LV_DPI_DEF 130 /**< [px/inch] */
/*=================
* OPERATING SYSTEM
*=================*/
/** Select operating system to use. Possible options:
* - LV_OS_NONE
* - LV_OS_PTHREAD
* - LV_OS_FREERTOS
* - LV_OS_CMSIS_RTOS2
* - LV_OS_RTTHREAD
* - LV_OS_WINDOWS
* - LV_OS_MQX
* - LV_OS_SDL2
* - LV_OS_CUSTOM */
#define LV_USE_OS LV_OS_NONE
#if LV_USE_OS == LV_OS_CUSTOM
#define LV_OS_CUSTOM_INCLUDE <stdint.h>
#endif
#if LV_USE_OS == LV_OS_FREERTOS
/*
* Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM
* than unblocking a task using an intermediary object such as a binary semaphore.
* RTOS task notifications can only be used when there is only one task that can be the recipient of the event.
*/
#define LV_USE_FREERTOS_TASK_NOTIFY 1
#endif
/*========================
* RENDERING CONFIGURATION
*========================*/
/** Align stride of all layers and images to this bytes */
#define LV_DRAW_BUF_STRIDE_ALIGN 1
/** Align start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 16
/** Using matrix for transformations.
* Requirements:
* - `LV_USE_MATRIX = 1`.
* - Rendering engine needs to support 3x3 matrix transformations. */
#define LV_DRAW_TRANSFORM_USE_MATRIX 0
/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode
* it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks.
* "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers
* and can't be drawn in chunks. */
/** The target buffer size for simple layer chunks. */
#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (32 * 1024) /**< [bytes]*/
/* Limit the max allocated memory for simple and transformed layers.
* It should be at least `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` sized but if transformed layers are also used
* it should be enough to store the largest widget too (width x height x 4 area).
* Set it to 0 to have no limit. */
#define LV_DRAW_LAYER_MAX_MEMORY 0 /**< No limit by default [bytes]*/
/** Stack size of drawing thread.
* NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
*/
#define LV_DRAW_THREAD_STACK_SIZE (16 * 1024) /**< [bytes]*/
/** Thread priority of the drawing task.
* Higher values mean higher priority.
* Can use values from lv_thread_prio_t enum in lv_os.h: LV_THREAD_PRIO_LOWEST,
* LV_THREAD_PRIO_LOW, LV_THREAD_PRIO_MID, LV_THREAD_PRIO_HIGH, LV_THREAD_PRIO_HIGHEST
* Make sure the priority value aligns with the OS-specific priority levels.
* On systems with limited priority levels (e.g., FreeRTOS), a higher value can improve
* rendering performance but might cause other tasks to starve. */
#define LV_DRAW_THREAD_PRIO LV_THREAD_PRIO_HIGH
#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
/*
* Selectively disable color format support in order to reduce code size.
* NOTE: some features use certain color formats internally, e.g.
* - gradients use RGB888
* - bitmaps with transparency may use ARGB8888
*/
#define LV_DRAW_SW_SUPPORT_RGB565 1
#define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1
#define LV_DRAW_SW_SUPPORT_RGB565A8 1
#define LV_DRAW_SW_SUPPORT_RGB888 1
#define LV_DRAW_SW_SUPPORT_XRGB8888 1
#define LV_DRAW_SW_SUPPORT_ARGB8888 1
#define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 1
#define LV_DRAW_SW_SUPPORT_L8 1
#define LV_DRAW_SW_SUPPORT_AL88 1
#define LV_DRAW_SW_SUPPORT_A8 1
#define LV_DRAW_SW_SUPPORT_I1 1
/* The threshold of the luminance to consider a pixel as
* active in indexed color format */
#define LV_DRAW_SW_I1_LUM_THRESHOLD 127
/** Set number of draw units.
* - > 1 requires operating system to be enabled in `LV_USE_OS`.
* - > 1 means multiple threads will render the screen in parallel. */
#define LV_DRAW_SW_DRAW_UNIT_CNT 1
/** Use Arm-2D to accelerate software (sw) rendering. */
#define LV_USE_DRAW_ARM2D_SYNC 0
/** Enable native helium assembly to be compiled. */
#define LV_USE_NATIVE_HELIUM_ASM 0
/**
* - 0: Use a simple renderer capable of drawing only simple rectangles with gradient, images, text, and straight lines only.
* - 1: Use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too. */
#define LV_DRAW_SW_COMPLEX 1
#if LV_DRAW_SW_COMPLEX == 1
/** Allow buffering some shadow calculation.
* LV_DRAW_SW_SHADOW_CACHE_SIZE is the maximum shadow size to buffer, where shadow size is
* `shadow_width + radius`. Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost. */
#define LV_DRAW_SW_SHADOW_CACHE_SIZE 0
/** Set number of maximally-cached circle data.
* The circumference of 1/4 circle are saved for anti-aliasing.
* `radius * 4` bytes are used per circle (the most often used radiuses are saved).
* - 0: disables caching */
#define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4
#endif
#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#define LV_DRAW_SW_ASM_CUSTOM_INCLUDE ""
#endif
/** Enable drawing complex gradients in software: linear at an angle, radial or conical */
#define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 1
#endif
/*Use TSi's aka (Think Silicon) NemaGFX */
#define LV_USE_NEMA_GFX 0
#if LV_USE_NEMA_GFX
/** Select which NemaGFX HAL to use. Possible options:
* - LV_NEMA_HAL_CUSTOM
* - LV_NEMA_HAL_STM32 */
#define LV_USE_NEMA_HAL LV_NEMA_HAL_CUSTOM
#if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32
#define LV_NEMA_STM32_HAL_INCLUDE <stm32u5xx_hal.h>
#endif
/*Enable Vector Graphics Operations. Available only if NemaVG library is present*/
#define LV_USE_NEMA_VG 0
#if LV_USE_NEMA_VG
/*Define application's resolution used for VG related buffer allocation */
#define LV_NEMA_GFX_MAX_RESX 800
#define LV_NEMA_GFX_MAX_RESY 600
#endif
#endif
Screenshot and/or video
Environment
- MCU/MPU/Board: ESP32-S3-WROOM-1-N16-R2
- LVGL version: V9.3.0
- ESP-IDF version: V5.3.1