-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(runner): Add benchmark example and print benchmark results.
- Loading branch information
Showing
19 changed files
with
663 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# For more information about build system see | ||
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html | ||
# The following five lines of boilerplate have to be in your project's | ||
# CMakeLists in this exact order for cmake to work correctly | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
set(COMPONENTS main) # "Trim" the build. Include the minimal set of components; main and anything it depends on. | ||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
add_compile_options("-Wno-attributes") # For LVGL code | ||
project(display_lvgl_benchmark) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Display LVGL Benchmark | ||
|
||
This example shows LVGL internal benchmark demo. | ||
|
||
## How to use the example | ||
|
||
### Hardware Required | ||
|
||
* ESP32-S3-LCD-EV-Board or ESP32-S3-LCD-EV-Board-2 | ||
* USB-C Cable | ||
|
||
### Compile and flash | ||
|
||
``` | ||
idf.py -p COMx build flash monitor | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
set(LV_DEMO_DIR "") | ||
set(LV_DEMOS_SOURCES "") | ||
if(CONFIG_LV_USE_DEMO_BENCHMARK) | ||
list(APPEND LV_DEMO_DIR ../managed_components/lvgl__lvgl/demos) | ||
file(GLOB_RECURSE LV_DEMOS_SOURCES ${LV_DEMO_DIR}/*.c) | ||
endif() | ||
|
||
idf_component_register( | ||
SRCS "main.c" ${LV_DEMOS_SOURCES} | ||
INCLUDE_DIRS "." ${LV_DEMO_DIR}) | ||
|
||
if(CONFIG_LV_USE_DEMO_BENCHMARK) | ||
set_source_files_properties( | ||
${LV_DEMOS_SOURCES} | ||
PROPERTIES COMPILE_OPTIONS | ||
-DLV_LVGL_H_INCLUDE_SIMPLE) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: BSP Display rotation example | ||
dependencies: | ||
esp32_p4_function_ev_board: | ||
version: '*' | ||
override_path: ../../../bsp/esp32_p4_function_ev_board |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: CC0-1.0 | ||
*/ | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/task.h" | ||
#include "esp_log.h" | ||
|
||
#include "lv_demos.h" | ||
#include "bsp/esp-bsp.h" | ||
|
||
static char *TAG = "app_main"; | ||
|
||
#define LOG_MEM_INFO (0) | ||
|
||
void app_main(void) | ||
{ | ||
/* Initialize display and LVGL */ | ||
bsp_display_start(); | ||
|
||
#if CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR | ||
ESP_LOGI(TAG, "Avoid lcd tearing effect"); | ||
#if CONFIG_BSP_DISPLAY_LVGL_FULL_REFRESH | ||
ESP_LOGI(TAG, "LVGL full-refresh"); | ||
#elif CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE | ||
ESP_LOGI(TAG, "LVGL direct-mode"); | ||
#endif | ||
#endif | ||
|
||
/* Set display brightness to 100% */ | ||
bsp_display_backlight_on(); | ||
|
||
ESP_LOGI(TAG, "Display LVGL demo"); | ||
bsp_display_lock(0); | ||
lv_demo_benchmark(); /* A demo to measure the performance of LVGL or to compare different settings. */ | ||
bsp_display_unlock(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Name, Type, SubType, Offset, Size, Flags | ||
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild | ||
nvs, data, nvs, 0x9000, 0x6000, | ||
phy_init, data, phy, 0xf000, 0x1000, | ||
factory, app, factory, 0x10000, 0x160000, |
64 changes: 64 additions & 0 deletions
64
examples/display_lvgl_benchmark/pytest_display_lvgl_benchmark.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
import os | ||
import datetime | ||
import pytest | ||
from pytest_embedded import Dut | ||
|
||
|
||
def write_to_file(board, text): | ||
with open("benchmark_" + board + ".md", "a") as h: | ||
h.write(text) | ||
|
||
|
||
@pytest.mark.esp_box_3 | ||
@pytest.mark.esp32_p4_function_ev_board | ||
@pytest.mark.esp32_c3_lcdkit | ||
@pytest.mark.esp32_s3_eye | ||
@pytest.mark.esp32_s3_lcd_ev_board | ||
@pytest.mark.esp32_s3_lcd_ev_board_2 | ||
@pytest.mark.esp32_s3_usb_otg | ||
@pytest.mark.esp_wrover_kit | ||
@pytest.mark.m5dial | ||
@pytest.mark.m5stack_core | ||
@pytest.mark.m5stack_core_2 | ||
@pytest.mark.m5stack_core_s3 | ||
@pytest.mark.m5stack_core_s3_se | ||
def test_example(dut: Dut, request) -> None: | ||
date = datetime.datetime.now() | ||
board = request.node.callspec.id | ||
|
||
# Wait for start benchmark | ||
dut.expect_exact('app_main: Display LVGL demo') | ||
dut.expect_exact('main_task: Returned from app_main()') | ||
|
||
try: | ||
os.remove("benchmark_" + board + ".md") | ||
except OSError: | ||
pass | ||
|
||
# Write board into file | ||
write_to_file(board, f"# Benchmark for BOARD " + board + "\n\n") | ||
write_to_file(board, f"**DATE:** " + date.strftime('%d.%m.%Y %H:%M') + "\n\n") | ||
# Get LVGL version write it into file | ||
outdata = dut.expect(r'Benchmark Summary \((.*) \)', timeout=200) | ||
write_to_file(board, f"**LVGL version:** " + outdata[1].decode() + "\n\n") | ||
outdata = dut.expect(r'Name, Avg. CPU, Avg. FPS, Avg. time, render time, flush time', timeout=200) | ||
write_to_file(board, f"| Name | Avg. CPU | Avg. FPS | Avg. time | render time | flush time |\n") | ||
write_to_file(board, f"| ---- | :------: | :------: | :-------: | :---------: | :--------: |\n") | ||
|
||
# Benchmark lines | ||
for x in range(17): | ||
outdata = dut.expect(r'([\w \.]+),[ ]?(\d+%),[ ]?(\d+),[ ]?(\d+),[ ]?(\d+),[ ]?(\d+)', timeout=200) | ||
write_to_file(board, f"| " + | ||
outdata[1].decode() + " | " + | ||
outdata[2].decode() + " | " + | ||
outdata[3].decode() + " | " + | ||
outdata[4].decode() + " | " + | ||
outdata[5].decode() + " | " + | ||
outdata[6].decode() + " |\n") | ||
|
||
write_to_file(board, "\n") | ||
write_to_file(board, "***") | ||
write_to_file(board, "\n\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This file was generated using idf.py save-defconfig. It can be edited manually. | ||
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration | ||
# | ||
CONFIG_IDF_TARGET="esp32s3" | ||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y | ||
CONFIG_COMPILER_OPTIMIZATION_PERF=y | ||
CONFIG_PARTITION_TABLE_CUSTOM=y | ||
CONFIG_SPIRAM=y | ||
CONFIG_SPIRAM_MODE_OCT=y | ||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y | ||
CONFIG_SPIRAM_RODATA=y | ||
CONFIG_SPIRAM_SPEED_80M=y | ||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y | ||
CONFIG_FREERTOS_HZ=1000 | ||
CONFIG_LV_MEM_SIZE_KILOBYTES=48 | ||
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y | ||
CONFIG_LV_FONT_MONTSERRAT_12=y | ||
CONFIG_LV_FONT_MONTSERRAT_16=y | ||
CONFIG_LV_USE_DEMO_WIDGETS=y | ||
CONFIG_LV_USE_DEMO_BENCHMARK=y | ||
|
||
# Enable logging | ||
CONFIG_LV_USE_LOG=y | ||
CONFIG_LV_LOG_PRINTF=y | ||
|
||
## LVGL8 ## | ||
CONFIG_LV_USE_PERF_MONITOR=y | ||
CONFIG_LV_COLOR_16_SWAP=y | ||
CONFIG_LV_MEM_CUSTOM=y | ||
CONFIG_LV_MEMCPY_MEMSET_STD=y | ||
|
||
## LVGL9 ## | ||
CONFIG_LV_CONF_SKIP=y | ||
|
||
#CLIB default | ||
CONFIG_LV_USE_CLIB_MALLOC=y | ||
CONFIG_LV_USE_CLIB_SPRINTF=y | ||
CONFIG_LV_USE_CLIB_STRING=y | ||
|
||
# Performance monitor | ||
CONFIG_LV_USE_OBSERVER=y | ||
CONFIG_LV_USE_SYSMON=y | ||
CONFIG_LV_USE_PERF_MONITOR=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This file was generated using idf.py save-defconfig. It can be edited manually. | ||
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration | ||
# | ||
CONFIG_IDF_TARGET="esp32s3" | ||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y | ||
CONFIG_COMPILER_OPTIMIZATION_PERF=y | ||
CONFIG_PARTITION_TABLE_CUSTOM=y | ||
CONFIG_SPIRAM=y | ||
CONFIG_SPIRAM_MODE_OCT=y | ||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y | ||
CONFIG_SPIRAM_RODATA=y | ||
CONFIG_SPIRAM_SPEED_80M=y | ||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y | ||
CONFIG_FREERTOS_HZ=1000 | ||
CONFIG_LV_MEM_SIZE_KILOBYTES=48 | ||
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y | ||
CONFIG_LV_FONT_MONTSERRAT_12=y | ||
CONFIG_LV_FONT_MONTSERRAT_16=y | ||
CONFIG_LV_USE_DEMO_WIDGETS=y | ||
CONFIG_LV_USE_DEMO_BENCHMARK=y | ||
CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n | ||
|
||
# Enable logging | ||
CONFIG_LV_USE_LOG=y | ||
CONFIG_LV_LOG_PRINTF=y | ||
|
||
## LVGL8 ## | ||
CONFIG_LV_USE_PERF_MONITOR=y | ||
CONFIG_LV_COLOR_16_SWAP=y | ||
CONFIG_LV_MEM_CUSTOM=y | ||
CONFIG_LV_MEMCPY_MEMSET_STD=y | ||
|
||
## LVGL9 ## | ||
CONFIG_LV_CONF_SKIP=y | ||
|
||
#CLIB default | ||
CONFIG_LV_USE_CLIB_MALLOC=y | ||
CONFIG_LV_USE_CLIB_SPRINTF=y | ||
CONFIG_LV_USE_CLIB_STRING=y | ||
|
||
# Performance monitor | ||
CONFIG_LV_USE_OBSERVER=y | ||
CONFIG_LV_USE_SYSMON=y | ||
CONFIG_LV_USE_PERF_MONITOR=y |
43 changes: 43 additions & 0 deletions
43
examples/display_lvgl_benchmark/sdkconfig.bsp.esp-box-lite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This file was generated using idf.py save-defconfig. It can be edited manually. | ||
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration | ||
# | ||
CONFIG_IDF_TARGET="esp32s3" | ||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y | ||
CONFIG_COMPILER_OPTIMIZATION_PERF=y | ||
CONFIG_PARTITION_TABLE_CUSTOM=y | ||
CONFIG_SPIRAM=y | ||
CONFIG_SPIRAM_MODE_OCT=y | ||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y | ||
CONFIG_SPIRAM_RODATA=y | ||
CONFIG_SPIRAM_SPEED_80M=y | ||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y | ||
CONFIG_FREERTOS_HZ=1000 | ||
CONFIG_LV_MEM_SIZE_KILOBYTES=48 | ||
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y | ||
CONFIG_LV_FONT_MONTSERRAT_12=y | ||
CONFIG_LV_FONT_MONTSERRAT_16=y | ||
CONFIG_LV_USE_DEMO_WIDGETS=y | ||
CONFIG_LV_USE_DEMO_BENCHMARK=y | ||
|
||
# Enable logging | ||
CONFIG_LV_USE_LOG=y | ||
CONFIG_LV_LOG_PRINTF=y | ||
|
||
## LVGL8 ## | ||
CONFIG_LV_USE_PERF_MONITOR=y | ||
CONFIG_LV_COLOR_16_SWAP=y | ||
CONFIG_LV_MEM_CUSTOM=y | ||
CONFIG_LV_MEMCPY_MEMSET_STD=y | ||
|
||
## LVGL9 ## | ||
CONFIG_LV_CONF_SKIP=y | ||
|
||
#CLIB default | ||
CONFIG_LV_USE_CLIB_MALLOC=y | ||
CONFIG_LV_USE_CLIB_SPRINTF=y | ||
CONFIG_LV_USE_CLIB_STRING=y | ||
|
||
# Performance monitor | ||
CONFIG_LV_USE_OBSERVER=y | ||
CONFIG_LV_USE_SYSMON=y | ||
CONFIG_LV_USE_PERF_MONITOR=y |
51 changes: 51 additions & 0 deletions
51
examples/display_lvgl_benchmark/sdkconfig.bsp.esp32_p4_function_ev_board
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# This file was generated using idf.py save-defconfig. It can be edited manually. | ||
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration | ||
# | ||
CONFIG_IDF_TARGET="esp32p4" | ||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y | ||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y | ||
CONFIG_PARTITION_TABLE_CUSTOM=y | ||
CONFIG_COMPILER_OPTIMIZATION_PERF=y | ||
CONFIG_SPIRAM=y | ||
CONFIG_SPIRAM_MODE_OCT=y | ||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y | ||
CONFIG_SPIRAM_RODATA=y | ||
CONFIG_SPIRAM_SPEED_80M=y | ||
CONFIG_FREERTOS_HZ=1000 | ||
CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2 | ||
CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y | ||
CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y | ||
CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y | ||
CONFIG_LV_FONT_MONTSERRAT_12=y | ||
CONFIG_LV_FONT_MONTSERRAT_16=y | ||
CONFIG_LV_FONT_MONTSERRAT_24=y | ||
CONFIG_LV_USE_DEMO_WIDGETS=y | ||
CONFIG_LV_USE_DEMO_BENCHMARK=y | ||
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y | ||
CONFIG_LV_DISP_DEF_REFR_PERIOD=10 | ||
|
||
CONFIG_SPIRAM=y | ||
CONFIG_SPIRAM_MODE_HEX=y | ||
CONFIG_SPIRAM_SPEED_200M=y | ||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y | ||
|
||
# Enable logging | ||
CONFIG_LV_USE_LOG=y | ||
CONFIG_LV_LOG_PRINTF=y | ||
|
||
## LVGL8 ## | ||
CONFIG_LV_MEM_SIZE_KILOBYTES=48 | ||
CONFIG_LV_USE_PERF_MONITOR=y | ||
|
||
## LVGL9 ## | ||
CONFIG_LV_CONF_SKIP=y | ||
|
||
#CLIB default | ||
CONFIG_LV_USE_CLIB_MALLOC=y | ||
CONFIG_LV_USE_CLIB_SPRINTF=y | ||
CONFIG_LV_USE_CLIB_STRING=y | ||
|
||
# Performance monitor | ||
CONFIG_LV_USE_OBSERVER=y | ||
CONFIG_LV_USE_SYSMON=y | ||
CONFIG_LV_USE_PERF_MONITOR=y |
Oops, something went wrong.