@@ -4,13 +4,18 @@ if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "4.4")
44    return ()
55endif ()
66
7+ set (COMPONENT_REQUIRES esp_lcd)
8+ IF  (${IDF_TARGET}  STREQUAL  "esp32p4" )
9+     list (APPEND  COMPONENT_REQUIRES esp_driver_ppa)
10+ ENDIF  ()
11+ 
712# This component uses a CMake workaround, so we can compile esp_lvgl_port for both LVGL8.x and LVGL9.x 
813# 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) 
914# 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 
1015idf_component_register(
1116        INCLUDE_DIRS "include" 
1217        PRIV_INCLUDE_DIRS "priv_include" 
13-         REQUIRES "esp_lcd" )
18+         REQUIRES ${COMPONENT_REQUIRES} )
1419
1520# Get LVGL version 
1621idf_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"))
103108    endif ()
104109endif ()
105110
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+ 
106126# Here we create the real lvgl_port_lib 
107127add_library (lvgl_port_lib STATIC 
108128    ${PORT_PATH} /esp_lvgl_port.c
@@ -120,5 +140,9 @@ target_link_libraries(lvgl_port_lib PRIVATE
120140    ${ADD_LIBS} 
121141    )
122142
143+ if (CONFIG_IDF_TARGET_ESP32P4)
144+     target_link_libraries (lvgl_port_lib PRIVATE  idf::esp_driver_ppa idf::esp_mm)
145+ endif ()
146+ 
123147# Finally, link the lvgl_port_lib its esp-idf interface library 
124148target_link_libraries (${COMPONENT_LIB}  INTERFACE  lvgl_port_lib)
0 commit comments