Skip to content

fix(m5stack-tab5): wait for the flush's PPA rotation with LVGL's PPA draw unit - #917

Merged
finger563 merged 1 commit into
mainfrom
fix/m5stack-tab5-lvgl-ppa-rotation
Nov 20, 2026
Merged

finger563 merged 1 commit into
mainfrom
fix/m5stack-tab5-lvgl-ppa-rotation

Conversation

@finger563

Copy link
Copy Markdown
Contributor

What

With CONFIG_LV_USE_PPA (LVGL's PPA draw unit), M5StackTab5::flush() runs its PPA rotation blocking (PPA_TRANS_MODE_BLOCKING) instead of leaving it in flight while LVGL draws the next area. The completion callback still signals LVGL as before (complete_transfer()), so nothing else changes. Without LV_USE_PPA the flush is unchanged.

The README gains a section on using LVGL's PPA draw unit with this BSP:

  • the settings it needs: LV_USE_PPA, LV_USE_PPA_IMG, LV_DRAW_BUF_ALIGN=128, and LV_PPA_BURST_LENGTH_64 (short bursts, like the BSP's own client);
  • what it measured on a Tab5 (below).

Why

With the PPA draw unit enabled, LVGL's fills and blends (the PPA's blend engine) ran while the flush's rotation (the SRM engine) was still in flight. On a Tab5 that rotation's completion then stopped arriving, and LVGL waited for the flush forever. A core dump of the hang shows the LVGL task in wait_for_flushing() ← draw_buf_flush() ← refr_invalid_areas(), holding the application's LVGL lock. I did not pin down whether the stalled transaction sits in the 2D-DMA queue or in the hardware. Running the rotation to completion before LVGL draws again avoids the overlap, and the hang with it.

Needs #916 to be useful: without it, LVGL refuses initialize_display()'s draw buffers once LV_DRAW_BUF_ALIGN is 128. The README states that they satisfy it.

Test

M5Stack Tab5 (ESP32-P4 v1.x, ESP-IDF 6.1, LVGL 9.6.0), an application drawing a 1280 x 720 landscape launcher (rotated 90° by the flush's PPA rotation, two 1/10-screen draw buffers in PSRAM). Each run is a scripted 20 s scroll (emulink key presses), with LVGL's refresh times recorded:

Configuration Redraw, average Worst Runs
PPA draw unit, rotation left in flight (before) — — hung in every run (3 scroll runs, and once while idle)
PPA draw unit, rotation blocking (this PR) 88–91 ms 220 ms 3, no hang
No PPA draw unit, rotation blocking 85–88 ms 213 ms 3
No PPA draw unit, rotation left in flight (default, unchanged) 75 ms 166 ms 1

So with this UI the PPA draw unit does not pay off. Each PPA operation syncs the cache over the rows it touches, and waiting for the rotation loses the overlap with drawing; the README says so.

clang-format pre-commit hook passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

…draw unit

With CONFIG_LV_USE_PPA, LVGL's fills and blends (the PPA's blend engine) ran
while the flush's rotation (the SRM engine) was still in flight, and on a Tab5
that rotation's completion then never arrived: LVGL waited in
wait_for_flushing() forever (core dump of a launcher that hung within seconds
of scrolling). With LV_USE_PPA the flush now runs its rotation blocking, so it
finishes before LVGL draws again; the completion callback still signals LVGL
as before. Without LV_USE_PPA nothing changes.

The README documents the settings the PPA draw unit needs with this BSP and
what it measured on a Tab5: no gain over software drawing with the rotation
left in flight (75 ms average redraw, against 88-91 ms with the PPA draw unit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

@finger563
finger563 merged commit c14f415 into main Nov 20, 2026
346 of 348 checks passed
@finger563
finger563 deleted the fix/m5stack-tab5-lvgl-ppa-rotation branch November 20, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant