Repository navigation
feat(rmt5): switch DMA off automatically for short strips - #5228
Merged
Merged
Conversation
#5166 added FL_RMT5_USE_DMA=0 as a build-wide opt-out, but the default still gave every ESP32-S3 TX channel the single DMA slot, and with it a fixed 4 KB DMA-capable internal-RAM block, even for a 12-LED strip. Even with DMA enabled the driver now only takes the DMA channel when the encoded frame is longer than FL_RMT5_DMA_MIN_SYMBOLS (default 1024 symbols, one DMA block, ~42 WS2812 RGB LEDs). Below that the frame cannot be streamed faster than the block already allows, so DMA only spends heap: the channel falls back to the double-buffered on-chip RMT path that non-S3 chips use. - FL_RMT5_DMA_AUTO=0 restores 'always DMA when the hardware supports it'. - FL_RMT5_USE_DMA=0 still forces non-DMA everywhere. - The stub memory manager gains setDMAHardwareAvailable() so host tests can exercise the decision; three tests cover short, long and no-DMA-hardware. - Documented in src/platforms/esp/32/README.md.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 3 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
Memory usage (this PR vs. its merge base)Change in
|
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
#5166 added
FL_RMT5_USE_DMA=0, but the default still gives every ESP32-S3 TX channelthe single DMA slot — and with it a fixed 4 KB DMA-capable internal-RAM block — even for
a 12-LED strip. This makes the short-strip case the default instead of an opt-in.
The driver now only takes the DMA channel when the encoded frame is longer than
FL_RMT5_DMA_MIN_SYMBOLS(default 1024 symbols, i.e. one DMA block, about 42 WS2812RGB LEDs). Below that the frame cannot be streamed faster than the block already allows,
so DMA only spends heap; the channel stays on the double-buffered on-chip RMT path that
non-S3 chips already use.
Knobs
FL_RMT5_DMA_AUTO(default1) — set0to restore "always DMA when the hardwaresupports it".
FL_RMT5_DMA_MIN_SYMBOLS(default1024) — the cutoff.FL_RMT5_USE_DMA=0— unchanged, still forces non-DMA for every TX/RX channel.Why 1024
ESP-IDF's RMT docs for
rmt_tx_channel_config_t::mem_block_symbols: "If the DMA isenabled ... this field controls the size of the internal DMA buffer ... you can set a
larger value, e.g.,
1024. If DMA is not used, this field controls the size of thededicated memory block owned by the channel." So the block size is the natural cutoff:
past it, streaming pays for the heap; below it, it does not. FastLED's encoder emits one
RMT symbol per encoded bit, so symbols = pixel bytes * 8.
Tests
bash test channel_driver_rmt --cpp --clean— 18 cases pass. Three new ones:The stub memory manager gained
setDMAHardwareAvailable()so the host build can exercisethe decision; it defaults to
false, so existing tests are unaffected.bash lint --cppclean.Not addressed here
With DMA still on for long strips the block remains a fixed 1024 symbols rather than
sized to the frame, and the ~3.7 KB of driver registry / channel manager / buffer pool is
untouched. Those are separate follow-ups on #5161.
Closes #5227. Ref #5161.