pipeline: rpi: Derive RAW stream Bayer order from the selected sensor mode - #1
Open
santiagobarros wants to merge 1 commit into
Conversation
… mode
The IMX900 uses a different Bayer order per mode (binned 1032x776 = GBRG,
full-resolution 2064x1552 = RGGB). RPiCameraConfiguration::validate() sets the
RAW stream's Bayer order from sensor_->bayerOrder(combinedTransform_), i.e. the
sensor's single assumed native order, which libcamera takes from the
first-enumerated mbus code (SGBRG12, GBRG). At full resolution findBestFormat()
correctly selects the RGGB mode, but the RAW stream order stays GBRG, so the CFE
output node is configured with PC1g (GBRG) while the CSI2 source pad is RGGB.
The RP1 CFE then rejects the pipeline at stream-on:
rp1-cfe: Format mismatch!
/dev/video7: Failed to start streaming: Invalid argument
This breaks every capture wider than the binned mode.
Derive the RAW stream Bayer order from the actually-selected sensor mode
(sensorFormat_.code), which is exactly what the CFE source pad carries, instead
of the assumed single native order. Full-res then selects PC1R (RGGB) and link
validation passes; the binned mode continues to use PC1g.
Verified on IMX900 (Framos FSM:GO) on Raspberry Pi 5, Raspberry Pi OS trixie,
kernel 6.18.29+rpt-rpi-2712: full-res 2064x1552 JPEG + RAW capture now succeed.
Signed-off-by: Santiago Barros <santiagobarros@gmail.com>
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.
Reported in framosimaging/framos-rpi-drivers#6
Problem
The IMX900 uses a different Bayer order per mode (binned 1032×776 = GBRG,
full-resolution 2064×1552 = RGGB).
RPiCameraConfiguration::validate()sets theRAW stream's Bayer order from
sensor_->bayerOrder(combinedTransform_), i.e. thesensor's single assumed native order, which libcamera takes from the
first-enumerated mbus code (
SGBRG12, GBRG). At full resolutionfindBestFormat()correctly selects the RGGB mode, but the RAW stream order stays GBRG, so the CFE
output node is configured with
PC1g(GBRG) while the CSI2 source pad is RGGB.The RP1 CFE then rejects the pipeline at stream-on:
This breaks every capture wider than the binned mode (
rpicam-still/rpicam-rawat 1920×1080 and 2064×1552), while the binned 1032×776 mode works.Fix
Derive the RAW stream Bayer order from the actually-selected sensor mode
(
sensorFormat_.code), which is exactly what the CFE source pad carries, insteadof the assumed single native order. Full-res then selects
PC1R(RGGB) and linkvalidation passes; the binned mode continues to use
PC1g.Testing
6.18.29+rpt-rpi-2712, framos-libcameraframos_v0.5.2+rpt20250903.rpicam-still/rpicam-rawat 1920×1080 and 2064×1552 fail with theCFE "Format mismatch!" EINVAL above; 1032×776 works.
2064x1552-PC1R/RAW, captures a valid 2064×1552 JPEGand RAW; binned 1032×776 still works (selects
PC1g).Note / limitation
This derives the order purely from the selected mode's mbus code, which is correct
for the default (identity) transform. A sensor that also changes Bayer order
under H/V flip would additionally need the transform applied; that path is
unchanged here.