{"record":{"id":"920211b4a74abf33","repo":"embassy-rs/embassy","slug":"selected-output-pixel-format-not-supported","errorCode":null,"errorMessage":"Selected output pixel format not supported","messagePattern":"Selected output pixel format not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/dma2d/mod.rs","lineNumber":226,"sourceCode":"            PixelFormat::AL88 => vals::BgpfccrCm::Al88,\n            PixelFormat::L4 => vals::BgpfccrCm::L4,\n            PixelFormat::A8 => vals::BgpfccrCm::A8,\n            PixelFormat::A4 => vals::BgpfccrCm::A4,\n            #[cfg(dma2d_v2)]\n            _ => panic!(\"YCbCr pixel format not supported for background buffer\"),\n        }\n    }\n}\n\nimpl Into<vals::OpfccrCm> for PixelFormat {\n    fn into(self) -> vals::OpfccrCm {\n        match self {\n            PixelFormat::Argb8888 => vals::OpfccrCm::Argb8888,\n            PixelFormat::Rgb888 => vals::OpfccrCm::Rgb888,\n            PixelFormat::Rgb565 => vals::OpfccrCm::Rgb565,\n            PixelFormat::Argb1555 => vals::OpfccrCm::Argb1555,\n            PixelFormat::Argb4444 => vals::OpfccrCm::Argb4444,\n            _ => panic!(\"Selected output pixel format not supported\"),\n        }\n    }\n}\n\n/// Input buffer alpha Mode\n#[derive(Clone, Copy)]\n#[cfg_attr(feature = \"defmt\", derive(defmt::Format))]\npub enum AlphaMode {\n    /// Do not modify alpha\n    NoModify,\n    /// Replace alpha\n    Replace(u8),\n    /// Multiply alpha\n    Multiply(u8),\n}\n\nimpl Into<vals::FgpfccrAm> for AlphaMode {\n    fn into(self) -> vals::FgpfccrAm {","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/dma2d/mod.rs#L208-L244","documentation":"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.","triggerScenarios":"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.","commonSituations":"Reusing an input-layer pixel format constant for the output layer; misreading docs where L8/L4/A8 are legal as inputs but not outputs.","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."],"exampleFix":"// before\nlet out = OutputLayer::new(&mut dma2d, buf, layout, PixelFormat::A4);\n// after\nlet out = OutputLayer::new(&mut dma2d, buf, layout, PixelFormat::Argb8888);","handlingStrategy":"validation","validationCode":"fn assert_output_format(f: PixelFormat) {\n    assert!(matches!(f, PixelFormat::Argb8888 | PixelFormat::Rgb888 | PixelFormat::Rgb565 | PixelFormat::Argb1555 | PixelFormat::Argb4444),\n        \"format not supported as DMA2D output\");\n}","typeGuard":"fn is_output_pixel_format(f: PixelFormat) -> bool { matches!(f, PixelFormat::Argb8888 | PixelFormat::Rgb888 | PixelFormat::Rgb565 | PixelFormat::Argb1555 | PixelFormat::Argb4444) }","tryCatchPattern":null,"preventionTips":["Use only the five output-capable formats for the destination layer.","Assert output format validity at display-init time."],"tags":["embedded","rust","dma2d","graphics"],"backgroundTag":"unsupported-enum-value","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}