@geastack/targets 0.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +83 -0
- package/package.json +50 -0
- package/targets/cmake/geatsc-generated-archive-build.mjs +614 -0
- package/targets/cmake/geatsc_generated_archive.cmake +116 -0
- package/targets/cmake/geatsc_generated_archive_build.cmake +50 -0
- package/targets/esp32/app_project.cmake +33 -0
- package/targets/esp32/apps/app_manager.cpp +188 -0
- package/targets/esp32/apps/app_manager.h +10 -0
- package/targets/esp32/chip_bindings/README.md +58 -0
- package/targets/esp32/chip_bindings/audio/es8311.cpp +556 -0
- package/targets/esp32/chip_bindings/displays/co5300.cpp +510 -0
- package/targets/esp32/chip_bindings/displays/co5300.h +47 -0
- package/targets/esp32/chip_bindings/displays/co5300_async_stream.inc +79 -0
- package/targets/esp32/chip_bindings/displays/qspi_panel.h +65 -0
- package/targets/esp32/chip_bindings/displays/sh8601.cpp +583 -0
- package/targets/esp32/chip_bindings/displays/sh8601.h +36 -0
- package/targets/esp32/chip_bindings/gps/lc76g.cpp +296 -0
- package/targets/esp32/chip_bindings/gps/lc76g.h +7 -0
- package/targets/esp32/chip_bindings/imu/bmi270.cpp +299 -0
- package/targets/esp32/chip_bindings/imu/bmi270_config.inl +439 -0
- package/targets/esp32/chip_bindings/imu/qmi8658.cpp +213 -0
- package/targets/esp32/chip_bindings/power/axp2101.cpp +185 -0
- package/targets/esp32/chip_bindings/touch/cst9217.cpp +229 -0
- package/targets/esp32/chip_bindings/touch/cst9217_controller.h +78 -0
- package/targets/esp32/chip_bindings/touch/ft3168.cpp +340 -0
- package/targets/esp32/chip_bindings/touch/ft3168_controller.h +103 -0
- package/targets/esp32/chip_bindings/touch/ft6336.cpp +310 -0
- package/targets/esp32/chip_bindings/touch/ft6336_controller.h +90 -0
- package/targets/esp32/components/gea_framework/CMakeLists.txt +62 -0
- package/targets/esp32/connectivity/ble_hid.cpp +2916 -0
- package/targets/esp32/connectivity/ble_hid.h +8 -0
- package/targets/esp32/connectivity/diagnostics_transport.cpp +523 -0
- package/targets/esp32/connectivity/diagnostics_transport_offline.cpp +108 -0
- package/targets/esp32/connectivity/wifi.cpp +615 -0
- package/targets/esp32/connectivity/wifi_debug_offline.cpp +37 -0
- package/targets/esp32/connectivity/wifi_task_stack.h +119 -0
- package/targets/esp32/display.cpp +6010 -0
- package/targets/esp32/display_headless.cpp +468 -0
- package/targets/esp32/gea/platform_random.h +11 -0
- package/targets/esp32/gea_framework.cmake +382 -0
- package/targets/esp32/gpio.cpp +229 -0
- package/targets/esp32/host_sources.cmake +35 -0
- package/targets/esp32/imu_absent.cpp +36 -0
- package/targets/esp32/ldfragments/gea_ui_state_external.lf +35 -0
- package/targets/esp32/memory_config.h +64 -0
- package/targets/esp32/power_absent.cpp +22 -0
- package/targets/esp32/sdk-patches/0001-esp_ptr_dma_capable-accept-PSRAM.patch +70 -0
- package/targets/esp32/sdk-patches/0002-gdma-access_ext_mem-spi_master.patch +59 -0
- package/targets/esp32/sdk-patches/README.md +127 -0
- package/targets/esp32/services/app_runner.cpp +248 -0
- package/targets/esp32/services/app_state.cpp +56 -0
- package/targets/esp32/services/audio_runtime_stub.cpp +86 -0
- package/targets/esp32/services/battery_service.cpp +31 -0
- package/targets/esp32/services/device_control.cpp +1896 -0
- package/targets/esp32/services/device_control.h +31 -0
- package/targets/esp32/services/frame_scheduler.cpp +1571 -0
- package/targets/esp32/services/heap.cpp +129 -0
- package/targets/esp32/services/memory.cpp +103 -0
- package/targets/esp32/services/ota.cpp +840 -0
- package/targets/esp32/services/ota_image.cpp +162 -0
- package/targets/esp32/services/ota_image.h +16 -0
- package/targets/esp32/services/storage_service.cpp +159 -0
- package/targets/esp32/touch_absent.cpp +44 -0
- package/targets/esp32-m5stack-m5paper/CMakeLists.txt +10 -0
- package/targets/esp32-m5stack-m5paper/README.md +55 -0
- package/targets/esp32-m5stack-m5paper/dependencies.lock +76 -0
- package/targets/esp32-m5stack-m5paper/main/CMakeLists.txt +46 -0
- package/targets/esp32-m5stack-m5paper/main/Kconfig.projbuild +10 -0
- package/targets/esp32-m5stack-m5paper/main/app_main.cpp +114 -0
- package/targets/esp32-m5stack-m5paper/main/audio_stub.cpp +27 -0
- package/targets/esp32-m5stack-m5paper/main/buttons.cpp +111 -0
- package/targets/esp32-m5stack-m5paper/main/display.cpp +1074 -0
- package/targets/esp32-m5stack-m5paper/main/i2c.cpp +36 -0
- package/targets/esp32-m5stack-m5paper/main/idf_component.yml +7 -0
- package/targets/esp32-m5stack-m5paper/main/imu_stub.cpp +20 -0
- package/targets/esp32-m5stack-m5paper/main/include/board.h +100 -0
- package/targets/esp32-m5stack-m5paper/main/include/buttons.h +8 -0
- package/targets/esp32-m5stack-m5paper/main/launcher_button.cpp +82 -0
- package/targets/esp32-m5stack-m5paper/main/m5paper_psram.lf +20 -0
- package/targets/esp32-m5stack-m5paper/main/power.cpp +73 -0
- package/targets/esp32-m5stack-m5paper/main/sdcard_mount.cpp +82 -0
- package/targets/esp32-m5stack-m5paper/main/touch.cpp +279 -0
- package/targets/esp32-m5stack-m5paper/partitions.csv +9 -0
- package/targets/esp32-m5stack-m5paper/sdkconfig.defaults +84 -0
- package/targets/esp32-p4-m5stack-tab5/CMakeLists.txt +10 -0
- package/targets/esp32-p4-m5stack-tab5/dependencies.lock +276 -0
- package/targets/esp32-p4-m5stack-tab5/main/CMakeLists.txt +586 -0
- package/targets/esp32-p4-m5stack-tab5/main/Kconfig.projbuild +12 -0
- package/targets/esp32-p4-m5stack-tab5/main/app_main.cpp +177 -0
- package/targets/esp32-p4-m5stack-tab5/main/camera.cpp +2025 -0
- package/targets/esp32-p4-m5stack-tab5/main/display.cpp +4033 -0
- package/targets/esp32-p4-m5stack-tab5/main/fatfs_ffconf.h +383 -0
- package/targets/esp32-p4-m5stack-tab5/main/i2c.cpp +39 -0
- package/targets/esp32-p4-m5stack-tab5/main/idf_component.yml +21 -0
- package/targets/esp32-p4-m5stack-tab5/main/include/board.h +130 -0
- package/targets/esp32-p4-m5stack-tab5/main/include/tab5_drivers.h +68 -0
- package/targets/esp32-p4-m5stack-tab5/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-p4-m5stack-tab5/main/launcher_button.cpp +188 -0
- package/targets/esp32-p4-m5stack-tab5/main/power.cpp +22 -0
- package/targets/esp32-p4-m5stack-tab5/main/sdcard_mount.cpp +125 -0
- package/targets/esp32-p4-m5stack-tab5/main/tab5_audio.cpp +345 -0
- package/targets/esp32-p4-m5stack-tab5/main/tab5_drivers.cpp +871 -0
- package/targets/esp32-p4-m5stack-tab5/main/tab5_imu.cpp +246 -0
- package/targets/esp32-p4-m5stack-tab5/main/touch.cpp +206 -0
- package/targets/esp32-p4-m5stack-tab5/partitions.csv +12 -0
- package/targets/esp32-p4-m5stack-tab5/sdkconfig.defaults +128 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/CMakeLists.txt +19 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/0001-esp_video-csi-raw-passthrough-p4-rev-lt-v3.patch +28 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/README.md +45 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/apply.sh +37 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/dependencies.lock +196 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/CMakeLists.txt +562 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/Kconfig.projbuild +12 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/app_main.cpp +166 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/camera.cpp +2105 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/display.cpp +1730 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/fatfs_ffconf.h +383 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/i2c.cpp +39 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/idf_component.yml +11 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/board.h +87 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/panel_native.h +59 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/launcher_button.cpp +191 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/power.cpp +15 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/touch.cpp +306 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/partitions.csv +13 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/patches/README.md +22 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/patches/espressif__esp_video-csi-bypass.patch +28 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/sdkconfig.defaults +109 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/tools/README-camera-capture.md +84 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/tools/capture-camera.py +369 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/CMakeLists.txt +10 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/dependencies.lock +258 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/CMakeLists.txt +577 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/Kconfig.projbuild +12 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/app_main.cpp +177 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/camera.cpp +1935 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/display.cpp +2832 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/fatfs_ffconf.h +383 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/i2c.cpp +39 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/idf_component.yml +23 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/include/board.h +68 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/launcher_button.cpp +191 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/power.cpp +15 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/sdcard_mount.cpp +125 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/touch.cpp +332 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/partitions.csv +12 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/sdkconfig.defaults +122 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/tools/README-camera-capture.md +84 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/tools/capture-camera.py +369 -0
- package/targets/esp32-s3-devkit-n16r8.json +31 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/CMakeLists.txt +10 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/dependencies.lock +40 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/CMakeLists.txt +549 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/app_main.cpp +187 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/display_rgb.cpp +1338 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/i2c.cpp +39 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/idf_component.yml +5 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/include/board.h +142 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/include/pcf8574.h +16 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/include/rotary_encoder.h +7 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/pcf8574.cpp +86 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/platform_stubs.cpp +47 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/rotary_encoder.cpp +135 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/touch.cpp +250 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/partitions.csv +8 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/sdkconfig.defaults +116 -0
- package/targets/esp32-s3-epaper-1.54/CMakeLists.txt +10 -0
- package/targets/esp32-s3-epaper-1.54/dependencies.lock +76 -0
- package/targets/esp32-s3-epaper-1.54/main/CMakeLists.txt +691 -0
- package/targets/esp32-s3-epaper-1.54/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-epaper-1.54/main/app_main.cpp +181 -0
- package/targets/esp32-s3-epaper-1.54/main/buttons.cpp +144 -0
- package/targets/esp32-s3-epaper-1.54/main/display.cpp +1281 -0
- package/targets/esp32-s3-epaper-1.54/main/fatfs_ffconf.h +377 -0
- package/targets/esp32-s3-epaper-1.54/main/i2c.cpp +39 -0
- package/targets/esp32-s3-epaper-1.54/main/idf_component.yml +7 -0
- package/targets/esp32-s3-epaper-1.54/main/imu_stub.cpp +21 -0
- package/targets/esp32-s3-epaper-1.54/main/include/board.h +119 -0
- package/targets/esp32-s3-epaper-1.54/main/include/buttons.h +9 -0
- package/targets/esp32-s3-epaper-1.54/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-epaper-1.54/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-epaper-1.54/main/power.cpp +15 -0
- package/targets/esp32-s3-epaper-1.54/main/sdcard_mount.cpp +89 -0
- package/targets/esp32-s3-epaper-1.54/main/touch.cpp +299 -0
- package/targets/esp32-s3-epaper-1.54/partitions.csv +8 -0
- package/targets/esp32-s3-epaper-1.54/sdkconfig.defaults +217 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/CMakeLists.txt +10 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/README.md +29 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/dependencies.lock +116 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/CMakeLists.txt +90 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/idf_component.yml +7 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/include/board.h +61 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/touch.cpp +299 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/partitions.csv +7 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/sdkconfig.defaults +50 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/CMakeLists.txt +12 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/CMakeLists.txt +17 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/ed047tc1.c +269 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/ed047tc1.h +142 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/epd_driver.c +1114 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/epd_driver.h +410 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/gea_epd.c +989 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/i2s_data_bus.c +489 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/i2s_data_bus.h +104 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/rmt_pulse.c +136 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/rmt_pulse.h +78 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/utilities.h +49 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/dependencies.lock +35 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/CMakeLists.txt +30 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/Kconfig.projbuild +10 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/app_main.cpp +95 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/audio_stub.cpp +27 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/buttons.cpp +40 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/display.cpp +627 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/i2c.cpp +36 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/idf_component.yml +4 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/imu_stub.cpp +20 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/include/board.h +85 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/include/buttons.h +8 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/launcher_button.cpp +82 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/power.cpp +36 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/sdcard_mount.cpp +90 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/touch.cpp +293 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/partitions.csv +9 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/sdkconfig.defaults +217 -0
- package/targets/esp32-s3-m5stack-papers3/CMakeLists.txt +13 -0
- package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/CMakeLists.txt +5 -0
- package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/include/papers3_epd.h +74 -0
- package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/papers3_epd.c +671 -0
- package/targets/esp32-s3-m5stack-papers3/dependencies.lock +76 -0
- package/targets/esp32-s3-m5stack-papers3/main/CMakeLists.txt +64 -0
- package/targets/esp32-s3-m5stack-papers3/main/Kconfig.projbuild +10 -0
- package/targets/esp32-s3-m5stack-papers3/main/app_main.cpp +96 -0
- package/targets/esp32-s3-m5stack-papers3/main/audio_stub.cpp +27 -0
- package/targets/esp32-s3-m5stack-papers3/main/buttons.cpp +49 -0
- package/targets/esp32-s3-m5stack-papers3/main/display.cpp +706 -0
- package/targets/esp32-s3-m5stack-papers3/main/i2c.cpp +36 -0
- package/targets/esp32-s3-m5stack-papers3/main/idf_component.yml +14 -0
- package/targets/esp32-s3-m5stack-papers3/main/imu.cpp +351 -0
- package/targets/esp32-s3-m5stack-papers3/main/include/board.h +101 -0
- package/targets/esp32-s3-m5stack-papers3/main/include/buttons.h +8 -0
- package/targets/esp32-s3-m5stack-papers3/main/launcher_button.cpp +96 -0
- package/targets/esp32-s3-m5stack-papers3/main/power.cpp +102 -0
- package/targets/esp32-s3-m5stack-papers3/main/sdcard_mount.cpp +88 -0
- package/targets/esp32-s3-m5stack-papers3/main/touch.cpp +287 -0
- package/targets/esp32-s3-m5stack-papers3/partitions.csv +9 -0
- package/targets/esp32-s3-m5stack-papers3/sdkconfig.defaults +232 -0
- package/targets/esp32-s3-m5stack-sticks3/CMakeLists.txt +10 -0
- package/targets/esp32-s3-m5stack-sticks3/dependencies.lock +51 -0
- package/targets/esp32-s3-m5stack-sticks3/main/CMakeLists.txt +51 -0
- package/targets/esp32-s3-m5stack-sticks3/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-m5stack-sticks3/main/app_main.cpp +130 -0
- package/targets/esp32-s3-m5stack-sticks3/main/buttons.cpp +101 -0
- package/targets/esp32-s3-m5stack-sticks3/main/display.cpp +1391 -0
- package/targets/esp32-s3-m5stack-sticks3/main/i2c.cpp +39 -0
- package/targets/esp32-s3-m5stack-sticks3/main/idf_component.yml +8 -0
- package/targets/esp32-s3-m5stack-sticks3/main/imu_stub.cpp +9 -0
- package/targets/esp32-s3-m5stack-sticks3/main/include/board.h +89 -0
- package/targets/esp32-s3-m5stack-sticks3/main/include/buttons.h +9 -0
- package/targets/esp32-s3-m5stack-sticks3/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-m5stack-sticks3/main/power.cpp +15 -0
- package/targets/esp32-s3-m5stack-sticks3/main/sdcard_mount.cpp +8 -0
- package/targets/esp32-s3-m5stack-sticks3/main/touch.cpp +65 -0
- package/targets/esp32-s3-m5stack-sticks3/partitions.csv +8 -0
- package/targets/esp32-s3-m5stack-sticks3/sdkconfig.defaults +130 -0
- package/targets/esp32-s3-touch-amoled-1.75/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-1.75/dependencies.lock +130 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/CMakeLists.txt +589 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/app_main.cpp +153 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/i2c.cpp +39 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/idf_component.yml +9 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/include/board.h +110 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/touch.cpp +45 -0
- package/targets/esp32-s3-touch-amoled-1.75/partitions.csv +8 -0
- package/targets/esp32-s3-touch-amoled-1.75/sdkconfig.defaults +179 -0
- package/targets/esp32-s3-touch-amoled-1.8/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-1.8/dependencies.lock +105 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +768 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/app_main.cpp +172 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/i2c.cpp +39 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/idf_component.yml +8 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/include/board.h +83 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/touch.cpp +41 -0
- package/targets/esp32-s3-touch-amoled-1.8/partitions.csv +8 -0
- package/targets/esp32-s3-touch-amoled-1.8/sdkconfig.defaults +179 -0
- package/targets/esp32-s3-touch-amoled-2.06/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +64 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +1121 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/app_main.cpp +333 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/i2c.cpp +39 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/idf_component.yml +27 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/include/board.h +114 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/launcher_button.cpp +199 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/sdcard_mount.cpp +105 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/touch.cpp +49 -0
- package/targets/esp32-s3-touch-amoled-2.06/partitions.csv +14 -0
- package/targets/esp32-s3-touch-amoled-2.06/sdkconfig.defaults +273 -0
- package/targets/esp32-s3-touch-amoled-2.41/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/CMakeLists.txt +71 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/idf_component.yml +27 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/include/board.h +108 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/panel_reset.cpp +82 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/touch.cpp +49 -0
- package/targets/esp32-s3-touch-amoled-2.41/partitions.csv +8 -0
- package/targets/esp32-s3-touch-amoled-2.41/sdkconfig.defaults +273 -0
- package/targets/rp2350-tufty-2350/CMakeLists.txt +348 -0
- package/targets/rp2350-tufty-2350/README.md +53 -0
- package/targets/rp2350-tufty-2350/boards/pimoroni_tufty2350.h +87 -0
- package/targets/rp2350-tufty-2350/main/bringup.cpp +187 -0
- package/targets/rp2350-tufty-2350/main/include/board.h +124 -0
- package/targets/rp2350-tufty-2350/main/rp2350_panel.cpp +428 -0
- package/targets/rp2350-tufty-2350/main/rp2350_panel.h +46 -0
- package/targets/rp2350-tufty-2350/main/st7789_parallel.pio +7 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/CMakeLists.txt +345 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/README.md +153 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/boards/waveshare_rp2350_touch_amoled_2_41.h +59 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/app.cpp +984 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/bringup.cpp +222 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/include/board.h +138 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.cpp +2553 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.h +18 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_host_fetch_stub.cpp +64 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.cpp +677 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.h +48 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/rp_pico_alloc.c +354 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/rp_pico_alloc.h +56 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf.c +1284 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf.h +95 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf_block_functions.h +123 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf_common.h +127 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/tools/rp2350-scroll-bench.py +162 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/tools/rp2350-scroll-parity.py +198 -0
- package/targets.json +154 -0
|
@@ -0,0 +1,1571 @@
|
|
|
1
|
+
#include "services/frame_scheduler.h"
|
|
2
|
+
|
|
3
|
+
#include "app.h"
|
|
4
|
+
#include "display.h"
|
|
5
|
+
#include "host/timers.h"
|
|
6
|
+
#include "ui/refresh_trace.h"
|
|
7
|
+
#include "ui/refresh_perf.h"
|
|
8
|
+
#include "ui/document.h"
|
|
9
|
+
#include "memory_config.h"
|
|
10
|
+
#include "services/app_state.h"
|
|
11
|
+
#include "ui/canvas_element.h"
|
|
12
|
+
|
|
13
|
+
#include <atomic>
|
|
14
|
+
#include <cstdint>
|
|
15
|
+
#include <limits>
|
|
16
|
+
|
|
17
|
+
#include "esp_heap_caps.h"
|
|
18
|
+
#include "esp_log.h"
|
|
19
|
+
#include "esp_timer.h"
|
|
20
|
+
#include "freertos/FreeRTOS.h"
|
|
21
|
+
#include "freertos/queue.h"
|
|
22
|
+
#include "freertos/task.h"
|
|
23
|
+
|
|
24
|
+
namespace gea::framework::services {
|
|
25
|
+
|
|
26
|
+
namespace {
|
|
27
|
+
|
|
28
|
+
// [DIAG A/B] fused-gradient-blend optimisation phase. Pinned to 0 = fused path OFF
|
|
29
|
+
// (ship the proven constant-alpha gather; the fused kernel measured +0). Flip the
|
|
30
|
+
// initial value (and uncomment the ^=1 below) to re-A/B fused vs gather.
|
|
31
|
+
volatile int g_diagAbPhase = 0;
|
|
32
|
+
|
|
33
|
+
constexpr const char *kTag = "gea_esp32_frame";
|
|
34
|
+
constexpr int kTaskStackWords = GEA_EMBEDDED_APP_FRAME_TASK_STACK_WORDS;
|
|
35
|
+
// GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL=1 allocates the frame task's stack
|
|
36
|
+
// from external RAM in start() instead of carrying it inside this static
|
|
37
|
+
// engine, which is internal SRAM. The task never runs with the flash cache
|
|
38
|
+
// disabled when the app executes from external RAM (flash writes are
|
|
39
|
+
// serialized elsewhere), so the stack may live outside; the control block and
|
|
40
|
+
// the ISR-fed event queue stay in the engine, where FreeRTOS requires them.
|
|
41
|
+
// Needs CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY.
|
|
42
|
+
#ifndef GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL
|
|
43
|
+
#define GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL 0
|
|
44
|
+
#endif
|
|
45
|
+
constexpr int kTaskPriority = GEA_EMBEDDED_APP_FRAME_TASK_PRIORITY;
|
|
46
|
+
#ifndef GEA_EMBEDDED_APP_FRAME_TASK_CORE
|
|
47
|
+
// -1 = tskNO_AFFINITY (run on either core). Boards with BT/WiFi pinned to a
|
|
48
|
+
// specific core can override this to put the frame task on the other core,
|
|
49
|
+
// eliminating preemption from BT host / NimBLE / Wi-Fi background tasks.
|
|
50
|
+
#define GEA_EMBEDDED_APP_FRAME_TASK_CORE -1
|
|
51
|
+
#endif
|
|
52
|
+
constexpr int kTaskCore = GEA_EMBEDDED_APP_FRAME_TASK_CORE;
|
|
53
|
+
|
|
54
|
+
#ifndef GEA_EMBEDDED_FRAME_SCHEDULER_DROP_CATCHUP_FRAMES
|
|
55
|
+
#define GEA_EMBEDDED_FRAME_SCHEDULER_DROP_CATCHUP_FRAMES 0
|
|
56
|
+
#endif
|
|
57
|
+
|
|
58
|
+
#ifndef GEA_EMBEDDED_FRAME_SCHEDULER_IDLE_YIELD_TICKS
|
|
59
|
+
#define GEA_EMBEDDED_FRAME_SCHEDULER_IDLE_YIELD_TICKS 1
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
#ifndef GEA_EMBEDDED_FRAME_SCHEDULER_MAX_CATCHUP_FRAMES_BEFORE_YIELD
|
|
63
|
+
#define GEA_EMBEDDED_FRAME_SCHEDULER_MAX_CATCHUP_FRAMES_BEFORE_YIELD 0
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#ifndef GEA_EMBEDDED_FRAME_SCHEDULER_USE_ESP_TIMER
|
|
67
|
+
#define GEA_EMBEDDED_FRAME_SCHEDULER_USE_ESP_TIMER 0
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
// Per-drop TE-miss flush-breakdown diagnostic (kept for profiling flush spikes).
|
|
71
|
+
// Default OFF: it emits an ESP_LOGW on the frame task for EVERY missed VBlank, and on a
|
|
72
|
+
// frame that only just overruns the TE that log can itself cascade further drops —
|
|
73
|
+
// perturbing the very cadence it measures. Set to 1 to profile; leave 0 for clean fps.
|
|
74
|
+
#ifndef GEA_EMBEDDED_TE_MISS_LOG
|
|
75
|
+
#define GEA_EMBEDDED_TE_MISS_LOG 0
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
enum class FrameStage {
|
|
79
|
+
Idle,
|
|
80
|
+
FrameBegin,
|
|
81
|
+
WaitAppLock,
|
|
82
|
+
AppFrame,
|
|
83
|
+
AppUnlock,
|
|
84
|
+
ReadInFrameStats,
|
|
85
|
+
TrailFlush,
|
|
86
|
+
ReadTrailStats,
|
|
87
|
+
FrameDone,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
class FrameSchedulerEngine {
|
|
91
|
+
public:
|
|
92
|
+
static FrameSchedulerEngine &instance()
|
|
93
|
+
{
|
|
94
|
+
static FrameSchedulerEngine engine;
|
|
95
|
+
return engine;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
EventQueue createEventQueue()
|
|
99
|
+
{
|
|
100
|
+
eventQueue_ = xQueueCreateStatic(
|
|
101
|
+
FrameScheduler::kEventQueueDepth,
|
|
102
|
+
sizeof(gea::framework::events::Event),
|
|
103
|
+
eventQueueBuffer_,
|
|
104
|
+
&eventQueueStorage_);
|
|
105
|
+
return EventQueue(eventQueue_);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
EventQueue eventQueue() const
|
|
109
|
+
{
|
|
110
|
+
return EventQueue(eventQueue_);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
bool sendEvent(const gea::framework::events::Event &event, int waitMs)
|
|
114
|
+
{
|
|
115
|
+
const TickType_t wait = waitMs <= 0 ? 0 : pdMS_TO_TICKS(waitMs);
|
|
116
|
+
return eventQueue_ && xQueueSend(eventQueue_, &event, wait) == pdPASS;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
bool receiveEvent(gea::framework::events::Event *event)
|
|
120
|
+
{
|
|
121
|
+
return eventQueue_ && event && xQueueReceive(eventQueue_, event, portMAX_DELAY) == pdPASS;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Graceful-overrun catch-up: the event loop calls takeCatchUpRequest() after a
|
|
125
|
+
// frame; if the frame overran the budget it runs the next one back-to-back.
|
|
126
|
+
bool takeCatchUpRequest() { return catchUpRequest_.exchange(false, std::memory_order_acq_rel); }
|
|
127
|
+
|
|
128
|
+
void setVsyncDriven(bool driven) { vsyncDriven_.store(driven, std::memory_order_release); }
|
|
129
|
+
bool vsyncDriven() const { return vsyncDriven_.load(std::memory_order_acquire); }
|
|
130
|
+
|
|
131
|
+
// Called from the panel's TE (VBlank) edge ISR when TE-sync is enabled: this is the
|
|
132
|
+
// SOLE frame producer in that mode. Posts one Frame event per edge, coalesced — if a
|
|
133
|
+
// frame is still queued or running (overrun), the edge is dropped rather than piling
|
|
134
|
+
// up. Records the post time so the timer can detect a dead TE and fall back.
|
|
135
|
+
void notifyVsyncFromISR()
|
|
136
|
+
{
|
|
137
|
+
if (!eventQueue_)
|
|
138
|
+
return;
|
|
139
|
+
lastVsyncPostUs_.store(static_cast<uint32_t>(esp_timer_get_time()), std::memory_order_release);
|
|
140
|
+
if (eventPending_.load(std::memory_order_acquire))
|
|
141
|
+
return;
|
|
142
|
+
if (frameInProgress_.load(std::memory_order_acquire))
|
|
143
|
+
return;
|
|
144
|
+
gea::framework::events::Event event{};
|
|
145
|
+
event.type = gea::framework::events::EventType::Frame;
|
|
146
|
+
eventPending_.store(true, std::memory_order_release);
|
|
147
|
+
BaseType_t needYield = pdFALSE;
|
|
148
|
+
if (xQueueSendFromISR(eventQueue_, &event, &needYield) != pdTRUE)
|
|
149
|
+
eventPending_.store(false, std::memory_order_release);
|
|
150
|
+
else if (needYield == pdTRUE)
|
|
151
|
+
portYIELD_FROM_ISR();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Before each back-to-back catch-up frame: discard the redundant Frame events
|
|
155
|
+
// the timer keeps posting (we're driving frames ourselves), and return true the
|
|
156
|
+
// moment a non-Frame event (touch/input) is waiting so the caller stops catching
|
|
157
|
+
// up and lets the normal event loop service it — input is never starved.
|
|
158
|
+
bool drainFramesAndCheckInput()
|
|
159
|
+
{
|
|
160
|
+
if (!eventQueue_) return false;
|
|
161
|
+
gea::framework::events::Event peeked{};
|
|
162
|
+
while (xQueuePeek(eventQueue_, &peeked, 0) == pdPASS) {
|
|
163
|
+
if (peeked.type != gea::framework::events::EventType::Frame) return true;
|
|
164
|
+
gea::framework::events::Event discard{};
|
|
165
|
+
xQueueReceive(eventQueue_, &discard, 0);
|
|
166
|
+
eventPending_.store(false, std::memory_order_release);
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
void start(EventQueue queue)
|
|
172
|
+
{
|
|
173
|
+
eventQueue_ = static_cast<QueueHandle_t>(queue.nativeHandle());
|
|
174
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_USE_ESP_TIMER
|
|
175
|
+
startTimer();
|
|
176
|
+
#else
|
|
177
|
+
if (task_) return;
|
|
178
|
+
#if GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL
|
|
179
|
+
if (!taskStack_) {
|
|
180
|
+
const std::size_t bytes = static_cast<std::size_t>(kTaskStackWords) * sizeof(StackType_t);
|
|
181
|
+
taskStack_ = static_cast<StackType_t *>(heap_caps_malloc(bytes, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
|
|
182
|
+
if (!taskStack_) taskStack_ = static_cast<StackType_t *>(heap_caps_malloc(bytes, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
|
|
183
|
+
if (!taskStack_) {
|
|
184
|
+
ESP_LOGW(kTag, "Failed to allocate the app frame task stack");
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
#endif
|
|
189
|
+
if (kTaskCore < 0) {
|
|
190
|
+
task_ = xTaskCreateStatic(
|
|
191
|
+
&FrameSchedulerEngine::taskMain,
|
|
192
|
+
"app_frame",
|
|
193
|
+
kTaskStackWords,
|
|
194
|
+
this,
|
|
195
|
+
kTaskPriority,
|
|
196
|
+
taskStack_,
|
|
197
|
+
&taskStorage_);
|
|
198
|
+
} else {
|
|
199
|
+
task_ = xTaskCreateStaticPinnedToCore(
|
|
200
|
+
&FrameSchedulerEngine::taskMain,
|
|
201
|
+
"app_frame",
|
|
202
|
+
kTaskStackWords,
|
|
203
|
+
this,
|
|
204
|
+
kTaskPriority,
|
|
205
|
+
taskStack_,
|
|
206
|
+
&taskStorage_,
|
|
207
|
+
static_cast<BaseType_t>(kTaskCore));
|
|
208
|
+
}
|
|
209
|
+
if (!task_) {
|
|
210
|
+
ESP_LOGW(kTag, "Failed to start app frame task");
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
214
|
+
ESP_LOGI(kTag,
|
|
215
|
+
"stack probe [frame_scheduler:after_app_frame_task] task=app_frame priority=%d stack_arg_words=%d hwm=%u",
|
|
216
|
+
kTaskPriority,
|
|
217
|
+
kTaskStackWords,
|
|
218
|
+
static_cast<unsigned>(uxTaskGetStackHighWaterMark(task_)));
|
|
219
|
+
#endif
|
|
220
|
+
#endif
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
void runFrame(const FrameScheduler::FrameCallbacks &callbacks)
|
|
224
|
+
{
|
|
225
|
+
// frameStartUs is FUNCTIONAL (drives lastFrameStartUs_, frameStartedMs_, and
|
|
226
|
+
// the watchdog), so it stays. Only the perf period accumulation is gated.
|
|
227
|
+
const int64_t frameStartUs = esp_timer_get_time();
|
|
228
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
229
|
+
if (lastFrameStartUs_ > 0) {
|
|
230
|
+
perf_.framePeriodUs += frameStartUs - lastFrameStartUs_;
|
|
231
|
+
perf_.framePeriodCount++;
|
|
232
|
+
}
|
|
233
|
+
#endif
|
|
234
|
+
lastFrameStartUs_ = frameStartUs;
|
|
235
|
+
frameSequence_.fetch_add(1, std::memory_order_relaxed);
|
|
236
|
+
frameStartedMs_.store(static_cast<int>(frameStartUs / 1000), std::memory_order_relaxed);
|
|
237
|
+
setFrameStage(FrameStage::FrameBegin);
|
|
238
|
+
frameInProgress_.store(true, std::memory_order_release);
|
|
239
|
+
eventPending_.store(false, std::memory_order_release);
|
|
240
|
+
|
|
241
|
+
gea::platform::display::Display::flushStatsReset();
|
|
242
|
+
// Apply any pending elastic-RAM staging resize requested off-task (e.g. the
|
|
243
|
+
// WiFi/BLE bring-up worker's reserveInternal). Done here, on the frame task,
|
|
244
|
+
// every frame so the shrink lands even on a fully static screen that never
|
|
245
|
+
// enters a content flush — otherwise esp_wifi_init can NO_MEM waiting for
|
|
246
|
+
// internal DMA RAM the staging buffers are still holding.
|
|
247
|
+
gea::platform::display::Display::applyPendingInternalReserve();
|
|
248
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
249
|
+
// These per-frame stat accumulators are only WRITTEN when perf is on (raf
|
|
250
|
+
// under GEA_EMBEDDED_RAF_PERF, canvas/refresh via their detail flags,
|
|
251
|
+
// gFramePerfStats via recordFramePhase) and only READ by the harvest below —
|
|
252
|
+
// all governed by GEA_EMBEDDED_PERF. Resetting them with the flag off is
|
|
253
|
+
// pure dead work, so the resets are gated too.
|
|
254
|
+
gea::host::animationFramePerfStatsReset();
|
|
255
|
+
gea::embedded::ui::canvasPerfStatsReset();
|
|
256
|
+
gea::embedded::ui::refreshPerfStatsReset();
|
|
257
|
+
gea::framework::app::applicationFramePerfStatsReset();
|
|
258
|
+
#endif
|
|
259
|
+
setFrameStage(FrameStage::WaitAppLock);
|
|
260
|
+
AppState::lock();
|
|
261
|
+
setFrameStage(FrameStage::AppFrame);
|
|
262
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
263
|
+
const int64_t appStartUs = esp_timer_get_time();
|
|
264
|
+
#endif
|
|
265
|
+
if (callbacks.frame) callbacks.frame(FrameScheduler::nowMs(), callbacks.context);
|
|
266
|
+
if (vsyncDriven_.load(std::memory_order_acquire)) {
|
|
267
|
+
#if !defined(GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT) || !GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT
|
|
268
|
+
// The phase-set is kept (watchdog stall report); only the timing reads +
|
|
269
|
+
// the perf accumulation around the real refresh are perf machinery.
|
|
270
|
+
gea::framework::app::applicationFramePhaseSet(gea::framework::app::ApplicationFramePhase::RefreshMounted);
|
|
271
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
272
|
+
const int64_t refreshStartUs = esp_timer_get_time();
|
|
273
|
+
#endif
|
|
274
|
+
gea::embedded::ui::Document::instance().refreshMountedIfDirty();
|
|
275
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
276
|
+
gea::framework::app::applicationFramePerfStatsAdd(
|
|
277
|
+
gea::framework::app::ApplicationFramePhase::RefreshMounted,
|
|
278
|
+
esp_timer_get_time() - refreshStartUs);
|
|
279
|
+
#endif
|
|
280
|
+
gea::framework::app::applicationFramePhaseSet(gea::framework::app::ApplicationFramePhase::Idle);
|
|
281
|
+
#endif
|
|
282
|
+
}
|
|
283
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
284
|
+
perf_.appTotalUs += esp_timer_get_time() - appStartUs;
|
|
285
|
+
const gea::framework::app::ApplicationFramePerfStats appStats = gea::framework::app::applicationFramePerfStatsRead();
|
|
286
|
+
perf_.drainMicrotasksUs += appStats.drainMicrotasksUs;
|
|
287
|
+
perf_.animationFrameUs += appStats.animationFrameUs;
|
|
288
|
+
perf_.styleRecomputeUs += appStats.styleRecomputeUs;
|
|
289
|
+
perf_.documentFrameUs += appStats.documentFrameUs;
|
|
290
|
+
perf_.refreshMountedUs += appStats.refreshMountedUs;
|
|
291
|
+
const gea::host::AnimationFramePerfStats rafStats = gea::host::animationFramePerfStatsRead();
|
|
292
|
+
perf_.rafTotalUs += rafStats.totalUs;
|
|
293
|
+
perf_.rafPrepareUs += rafStats.prepareUs;
|
|
294
|
+
perf_.rafCallbackUs += rafStats.callbackUs;
|
|
295
|
+
if (rafStats.maxCallbackUs > perf_.rafMaxCallbackUs) perf_.rafMaxCallbackUs = rafStats.maxCallbackUs;
|
|
296
|
+
perf_.rafPendingAtRun += rafStats.pendingAtRun;
|
|
297
|
+
perf_.rafCallbackCount += rafStats.callbackCount;
|
|
298
|
+
perf_.rafRequestCount += rafStats.requestCount;
|
|
299
|
+
perf_.rafDroppedCount += rafStats.droppedCount;
|
|
300
|
+
const gea::embedded::ui::CanvasPerfStats canvasStats = gea::embedded::ui::canvasPerfStatsRead();
|
|
301
|
+
perf_.canvasLookupUs += canvasStats.canvasLookupUs;
|
|
302
|
+
perf_.canvasLookupCalls += canvasStats.canvasLookupCalls;
|
|
303
|
+
perf_.markDirtyUs += canvasStats.markDirtyUs;
|
|
304
|
+
perf_.markDirtyCalls += canvasStats.markDirtyCalls;
|
|
305
|
+
perf_.clearRectUs += canvasStats.clearRectUs;
|
|
306
|
+
perf_.clearRectCalls += canvasStats.clearRectCalls;
|
|
307
|
+
perf_.fillRectUs += canvasStats.fillRectUs;
|
|
308
|
+
perf_.fillRectCalls += canvasStats.fillRectCalls;
|
|
309
|
+
perf_.fillCircleUs += canvasStats.fillCircleUs;
|
|
310
|
+
perf_.fillCircleCalls += canvasStats.fillCircleCalls;
|
|
311
|
+
perf_.fillTriangleUs += canvasStats.fillTriangleUs;
|
|
312
|
+
perf_.fillTriangleCalls += canvasStats.fillTriangleCalls;
|
|
313
|
+
perf_.drawImageUs += canvasStats.drawImageUs;
|
|
314
|
+
perf_.drawImageCalls += canvasStats.drawImageCalls;
|
|
315
|
+
perf_.fillTextUs += canvasStats.fillTextUs;
|
|
316
|
+
perf_.fillTextCalls += canvasStats.fillTextCalls;
|
|
317
|
+
perf_.batchFlushUs += canvasStats.batchFlushUs;
|
|
318
|
+
perf_.batchFlushCalls += canvasStats.batchFlushCalls;
|
|
319
|
+
const gea::embedded::ui::RefreshPerfStats refreshStats = gea::embedded::ui::refreshPerfStatsRead();
|
|
320
|
+
const bool hadScrollUpdate =
|
|
321
|
+
refreshStats.rootScrollMovePx != 0 ||
|
|
322
|
+
refreshStats.rootScrollViewportPx > 0 ||
|
|
323
|
+
refreshStats.rootScrollStripPx > 0 ||
|
|
324
|
+
refreshStats.rootScrollAccepted > 0 ||
|
|
325
|
+
refreshStats.rootScrollStreamFrames > 0 ||
|
|
326
|
+
refreshStats.rootScrollSyncFrames > 0;
|
|
327
|
+
perf_.rootScrollScanUs += refreshStats.rootScrollScanUs;
|
|
328
|
+
perf_.rootScrollRebuildUs += refreshStats.rootScrollRebuildUs;
|
|
329
|
+
perf_.rootScrollScrollRectUs += refreshStats.rootScrollScrollRectUs;
|
|
330
|
+
perf_.rootScrollStripReplayUs += refreshStats.rootScrollStripReplayUs;
|
|
331
|
+
perf_.rootScrollScrollbarReplayUs += refreshStats.rootScrollScrollbarReplayUs;
|
|
332
|
+
perf_.rootScrollFullReplayUs += refreshStats.rootScrollFullReplayUs;
|
|
333
|
+
perf_.rootScrollStreamUs += refreshStats.rootScrollStreamUs;
|
|
334
|
+
perf_.rootScrollExtraReplayUs += refreshStats.rootScrollExtraReplayUs;
|
|
335
|
+
perf_.rootScrollFlushUs += refreshStats.rootScrollFlushUs;
|
|
336
|
+
perf_.rootScrollSnapshotUs += refreshStats.rootScrollSnapshotUs;
|
|
337
|
+
perf_.virtualListRegionFillUs += refreshStats.virtualListRegionFillUs;
|
|
338
|
+
perf_.virtualListRegionTextUs += refreshStats.virtualListRegionTextUs;
|
|
339
|
+
perf_.virtualListRegionThumbUs += refreshStats.virtualListRegionThumbUs;
|
|
340
|
+
perf_.treeLayoutModeUs += refreshStats.treeLayoutModeUs;
|
|
341
|
+
perf_.treeLayoutUs += refreshStats.treeLayoutUs;
|
|
342
|
+
perf_.treeDisplayListUs += refreshStats.treeDisplayListUs;
|
|
343
|
+
perf_.treeRecordNodeUs += refreshStats.treeRecordNodeUs;
|
|
344
|
+
perf_.treeSetStyleUs += refreshStats.treeSetStyleUs;
|
|
345
|
+
perf_.treeSetTextUs += refreshStats.treeSetTextUs;
|
|
346
|
+
perf_.treeAbsModeUs += refreshStats.treeAbsModeUs;
|
|
347
|
+
perf_.treeDirtyCollectUs += refreshStats.treeDirtyCollectUs;
|
|
348
|
+
perf_.treeDirtyCoalesceUs += refreshStats.treeDirtyCoalesceUs;
|
|
349
|
+
perf_.treeReplayUs += refreshStats.treeReplayUs;
|
|
350
|
+
perf_.treeReplayFillUs += refreshStats.treeReplayFillUs;
|
|
351
|
+
perf_.treeReplayCircleUs += refreshStats.treeReplayCircleUs;
|
|
352
|
+
perf_.treeReplayTextUs += refreshStats.treeReplayTextUs;
|
|
353
|
+
perf_.treeReplayGradientUs += refreshStats.treeReplayGradientUs;
|
|
354
|
+
perf_.treeReplayImageUs += refreshStats.treeReplayImageUs;
|
|
355
|
+
perf_.treeReplayOtherUs += refreshStats.treeReplayOtherUs;
|
|
356
|
+
perf_.treeReplaySplitBgUs += refreshStats.treeReplaySplitBgUs;
|
|
357
|
+
perf_.treeReplaySplitDynUs += refreshStats.treeReplaySplitDynUs;
|
|
358
|
+
perf_.treeReplaySplitRasterUs += refreshStats.treeReplaySplitRasterUs;
|
|
359
|
+
perf_.treeReplayBgRestoreUs += refreshStats.treeReplayBgRestoreUs;
|
|
360
|
+
perf_.treeReplayNodeWalkUs += refreshStats.treeReplayNodeWalkUs;
|
|
361
|
+
perf_.treeReplayCommandFilterUs += refreshStats.treeReplayCommandFilterUs;
|
|
362
|
+
perf_.treeReplayCommandClipUs += refreshStats.treeReplayCommandClipUs;
|
|
363
|
+
perf_.treeFlushRectsUs += refreshStats.treeFlushRectsUs;
|
|
364
|
+
perf_.treeSnapshotUs += refreshStats.treeSnapshotUs;
|
|
365
|
+
perf_.treeReplayRegions += refreshStats.treeReplayRegions;
|
|
366
|
+
perf_.treeReplayOriginRegions += refreshStats.treeReplayOriginRegions;
|
|
367
|
+
perf_.treeReplayCommandChecks += refreshStats.treeReplayCommandChecks;
|
|
368
|
+
perf_.treeReplayDirectRegionCalls += refreshStats.treeReplayDirectRegionCalls;
|
|
369
|
+
perf_.treeReplayDirectRegionsCalls += refreshStats.treeReplayDirectRegionsCalls;
|
|
370
|
+
perf_.treeReplaySimpleRegionCalls += refreshStats.treeReplaySimpleRegionCalls;
|
|
371
|
+
perf_.treeReplayCommandFilterCalls += refreshStats.treeReplayCommandFilterCalls;
|
|
372
|
+
perf_.treeReplayCommandClipCalls += refreshStats.treeReplayCommandClipCalls;
|
|
373
|
+
perf_.treeReplayCircleCommands += refreshStats.treeReplayCircleCommands;
|
|
374
|
+
perf_.treeBgRecolorCalls += refreshStats.treeBgRecolorCalls;
|
|
375
|
+
perf_.treeBgRecolorPixels += refreshStats.treeBgRecolorPixels;
|
|
376
|
+
perf_.treeSetStyleCalls += refreshStats.treeSetStyleCalls;
|
|
377
|
+
perf_.treeSetStyleChanged += refreshStats.treeSetStyleChanged;
|
|
378
|
+
perf_.treeSetStyleNoop += refreshStats.treeSetStyleNoop;
|
|
379
|
+
perf_.treeSetStyleLayoutChanged += refreshStats.treeSetStyleLayoutChanged;
|
|
380
|
+
perf_.treeSetStyleTransformChanged += refreshStats.treeSetStyleTransformChanged;
|
|
381
|
+
perf_.treeSetStylePaintChanged += refreshStats.treeSetStylePaintChanged;
|
|
382
|
+
perf_.treeSetTextCalls += refreshStats.treeSetTextCalls;
|
|
383
|
+
perf_.treeSetTextChanged += refreshStats.treeSetTextChanged;
|
|
384
|
+
perf_.treeSetTextStable += refreshStats.treeSetTextStable;
|
|
385
|
+
perf_.treeSetTextHidden += refreshStats.treeSetTextHidden;
|
|
386
|
+
perf_.treeMarkDisplayListDirtyCalls += refreshStats.treeMarkDisplayListDirtyCalls;
|
|
387
|
+
perf_.treeMarkDisplayListContentDirtyCalls += refreshStats.treeMarkDisplayListContentDirtyCalls;
|
|
388
|
+
perf_.treeMarkNodeCommandDirtyCalls += refreshStats.treeMarkNodeCommandDirtyCalls;
|
|
389
|
+
perf_.treeAbsModeCalls += refreshStats.treeAbsModeCalls;
|
|
390
|
+
perf_.treeAbsModeFast += refreshStats.treeAbsModeFast;
|
|
391
|
+
perf_.treeAbsModeFull += refreshStats.treeAbsModeFull;
|
|
392
|
+
perf_.treeAbsModeNoop += refreshStats.treeAbsModeNoop;
|
|
393
|
+
perf_.treeAbsModeDirtyNodes += refreshStats.treeAbsModeDirtyNodes;
|
|
394
|
+
if (refreshStats.treeAbsModeRejectReason != 0) {
|
|
395
|
+
perf_.treeAbsModeRejectNode = refreshStats.treeAbsModeRejectNode;
|
|
396
|
+
perf_.treeAbsModeRejectReason = refreshStats.treeAbsModeRejectReason;
|
|
397
|
+
}
|
|
398
|
+
perf_.rootScrollCalls += refreshStats.rootScrollCalls;
|
|
399
|
+
perf_.rootScrollAccepted += refreshStats.rootScrollAccepted;
|
|
400
|
+
perf_.rootScrollRejected += refreshStats.rootScrollRejected;
|
|
401
|
+
perf_.rootScrollMovePx += refreshStats.rootScrollMovePx;
|
|
402
|
+
perf_.rootScrollViewportPx += refreshStats.rootScrollViewportPx;
|
|
403
|
+
perf_.rootScrollStripPx += refreshStats.rootScrollStripPx;
|
|
404
|
+
perf_.rootScrollExtraDirtyNodes += refreshStats.rootScrollExtraDirtyNodes;
|
|
405
|
+
perf_.rootScrollStreamFrames += refreshStats.rootScrollStreamFrames;
|
|
406
|
+
perf_.rootScrollSyncFrames += refreshStats.rootScrollSyncFrames;
|
|
407
|
+
perf_.virtualListRegionCalls += refreshStats.virtualListRegionCalls;
|
|
408
|
+
perf_.virtualListRegionRows += refreshStats.virtualListRegionRows;
|
|
409
|
+
perf_.virtualListRegionTextCalls += refreshStats.virtualListRegionTextCalls;
|
|
410
|
+
perf_.treeRefreshCalls += refreshStats.treeRefreshCalls;
|
|
411
|
+
perf_.treeDirectReplayCalls += refreshStats.treeDirectReplayCalls;
|
|
412
|
+
perf_.treeRecordCalls += refreshStats.treeRecordCalls;
|
|
413
|
+
perf_.treeRecordedNodes += refreshStats.treeRecordedNodes;
|
|
414
|
+
perf_.treeRecordedCommands += refreshStats.treeRecordedCommands;
|
|
415
|
+
#endif // GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG (perf harvest R1)
|
|
416
|
+
setFrameStage(FrameStage::AppUnlock);
|
|
417
|
+
AppState::unlock();
|
|
418
|
+
|
|
419
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
420
|
+
setFrameStage(FrameStage::ReadInFrameStats);
|
|
421
|
+
const gea::platform::display::DisplayFlushPerfStats inFrameStats =
|
|
422
|
+
gea::platform::display::Display::flushPerfStatsRead();
|
|
423
|
+
perf_.inFrameFlushUs += inFrameStats.totalUs;
|
|
424
|
+
perf_.inFrameFlushCalls += inFrameStats.callCount;
|
|
425
|
+
perf_.inFrameFlushPixels += inFrameStats.pixelCount;
|
|
426
|
+
perf_.inFrameFlushChunks += inFrameStats.chunkCount;
|
|
427
|
+
perf_.inFrameSetWindowUs += inFrameStats.setWindowUs;
|
|
428
|
+
perf_.inFrameSlotWaitUs += inFrameStats.slotWaitUs;
|
|
429
|
+
perf_.inFrameCopyUs += inFrameStats.copyUs;
|
|
430
|
+
perf_.inFrameRasterUs += inFrameStats.rasterUs;
|
|
431
|
+
perf_.inFrameByteSwapUs += inFrameStats.byteSwapUs;
|
|
432
|
+
perf_.inFrameTxUs += inFrameStats.txUs;
|
|
433
|
+
perf_.inFrameCompleteWaitUs += inFrameStats.completeWaitUs;
|
|
434
|
+
perf_.inFrameEntryWaitUs += inFrameStats.entryWaitUs;
|
|
435
|
+
perf_.inFrameChunkWaitUs += inFrameStats.chunkWaitUs;
|
|
436
|
+
perf_.inFrameTailWaitUs += inFrameStats.tailWaitUs;
|
|
437
|
+
#endif // GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG (perf harvest R2 inFrame)
|
|
438
|
+
|
|
439
|
+
gea::platform::display::Display::flushStatsReset();
|
|
440
|
+
setFrameStage(FrameStage::TrailFlush);
|
|
441
|
+
const int64_t trailStartUs = esp_timer_get_time();
|
|
442
|
+
gea::platform::display::Display::flush();
|
|
443
|
+
perf_.trailFlushUs += esp_timer_get_time() - trailStartUs;
|
|
444
|
+
|
|
445
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
446
|
+
setFrameStage(FrameStage::ReadTrailStats);
|
|
447
|
+
const gea::platform::display::DisplayFlushPerfStats trailStats =
|
|
448
|
+
gea::platform::display::Display::flushPerfStatsRead();
|
|
449
|
+
perf_.trailFlushCalls += trailStats.callCount;
|
|
450
|
+
perf_.trailFlushPixels += trailStats.pixelCount;
|
|
451
|
+
perf_.trailFlushChunks += trailStats.chunkCount;
|
|
452
|
+
perf_.trailSetWindowUs += trailStats.setWindowUs;
|
|
453
|
+
perf_.trailSlotWaitUs += trailStats.slotWaitUs;
|
|
454
|
+
perf_.trailCopyUs += trailStats.copyUs;
|
|
455
|
+
perf_.trailRasterUs += trailStats.rasterUs;
|
|
456
|
+
perf_.trailByteSwapUs += trailStats.byteSwapUs;
|
|
457
|
+
perf_.trailTxUs += trailStats.txUs;
|
|
458
|
+
perf_.trailCompleteWaitUs += trailStats.completeWaitUs;
|
|
459
|
+
perf_.trailEntryWaitUs += trailStats.entryWaitUs;
|
|
460
|
+
perf_.trailChunkWaitUs += trailStats.chunkWaitUs;
|
|
461
|
+
perf_.trailTailWaitUs += trailStats.tailWaitUs;
|
|
462
|
+
#endif // GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG (perf harvest R3 trail)
|
|
463
|
+
|
|
464
|
+
setFrameStage(FrameStage::FrameDone);
|
|
465
|
+
frameInProgress_.store(false, std::memory_order_release);
|
|
466
|
+
setFrameStage(FrameStage::Idle);
|
|
467
|
+
const int64_t frameDoneUs = esp_timer_get_time();
|
|
468
|
+
// Production-fps probe: deliberately outside GEA_EMBEDDED_PERF, so it still
|
|
469
|
+
// reports the TRUE production frame rate when every other perf subsystem is
|
|
470
|
+
// stripped. It has its own switch because it is otherwise a once-a-second
|
|
471
|
+
// INFO line for the life of the device: that is fine while measuring and
|
|
472
|
+
// wrong for an app that keeps a log ring or a serial capture, where it
|
|
473
|
+
// overwrites everything else within minutes. Default stays on so no existing
|
|
474
|
+
// board changes behaviour; an app turns it off with
|
|
475
|
+
// GEA_EMBEDDED_FRAME_SCHEDULER_FPS_LOG=0 in gea.defines.
|
|
476
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_FPS_LOG
|
|
477
|
+
{
|
|
478
|
+
static int64_t fpsWinStartUs = 0;
|
|
479
|
+
static int fpsWinFrames = 0;
|
|
480
|
+
if (fpsWinStartUs == 0) fpsWinStartUs = frameDoneUs;
|
|
481
|
+
fpsWinFrames++;
|
|
482
|
+
const int64_t fpsElapsed = frameDoneUs - fpsWinStartUs;
|
|
483
|
+
if (fpsElapsed >= 1000000) {
|
|
484
|
+
ESP_LOGI("geafps", "PRODFPS=%.1f (%d frames/%lldms)",
|
|
485
|
+
fpsWinFrames * 1000000.0 / static_cast<double>(fpsElapsed), fpsWinFrames, fpsElapsed / 1000);
|
|
486
|
+
fpsWinStartUs = frameDoneUs;
|
|
487
|
+
fpsWinFrames = 0;
|
|
488
|
+
// g_diagAbPhase ^= 1; // [DIAG A/B] re-enable to flip fused vs gather each window
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
#endif // GEA_EMBEDDED_FRAME_SCHEDULER_FPS_LOG
|
|
492
|
+
perf_.frameTotalUs += frameDoneUs - frameStartUs;
|
|
493
|
+
perf_.frameCount++;
|
|
494
|
+
#if GEA_EMBEDDED_TE_MISS_LOG
|
|
495
|
+
// Flush-spike profiling: under TE-sync a frame whose WORK exceeds one TE interval
|
|
496
|
+
// (~16.8ms) misses its VBlank and drops. Dump THIS frame's flush sub-stage split so
|
|
497
|
+
// we can see which stage (drain / raster / copy / tx) spiked — these ~2% of frames
|
|
498
|
+
// are what cap the locked rate. The log fires AFTER frameDoneUs is captured, so it
|
|
499
|
+
// doesn't inflate the measured frame; it only profiles already-overrun frames.
|
|
500
|
+
{
|
|
501
|
+
const int64_t thisFrameUs = frameDoneUs - frameStartUs;
|
|
502
|
+
if (vsyncDriven_.load(std::memory_order_acquire) && thisFrameUs > 16800) {
|
|
503
|
+
// Find the largest dirty region this frame (tree replay samples) so we can see
|
|
504
|
+
// WHAT geometry blew the budget — a text-sized box, a full-width band, or worse.
|
|
505
|
+
int bigW = 0, bigH = 0, bigX = 0, bigY = 0;
|
|
506
|
+
long long bigA = 0;
|
|
507
|
+
for (int i = 0; i < refreshStats.treeReplayRegionSampleCount; i++) {
|
|
508
|
+
const int w = refreshStats.treeReplayRegionX1[i] - refreshStats.treeReplayRegionX0[i] + 1;
|
|
509
|
+
const int h = refreshStats.treeReplayRegionY1[i] - refreshStats.treeReplayRegionY0[i] + 1;
|
|
510
|
+
const long long a = static_cast<long long>(w) * h;
|
|
511
|
+
if (a > bigA) {
|
|
512
|
+
bigA = a; bigW = w; bigH = h;
|
|
513
|
+
bigX = refreshStats.treeReplayRegionX0[i];
|
|
514
|
+
bigY = refreshStats.treeReplayRegionY0[i];
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
ESP_LOGW(kTag,
|
|
518
|
+
"TE-MISS frame=%lldus inflush=%lldus(copy=%lld tx=%lld chunks=%d px=%d) regions=%d biggest=%dx%d@(%d,%d)=%lldpx",
|
|
519
|
+
(long long)thisFrameUs,
|
|
520
|
+
(long long)inFrameStats.totalUs,
|
|
521
|
+
(long long)inFrameStats.copyUs,
|
|
522
|
+
(long long)inFrameStats.txUs,
|
|
523
|
+
inFrameStats.chunkCount,
|
|
524
|
+
inFrameStats.pixelCount,
|
|
525
|
+
refreshStats.treeReplayRegionSampleCount,
|
|
526
|
+
bigW, bigH, bigX, bigY, bigA);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
#endif
|
|
530
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
531
|
+
const bool hadDisplayUpdate =
|
|
532
|
+
hadScrollUpdate ||
|
|
533
|
+
inFrameStats.pixelCount > 0 ||
|
|
534
|
+
trailStats.pixelCount > 0 ||
|
|
535
|
+
inFrameStats.callCount > 0 ||
|
|
536
|
+
trailStats.callCount > 0;
|
|
537
|
+
recordCadence(frameStartUs, frameDoneUs, hadDisplayUpdate);
|
|
538
|
+
#endif // GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG (perf harvest R5 cadence)
|
|
539
|
+
|
|
540
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
541
|
+
// Single-frame dump for any frame that overran a soft budget (50ms). Unlike
|
|
542
|
+
// the windowed log (which averages over kFrameLogInterval frames and so smears
|
|
543
|
+
// a lone spike into 1/30 of its real cost), this prints THIS frame's own phase
|
|
544
|
+
// breakdown — the only honest view of a one-off hitch like a city/theme switch.
|
|
545
|
+
{
|
|
546
|
+
const int64_t thisFrameUs = frameDoneUs - frameStartUs;
|
|
547
|
+
// TEMP (regression diagnosis): raised 50000 -> 300000 so the per-frame dump does
|
|
548
|
+
// not fire on every instrumented frame and spiral the UART (the windowed perf:
|
|
549
|
+
// line below carries the full breakdown instead). A board where the interesting
|
|
550
|
+
// hitch is spread over MANY frames rather than concentrated in one lowers it,
|
|
551
|
+
// so each painting frame prints its own split.
|
|
552
|
+
#ifndef GEA_EMBEDDED_FRAME_SCHEDULER_SLOW_FRAME_US
|
|
553
|
+
#define GEA_EMBEDDED_FRAME_SCHEDULER_SLOW_FRAME_US 300000
|
|
554
|
+
#endif
|
|
555
|
+
if (thisFrameUs > GEA_EMBEDDED_FRAME_SCHEDULER_SLOW_FRAME_US) {
|
|
556
|
+
ESP_LOGW(kTag,
|
|
557
|
+
"SLOW frame=%lldus | drain=%lldus raf=%lldus recompute=%lldus doc=%lldus refresh=%lldus | tree(layout=%lldus(calls:%d repos:%d txt:%lldus) dlist=%lldus dirty=%lldus replay=%lldus/%dr checks=%d draw=rect:%d circle:%d round:%d xround:%d text:%d other:%d rUs=f:%lld/c:%lld/t:%lld/g:%lld/i:%lld/o:%lld bg=%d/%d fast=%d bgUs=%lld/%lld/%lld/%lld flush=%lldus) record(nodes=%d cmds=%d us=%lldus) inflush=%lldus(%dcalls/%dchunks/%dpx setwin=%lldus slot=%lldus copy=%lldus swap=%lldus tx=%lldus wait=%lldus[entry=%lldus chunk=%lldus tail=%lldus]) trail=%lldus(%dcalls/%dpx copy=%lldus wait=%lldus)",
|
|
558
|
+
thisFrameUs,
|
|
559
|
+
(long long)appStats.drainMicrotasksUs,
|
|
560
|
+
(long long)rafStats.totalUs,
|
|
561
|
+
(long long)appStats.styleRecomputeUs,
|
|
562
|
+
(long long)appStats.documentFrameUs,
|
|
563
|
+
(long long)appStats.refreshMountedUs,
|
|
564
|
+
(long long)refreshStats.treeLayoutUs,
|
|
565
|
+
refreshStats.treeLayoutNodeCalls,
|
|
566
|
+
refreshStats.treeLayoutRepositionCalls,
|
|
567
|
+
(long long)refreshStats.treeLayoutTextUs,
|
|
568
|
+
(long long)refreshStats.treeDisplayListUs,
|
|
569
|
+
(long long)refreshStats.treeDirtyCollectUs,
|
|
570
|
+
(long long)refreshStats.treeReplayUs,
|
|
571
|
+
refreshStats.treeReplayRegions,
|
|
572
|
+
refreshStats.treeReplayCommandChecks,
|
|
573
|
+
refreshStats.treeReplayFillRectCommands,
|
|
574
|
+
refreshStats.treeReplayCircleCommands,
|
|
575
|
+
refreshStats.treeReplayRoundedRectCommands,
|
|
576
|
+
refreshStats.treeReplayTransformedRoundedRectCommands,
|
|
577
|
+
refreshStats.treeReplayTextCommands,
|
|
578
|
+
refreshStats.treeReplayOtherCommands,
|
|
579
|
+
(long long)refreshStats.treeReplayFillUs,
|
|
580
|
+
(long long)refreshStats.treeReplayCircleUs,
|
|
581
|
+
(long long)refreshStats.treeReplayTextUs,
|
|
582
|
+
(long long)refreshStats.treeReplayGradientUs,
|
|
583
|
+
(long long)refreshStats.treeReplayImageUs,
|
|
584
|
+
(long long)refreshStats.treeReplayOtherUs,
|
|
585
|
+
refreshStats.treeBgRecolorCalls,
|
|
586
|
+
refreshStats.treeBgRecolorPixels,
|
|
587
|
+
refreshStats.treeBgRecolorFastPixels,
|
|
588
|
+
(long long)refreshStats.treeBgRecolorUs,
|
|
589
|
+
(long long)refreshStats.treeBgRecolorFillUs,
|
|
590
|
+
(long long)refreshStats.treeBgRecolorEdgeUs,
|
|
591
|
+
(long long)refreshStats.treeBgRecolorReplayUs,
|
|
592
|
+
(long long)refreshStats.treeFlushRectsUs,
|
|
593
|
+
refreshStats.treeRecordedNodes,
|
|
594
|
+
refreshStats.treeRecordedCommands,
|
|
595
|
+
(long long)refreshStats.treeRecordNodeUs,
|
|
596
|
+
(long long)inFrameStats.totalUs,
|
|
597
|
+
inFrameStats.callCount,
|
|
598
|
+
inFrameStats.chunkCount,
|
|
599
|
+
inFrameStats.pixelCount,
|
|
600
|
+
(long long)inFrameStats.setWindowUs,
|
|
601
|
+
(long long)inFrameStats.slotWaitUs,
|
|
602
|
+
(long long)inFrameStats.copyUs,
|
|
603
|
+
(long long)inFrameStats.byteSwapUs,
|
|
604
|
+
(long long)inFrameStats.txUs,
|
|
605
|
+
(long long)inFrameStats.completeWaitUs,
|
|
606
|
+
(long long)inFrameStats.entryWaitUs,
|
|
607
|
+
(long long)inFrameStats.chunkWaitUs,
|
|
608
|
+
(long long)inFrameStats.tailWaitUs,
|
|
609
|
+
(long long)trailStats.totalUs,
|
|
610
|
+
trailStats.callCount,
|
|
611
|
+
trailStats.pixelCount,
|
|
612
|
+
(long long)trailStats.copyUs,
|
|
613
|
+
(long long)trailStats.completeWaitUs);
|
|
614
|
+
ESP_LOGW(kTag,
|
|
615
|
+
"SLOW replay-detail direct1=%d directN=%d simple1=%d bgRestore=%lldus nodeWalk=%lldus filter=%lldus/%d clip=%lldus/%d",
|
|
616
|
+
refreshStats.treeReplayDirectRegionCalls,
|
|
617
|
+
refreshStats.treeReplayDirectRegionsCalls,
|
|
618
|
+
refreshStats.treeReplaySimpleRegionCalls,
|
|
619
|
+
(long long)refreshStats.treeReplayBgRestoreUs,
|
|
620
|
+
(long long)refreshStats.treeReplayNodeWalkUs,
|
|
621
|
+
(long long)refreshStats.treeReplayCommandFilterUs,
|
|
622
|
+
refreshStats.treeReplayCommandFilterCalls,
|
|
623
|
+
(long long)refreshStats.treeReplayCommandClipUs,
|
|
624
|
+
refreshStats.treeReplayCommandClipCalls);
|
|
625
|
+
ESP_LOGW(kTag,
|
|
626
|
+
"SLOW inv setStyle=%lldus/%d calls changed=%d noop=%d layout=%d xform=%d paint=%d setText=%lldus/%d changed=%d stable=%d hidden=%d marks=dl:%d content:%d node:%d absMode=%lldus calls:%d fast:%d full:%d noop:%d dirty:%d reject:%d/%d",
|
|
627
|
+
(long long)refreshStats.treeSetStyleUs,
|
|
628
|
+
refreshStats.treeSetStyleCalls,
|
|
629
|
+
refreshStats.treeSetStyleChanged,
|
|
630
|
+
refreshStats.treeSetStyleNoop,
|
|
631
|
+
refreshStats.treeSetStyleLayoutChanged,
|
|
632
|
+
refreshStats.treeSetStyleTransformChanged,
|
|
633
|
+
refreshStats.treeSetStylePaintChanged,
|
|
634
|
+
(long long)refreshStats.treeSetTextUs,
|
|
635
|
+
refreshStats.treeSetTextCalls,
|
|
636
|
+
refreshStats.treeSetTextChanged,
|
|
637
|
+
refreshStats.treeSetTextStable,
|
|
638
|
+
refreshStats.treeSetTextHidden,
|
|
639
|
+
refreshStats.treeMarkDisplayListDirtyCalls,
|
|
640
|
+
refreshStats.treeMarkDisplayListContentDirtyCalls,
|
|
641
|
+
refreshStats.treeMarkNodeCommandDirtyCalls,
|
|
642
|
+
(long long)refreshStats.treeAbsModeUs,
|
|
643
|
+
refreshStats.treeAbsModeCalls,
|
|
644
|
+
refreshStats.treeAbsModeFast,
|
|
645
|
+
refreshStats.treeAbsModeFull,
|
|
646
|
+
refreshStats.treeAbsModeNoop,
|
|
647
|
+
refreshStats.treeAbsModeDirtyNodes,
|
|
648
|
+
refreshStats.treeAbsModeRejectNode,
|
|
649
|
+
refreshStats.treeAbsModeRejectReason);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
#endif
|
|
653
|
+
|
|
654
|
+
logPerfWindowIfReady();
|
|
655
|
+
const bool timerCatchUpDue = catchUpFrameDue_.exchange(false, std::memory_order_acq_rel);
|
|
656
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_DROP_CATCHUP_FRAMES
|
|
657
|
+
catchUpRequest_.store(false, std::memory_order_release);
|
|
658
|
+
vTaskDelay(1);
|
|
659
|
+
#else
|
|
660
|
+
// Graceful overrun: if this frame exceeded the frame budget, or the frame
|
|
661
|
+
// timer fired while it was still running, let the event loop run the next
|
|
662
|
+
// frame back-to-back. Boards can cap long catch-up bursts so idle still
|
|
663
|
+
// runs during debug logging or sustained heavy animation.
|
|
664
|
+
//
|
|
665
|
+
// TE-vsync single-clock: when the display drives off TE, the panel's TE edge is
|
|
666
|
+
// the sole frame producer (teEdgeIsr → notifyVsyncFromISR posts each frame; the
|
|
667
|
+
// timer below stops producing). So there is NO graceful-overrun catch-up in that
|
|
668
|
+
// mode — one TE edge = one frame, and an overrun simply drops the next edge
|
|
669
|
+
// (coalesced) rather than spinning a back-to-back loop on a second clock.
|
|
670
|
+
const bool vsyncDriven = vsyncDriven_.load(std::memory_order_acquire);
|
|
671
|
+
const bool catchUpRequested =
|
|
672
|
+
!vsyncDriven && (timerCatchUpDue || (frameDoneUs - frameStartUs) >= frameIntervalUs());
|
|
673
|
+
catchUpRequest_.store(catchUpRequested, std::memory_order_release);
|
|
674
|
+
bool forceIdleYield = false;
|
|
675
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_MAX_CATCHUP_FRAMES_BEFORE_YIELD > 0
|
|
676
|
+
if (catchUpRequested) {
|
|
677
|
+
catchUpBurstFrames_++;
|
|
678
|
+
if (catchUpBurstFrames_ >= GEA_EMBEDDED_FRAME_SCHEDULER_MAX_CATCHUP_FRAMES_BEFORE_YIELD) {
|
|
679
|
+
catchUpBurstFrames_ = 0;
|
|
680
|
+
forceIdleYield = true;
|
|
681
|
+
}
|
|
682
|
+
} else {
|
|
683
|
+
catchUpBurstFrames_ = 0;
|
|
684
|
+
}
|
|
685
|
+
#endif
|
|
686
|
+
if (forceIdleYield) {
|
|
687
|
+
vTaskDelay(1);
|
|
688
|
+
} else if (!catchUpRequested && GEA_EMBEDDED_FRAME_SCHEDULER_IDLE_YIELD_TICKS > 0) {
|
|
689
|
+
vTaskDelay(GEA_EMBEDDED_FRAME_SCHEDULER_IDLE_YIELD_TICKS);
|
|
690
|
+
}
|
|
691
|
+
#endif
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
void setFrameIntervalMs(int intervalMs)
|
|
695
|
+
{
|
|
696
|
+
setFrameIntervalUs(static_cast<int64_t>(intervalMs) * 1000);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
int frameIntervalMs() const
|
|
700
|
+
{
|
|
701
|
+
return static_cast<int>((frameIntervalUs() + 500) / 1000);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
void setFrameRate(double fps)
|
|
705
|
+
{
|
|
706
|
+
if (!(fps > 0.0)) return;
|
|
707
|
+
setFrameIntervalUs(static_cast<int64_t>((1000000.0 / fps) + 0.5));
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
double frameRate() const
|
|
711
|
+
{
|
|
712
|
+
const int64_t intervalUs = frameIntervalUs();
|
|
713
|
+
return intervalUs > 0 ? 1000000.0 / static_cast<double>(intervalUs) : 0.0;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
private:
|
|
717
|
+
struct PerfWindow {
|
|
718
|
+
int frameCount = 0;
|
|
719
|
+
int64_t frameTotalUs = 0;
|
|
720
|
+
int64_t framePeriodUs = 0;
|
|
721
|
+
int framePeriodCount = 0;
|
|
722
|
+
int64_t appTotalUs = 0;
|
|
723
|
+
int64_t trailFlushUs = 0;
|
|
724
|
+
int64_t inFrameFlushUs = 0;
|
|
725
|
+
int inFrameFlushCalls = 0;
|
|
726
|
+
int inFrameFlushPixels = 0;
|
|
727
|
+
int trailFlushCalls = 0;
|
|
728
|
+
int trailFlushPixels = 0;
|
|
729
|
+
int inFrameFlushChunks = 0;
|
|
730
|
+
int trailFlushChunks = 0;
|
|
731
|
+
int64_t inFrameSetWindowUs = 0;
|
|
732
|
+
int64_t inFrameSlotWaitUs = 0;
|
|
733
|
+
int64_t inFrameCopyUs = 0;
|
|
734
|
+
int64_t inFrameRasterUs = 0;
|
|
735
|
+
int64_t inFrameByteSwapUs = 0;
|
|
736
|
+
int64_t inFrameTxUs = 0;
|
|
737
|
+
int64_t inFrameCompleteWaitUs = 0;
|
|
738
|
+
int64_t inFrameEntryWaitUs = 0;
|
|
739
|
+
int64_t inFrameChunkWaitUs = 0;
|
|
740
|
+
int64_t inFrameTailWaitUs = 0;
|
|
741
|
+
int64_t trailSetWindowUs = 0;
|
|
742
|
+
int64_t trailSlotWaitUs = 0;
|
|
743
|
+
int64_t trailCopyUs = 0;
|
|
744
|
+
int64_t trailRasterUs = 0;
|
|
745
|
+
int64_t trailByteSwapUs = 0;
|
|
746
|
+
int64_t trailTxUs = 0;
|
|
747
|
+
int64_t trailCompleteWaitUs = 0;
|
|
748
|
+
int64_t trailEntryWaitUs = 0;
|
|
749
|
+
int64_t trailChunkWaitUs = 0;
|
|
750
|
+
int64_t trailTailWaitUs = 0;
|
|
751
|
+
int64_t canvasLookupUs = 0;
|
|
752
|
+
int64_t markDirtyUs = 0;
|
|
753
|
+
int64_t clearRectUs = 0;
|
|
754
|
+
int64_t fillRectUs = 0;
|
|
755
|
+
int64_t fillCircleUs = 0;
|
|
756
|
+
int64_t fillTriangleUs = 0;
|
|
757
|
+
int64_t drawImageUs = 0;
|
|
758
|
+
int64_t fillTextUs = 0;
|
|
759
|
+
int64_t batchFlushUs = 0;
|
|
760
|
+
int64_t drainMicrotasksUs = 0;
|
|
761
|
+
int64_t animationFrameUs = 0;
|
|
762
|
+
int64_t rafTotalUs = 0;
|
|
763
|
+
int64_t rafPrepareUs = 0;
|
|
764
|
+
int64_t rafCallbackUs = 0;
|
|
765
|
+
int64_t rafMaxCallbackUs = 0;
|
|
766
|
+
int64_t styleRecomputeUs = 0;
|
|
767
|
+
int64_t documentFrameUs = 0;
|
|
768
|
+
int64_t refreshMountedUs = 0;
|
|
769
|
+
int64_t rootScrollScanUs = 0;
|
|
770
|
+
int64_t rootScrollRebuildUs = 0;
|
|
771
|
+
int64_t rootScrollScrollRectUs = 0;
|
|
772
|
+
int64_t rootScrollStripReplayUs = 0;
|
|
773
|
+
int64_t rootScrollScrollbarReplayUs = 0;
|
|
774
|
+
int64_t rootScrollFullReplayUs = 0;
|
|
775
|
+
int64_t rootScrollStreamUs = 0;
|
|
776
|
+
int64_t rootScrollExtraReplayUs = 0;
|
|
777
|
+
int64_t rootScrollFlushUs = 0;
|
|
778
|
+
int64_t rootScrollSnapshotUs = 0;
|
|
779
|
+
int64_t virtualListRegionFillUs = 0;
|
|
780
|
+
int64_t virtualListRegionTextUs = 0;
|
|
781
|
+
int64_t virtualListRegionThumbUs = 0;
|
|
782
|
+
int64_t treeLayoutModeUs = 0;
|
|
783
|
+
int64_t treeLayoutUs = 0;
|
|
784
|
+
int64_t treeDisplayListUs = 0;
|
|
785
|
+
int64_t treeRecordNodeUs = 0;
|
|
786
|
+
int64_t treeSetStyleUs = 0;
|
|
787
|
+
int64_t treeSetTextUs = 0;
|
|
788
|
+
int64_t treeAbsModeUs = 0;
|
|
789
|
+
int64_t treeDirtyCollectUs = 0;
|
|
790
|
+
int64_t treeDirtyCoalesceUs = 0;
|
|
791
|
+
int64_t treeReplayUs = 0;
|
|
792
|
+
// Per-command-type replay attribution (fill/text/gradient/image/other) in the
|
|
793
|
+
// windowed log too — the SLOW-frame dump already prints these, but steady-state
|
|
794
|
+
// tuning (e.g. the rotary's staged-replay work) needs the 30-frame average.
|
|
795
|
+
int64_t treeReplayFillUs = 0;
|
|
796
|
+
int64_t treeReplayCircleUs = 0;
|
|
797
|
+
int64_t treeReplayTextUs = 0;
|
|
798
|
+
int64_t treeReplayGradientUs = 0;
|
|
799
|
+
int64_t treeReplayImageUs = 0;
|
|
800
|
+
int64_t treeReplayOtherUs = 0;
|
|
801
|
+
int64_t treeReplaySplitBgUs = 0;
|
|
802
|
+
int64_t treeReplaySplitDynUs = 0;
|
|
803
|
+
int64_t treeReplaySplitRasterUs = 0;
|
|
804
|
+
int64_t treeReplayBgRestoreUs = 0;
|
|
805
|
+
int64_t treeReplayNodeWalkUs = 0;
|
|
806
|
+
int64_t treeReplayCommandFilterUs = 0;
|
|
807
|
+
int64_t treeReplayCommandClipUs = 0;
|
|
808
|
+
int64_t treeFlushRectsUs = 0;
|
|
809
|
+
int64_t treeSnapshotUs = 0;
|
|
810
|
+
int treeReplayCircleCommands = 0;
|
|
811
|
+
int canvasLookupCalls = 0;
|
|
812
|
+
int markDirtyCalls = 0;
|
|
813
|
+
int clearRectCalls = 0;
|
|
814
|
+
int fillRectCalls = 0;
|
|
815
|
+
int fillCircleCalls = 0;
|
|
816
|
+
int fillTriangleCalls = 0;
|
|
817
|
+
int drawImageCalls = 0;
|
|
818
|
+
int fillTextCalls = 0;
|
|
819
|
+
int batchFlushCalls = 0;
|
|
820
|
+
int rafPendingAtRun = 0;
|
|
821
|
+
int rafCallbackCount = 0;
|
|
822
|
+
int rafRequestCount = 0;
|
|
823
|
+
int rafDroppedCount = 0;
|
|
824
|
+
int rootScrollCalls = 0;
|
|
825
|
+
int rootScrollAccepted = 0;
|
|
826
|
+
int rootScrollRejected = 0;
|
|
827
|
+
int rootScrollMovePx = 0;
|
|
828
|
+
int rootScrollViewportPx = 0;
|
|
829
|
+
int rootScrollStripPx = 0;
|
|
830
|
+
int rootScrollExtraDirtyNodes = 0;
|
|
831
|
+
int rootScrollStreamFrames = 0;
|
|
832
|
+
int rootScrollSyncFrames = 0;
|
|
833
|
+
int virtualListRegionCalls = 0;
|
|
834
|
+
int virtualListRegionRows = 0;
|
|
835
|
+
int virtualListRegionTextCalls = 0;
|
|
836
|
+
int treeRefreshCalls = 0;
|
|
837
|
+
int treeDirectReplayCalls = 0;
|
|
838
|
+
int treeBgRecolorCalls = 0;
|
|
839
|
+
int treeBgRecolorPixels = 0;
|
|
840
|
+
int treeReplayRegions = 0;
|
|
841
|
+
int treeReplayOriginRegions = 0;
|
|
842
|
+
int treeReplayCommandChecks = 0;
|
|
843
|
+
int treeReplayDirectRegionCalls = 0;
|
|
844
|
+
int treeReplayDirectRegionsCalls = 0;
|
|
845
|
+
int treeReplaySimpleRegionCalls = 0;
|
|
846
|
+
int treeReplayCommandFilterCalls = 0;
|
|
847
|
+
int treeReplayCommandClipCalls = 0;
|
|
848
|
+
int treeSetStyleCalls = 0;
|
|
849
|
+
int treeSetStyleChanged = 0;
|
|
850
|
+
int treeSetStyleNoop = 0;
|
|
851
|
+
int treeSetStyleLayoutChanged = 0;
|
|
852
|
+
int treeSetStyleTransformChanged = 0;
|
|
853
|
+
int treeSetStylePaintChanged = 0;
|
|
854
|
+
int treeSetTextCalls = 0;
|
|
855
|
+
int treeSetTextChanged = 0;
|
|
856
|
+
int treeSetTextStable = 0;
|
|
857
|
+
int treeSetTextHidden = 0;
|
|
858
|
+
int treeMarkDisplayListDirtyCalls = 0;
|
|
859
|
+
int treeMarkDisplayListContentDirtyCalls = 0;
|
|
860
|
+
int treeMarkNodeCommandDirtyCalls = 0;
|
|
861
|
+
int treeAbsModeCalls = 0;
|
|
862
|
+
int treeAbsModeFast = 0;
|
|
863
|
+
int treeAbsModeFull = 0;
|
|
864
|
+
int treeAbsModeNoop = 0;
|
|
865
|
+
int treeAbsModeDirtyNodes = 0;
|
|
866
|
+
int treeAbsModeRejectNode = -1;
|
|
867
|
+
int treeAbsModeRejectReason = 0;
|
|
868
|
+
int treeRecordCalls = 0;
|
|
869
|
+
int treeRecordedNodes = 0;
|
|
870
|
+
int treeRecordedCommands = 0;
|
|
871
|
+
int cadenceActiveFrames = 0;
|
|
872
|
+
int cadenceStartGapCount = 0;
|
|
873
|
+
int cadenceStartGapOver20ms = 0;
|
|
874
|
+
int cadenceStartGapOver33ms = 0;
|
|
875
|
+
int cadenceDoneGapCount = 0;
|
|
876
|
+
int cadenceDoneGapOver20ms = 0;
|
|
877
|
+
int cadenceDoneGapOver33ms = 0;
|
|
878
|
+
int64_t cadenceStartGapUs = 0;
|
|
879
|
+
int64_t cadenceStartGapMinUs = std::numeric_limits<int64_t>::max();
|
|
880
|
+
int64_t cadenceStartGapMaxUs = 0;
|
|
881
|
+
int64_t cadenceDoneGapUs = 0;
|
|
882
|
+
int64_t cadenceDoneGapMinUs = std::numeric_limits<int64_t>::max();
|
|
883
|
+
int64_t cadenceDoneGapMaxUs = 0;
|
|
884
|
+
int64_t cadenceFrameUs = 0;
|
|
885
|
+
int64_t cadenceFrameMaxUs = 0;
|
|
886
|
+
|
|
887
|
+
void reset()
|
|
888
|
+
{
|
|
889
|
+
*this = {};
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
FrameSchedulerEngine() = default;
|
|
894
|
+
|
|
895
|
+
static const char *stageName(FrameStage stage)
|
|
896
|
+
{
|
|
897
|
+
switch (stage) {
|
|
898
|
+
case FrameStage::FrameBegin: return "frame_begin";
|
|
899
|
+
case FrameStage::WaitAppLock: return "wait_app_lock";
|
|
900
|
+
case FrameStage::AppFrame: return "app_frame";
|
|
901
|
+
case FrameStage::AppUnlock: return "app_unlock";
|
|
902
|
+
case FrameStage::ReadInFrameStats: return "read_inframe_stats";
|
|
903
|
+
case FrameStage::TrailFlush: return "trail_flush";
|
|
904
|
+
case FrameStage::ReadTrailStats: return "read_trail_stats";
|
|
905
|
+
case FrameStage::FrameDone: return "frame_done";
|
|
906
|
+
case FrameStage::Idle: return "idle";
|
|
907
|
+
}
|
|
908
|
+
return "idle";
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
void setFrameStage(FrameStage stage)
|
|
912
|
+
{
|
|
913
|
+
frameStage_.store(static_cast<int>(stage), std::memory_order_release);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
FrameStage frameStage() const
|
|
917
|
+
{
|
|
918
|
+
return static_cast<FrameStage>(frameStage_.load(std::memory_order_acquire));
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
void setFrameIntervalUs(int64_t intervalUs)
|
|
922
|
+
{
|
|
923
|
+
const int64_t normalized = normalizeFrameIntervalUs(intervalUs);
|
|
924
|
+
frameIntervalUs_.store(normalized, std::memory_order_relaxed);
|
|
925
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_USE_ESP_TIMER
|
|
926
|
+
restartTimer(normalized);
|
|
927
|
+
#endif
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
int64_t frameIntervalUs() const
|
|
931
|
+
{
|
|
932
|
+
return frameIntervalUs_.load(std::memory_order_relaxed);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
static int64_t normalizeFrameIntervalUs(int64_t intervalUs)
|
|
936
|
+
{
|
|
937
|
+
const int64_t minUs = static_cast<int64_t>(FrameScheduler::kMinFrameIntervalMs) * 1000;
|
|
938
|
+
const int64_t maxUs = static_cast<int64_t>(FrameScheduler::kMaxFrameIntervalMs) * 1000;
|
|
939
|
+
if (intervalUs < minUs) return minUs;
|
|
940
|
+
if (intervalUs > maxUs) return maxUs;
|
|
941
|
+
return intervalUs;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
static int64_t tickPeriodUs()
|
|
945
|
+
{
|
|
946
|
+
constexpr int64_t periodUs = 1000000LL / configTICK_RATE_HZ;
|
|
947
|
+
return periodUs > 0 ? periodUs : 1000;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
static TickType_t ticksForFrameIntervalUs(int64_t intervalUs)
|
|
951
|
+
{
|
|
952
|
+
const int64_t tickUs = tickPeriodUs();
|
|
953
|
+
TickType_t ticks = static_cast<TickType_t>(normalizeFrameIntervalUs(intervalUs) / tickUs);
|
|
954
|
+
return ticks < 1 ? 1 : ticks;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
void checkWatchdog()
|
|
958
|
+
{
|
|
959
|
+
if (!frameInProgress_.load(std::memory_order_acquire)) return;
|
|
960
|
+
|
|
961
|
+
const int nowMs = FrameScheduler::nowMs();
|
|
962
|
+
const int elapsedMs = nowMs - frameStartedMs_.load(std::memory_order_relaxed);
|
|
963
|
+
if (elapsedMs < FrameScheduler::kWatchdogMs) return;
|
|
964
|
+
if (nowMs - watchdogLastMs_ < FrameScheduler::kWatchdogMs) return;
|
|
965
|
+
watchdogLastMs_ = nowMs;
|
|
966
|
+
const auto displayDetail = gea::platform::display::Display::flushStageDetail();
|
|
967
|
+
|
|
968
|
+
ESP_LOGE(kTag,
|
|
969
|
+
"frame watchdog: seq=%lu stuck=%dms stage=%s app_phase=%s ui=%s/%d display=%s/%d rect=%d,%d-%d,%d rows=%d px=%d pending=%d internal_free=%u internal_largest=%u internal_min=%u psram_free=%u",
|
|
970
|
+
static_cast<unsigned long>(frameSequence_.load(std::memory_order_relaxed)),
|
|
971
|
+
elapsedMs,
|
|
972
|
+
stageName(frameStage()),
|
|
973
|
+
gea::framework::app::applicationFramePhaseName(gea::framework::app::applicationFramePhaseRead()),
|
|
974
|
+
gea::embedded::ui::refreshTraceStageName(),
|
|
975
|
+
gea::embedded::ui::refreshTraceIndex(),
|
|
976
|
+
gea::platform::display::Display::flushStageName(),
|
|
977
|
+
gea::platform::display::Display::flushStageChunk(),
|
|
978
|
+
displayDetail.x0,
|
|
979
|
+
displayDetail.y0,
|
|
980
|
+
displayDetail.x1,
|
|
981
|
+
displayDetail.y1,
|
|
982
|
+
displayDetail.rows,
|
|
983
|
+
displayDetail.pixels,
|
|
984
|
+
eventPending_.load(std::memory_order_relaxed) ? 1 : 0,
|
|
985
|
+
static_cast<unsigned>(heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)),
|
|
986
|
+
static_cast<unsigned>(heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)),
|
|
987
|
+
static_cast<unsigned>(heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)),
|
|
988
|
+
static_cast<unsigned>(heap_caps_get_free_size(MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT)));
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
void queueFrameEvent()
|
|
992
|
+
{
|
|
993
|
+
timerTickCount_.fetch_add(1, std::memory_order_relaxed);
|
|
994
|
+
if (!eventQueue_)
|
|
995
|
+
return;
|
|
996
|
+
// TE-vsync single-clock: while the panel TE is producing frames, the timer must
|
|
997
|
+
// NOT also post — that's the second clock we're eliminating. Only fall back to
|
|
998
|
+
// timer-posting if the TE edge has gone silent for >2 periods (dead/garbled TE),
|
|
999
|
+
// so a missing TE can never freeze rendering.
|
|
1000
|
+
if (vsyncDriven_.load(std::memory_order_acquire)) {
|
|
1001
|
+
const uint32_t sincePost =
|
|
1002
|
+
static_cast<uint32_t>(esp_timer_get_time()) - lastVsyncPostUs_.load(std::memory_order_acquire);
|
|
1003
|
+
if (sincePost < 2u * static_cast<uint32_t>(frameIntervalUs()))
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
if (eventPending_.load(std::memory_order_acquire)) {
|
|
1007
|
+
catchUpFrameDue_.store(true, std::memory_order_release);
|
|
1008
|
+
timerPendingSkipCount_.fetch_add(1, std::memory_order_relaxed);
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
if (frameInProgress_.load(std::memory_order_acquire)) {
|
|
1012
|
+
catchUpFrameDue_.store(true, std::memory_order_release);
|
|
1013
|
+
timerInProgressCount_.fetch_add(1, std::memory_order_relaxed);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
gea::framework::events::Event event{};
|
|
1017
|
+
event.type = gea::framework::events::EventType::Frame;
|
|
1018
|
+
eventPending_.store(true, std::memory_order_release);
|
|
1019
|
+
if (!sendEvent(event, 0)) {
|
|
1020
|
+
eventPending_.store(false, std::memory_order_release);
|
|
1021
|
+
timerSendFailCount_.fetch_add(1, std::memory_order_relaxed);
|
|
1022
|
+
} else {
|
|
1023
|
+
timerQueueCount_.fetch_add(1, std::memory_order_relaxed);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_USE_ESP_TIMER
|
|
1028
|
+
void startTimer()
|
|
1029
|
+
{
|
|
1030
|
+
if (timer_) return;
|
|
1031
|
+
const esp_timer_create_args_t args = {
|
|
1032
|
+
.callback = &FrameSchedulerEngine::timerCallback,
|
|
1033
|
+
.arg = this,
|
|
1034
|
+
.dispatch_method = ESP_TIMER_TASK,
|
|
1035
|
+
.name = "gea_frame",
|
|
1036
|
+
.skip_unhandled_events = true,
|
|
1037
|
+
};
|
|
1038
|
+
const esp_err_t createErr = esp_timer_create(&args, &timer_);
|
|
1039
|
+
if (createErr != ESP_OK) {
|
|
1040
|
+
ESP_LOGW(kTag, "Failed to create frame scheduler timer: %d", static_cast<int>(createErr));
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
restartTimer(frameIntervalUs());
|
|
1044
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
1045
|
+
ESP_LOGI(kTag, "frame scheduler esp_timer started interval=%lldus", static_cast<long long>(timerIntervalUs_));
|
|
1046
|
+
#endif
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
void restartTimer(int64_t intervalUs)
|
|
1050
|
+
{
|
|
1051
|
+
if (!timer_) return;
|
|
1052
|
+
if (timerRunning_) {
|
|
1053
|
+
const esp_err_t stopErr = esp_timer_stop(timer_);
|
|
1054
|
+
if (stopErr != ESP_OK && stopErr != ESP_ERR_INVALID_STATE)
|
|
1055
|
+
ESP_LOGW(kTag, "Failed to stop frame scheduler timer: %d", static_cast<int>(stopErr));
|
|
1056
|
+
timerRunning_ = false;
|
|
1057
|
+
}
|
|
1058
|
+
const esp_err_t startErr = esp_timer_start_periodic(timer_, static_cast<uint64_t>(intervalUs));
|
|
1059
|
+
if (startErr != ESP_OK) {
|
|
1060
|
+
ESP_LOGW(kTag, "Failed to start frame scheduler timer: %d", static_cast<int>(startErr));
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
timerIntervalUs_ = intervalUs;
|
|
1064
|
+
timerRunning_ = true;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
void onTimer()
|
|
1068
|
+
{
|
|
1069
|
+
checkWatchdog();
|
|
1070
|
+
queueFrameEvent();
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
static void timerCallback(void *arg)
|
|
1074
|
+
{
|
|
1075
|
+
static_cast<FrameSchedulerEngine *>(arg)->onTimer();
|
|
1076
|
+
}
|
|
1077
|
+
#else
|
|
1078
|
+
// In TE-vsync mode the panel's TE ISR produces every frame, so this timer task is only
|
|
1079
|
+
// a dead-TE watchdog + setFrameRate fallback — it must NOT wake every frame. Waking at
|
|
1080
|
+
// the ~16ms frame interval makes this prio-23 task preempt the prio-5 render task once
|
|
1081
|
+
// per frame, beating against the ~16.7ms TE and knocking ~2% of frames past their edge
|
|
1082
|
+
// (a missed VBlank → the steady rate stalls at ~58 instead of locking to ~60). At a
|
|
1083
|
+
// coarse watchdog cadence the render task owns core 0 between TEs and locks cleanly.
|
|
1084
|
+
// 48ms still catches a dead/garbled TE within ~3 frames (queueFrameEvent's fallback
|
|
1085
|
+
// fires once TE has been silent > 2 frame intervals).
|
|
1086
|
+
static constexpr int64_t kVsyncWatchdogIntervalUs = 48000;
|
|
1087
|
+
|
|
1088
|
+
void runTask()
|
|
1089
|
+
{
|
|
1090
|
+
TickType_t lastWake = xTaskGetTickCount();
|
|
1091
|
+
int64_t lastIntervalUs = -1;
|
|
1092
|
+
TickType_t ticks = 1;
|
|
1093
|
+
|
|
1094
|
+
while (true) {
|
|
1095
|
+
// Pick the wake cadence by mode: frame-rate timer when we drive frames
|
|
1096
|
+
// ourselves, coarse watchdog when the TE drives them.
|
|
1097
|
+
const int64_t intervalUs =
|
|
1098
|
+
vsyncDriven() ? kVsyncWatchdogIntervalUs : frameIntervalUs();
|
|
1099
|
+
if (intervalUs != lastIntervalUs) {
|
|
1100
|
+
lastIntervalUs = intervalUs;
|
|
1101
|
+
ticks = ticksForFrameIntervalUs(intervalUs);
|
|
1102
|
+
lastWake = xTaskGetTickCount();
|
|
1103
|
+
}
|
|
1104
|
+
vTaskDelayUntil(&lastWake, ticks);
|
|
1105
|
+
checkWatchdog();
|
|
1106
|
+
queueFrameEvent();
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
static void taskMain(void *arg)
|
|
1111
|
+
{
|
|
1112
|
+
static_cast<FrameSchedulerEngine *>(arg)->runTask();
|
|
1113
|
+
}
|
|
1114
|
+
#endif
|
|
1115
|
+
|
|
1116
|
+
static void recordGap(int64_t gapUs,
|
|
1117
|
+
int *count,
|
|
1118
|
+
int64_t *totalUs,
|
|
1119
|
+
int64_t *minUs,
|
|
1120
|
+
int64_t *maxUs,
|
|
1121
|
+
int *over20ms,
|
|
1122
|
+
int *over33ms)
|
|
1123
|
+
{
|
|
1124
|
+
if (gapUs <= 0 || gapUs > 100000)
|
|
1125
|
+
return;
|
|
1126
|
+
(*count)++;
|
|
1127
|
+
*totalUs += gapUs;
|
|
1128
|
+
if (gapUs < *minUs) *minUs = gapUs;
|
|
1129
|
+
if (gapUs > *maxUs) *maxUs = gapUs;
|
|
1130
|
+
if (gapUs > 20000) (*over20ms)++;
|
|
1131
|
+
if (gapUs > 33333) (*over33ms)++;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
void recordCadence(int64_t frameStartUs, int64_t frameDoneUs, bool active)
|
|
1135
|
+
{
|
|
1136
|
+
if (!active)
|
|
1137
|
+
return;
|
|
1138
|
+
perf_.cadenceActiveFrames++;
|
|
1139
|
+
const int64_t frameUs = frameDoneUs - frameStartUs;
|
|
1140
|
+
perf_.cadenceFrameUs += frameUs;
|
|
1141
|
+
if (frameUs > perf_.cadenceFrameMaxUs)
|
|
1142
|
+
perf_.cadenceFrameMaxUs = frameUs;
|
|
1143
|
+
if (lastActiveFrameStartUs_ > 0) {
|
|
1144
|
+
recordGap(frameStartUs - lastActiveFrameStartUs_,
|
|
1145
|
+
&perf_.cadenceStartGapCount,
|
|
1146
|
+
&perf_.cadenceStartGapUs,
|
|
1147
|
+
&perf_.cadenceStartGapMinUs,
|
|
1148
|
+
&perf_.cadenceStartGapMaxUs,
|
|
1149
|
+
&perf_.cadenceStartGapOver20ms,
|
|
1150
|
+
&perf_.cadenceStartGapOver33ms);
|
|
1151
|
+
}
|
|
1152
|
+
lastActiveFrameStartUs_ = frameStartUs;
|
|
1153
|
+
if (lastActiveFrameDoneUs_ > 0) {
|
|
1154
|
+
recordGap(frameDoneUs - lastActiveFrameDoneUs_,
|
|
1155
|
+
&perf_.cadenceDoneGapCount,
|
|
1156
|
+
&perf_.cadenceDoneGapUs,
|
|
1157
|
+
&perf_.cadenceDoneGapMinUs,
|
|
1158
|
+
&perf_.cadenceDoneGapMaxUs,
|
|
1159
|
+
&perf_.cadenceDoneGapOver20ms,
|
|
1160
|
+
&perf_.cadenceDoneGapOver33ms);
|
|
1161
|
+
}
|
|
1162
|
+
lastActiveFrameDoneUs_ = frameDoneUs;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
void logPerfWindowIfReady()
|
|
1166
|
+
{
|
|
1167
|
+
// Window length. The ~80-arg ESP_LOGI dump below costs a few ms of vsnprintf +
|
|
1168
|
+
// console TX ON THE FRAME TASK when it fires; at a 30-frame cadence that lands as
|
|
1169
|
+
// ~1 dropped VBlank per 30 under TE-sync (the frame overruns its 16ms window). A
|
|
1170
|
+
// 300-frame window keeps the diagnostic but makes that perturbation rare (~once
|
|
1171
|
+
// per 5s) so it stops capping the steady TE-locked rate.
|
|
1172
|
+
// Board-tunable: a board capturing the PER-FRAME dump instead needs this
|
|
1173
|
+
// windowed line out of the way, or its ~80-arg output floods a small log
|
|
1174
|
+
// ring and evicts the frames actually being looked at.
|
|
1175
|
+
#ifndef GEA_EMBEDDED_FRAME_SCHEDULER_PERF_WINDOW_FRAMES
|
|
1176
|
+
#define GEA_EMBEDDED_FRAME_SCHEDULER_PERF_WINDOW_FRAMES 300
|
|
1177
|
+
#endif
|
|
1178
|
+
if (perf_.frameCount < GEA_EMBEDDED_FRAME_SCHEDULER_PERF_WINDOW_FRAMES) return;
|
|
1179
|
+
#if !GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LOG
|
|
1180
|
+
// Perf logging disabled at build time. Still reset counters so they
|
|
1181
|
+
// don't accumulate indefinitely. The ~80-arg ESP_LOGI vsnprintf below
|
|
1182
|
+
// costs ~1-2ms when it fires, which lands as a single per-window
|
|
1183
|
+
// outlier in steady-state animations — disabling lets a board measure
|
|
1184
|
+
// without perturbing what it's measuring.
|
|
1185
|
+
perf_.reset();
|
|
1186
|
+
return;
|
|
1187
|
+
#else
|
|
1188
|
+
const int64_t appNoFlushUs = perf_.appTotalUs - perf_.inFrameFlushUs;
|
|
1189
|
+
const int64_t accountedCanvasUs =
|
|
1190
|
+
perf_.canvasLookupUs +
|
|
1191
|
+
perf_.markDirtyUs +
|
|
1192
|
+
perf_.clearRectUs +
|
|
1193
|
+
perf_.fillRectUs +
|
|
1194
|
+
perf_.fillCircleUs +
|
|
1195
|
+
perf_.fillTriangleUs +
|
|
1196
|
+
perf_.drawImageUs +
|
|
1197
|
+
perf_.fillTextUs;
|
|
1198
|
+
const int64_t otherAppUs = appNoFlushUs - accountedCanvasUs;
|
|
1199
|
+
const int64_t animationFrameNoFlushUs = perf_.animationFrameUs - perf_.inFrameFlushUs;
|
|
1200
|
+
const unsigned internalFree = heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
|
1201
|
+
const unsigned internalLargest = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
|
1202
|
+
const unsigned internalMin = heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
|
1203
|
+
const unsigned psramFree = heap_caps_get_free_size(MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
1204
|
+
const unsigned geaMainStackHwm = static_cast<unsigned>(uxTaskGetStackHighWaterMark(nullptr));
|
|
1205
|
+
const unsigned appFrameStackHwm = task_ ? static_cast<unsigned>(uxTaskGetStackHighWaterMark(task_)) : 0;
|
|
1206
|
+
const int64_t avgPeriodUs = perf_.framePeriodCount > 0 ? perf_.framePeriodUs / perf_.framePeriodCount : 0;
|
|
1207
|
+
const int fpsX10 = avgPeriodUs > 0 ? static_cast<int>((10000000LL + avgPeriodUs / 2) / avgPeriodUs) : 0;
|
|
1208
|
+
const int64_t cadenceFrameAvgUs =
|
|
1209
|
+
perf_.cadenceActiveFrames > 0 ? perf_.cadenceFrameUs / perf_.cadenceActiveFrames : 0;
|
|
1210
|
+
const int64_t cadenceStartAvgUs =
|
|
1211
|
+
perf_.cadenceStartGapCount > 0 ? perf_.cadenceStartGapUs / perf_.cadenceStartGapCount : 0;
|
|
1212
|
+
const int64_t cadenceStartMinUs =
|
|
1213
|
+
perf_.cadenceStartGapCount > 0 ? perf_.cadenceStartGapMinUs : 0;
|
|
1214
|
+
const int64_t cadenceDoneAvgUs =
|
|
1215
|
+
perf_.cadenceDoneGapCount > 0 ? perf_.cadenceDoneGapUs / perf_.cadenceDoneGapCount : 0;
|
|
1216
|
+
const int64_t cadenceDoneMinUs =
|
|
1217
|
+
perf_.cadenceDoneGapCount > 0 ? perf_.cadenceDoneGapMinUs : 0;
|
|
1218
|
+
const int timerTicks = timerTickCount_.exchange(0, std::memory_order_relaxed);
|
|
1219
|
+
const int timerQueued = timerQueueCount_.exchange(0, std::memory_order_relaxed);
|
|
1220
|
+
const int timerPendingSkips = timerPendingSkipCount_.exchange(0, std::memory_order_relaxed);
|
|
1221
|
+
const int timerInProgress = timerInProgressCount_.exchange(0, std::memory_order_relaxed);
|
|
1222
|
+
const int timerSendFails = timerSendFailCount_.exchange(0, std::memory_order_relaxed);
|
|
1223
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_PERF_LITE
|
|
1224
|
+
ESP_LOGI(kTag,
|
|
1225
|
+
"perf-lite: frame=%lldus period=%lldus fps=%d.%01d target=%lldus timer=tick:%d queue:%d pend:%d busy:%d fail:%d app=%lldus raf=%lldus refresh=%lldus replay=%dr flush=%lldus/%dc/%dpx cadence=%lldus/%lldus/%lldus [avg over %d frames]",
|
|
1226
|
+
perf_.frameTotalUs / perf_.frameCount,
|
|
1227
|
+
avgPeriodUs,
|
|
1228
|
+
fpsX10 / 10,
|
|
1229
|
+
fpsX10 % 10,
|
|
1230
|
+
frameIntervalUs(),
|
|
1231
|
+
timerTicks,
|
|
1232
|
+
timerQueued,
|
|
1233
|
+
timerPendingSkips,
|
|
1234
|
+
timerInProgress,
|
|
1235
|
+
timerSendFails,
|
|
1236
|
+
perf_.appTotalUs / perf_.frameCount,
|
|
1237
|
+
perf_.animationFrameUs / perf_.frameCount,
|
|
1238
|
+
perf_.refreshMountedUs / perf_.frameCount,
|
|
1239
|
+
perf_.treeReplayRegions / perf_.frameCount,
|
|
1240
|
+
perf_.inFrameFlushUs / perf_.frameCount,
|
|
1241
|
+
perf_.inFrameFlushChunks / perf_.frameCount,
|
|
1242
|
+
perf_.inFrameFlushPixels / perf_.frameCount,
|
|
1243
|
+
cadenceStartMinUs,
|
|
1244
|
+
cadenceStartAvgUs,
|
|
1245
|
+
perf_.cadenceStartGapMaxUs,
|
|
1246
|
+
perf_.frameCount);
|
|
1247
|
+
perf_.reset();
|
|
1248
|
+
return;
|
|
1249
|
+
#endif
|
|
1250
|
+
ESP_LOGI(kTag,
|
|
1251
|
+
"perf: frame=%lldus period=%lldus fps=%d.%01d target=%lldus timer=tick:%d queue:%d pend:%d busy:%d fail:%d cadence=active:%d frame:%lldus max:%lldus start:%lldus/%lldus/%lldus over20:%d over33:%d done:%lldus/%lldus/%lldus over20:%d over33:%d app=%lldus appnoflush=%lldus phases=drain:%lldus raf:%lldus rafnoflush:%lldus recompute:%lldus doc:%lldus refresh:%lldus rafdetail=run:%lldus prep:%lldus cb:%lldus/%d max:%lldus pending:%d req:%d drop:%d canvas=lookup:%lldus/%d dirty:%lldus/%d clear:%lldus/%d fill:%lldus/%d image:%lldus/%d text:%lldus/%d other:%lldus batchflush=%lldus/%d inflush=%lldus(%dcalls/%dchunks/%dpx setwin:%lldus slot:%lldus copy:%lldus raster:%lldus swap:%lldus tx:%lldus wait:%lldus entry:%lldus chunk:%lldus tail:%lldus) trailflush=%lldus(%dcalls/%dchunks/%dpx setwin:%lldus slot:%lldus copy:%lldus raster:%lldus swap:%lldus tx:%lldus wait:%lldus entry:%lldus chunk:%lldus tail:%lldus) ui=root(scan:%lldus/%d ok:%d rej:%d rebuild:%lldus scroll:%lldus strip:%lldus bar:%lldus full:%lldus stream:%lldus/%d sync:%d extra:%lldus flush:%lldus snap:%lldus move:%dpx viewport:%dpx strip_px:%d extra_nodes:%d) vlist=region(fill:%lldus text:%lldus/%d thumb:%lldus calls:%d rows:%d) tree(count:%d direct:%d bgrecolor:%d/%dpx mode:%lldus layout:%lldus dlist:%lldus dirty:%lldus coal:%lldus replay:%lldus/%dr/%dor/%dcc circle:%d rUs=f:%lld/c:%lld/t:%lld/g:%lld/i:%lld/o:%lld flush:%lldus snap:%lldus) heap=internal:%u largest:%u min:%u psram:%u stack=gea_hwm:%u app_frame_hwm:%u recprobe(fullrebuilds:%d recUs:%lld nodes:%d cmds:%d) [avg over %d frames]",
|
|
1252
|
+
perf_.frameTotalUs / perf_.frameCount,
|
|
1253
|
+
avgPeriodUs,
|
|
1254
|
+
fpsX10 / 10,
|
|
1255
|
+
fpsX10 % 10,
|
|
1256
|
+
frameIntervalUs(),
|
|
1257
|
+
timerTicks,
|
|
1258
|
+
timerQueued,
|
|
1259
|
+
timerPendingSkips,
|
|
1260
|
+
timerInProgress,
|
|
1261
|
+
timerSendFails,
|
|
1262
|
+
perf_.cadenceActiveFrames,
|
|
1263
|
+
cadenceFrameAvgUs,
|
|
1264
|
+
perf_.cadenceFrameMaxUs,
|
|
1265
|
+
cadenceStartMinUs,
|
|
1266
|
+
cadenceStartAvgUs,
|
|
1267
|
+
perf_.cadenceStartGapMaxUs,
|
|
1268
|
+
perf_.cadenceStartGapOver20ms,
|
|
1269
|
+
perf_.cadenceStartGapOver33ms,
|
|
1270
|
+
cadenceDoneMinUs,
|
|
1271
|
+
cadenceDoneAvgUs,
|
|
1272
|
+
perf_.cadenceDoneGapMaxUs,
|
|
1273
|
+
perf_.cadenceDoneGapOver20ms,
|
|
1274
|
+
perf_.cadenceDoneGapOver33ms,
|
|
1275
|
+
perf_.appTotalUs / perf_.frameCount,
|
|
1276
|
+
appNoFlushUs / perf_.frameCount,
|
|
1277
|
+
perf_.drainMicrotasksUs / perf_.frameCount,
|
|
1278
|
+
perf_.animationFrameUs / perf_.frameCount,
|
|
1279
|
+
animationFrameNoFlushUs / perf_.frameCount,
|
|
1280
|
+
perf_.styleRecomputeUs / perf_.frameCount,
|
|
1281
|
+
perf_.documentFrameUs / perf_.frameCount,
|
|
1282
|
+
perf_.refreshMountedUs / perf_.frameCount,
|
|
1283
|
+
perf_.rafTotalUs / perf_.frameCount,
|
|
1284
|
+
perf_.rafPrepareUs / perf_.frameCount,
|
|
1285
|
+
perf_.rafCallbackUs / perf_.frameCount,
|
|
1286
|
+
perf_.rafCallbackCount / perf_.frameCount,
|
|
1287
|
+
perf_.rafMaxCallbackUs,
|
|
1288
|
+
perf_.rafPendingAtRun / perf_.frameCount,
|
|
1289
|
+
perf_.rafRequestCount / perf_.frameCount,
|
|
1290
|
+
perf_.rafDroppedCount / perf_.frameCount,
|
|
1291
|
+
perf_.canvasLookupUs / perf_.frameCount,
|
|
1292
|
+
perf_.canvasLookupCalls / perf_.frameCount,
|
|
1293
|
+
perf_.markDirtyUs / perf_.frameCount,
|
|
1294
|
+
perf_.markDirtyCalls / perf_.frameCount,
|
|
1295
|
+
(perf_.clearRectUs + perf_.fillRectUs) / perf_.frameCount,
|
|
1296
|
+
(perf_.clearRectCalls + perf_.fillRectCalls) / perf_.frameCount,
|
|
1297
|
+
(perf_.fillCircleUs + perf_.fillTriangleUs) / perf_.frameCount,
|
|
1298
|
+
(perf_.fillCircleCalls + perf_.fillTriangleCalls) / perf_.frameCount,
|
|
1299
|
+
perf_.drawImageUs / perf_.frameCount,
|
|
1300
|
+
perf_.drawImageCalls / perf_.frameCount,
|
|
1301
|
+
perf_.fillTextUs / perf_.frameCount,
|
|
1302
|
+
perf_.fillTextCalls / perf_.frameCount,
|
|
1303
|
+
otherAppUs / perf_.frameCount,
|
|
1304
|
+
perf_.batchFlushUs / perf_.frameCount,
|
|
1305
|
+
perf_.batchFlushCalls / perf_.frameCount,
|
|
1306
|
+
perf_.inFrameFlushUs / perf_.frameCount,
|
|
1307
|
+
perf_.inFrameFlushCalls / perf_.frameCount,
|
|
1308
|
+
perf_.inFrameFlushChunks / perf_.frameCount,
|
|
1309
|
+
perf_.inFrameFlushPixels / perf_.frameCount,
|
|
1310
|
+
perf_.inFrameSetWindowUs / perf_.frameCount,
|
|
1311
|
+
perf_.inFrameSlotWaitUs / perf_.frameCount,
|
|
1312
|
+
perf_.inFrameCopyUs / perf_.frameCount,
|
|
1313
|
+
perf_.inFrameRasterUs / perf_.frameCount,
|
|
1314
|
+
perf_.inFrameByteSwapUs / perf_.frameCount,
|
|
1315
|
+
perf_.inFrameTxUs / perf_.frameCount,
|
|
1316
|
+
perf_.inFrameCompleteWaitUs / perf_.frameCount,
|
|
1317
|
+
perf_.inFrameEntryWaitUs / perf_.frameCount,
|
|
1318
|
+
perf_.inFrameChunkWaitUs / perf_.frameCount,
|
|
1319
|
+
perf_.inFrameTailWaitUs / perf_.frameCount,
|
|
1320
|
+
perf_.trailFlushUs / perf_.frameCount,
|
|
1321
|
+
perf_.trailFlushCalls / perf_.frameCount,
|
|
1322
|
+
perf_.trailFlushChunks / perf_.frameCount,
|
|
1323
|
+
perf_.trailFlushPixels / perf_.frameCount,
|
|
1324
|
+
perf_.trailSetWindowUs / perf_.frameCount,
|
|
1325
|
+
perf_.trailSlotWaitUs / perf_.frameCount,
|
|
1326
|
+
perf_.trailCopyUs / perf_.frameCount,
|
|
1327
|
+
perf_.trailRasterUs / perf_.frameCount,
|
|
1328
|
+
perf_.trailByteSwapUs / perf_.frameCount,
|
|
1329
|
+
perf_.trailTxUs / perf_.frameCount,
|
|
1330
|
+
perf_.trailCompleteWaitUs / perf_.frameCount,
|
|
1331
|
+
perf_.trailEntryWaitUs / perf_.frameCount,
|
|
1332
|
+
perf_.trailChunkWaitUs / perf_.frameCount,
|
|
1333
|
+
perf_.trailTailWaitUs / perf_.frameCount,
|
|
1334
|
+
perf_.rootScrollScanUs / perf_.frameCount,
|
|
1335
|
+
perf_.rootScrollCalls / perf_.frameCount,
|
|
1336
|
+
perf_.rootScrollAccepted / perf_.frameCount,
|
|
1337
|
+
perf_.rootScrollRejected / perf_.frameCount,
|
|
1338
|
+
perf_.rootScrollRebuildUs / perf_.frameCount,
|
|
1339
|
+
perf_.rootScrollScrollRectUs / perf_.frameCount,
|
|
1340
|
+
perf_.rootScrollStripReplayUs / perf_.frameCount,
|
|
1341
|
+
perf_.rootScrollScrollbarReplayUs / perf_.frameCount,
|
|
1342
|
+
perf_.rootScrollFullReplayUs / perf_.frameCount,
|
|
1343
|
+
perf_.rootScrollStreamUs / perf_.frameCount,
|
|
1344
|
+
perf_.rootScrollStreamFrames,
|
|
1345
|
+
perf_.rootScrollSyncFrames,
|
|
1346
|
+
perf_.rootScrollExtraReplayUs / perf_.frameCount,
|
|
1347
|
+
perf_.rootScrollFlushUs / perf_.frameCount,
|
|
1348
|
+
perf_.rootScrollSnapshotUs / perf_.frameCount,
|
|
1349
|
+
perf_.rootScrollMovePx / perf_.frameCount,
|
|
1350
|
+
perf_.rootScrollViewportPx / perf_.frameCount,
|
|
1351
|
+
perf_.rootScrollStripPx / perf_.frameCount,
|
|
1352
|
+
perf_.rootScrollExtraDirtyNodes / perf_.frameCount,
|
|
1353
|
+
perf_.virtualListRegionFillUs / perf_.frameCount,
|
|
1354
|
+
perf_.virtualListRegionTextUs / perf_.frameCount,
|
|
1355
|
+
perf_.virtualListRegionTextCalls / perf_.frameCount,
|
|
1356
|
+
perf_.virtualListRegionThumbUs / perf_.frameCount,
|
|
1357
|
+
perf_.virtualListRegionCalls / perf_.frameCount,
|
|
1358
|
+
perf_.virtualListRegionRows / perf_.frameCount,
|
|
1359
|
+
perf_.treeRefreshCalls / perf_.frameCount,
|
|
1360
|
+
perf_.treeDirectReplayCalls / perf_.frameCount,
|
|
1361
|
+
perf_.treeBgRecolorCalls,
|
|
1362
|
+
perf_.treeBgRecolorPixels / perf_.frameCount,
|
|
1363
|
+
perf_.treeLayoutModeUs / perf_.frameCount,
|
|
1364
|
+
perf_.treeLayoutUs / perf_.frameCount,
|
|
1365
|
+
perf_.treeDisplayListUs / perf_.frameCount,
|
|
1366
|
+
perf_.treeDirtyCollectUs / perf_.frameCount,
|
|
1367
|
+
perf_.treeDirtyCoalesceUs / perf_.frameCount,
|
|
1368
|
+
perf_.treeReplayUs / perf_.frameCount,
|
|
1369
|
+
perf_.treeReplayRegions / perf_.frameCount,
|
|
1370
|
+
perf_.treeReplayOriginRegions / perf_.frameCount,
|
|
1371
|
+
perf_.treeReplayCommandChecks / perf_.frameCount,
|
|
1372
|
+
perf_.treeReplayCircleCommands / perf_.frameCount,
|
|
1373
|
+
perf_.treeReplayFillUs / perf_.frameCount,
|
|
1374
|
+
perf_.treeReplayCircleUs / perf_.frameCount,
|
|
1375
|
+
perf_.treeReplayTextUs / perf_.frameCount,
|
|
1376
|
+
perf_.treeReplayGradientUs / perf_.frameCount,
|
|
1377
|
+
perf_.treeReplayImageUs / perf_.frameCount,
|
|
1378
|
+
perf_.treeReplayOtherUs / perf_.frameCount,
|
|
1379
|
+
perf_.treeFlushRectsUs / perf_.frameCount,
|
|
1380
|
+
perf_.treeSnapshotUs / perf_.frameCount,
|
|
1381
|
+
internalFree,
|
|
1382
|
+
internalLargest,
|
|
1383
|
+
internalMin,
|
|
1384
|
+
psramFree,
|
|
1385
|
+
geaMainStackHwm,
|
|
1386
|
+
appFrameStackHwm,
|
|
1387
|
+
perf_.treeRecordCalls,
|
|
1388
|
+
(long long)perf_.treeRecordNodeUs,
|
|
1389
|
+
perf_.treeRecordedNodes,
|
|
1390
|
+
perf_.treeRecordedCommands,
|
|
1391
|
+
perf_.frameCount);
|
|
1392
|
+
ESP_LOGI(kTag,
|
|
1393
|
+
"replay-split: bg=%lldus dyn=%lldus raster=%lldus [per-frame avg over %d]",
|
|
1394
|
+
(long long)(perf_.treeReplaySplitBgUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1395
|
+
(long long)(perf_.treeReplaySplitDynUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1396
|
+
(long long)(perf_.treeReplaySplitRasterUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1397
|
+
perf_.frameCount);
|
|
1398
|
+
ESP_LOGI(kTag,
|
|
1399
|
+
"replay-detail: direct1=%d directN=%d simple1=%d bgRestore=%lldus nodeWalk=%lldus filter=%lldus/%d clip=%lldus/%d [per-frame avg over %d]",
|
|
1400
|
+
perf_.treeReplayDirectRegionCalls / perf_.frameCount,
|
|
1401
|
+
perf_.treeReplayDirectRegionsCalls / perf_.frameCount,
|
|
1402
|
+
perf_.treeReplaySimpleRegionCalls / perf_.frameCount,
|
|
1403
|
+
(long long)(perf_.treeReplayBgRestoreUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1404
|
+
(long long)(perf_.treeReplayNodeWalkUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1405
|
+
(long long)(perf_.treeReplayCommandFilterUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1406
|
+
perf_.treeReplayCommandFilterCalls / perf_.frameCount,
|
|
1407
|
+
(long long)(perf_.treeReplayCommandClipUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1408
|
+
perf_.treeReplayCommandClipCalls / perf_.frameCount,
|
|
1409
|
+
perf_.frameCount);
|
|
1410
|
+
ESP_LOGI(kTag,
|
|
1411
|
+
"layout-inv: setStyle=%lldus/%dc changed=%d noop=%d layout=%d xform=%d paint=%d setText=%lldus/%dc changed=%d stable=%d hidden=%d marks=dl:%d content:%d node:%d absMode=%lldus/%dc fast=%d full=%d noop=%d dirty=%d reject:%d/%d [avg/sum over %d]",
|
|
1412
|
+
(long long)(perf_.treeSetStyleUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1413
|
+
perf_.treeSetStyleCalls / perf_.frameCount,
|
|
1414
|
+
perf_.treeSetStyleChanged / perf_.frameCount,
|
|
1415
|
+
perf_.treeSetStyleNoop / perf_.frameCount,
|
|
1416
|
+
perf_.treeSetStyleLayoutChanged / perf_.frameCount,
|
|
1417
|
+
perf_.treeSetStyleTransformChanged / perf_.frameCount,
|
|
1418
|
+
perf_.treeSetStylePaintChanged / perf_.frameCount,
|
|
1419
|
+
(long long)(perf_.treeSetTextUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1420
|
+
perf_.treeSetTextCalls / perf_.frameCount,
|
|
1421
|
+
perf_.treeSetTextChanged / perf_.frameCount,
|
|
1422
|
+
perf_.treeSetTextStable / perf_.frameCount,
|
|
1423
|
+
perf_.treeSetTextHidden / perf_.frameCount,
|
|
1424
|
+
perf_.treeMarkDisplayListDirtyCalls / perf_.frameCount,
|
|
1425
|
+
perf_.treeMarkDisplayListContentDirtyCalls / perf_.frameCount,
|
|
1426
|
+
perf_.treeMarkNodeCommandDirtyCalls / perf_.frameCount,
|
|
1427
|
+
(long long)(perf_.treeAbsModeUs / (perf_.frameCount > 0 ? perf_.frameCount : 1)),
|
|
1428
|
+
perf_.treeAbsModeCalls / perf_.frameCount,
|
|
1429
|
+
perf_.treeAbsModeFast / perf_.frameCount,
|
|
1430
|
+
perf_.treeAbsModeFull / perf_.frameCount,
|
|
1431
|
+
perf_.treeAbsModeNoop / perf_.frameCount,
|
|
1432
|
+
perf_.treeAbsModeDirtyNodes / perf_.frameCount,
|
|
1433
|
+
perf_.treeAbsModeRejectNode,
|
|
1434
|
+
perf_.treeAbsModeRejectReason,
|
|
1435
|
+
perf_.frameCount);
|
|
1436
|
+
perf_.reset();
|
|
1437
|
+
#endif
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
TaskHandle_t task_ = nullptr;
|
|
1441
|
+
std::atomic<bool> eventPending_{false};
|
|
1442
|
+
std::atomic<bool> frameInProgress_{false};
|
|
1443
|
+
std::atomic<bool> catchUpFrameDue_{false};
|
|
1444
|
+
// Set true when a frame overran the budget; the event loop runs the next frame
|
|
1445
|
+
// back-to-back (graceful overrun) instead of waiting for the timer's tick.
|
|
1446
|
+
std::atomic<bool> catchUpRequest_{false};
|
|
1447
|
+
// Set by the display backend when TE-vsync is enabled. In this mode the panel's TE
|
|
1448
|
+
// edge is the SOLE frame producer (teEdgeIsr → notifyVsyncFromISR), and the timer
|
|
1449
|
+
// below stops posting frames. See FrameScheduler::setVsyncDriven / notifyVsyncFromISR.
|
|
1450
|
+
std::atomic<bool> vsyncDriven_{false};
|
|
1451
|
+
// µs (32-bit, wrap-safe) of the last TE-driven frame post, written by the TE ISR.
|
|
1452
|
+
// The timer reads it to fall back to timer-posting only if the TE has gone silent.
|
|
1453
|
+
std::atomic<uint32_t> lastVsyncPostUs_{0};
|
|
1454
|
+
std::atomic<int> frameStartedMs_{0};
|
|
1455
|
+
int64_t lastFrameStartUs_ = 0;
|
|
1456
|
+
int64_t lastActiveFrameStartUs_ = 0;
|
|
1457
|
+
int64_t lastActiveFrameDoneUs_ = 0;
|
|
1458
|
+
int catchUpBurstFrames_ = 0;
|
|
1459
|
+
int watchdogLastMs_ = 0;
|
|
1460
|
+
std::atomic<std::uint32_t> frameSequence_{0};
|
|
1461
|
+
std::atomic<int> frameStage_{static_cast<int>(FrameStage::Idle)};
|
|
1462
|
+
std::atomic<int> timerTickCount_{0};
|
|
1463
|
+
std::atomic<int> timerQueueCount_{0};
|
|
1464
|
+
std::atomic<int> timerPendingSkipCount_{0};
|
|
1465
|
+
std::atomic<int> timerInProgressCount_{0};
|
|
1466
|
+
std::atomic<int> timerSendFailCount_{0};
|
|
1467
|
+
StaticQueue_t eventQueueStorage_{};
|
|
1468
|
+
std::uint8_t eventQueueBuffer_[FrameScheduler::kEventQueueDepth * sizeof(gea::framework::events::Event)]{};
|
|
1469
|
+
#if GEA_EMBEDDED_FRAME_SCHEDULER_USE_ESP_TIMER
|
|
1470
|
+
esp_timer_handle_t timer_ = nullptr;
|
|
1471
|
+
int64_t timerIntervalUs_ = 0;
|
|
1472
|
+
bool timerRunning_ = false;
|
|
1473
|
+
#else
|
|
1474
|
+
StaticTask_t taskStorage_{};
|
|
1475
|
+
#if GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL
|
|
1476
|
+
StackType_t *taskStack_ = nullptr; // external RAM, allocated in start()
|
|
1477
|
+
#else
|
|
1478
|
+
StackType_t taskStack_[kTaskStackWords]{};
|
|
1479
|
+
#endif
|
|
1480
|
+
#endif
|
|
1481
|
+
QueueHandle_t eventQueue_ = nullptr;
|
|
1482
|
+
std::atomic<int64_t> frameIntervalUs_{FrameScheduler::kDefaultFrameIntervalUs};
|
|
1483
|
+
PerfWindow perf_{};
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
} // namespace
|
|
1487
|
+
|
|
1488
|
+
// [DIAG A/B] read by the renderer's fused-gradient-blend gate (weak symbol in render.cpp).
|
|
1489
|
+
extern "C" int gea_diag_ab_phase() { return g_diagAbPhase; }
|
|
1490
|
+
|
|
1491
|
+
EventQueue FrameScheduler::createEventQueue()
|
|
1492
|
+
{
|
|
1493
|
+
return FrameSchedulerEngine::instance().createEventQueue();
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
EventQueue FrameScheduler::eventQueue()
|
|
1497
|
+
{
|
|
1498
|
+
return FrameSchedulerEngine::instance().eventQueue();
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
bool FrameScheduler::sendEvent(const gea::framework::events::Event &event, int waitMs)
|
|
1502
|
+
{
|
|
1503
|
+
return FrameSchedulerEngine::instance().sendEvent(event, waitMs);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
bool FrameScheduler::receiveEvent(gea::framework::events::Event *event)
|
|
1507
|
+
{
|
|
1508
|
+
return FrameSchedulerEngine::instance().receiveEvent(event);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
int FrameScheduler::nowMs()
|
|
1512
|
+
{
|
|
1513
|
+
return static_cast<int>(esp_timer_get_time() / 1000);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
void FrameScheduler::start(EventQueue queue)
|
|
1517
|
+
{
|
|
1518
|
+
FrameSchedulerEngine::instance().start(queue);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
void FrameScheduler::runFrame(const FrameCallbacks &callbacks)
|
|
1522
|
+
{
|
|
1523
|
+
FrameSchedulerEngine::instance().runFrame(callbacks);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
bool FrameScheduler::takeCatchUpRequest()
|
|
1527
|
+
{
|
|
1528
|
+
return FrameSchedulerEngine::instance().takeCatchUpRequest();
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
bool FrameScheduler::drainFramesAndCheckInput()
|
|
1532
|
+
{
|
|
1533
|
+
return FrameSchedulerEngine::instance().drainFramesAndCheckInput();
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
void FrameScheduler::setVsyncDriven(bool driven)
|
|
1537
|
+
{
|
|
1538
|
+
FrameSchedulerEngine::instance().setVsyncDriven(driven);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
bool FrameScheduler::vsyncDriven()
|
|
1542
|
+
{
|
|
1543
|
+
return FrameSchedulerEngine::instance().vsyncDriven();
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
void FrameScheduler::notifyVsyncFromISR()
|
|
1547
|
+
{
|
|
1548
|
+
FrameSchedulerEngine::instance().notifyVsyncFromISR();
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
void FrameScheduler::setFrameIntervalMs(int intervalMs)
|
|
1552
|
+
{
|
|
1553
|
+
FrameSchedulerEngine::instance().setFrameIntervalMs(intervalMs);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
int FrameScheduler::frameIntervalMs()
|
|
1557
|
+
{
|
|
1558
|
+
return FrameSchedulerEngine::instance().frameIntervalMs();
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
void FrameScheduler::setFrameRate(double fps)
|
|
1562
|
+
{
|
|
1563
|
+
FrameSchedulerEngine::instance().setFrameRate(fps);
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
double FrameScheduler::frameRate()
|
|
1567
|
+
{
|
|
1568
|
+
return FrameSchedulerEngine::instance().frameRate();
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
} // namespace gea::framework::services
|