Skip to content

Commit

Permalink
feature(lvgl_port): Initial support for ppa rendering in lvgl
Browse files Browse the repository at this point in the history
      Mainly supports the following features:
       - color blend (simple fill)
       - color blend with opa
       - blend normal (blend with argb8888)
       - blend normal (color convert / memcpy)
  • Loading branch information
ThunderDai committed Oct 15, 2024
1 parent 61ab9cb commit 0984d25
Show file tree
Hide file tree
Showing 11 changed files with 1,532 additions and 17 deletions.
19 changes: 14 additions & 5 deletions components/esp_lvgl_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ if("usb_host_hid" IN_LIST build_components)
endif()

# Include SIMD assembly source code for rendering, only for (9.1.0 <= LVG_version < 9.2.0) and only for esp32 and esp32s3
if((lvgl_ver VERSION_GREATER_EQUAL "9.1.0") AND (lvgl_ver VERSION_LESS "9.2.0"))
if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S3)
if((lvgl_ver VERSION_GREATER_EQUAL "9.1.0") AND (lvgl_ver VERSION_LESS_EQUAL "9.2.0"))
if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S3 OR CONFIG_IDF_TARGET_ESP32P4)
message(VERBOSE "Compiling SIMD")
if(CONFIG_IDF_TARGET_ESP32S3)
file(GLOB_RECURSE ASM_SRCS ${PORT_PATH}/simd/*_esp32s3.S) # Select only esp32s3 related files
else()
elseif(CONFIG_IDF_TARGET_ESP32)
file(GLOB_RECURSE ASM_SRCS ${PORT_PATH}/simd/*_esp32.S) # Select only esp32 related files
endif()
list(APPEND ADD_SRCS ${ASM_SRCS})
Expand All @@ -91,9 +91,16 @@ if((lvgl_ver VERSION_GREATER_EQUAL "9.1.0") AND (lvgl_ver VERSION_LESS "9.2.0"))
idf_component_get_property(lvgl_lib ${lvgl_name} COMPONENT_LIB)
target_include_directories(${lvgl_lib} PRIVATE "include")

if(CONFIG_IDF_TARGET_ESP32P4)
file(GLOB_RECURSE PPA_SRCS ${PORT_PATH}/ppa/*)
list(APPEND ADD_SRCS ${PPA_SRCS})
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_malloc_core")
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u esp_ppa_fill_for_lvgl")
else()
# Force link .S files
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_argb8888_esp")
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_rgb565_esp")
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_argb8888_esp")
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_rgb565_esp")
endif()
endif()
endif()

Expand All @@ -111,6 +118,8 @@ target_link_libraries(lvgl_port_lib PUBLIC
)
target_link_libraries(lvgl_port_lib PRIVATE
idf::esp_timer
idf::esp_driver_ppa
idf::esp_mm
${ADD_LIBS}
)

Expand Down
15 changes: 15 additions & 0 deletions components/esp_lvgl_port/include/esp_lvgl_port_lv_blend.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ typedef struct {

extern int lv_color_blend_to_argb8888_esp(asm_dsc_t *asm_dsc);

// Just for compatibility with v9.2.0
// v9.2.0: lv_draw_sw_blend_fill_dsc_t
// v9.1.0: _lv_draw_sw_blend_fill_dsc_t
typedef struct {
void * dest_buf;
int32_t dest_w;
int32_t dest_h;
int32_t dest_stride;
const lv_opa_t * mask_buf;
int32_t mask_stride;
lv_color_t color;
lv_opa_t opa;
lv_area_t relative_area;
} _lv_draw_sw_blend_fill_dsc_t;

static inline lv_result_t _lv_color_blend_to_argb8888_esp(_lv_draw_sw_blend_fill_dsc_t *dsc)
{
asm_dsc_t asm_dsc = {
Expand Down
Loading

0 comments on commit 0984d25

Please sign in to comment.