Skip to content

Commit 24e762a

Browse files
committed
feature(lvgl_port): Initial support for ppa rendering in lvgl
Mainly supports the following features: - color blend (simple fill) - color blend with opa - blend normal (blend with argb8888) - blend normal (color convert / memcpy)
1 parent 29bebaf commit 24e762a

File tree

10 files changed

+1602
-26
lines changed

10 files changed

+1602
-26
lines changed

components/esp_lvgl_port/CMakeLists.txt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ if("usb_host_hid" IN_LIST build_components)
7777
endif()
7878

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

94+
if(CONFIG_IDF_TARGET_ESP32P4)
95+
file(GLOB_RECURSE PPA_SRCS ${PORT_PATH}/ppa/*)
96+
list(APPEND ADD_SRCS ${PPA_SRCS})
97+
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_malloc_core")
98+
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u esp_ppa_fill_for_lvgl")
99+
else()
94100
# Force link .S files
95-
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_argb8888_esp")
96-
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_rgb565_esp")
101+
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_argb8888_esp")
102+
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_color_blend_to_rgb565_esp")
103+
endif()
97104
endif()
98105
endif()
99106

@@ -114,5 +121,9 @@ target_link_libraries(lvgl_port_lib PRIVATE
114121
${ADD_LIBS}
115122
)
116123

124+
if(CONFIG_IDF_TARGET_ESP32P4)
125+
target_link_libraries(lvgl_port_lib PRIVATE idf::esp_driver_ppa idf::esp_mm)
126+
endif()
127+
117128
# Finally, link the lvgl_port_lib its esp-idf interface library
118129
target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl_port_lib)

components/esp_lvgl_port/include/esp_lvgl_port_lv_blend.h

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ extern "C" {
1818
#warning "esp_lvgl_port_lv_blend.h included, but CONFIG_LV_DRAW_SW_ASM_CUSTOM not set. Assembly rendering not used"
1919
#else
2020

21+
#include "lv_version.h"
22+
2123
/*********************
2224
* DEFINES
2325
*********************/
@@ -53,31 +55,92 @@ typedef struct {
5355
* GLOBAL PROTOTYPES
5456
**********************/
5557

58+
#if ((LVGL_VERSION_MAJOR == 9) && (LVGL_VERSION_MINOR == 1))
59+
60+
typedef struct {
61+
void * dest_buf;
62+
int32_t dest_w;
63+
int32_t dest_h;
64+
int32_t dest_stride;
65+
const lv_opa_t * mask_buf;
66+
int32_t mask_stride;
67+
lv_color_t color;
68+
lv_opa_t opa;
69+
} bsp_blend_fill_dsc_t;
70+
71+
typedef struct {
72+
void * dest_buf;
73+
int32_t dest_w;
74+
int32_t dest_h;
75+
int32_t dest_stride;
76+
const lv_opa_t * mask_buf;
77+
int32_t mask_stride;
78+
const void * src_buf;
79+
int32_t src_stride;
80+
lv_color_format_t src_color_format;
81+
lv_opa_t opa;
82+
lv_blend_mode_t blend_mode;
83+
} bsp_blend_image_dsc_t;
84+
85+
#elif ((LVGL_VERSION_MAJOR == 9) && (LVGL_VERSION_MINOR == 2))
86+
87+
typedef struct {
88+
void * dest_buf;
89+
int32_t dest_w;
90+
int32_t dest_h;
91+
int32_t dest_stride;
92+
const lv_opa_t * mask_buf;
93+
int32_t mask_stride;
94+
lv_color_t color;
95+
lv_opa_t opa;
96+
lv_area_t relative_area;
97+
} bsp_blend_fill_dsc_t;
98+
99+
typedef struct {
100+
void * dest_buf;
101+
int32_t dest_w;
102+
int32_t dest_h;
103+
int32_t dest_stride;
104+
const lv_opa_t * mask_buf;
105+
int32_t mask_stride;
106+
const void * src_buf;
107+
int32_t src_stride;
108+
lv_color_format_t src_color_format;
109+
lv_opa_t opa;
110+
lv_blend_mode_t blend_mode;
111+
lv_area_t relative_area; /**< The blend area relative to the layer's buffer area. */
112+
lv_area_t src_area; /**< The original src area. */
113+
} bsp_blend_image_dsc_t;
114+
115+
#endif
116+
56117
extern int lv_color_blend_to_argb8888_esp(asm_dsc_t *asm_dsc);
57118

58-
static inline lv_result_t _lv_color_blend_to_argb8888_esp(_lv_draw_sw_blend_fill_dsc_t *dsc)
119+
static inline lv_result_t _lv_color_blend_to_argb8888_esp(void *dsc)
59120
{
121+
bsp_blend_fill_dsc_t * fill_dsc = (bsp_blend_fill_dsc_t *) dsc;
60122
asm_dsc_t asm_dsc = {
61-
.dst_buf = dsc->dest_buf,
62-
.dst_w = dsc->dest_w,
63-
.dst_h = dsc->dest_h,
64-
.dst_stride = dsc->dest_stride,
65-
.src_buf = &dsc->color,
123+
.dst_buf = fill_dsc->dest_buf,
124+
.dst_w = fill_dsc->dest_w,
125+
.dst_h = fill_dsc->dest_h,
126+
.dst_stride = fill_dsc->dest_stride,
127+
.src_buf = &fill_dsc->color,
66128
};
67129

68130
return lv_color_blend_to_argb8888_esp(&asm_dsc);
69131
}
70132

71133
extern int lv_color_blend_to_rgb565_esp(asm_dsc_t *asm_dsc);
72134

73-
static inline lv_result_t _lv_color_blend_to_rgb565_esp(_lv_draw_sw_blend_fill_dsc_t *dsc)
135+
static inline lv_result_t _lv_color_blend_to_rgb565_esp(void *dsc)
74136
{
137+
bsp_blend_fill_dsc_t * fill_dsc = (bsp_blend_fill_dsc_t *) dsc;
75138
asm_dsc_t asm_dsc = {
76-
.dst_buf = dsc->dest_buf,
77-
.dst_w = dsc->dest_w,
78-
.dst_h = dsc->dest_h,
79-
.dst_stride = dsc->dest_stride,
80-
.src_buf = &dsc->color,
139+
.dst_buf = fill_dsc->dest_buf,
140+
.dst_w = fill_dsc->dest_w,
141+
.dst_h = fill_dsc->dest_h,
142+
.dst_stride = fill_dsc->dest_stride,
143+
.src_buf = &fill_dsc->color,
81144
};
82145

83146
return lv_color_blend_to_rgb565_esp(&asm_dsc);

0 commit comments

Comments
 (0)