@@ -4,13 +4,18 @@ if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "4.4")
4
4
return ()
5
5
endif ()
6
6
7
+ set (COMPONENT_REQUIRES esp_lcd)
8
+ IF (${IDF_TARGET} STREQUAL "esp32p4" )
9
+ list (APPEND COMPONENT_REQUIRES esp_driver_ppa)
10
+ ENDIF ()
11
+
7
12
# This component uses a CMake workaround, so we can compile esp_lvgl_port for both LVGL8.x and LVGL9.x
8
13
# At the time of idf_component_register() we don't know which LVGL version is used, so we only register an INTERFACE component (with no sources)
9
14
# Later, when we know the LVGL version, we create another CMake library called 'lvgl_port_lib' and link it to the 'esp_lvgl_port' INTERFACE component
10
15
idf_component_register(
11
16
INCLUDE_DIRS "include"
12
17
PRIV_INCLUDE_DIRS "priv_include"
13
- REQUIRES "esp_lcd" )
18
+ REQUIRES ${COMPONENT_REQUIRES} )
14
19
15
20
# Get LVGL version
16
21
idf_build_get_property(build_components BUILD_COMPONENTS)
@@ -103,6 +108,21 @@ if((lvgl_ver VERSION_GREATER_EQUAL "9.1.0") AND (lvgl_ver VERSION_LESS "9.2.0"))
103
108
endif ()
104
109
endif ()
105
110
111
+ # Include hardware acceleration code (PPA and DMA2D) for rendering, and only for esp32p4
112
+ if (lvgl_ver VERSION_GREATER_EQUAL "9.1.0" )
113
+ if (CONFIG_IDF_TARGET_ESP32P4)
114
+ message (VERBOSE "Using hardware acceleration for esp32p4" )
115
+ # Include component libraries, so lvgl component would see lvgl_port includes
116
+ idf_component_get_property(lvgl_lib ${lvgl_name} COMPONENT_LIB)
117
+ target_include_directories (${lvgl_lib} PRIVATE "include" )
118
+
119
+ file (GLOB_RECURSE PPA_SRCS ${PORT_PATH} /ppa/*)
120
+ list (APPEND ADD_SRCS ${PPA_SRCS} )
121
+ set_property (TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u lv_malloc_core" )
122
+ set_property (TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u esp_ppa_fill_for_lvgl" )
123
+ endif ()
124
+ endif ()
125
+
106
126
# Here we create the real lvgl_port_lib
107
127
add_library (lvgl_port_lib STATIC
108
128
${PORT_PATH} /esp_lvgl_port.c
@@ -120,5 +140,9 @@ target_link_libraries(lvgl_port_lib PRIVATE
120
140
${ADD_LIBS}
121
141
)
122
142
143
+ if (CONFIG_IDF_TARGET_ESP32P4)
144
+ target_link_libraries (lvgl_port_lib PRIVATE idf::esp_driver_ppa idf::esp_mm)
145
+ endif ()
146
+
123
147
# Finally, link the lvgl_port_lib its esp-idf interface library
124
148
target_link_libraries (${COMPONENT_LIB} INTERFACE lvgl_port_lib)
0 commit comments