You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: RGBW/RGBWW pixel paths linked into RGB-only sketches (~1.5 KB on ESP32) #4795
SPI sketches: they additionally link loadAndScaleRGBWUnordered and rgb_2_rgbww_user_function.
Proposed fix
Find what makes these reachable when RGBW is never enabled, likely the PixelControllerVtable storing every loader or the LegacySettings::rgbw() dispatch. Only install the RGBW/RGBWW loaders when setRgbw() or the RGBWW API is actually called (link-on-use, same idea as the clockless encoder sub-issue).
Acceptance
These symbols are absent from Blink and APA102 maps on esp32dev and S3.
Investigated during the #4801 pass; deferred as it needs a design change, not a local fix.
Why it's linked:PixelIterator's constructor (src/fl/chipsets/encoders/pixel_iterator.h) takes the address of RgbwLoadBinder<T>'s RGBW/RGBWW thunks for every source type. The encoders (writeWS2812 and friends) branch on Rgbw::active() at runtime, so ScaledPixelIteratorRGBW(W)::advance, rgbww_partial_reorder and the thunks are always reachable.
Why the obvious fix doesn't work: RGBW can't be derived from the already-bound loadAndScaleRGB thunk. PixelController::loadAndScaleRGBWUnordered reads raw mData with premixed scaling and no dithering, while loadAndScaleRGB dithers, so the output bytes would differ.
Workable direction:
Replace the per-type RGBW/RGBWW thunks with one tiny per-type "raw pixel + premixed scale" thunk, and do rgb_2_rgbw/rgb_2_rgbww plus the reorder in the type-erased layer.
Second attempt (2026-10-09). Measured on master 50c99f0210 esp32dev Blink: about 2.0 KB of RGBW/RGBWW code is still linked. That includes PixelControllerVtable::loadAndScaleRGBW (296 B) and loadAndScaleRGBWW (219 B), ScaledPixelIteratorRGBW(W)::advance (175/219 B), the rgb_2_rgbw_* modes and rgbw(w)_partial_reorder. The call graph is PixelIterator::writeWS2812 → runtime mRgbww.active() / mRgbw.active() branches, plus thunk addresses taken in the PixelIterator constructor.
I tried gating a link-on-use hook at the point RGBW becomes active, and it isn't viable without an API change:
a default-constructed Rgbw is active (kRGBWExactColors), and RgbwInvalid derives from Rgbw, so a constructor hook fires in every sketch;
rgbw_mode is a public field, so RGBW can be switched on by assignment with no hook;
setRgbw() is not the only entry point (Channel options, LegacySettings).
Prerequisite: encapsulate Rgbw/Rgbww activation (a private mode with a setter), then install the RGBW encode path from that setter. Land it with byte-exact golden tests across colour orders and W placements.
Activity
zackees commentedon Oct 9, 2026
Investigated during the #4801 pass; deferred as it needs a design change, not a local fix.
Why it's linked:
PixelIterator's constructor (src/fl/chipsets/encoders/pixel_iterator.h) takes the address ofRgbwLoadBinder<T>'s RGBW/RGBWW thunks for every source type. The encoders (writeWS2812and friends) branch onRgbw::active()at runtime, soScaledPixelIteratorRGBW(W)::advance,rgbww_partial_reorderand the thunks are always reachable.Why the obvious fix doesn't work: RGBW can't be derived from the already-bound
loadAndScaleRGBthunk.PixelController::loadAndScaleRGBWUnorderedreads rawmDatawithpremixedscaling and no dithering, whileloadAndScaleRGBdithers, so the output bytes would differ.Workable direction:
rgb_2_rgbw/rgb_2_rgbwwplus the reorder in the type-erased layer.CLEDController::setRgbw()/ the RGBWW setter (link-on-use, same pattern as perf(esp32): APA102 SPI sketches link the clockless half of the unified FLEX_IO engine (~8-10 KB flash) #4793), so RGB-only programs never name them.This needs byte-exact golden tests for every colour order and W placement before landing.
zackees commentedon Oct 9, 2026
Second attempt (2026-10-09). Measured on master
50c99f0210esp32dev Blink: about 2.0 KB of RGBW/RGBWW code is still linked. That includesPixelControllerVtable::loadAndScaleRGBW(296 B) andloadAndScaleRGBWW(219 B),ScaledPixelIteratorRGBW(W)::advance(175/219 B), thergb_2_rgbw_*modes andrgbw(w)_partial_reorder. The call graph isPixelIterator::writeWS2812→ runtimemRgbww.active()/mRgbw.active()branches, plus thunk addresses taken in thePixelIteratorconstructor.I tried gating a link-on-use hook at the point RGBW becomes active, and it isn't viable without an API change:
Rgbwis active (kRGBWExactColors), andRgbwInvalidderives fromRgbw, so a constructor hook fires in every sketch;rgbw_modeis a public field, so RGBW can be switched on by assignment with no hook;setRgbw()is not the only entry point (Channel options,LegacySettings).Prerequisite: encapsulate
Rgbw/Rgbwwactivation (a private mode with a setter), then install the RGBW encode path from that setter. Land it with byte-exact golden tests across colour orders and W placements.zackees commentedon Oct 9, 2026
The prerequisite API change is now tracked separately in #4815.
fix(rgbw): review fixes for type-erased RGBW (#4795)
fix(rgbw): install the conversion for active white config set via Cha…
perf(rgbw): type-erased, link-on-use RGBW/RGBWW in PixelIterator (~1 …