embassy-rs/embassy · error
Selected output pixel format not supported
Error message
Selected output pixel format not supported
What it means
The Into<vals::OpfccrCm> conversion maps the typed PixelFormat enum to the DMA2D output-color-model register bits; the wildcard arm was reached with a variant (such as a YCbCr format, only accepted by background/foreground layers on dma2d_v2 hardware) that the output layer cannot express, so the conversion panics rather than produce a wrong register value.
Solutions
- Set the output format to one of Argb8888, Rgb888, Rgb565, Argb1555, Argb4444.
- Use a different PixelFormat for the output layer than restricted input formats.
Example fix
// before let out = OutputLayer::new(&mut dma2d, buf, layout, PixelFormat::A4); // after let out = OutputLayer::new(&mut dma2d, buf, layout, PixelFormat::Argb8888);
Defensive patterns
Strategy: validation
Validate before calling
fn assert_output_format(f: PixelFormat) {
assert!(matches!(f, PixelFormat::Argb8888 | PixelFormat::Rgb888 | PixelFormat::Rgb565 | PixelFormat::Argb1555 | PixelFormat::Argb4444),
"format not supported as DMA2D output");
} Type guard
fn is_output_pixel_format(f: PixelFormat) -> bool { matches!(f, PixelFormat::Argb8888 | PixelFormat::Rgb888 | PixelFormat::Rgb565 | PixelFormat::Argb1555 | PixelFormat::Argb4444) } Prevention
- Use only the five output-capable formats for the destination layer.
- Assert output format validity at display-init time.
When it happens
Trigger: Setting the DMA2D output/framebuffer pixel format with L4, A8, A4, AL44, AL88, or a YCbCr variant via the Into<OpfccrCm> conversion during display configuration.
Common situations: Reusing an input-layer pixel format constant for the output layer; misreading docs where L8/L4/A8 are legal as inputs but not outputs.
Related errors
- YCbCr pixel format not supported for background buffer
- Flexable pixels are not yet implemented
- Can only take the executor once
- Invalid FilterConfig (TooManyFilters)! A FilterConfig must…
- Invalid FilterConfig (EmptyFilterConfig)! A FilterConfig…
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/920211b4a74abf33.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/src/dma2d/mod.rs:226
PixelFormat::AL88 => vals::BgpfccrCm::Al88,
PixelFormat::L4 => vals::BgpfccrCm::L4,
PixelFormat::A8 => vals::BgpfccrCm::A8,
PixelFormat::A4 => vals::BgpfccrCm::A4,
#[cfg(dma2d_v2)]
_ => panic!("YCbCr pixel format not supported for background buffer"),
}
}
}
impl Into<vals::OpfccrCm> for PixelFormat {
fn into(self) -> vals::OpfccrCm {
match self {
PixelFormat::Argb8888 => vals::OpfccrCm::Argb8888,
PixelFormat::Rgb888 => vals::OpfccrCm::Rgb888,
PixelFormat::Rgb565 => vals::OpfccrCm::Rgb565,
PixelFormat::Argb1555 => vals::OpfccrCm::Argb1555,
PixelFormat::Argb4444 => vals::OpfccrCm::Argb4444,
_ => panic!("Selected output pixel format not supported"),
}
}
}
/// Input buffer alpha Mode
#[derive(Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AlphaMode {
/// Do not modify alpha
NoModify,
/// Replace alpha
Replace(u8),
/// Multiply alpha
Multiply(u8),
}
impl Into<vals::FgpfccrAm> for AlphaMode {
fn into(self) -> vals::FgpfccrAm {View on GitHub (pinned to 463a07b963)