Repository navigation
Description
Context
This is the canonical umbrella for the ESP32-P4 PARLIO output and timing/performance work. Use this issue as the single cross-referenced tracker for the original slow FastLED.show() report, the complete missing-output detour, fbuild/autoresearch prerequisites, binding diagnostics, and the perf tracing/fix PRs used to narrow the remaining performance behavior.
The original user-visible timing symptom in #2493 was FastLED.show() blocking for 16 ms or more before the WS2812 data burst began. The later complete missing-output failure was split out and fixed by #2513 / #2515. This umbrella now tracks the end-to-end state and the remaining performance question.
Current confirmed state
- PARLIO no-output is fixed on master by fix(esp32p4): route legacy clockless controllers through PARLIO #2515.
- fbuild release and FastLED fbuild pin bump are complete via chore(fbuild): release ESP32-P4 fixes and bump FastLED pin #2514 and chore(fbuild): bump pin to 2.2.7 #2516. fbuild v2.2.7 is released.
- The old
vTaskDelay(1)explanation is not sufficient for the current state because ESP32-P4 wait loops already compile totask::run(0, SYSTEM)after fix(channels): skip vTaskDelay(1) floor in wait-loop on ESP32-P4 (#2493 follow-up) #2503. - Current master was measured around 25 ms steady-state for ESP32-P4 EV, 12 lanes x 256 WS2812B.
- PR fix(parlio): size DMA buffers from per-lane input bytes #2519 narrowed the current performance loss to PARLIO DMA buffer sizing/preparation and reduced the measured case from about 25 ms to about 17 ms.
- Remaining ~17 ms behavior appears to be dominated by the current single-buffer/channel ownership model: the next
show()waits for the prior PARLIO transfer before channel data can be rewritten, then encodes/builds the next DMA waveform. - AutoResearch end-to-end validation is still blocked by serial/RPC/WDT behavior before the PARLIO test can run reliably; track that in agent runbook: get
bash autoresearch esp32p4 --parlioworking end-to-end on the attached EV board #2510. - Binding/disabled-driver diagnostics are tracked separately in fix(channels): emit FL_ERROR when queued LED data has no enabled driver to flush #2517.
Perf tracing and fix PRs
- debug(parlio): #2493 reproducer + FL_PARLIO_PROFILE markers #2494 - earlier PARLIO reproducer plus
FL_PARLIO_PROFILEmarkers. - feat(perf-trace): thread-local push/pop perf tracing + PARLIO sweep instrumentation #2508 - reusable
fl::PerfTrace,FL_PERF_SCOPE, AutoResearch RPC trace hooks, sweep tooling, and PARLIO hot-path instrumentation. Prefer this if more trace work is needed. - fix(parlio): size DMA buffers from per-lane input bytes #2519 - trace-derived PARLIO DMA sizing fix and current hardware measurements.
Measurements
Current-master baseline from the trace/fix pass:
show_min_us=24938
show_avg_us=24993
show_max_us=25069
Trace before the fix showed the time concentrated in PARLIO DMA preparation:
show_total_us=24987
show_on_begin_us=8879
show_internal_us=3574
show_on_end_frame_us=12429
manager_on_end_show_us=12316
parlio_begin_total_us=10912
parlio_populate_us=10690
parlio_ring_capacity=590144
parlio_first_buffer_bytes=36996
parlio_buffers_populated=1
Final production-code hardware timing from #2519:
show_min_us=16963
show_avg_us=16998
show_max_us=17022
samples=40
What remains to decide
For 12 lanes x 256 WS2812B, the expected parallel data burst is roughly 7.7-9 ms depending on reset/latch accounting. After #2519, the measured show() time is roughly prior-frame PARLIO drain plus current-frame channel encoding and DMA waveform generation.
If this design is accepted as the current maximum for the single-buffer architecture, close this issue after #2519 lands and the final state is documented. If lower wall-clock show() time is required, the follow-up design work is broader than the DMA sizing fix: investigate double-buffered channel/DMA ownership so current-frame preparation can overlap the previous PARLIO transfer.
Acceptance criteria
- A current trace accounts for the full measured
show()wall time. - The trace separates
onBeginFramewait,showLedsInternal,onEndFrameflush/wait, and PARLIO begin/populate/poll time. - The trace/fix PRs are linked here for future narrowing: debug(parlio): #2493 reproducer + FL_PARLIO_PROFILE markers #2494, feat(perf-trace): thread-local push/pop perf tracing + PARLIO sweep instrumentation #2508, and fix(parlio): size DMA buffers from per-lane input bytes #2519.
- The no-output fix from fix(esp32p4): route legacy clockless controllers through PARLIO #2515 remains covered and does not regress.
- fbuild prerequisites remain cross-referenced here instead of becoming a competing tracker.
- Binding/disabled-driver diagnostics remain tracked separately in fix(channels): emit FL_ERROR when queued LED data has no enabled driver to flush #2517.
- Final closure either lands fix(parlio): size DMA buffers from per-lane input bytes #2519 as the fix or documents why additional overlap/double-buffering work is required.
Cross references
- Original timing report: ESP32-P4 PARLIO: FastLED.show() appears to block for ~16.7 ms before WS2812 data burst begins #2493
- Current direct timing measurement: ESP32-P4 PARLIO: FastLED.show() appears to block for ~16.7 ms before WS2812 data burst begins #2493 (comment)
- Earlier perf marker PR: debug(parlio): #2493 reproducer + FL_PARLIO_PROFILE markers #2494
- Reusable perf trace PR: feat(perf-trace): thread-local push/pop perf tracing + PARLIO sweep instrumentation #2508
- Current trace-derived fix PR: fix(parlio): size DMA buffers from per-lane input bytes #2519
- Wait-loop mitigation already merged: fix(channels): skip vTaskDelay(1) floor in wait-loop on ESP32-P4 (#2493 follow-up) #2503
- AutoResearch runbook/blocker: agent runbook: get
bash autoresearch esp32p4 --parlioworking end-to-end on the attached EV board #2510 and fbuild:bash autoresearch esp32p4 --parliofails to build (WString.h / soc_caps.h missing, zccache hang) #2507 - No-output issue and fix: bug(esp32p4): PARLIO produces no LED output on recent master #2513 and fix(esp32p4): route legacy clockless controllers through PARLIO #2515
- fbuild release and FastLED bump: chore(fbuild): release ESP32-P4 fixes and bump FastLED pin #2514 and chore(fbuild): bump pin to 2.2.7 #2516
- fbuild related PRs: fix(esp32): strip Windows UNC prefix + collect .S/.s assembly sources (FastLED #2507) fbuild#273, chore: release v2.2.7 fbuild#276, ci: build Linux musl releases with zigbuild fbuild#277
- fbuild v2.2.7 release: https://github.com/FastLED/fbuild/releases/tag/v2.2.7
- Binding/driver failure diagnostic issue: fix(channels): emit FL_ERROR when queued LED data has no enabled driver to flush #2517
Activity
zackees commentedon May 28, 2026
Coordination note from
cludfor @zackees:This is the canonical umbrella issue for the current ESP32-P4 PARLIO work. It should be the single place to narrow the remaining performance issue, while the already split/fixed prerequisites stay cross-referenced instead of becoming competing tracking issues.
Perf tracing PRs to use for narrowing the current ~24 ms steady-state
FastLED.show()time:FL_PARLIO_PROFILEmarkers.fl::PerfTrace,FL_PERF_SCOPE, AutoResearch RPC trace hooks, sweep tooling, and PARLIO hot-path instrumentation. Prefer this for the current trace pass.Related prerequisites and adjacent fixes:
bash autoresearch esp32p4 --parlioworking end-to-end on the attached EV board #2510 and fbuild:bash autoresearch esp32p4 --parliofails to build (WString.h / soc_caps.h missing, zccache hang) #2507Next narrowing step: use #2508 if possible, or extract a minimal flash-dump trace path if AutoResearch remains blocked, and produce a current trace that separates
onBeginFrame,showLedsInternal,onEndFrame, driver wait/poll, and PARLIO begin/submit/callback/poll time.zackees commentedon May 28, 2026
cludfor @zackees update:I traced the current ESP32-P4 PARLIO 12 x 256 case and opened the fix PR here:
#2519
Current-master baseline from the flash-backed timing sketch was still about 25 ms:
The trace narrowed the missing time to PARLIO DMA preparation, not the old 16 ms scheduler wait:
Root cause: the PARLIO ring-buffer calculator used
maxLedsPerChannel * 3 * dataWidthas the input byte count even though the engine streams per-lane byte positions andoutputBytesPerInputByte()already accounts fordataWidth. For 12 x 256 WS2812B this allocated a ~590 KB DMA buffer for a 36,996-byte encoded frame, and the hot path paid that cost each frame.PR #2519 fixes the per-lane sizing, fixes chunk alignment to 3 RGB bytes instead of
3 * dataWidth, and zeroes only explicit padding regions. Final production-code hardware timing after the fix:Verification run:
bash test platforms/esp/32/drivers/parlio/parlio_driver --cppPLATFORMIO_SRC_DIR=examples/Blink uv run pio run -e esp32p4bash autoresearch esp32p4 --parlioworking end-to-end on the attached EV board #2510Remaining behavior note: after this fix, the steady-state
show()time is roughly prior-frame PARLIO drain (~8.9 ms in trace) plus current-frame channel encoding and DMA waveform generation. Getting materially below this would require a broader design change such as double-buffered channel/DMA ownership so current-frame preparation can overlap the previous PARLIO transfer.[-]perf(parlio): umbrella for ESP32-P4 show timing regression and trace narrowing[/-][+]perf(parlio): umbrella for ESP32-P4 PARLIO output and show timing work[/+]zackees commentedon May 28, 2026
cludfor @zackees — ESP32-P4 PARLIOshow()timing, measured live on the attached EV board (autoresearch RPCmeasureParlio, fixed #2519 firmware, debug build). Separatesshow()(encode) fromwait()(DMA wire drain).It's encoder-bound, not wire-bound
show_us(encode)wait_us(wire drain)wait_us= WS2812 wire drain — depends only on LEDs/lane (lanes transmit in parallel): 256/lane → ~6.3ms regardless of lane count; 128 → 3.1ms; 64 → 1.6ms. This matches the protocol math (~120–150fps wire); a single 1×256 lane hits ~127fps total.show_us= CPU waveform encode — scales with total LEDs across all lanes (~6µs/LED in debug): 256 → 1.4ms … 4096 → 25.4ms. At 16×256 the encode (25ms) dwarfs the wire (6.3ms) ⇒ ~31fps, encoder-bound.So the ~25ms
show()for 16×256 is encode + wire serialized, not a wire limit. (Release-O2encode is ~3× faster; the earlier "production" 17ms figure ≈ ~8ms encode + ~9ms drain.)Architectural factoids (confirmed in
parlio_engine.cpp.hpp)DMA seam + late callback. PARLIO has a ~20µs inter-buffer DMA seam (documented in
parlio_buffer_calc.h), andtxDoneCallbackis ISR-driven — it fires ~20µs late rather than instantly. Across buffer boundaries this corrupts WS2812 timing, which is exactly why fix(parlio): size DMA buffers from per-lane input bytes #2519 sizes the ring so the full frame fits in one buffer (one clean continuous DMA, no seam).No next-buffer pre-staging in the single-buffer path. In the full-frame single-buffer mode fix(parlio): size DMA buffers from per-lane input bytes #2519 selects for frames that fit (the common case),
show()pre-populates/encodes the entire frame synchronously before starting DMA (thewhile (hasRingSpace() && populateNextDMABuffer())loop at ~L1819), then transmits; the next frame is re-encoded from scratch on the nextshow(). There is no frame-level double-buffering — encode latency is fully exposed and serialized ahead of transmission. (The multi-ring-buffer streaming path does refill chunk buffers from the ISR, overlapping encode with transmit, but pays the ~20µs seam per boundary — so it trades correctness for overlap.)Design intent — hide encode behind transmission (not yet implemented). The encoder for frame N+1 should run after the pre-computed buffer for frame N is sent, so encode latency is hidden inside the transmission window. With frame-level ping-pong double-buffering (two full-frame buffers): submit buffer A (one clean DMA, no seam) → encode buffer B during A's ~6ms transmit → swap. Throughput →
max(encode, wire)instead ofencode + wire, and the ~20µs late-callback seam becomes irrelevant because the next buffer is already staged. For 16×256 in release this moves the ~17ms serialized figure toward the ~6–8ms wire floor (final gate = encode time, which then wants SIMD / multi-core).Coordination / next round
0x0→0x2000; eco5→eco2 ROM-script selection) should be implemented by a dedicated sub-agent and pushed as a PR to FastLED/fbuild — not hand-applied here.ARDUINO_USB_CDC_ON_BOOT=1+ ameasureParlioprobe RPC) is on local branchfeat/autoresearch-esp32p4-hwcdc; ready to push as its own PR (resolves agent runbook: getbash autoresearch esp32p4 --parlioworking end-to-end on the attached EV board #2510 blocker 3).zackees commentedon May 28, 2026
Correction / sharpening (per @zackees): the intended design is that
show()encodes only the first batch of ring buffers and the ISR encodes the remaining chunks during transmission (txDoneCallback→workerIsrCallback/populateNextDMABuffer), so encode latency hides inside the transmission gap. My previous comment understated this — the chunked-ISR-encode path is the design, not just a "multi-buffer alternative."The problem: that overlap is not engaging after #2519, and the data proves it.
#2519 sizes the ring so the whole frame fits in one buffer (to avoid the ~20µs seam). Consequence: for frames that fit (the common case),
show()'s pre-populate loop encodes the entire frame into that single buffer before DMA starts, and the ISR has nothing left to chunk-encode. Evidence:parlio_buffers_populated=1(12×256) — one buffer holds the full frame.show_us= 25.4ms scales with total LEDs (full-frame encode), whilewait_us= 6.3ms is pure wire drain with no encode interleaved. If the ISR were chunk-encoding during TX,wait_uswould carry encode time andshow_uswould be a fraction of the frame — it isn't.So today, on frames that fit in one buffer, encode is fully serialized ahead of transmission (
show() = full encode, thenwait() = full wire), not chunked/overlapped. This needs to be fixed so it matches the intended design.Fix direction (needs design decision): the two goals — "one continuous buffer (no seam)" and "chunked ISR encode overlapping TX" — currently conflict, because making the frame one buffer removes the chunk boundaries the ISR would encode at. Options:
max(encode, wire).Either way the requirement is the same:
show()must not encode the full transmission sequence — the encoder must run during the transmission window. Right now it doesn't, for single-buffer frames.(Measurement firmware: branch
feat/autoresearch-esp32p4-hwcdc; themeasureParlioRPC reportsshow_us/wait_usand SRAM/PSRAM deltas. fbuild ESP32-P4 boot fixes per FastLED/fbuild#278 to be implemented in a sub-agent and pushed.)zackees commentedon May 28, 2026
ESP32-P4 PARLIO show() performance — state report, memory/speed/seam analysis
Measured live on the attached ESP32-P4-EV via the autoresearch RPC (
measureParlio), fixed #2519 firmware. Decomposesshow()into encode (CPU) andwait()into wire drain (DMA). Debug build — absolute µs are ~3× a release-O2build; ratios and scaling laws hold.1. Perf decomposition (measured)
show_us(encode)wait_us(wire)show()andwait()are serialized → frame_time = encode + wire. Encode dominates ≥8 lanes.2. Memory model (analytic, corroborated)
The engine allocates 3 DMA ring buffers, each sized to the full frame (
parlio_engine.cpp.hppL1089-1093). Per-frame bytes (Wave3):e.g. 16×256 → 256×3×48 + 132 = 36,996 B/frame; ring total = 3 × 37,124 ≈ 109 KB.
#2519 picks the single-buffer (seam-free) path when
frame_bytes ≤ cap/3. P4 caps: 512 KB SRAM / 2 MB PSRAM (ring lives in PSRAM here). Max seam-free frame:Seam-free memory grows with
leds × dataWidth(lanes). Below these limits (the common case) a whole frame fits one buffer → one continuous DMA → no seam. Above them the frame must be chunked across buffers → seams.3. The 20µs transmission-gap (seam) tradeoff vs lane/LED count
txDoneCallbackfires ISR-late (not instant). Each chunk boundary inserts one seam.(K-1)×20µsadded to wire — small (e.g. 10 chunks ≈ +180µs ≈ +3% on a 6ms frame).∝ leds × dataWidth; onceleds × dataWidthexceedscap/3(large installs, e.g. >~4,850 leds/lane at 16 lanes in PSRAM) you are forced to chunk and accept seams. So lane count and LED count push you toward the memory ceiling; crossing it forces the speed/correctness compromise of seams.4. Maximum perf for the current memory parameters
The driver already allocates 3 full-frame buffers but transmits from only 1 in single-buffer mode — buffers 1 & 2 are paid for but idle. So throughput can be raised with no additional memory:
Approach A — frame-level ping-pong double-buffer (uses 2 of the existing 3 buffers): submit frame N (one clean seam-free DMA) → encode frame N+1 into the other buffer during N's transmission → swap. Frame_time → max(encode, wire) instead of encode + wire. No intra-frame seam (per-frame DMA shape identical to the #2519-validated single-buffer case).
Expected (16×256): debug 31ms→~25ms (encode-bound, +24%); release
14ms→8ms ≈ ~125fps (overlap roughly doubles fps when encode≈wire). Beyond this, the system is encode-bound — further gains need a faster encoder (SIMD / second core), which is orthogonal to memory.5. Recommendation / status
beginTransmission(L1726-1900: replace the encode-everything loop L1819 with single-slot encode + deferred submit + slot swap), with the ISR refill path effectively inert (reduces the existingmRingCountrace surface).Measurement firmware +
measureParlioprobe: branchfeat/autoresearch-esp32p4-hwcdc. fbuild P4 boot fixes (FastLED/fbuild#278) to be implemented in a sub-agent and pushed. Autoresearch RPC docs drift filed as #2520.zackees commentedon May 28, 2026
Implementation result — Approach A built + hardware-tested → does NOT pipeline (revises the +24% projection)
Implemented the frame-level ping-pong overlap (Approach A) on the attached ESP32-P4 and measured it directly. It does not reduce per-frame time. Draft PR: #2521 (do-not-merge).
Measurement (16×256, debug build, via
measureParliowith a newpipelined_per_frame_usmetric)A tight
show()-only loop (the case the overlap should help) gives the same per-frame time as serializedshow()+wait(). Everyshow()still pays encode(~25ms) + wire(~6ms): frame N-1's DMA is not draining during frame N's encode.Root cause (the key finding)
ParlioEngine::beginTransmission()performs a mandatory per-framedisable()/enable()of the PARLIO peripheral — documented in-code as required to reset the DMA state machine, "without this, consecutive transmissions with the same config silently fail (0 bytes output)." That teardown serializes frames at the hardware level: the peripheral cannot keep transmitting frame N-1 while it is being reconfigured/re-enabled for frame N. Ping-pong buffering alone cannot overcome this — the bottleneck is the peripheral reset, not the buffer count.Revised conclusion
disable()/enable()so the peripheral can pipeline consecutive frames (this is the actual blocker; it interacts with the same DMA-seam/reset constraints discussed above). Failing that, the remaining lever is a faster encoder (SIMD / second core), which is orthogonal to memory.Status / caveats
show()iterations stable, identical memory footprint.pipelined_per_frame_usprobe are preserved onfeat/parlio-pingpong-overlap/ WIP perf(parlio): frame-level ping-pong overlap (negative result — does not pipeline; refs #2518) #2521 for the follow-up that tackles the disable/enable serialization.