Skip to content

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Apr 17, 2025

6.12 version of #6208

Only compile tested.

@6by9 6by9 mentioned this pull request Apr 17, 2025
@ameybarapatre
Copy link

Hi, after fixing my noob setup i can confirm its working, meanwhile are we expecting to merge this soon?

@6by9 6by9 force-pushed the rpi-6.12.y-imx477 branch from ef2c0de to 576c474 Compare July 21, 2025 13:44
@6by9
Copy link
Contributor Author

6by9 commented Jul 21, 2025

Rebased which will retrigger the CI builds.

My comment from #6208 (comment) that 2028x1080 and 2028x1520 modes with 10 bit readout give totally white frames needs to be resolved before contemplating merging.
Unless you're saying that you've tested those modes and that they work.

@Carnarts
Copy link

Carnarts commented Sep 11, 2025

I have done some testing with this, yes the 10bit 2K modes are white frames
12 bit 2K modes seem to work ok but haven't tested those much.
The 4056 x 3040 10 & 12 bit uncropped modes at 24fps drop frames when recording in these modes, it's not my drive speed being the problem so I assume there's a bottleneck in the stream.
4056 x 2160 10 and 12 bit modes seem to work well though. Hope these can be resolved as great to see this sensor support 4K at 24fps :)

@6by9 6by9 force-pushed the rpi-6.12.y-imx477 branch from 576c474 to 579b122 Compare September 18, 2025 18:34
@6by9
Copy link
Contributor Author

6by9 commented Sep 18, 2025

I've finally had a few minutes to relook at this one.

I've dropped the patch that added 10 and 12 bit readout to all modes. That can be reintroduced in due course.

What I have done is reworked setting the link frequency so that it will accept any value that can be achieved (basically a multiple of 3MHz).
The minimum line length is then computed rather than being tabulated. That means that we can run at 750MHz to remain within the specs of RP1, but the user can choose to overclock just by setting it higher (I've not tested that).

At 750MHz we get

Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [169.87 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [105.95 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [75.36 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [27.48 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [19.53 fps - (0, 0)/4056x3040 crop]

It's not quite right as the base 450MHz drops performance on the 1332x990 mode. My 500usecs for LP<>HS is probably too generous, and I'm not accounting for it only being a 10bit mode.

Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [106.18 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [65.36 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [46.49 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [16.72 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [11.89 fps - (0, 0)/4056x3040 crop]

I haven't seen any image corruption issues, but it hasn't had masses of testing. It would be appreciated if those interested would test it and feed back any issues.

@sandyol55
Copy link

sandyol55 commented Sep 18, 2025

Some testing ** (well beyond the suggested max of 750 MHz) showed only occasional frame dropping in any of the modes up to the point where I stopped at 996 Mhz. At that frequency the full frame mode was exceeding 25 fps. However somewhere between 924 and 948 MHz both of the 2x2 binned modes started outputting solid colour frames. Magenta this time rather than white as in the previous 10 bit issue.
** Can post the results if they're likely to help provide any clues, it is just a list of 'advertised' frame rates at each mode, as the link frequency is increased, versus the achieved result in that mode - which I guess is giving an indication of whether there were dropped frames or not?
Edit
PS This was with a 'stock clock' 4Gb Pi5 and with camera connected via a 150mm FFC.

@6by9
Copy link
Contributor Author

6by9 commented Sep 19, 2025

Thanks for testing.

As this is a sensor driver, I'm not that interested in anything above 750MHz as then you're exceeding the Pi's capabilities rather than the sensor's.
Frame drops and corrupt frames are again most likely to be the Pi rather than the sensor. Ideally I'd like to get CSI2 level debug for error rates etc, but I don't believe I have an easy way to do that.

Pi5's libcamera pipeline handler already knows that RP1 CFE has a limit on pixel rate (250MPix/s IIRC), so I'm expecting that will be automatically extending the HBLANK control value once you get to a point where the link frequency can exceed the limit, but you won't get any increase in output framerate from libcamera on Pi5.

@schoolpost
Copy link

schoolpost commented Sep 19, 2025

Thanks for testing.

As this is a sensor driver, I'm not that interested in anything above 750MHz as then you're exceeding the Pi's capabilities rather than the sensor's. Frame drops and corrupt frames are again most likely to be the Pi rather than the sensor. Ideally I'd like to get CSI2 level debug for error rates etc, but I don't believe I have an easy way to do that.

Pi5's libcamera pipeline handler already knows that RP1 CFE has a limit on pixel rate (250MPix/s IIRC), so I'm expecting that will be automatically extending the HBLANK control value once you get to a point where the link frequency can exceed the limit, but you won't get any increase in output framerate from libcamera on Pi5.

There should be more headroom than 250Mpix/s, ~380Mpix/s is the standard / supported pixel rate. Even at the higher link frequencies tested by @sandyol55, I never saw any frame size/frame rate combo that exceeds 300Mpix/s.
https://github.com/raspberrypi/libcamera/blob/bfd68f786964636b09f8122e6c09c230367390e7/src/ipa/rpi/controller/controller.cpp#L64

Here is 945Mhz

Mode selection for 4056:3040:12:U(24)
    SRGGB10_CSI2P,1332x990/208.594 - Score: 10552.2
    SRGGB12_CSI2P,2028x1080/131.165 - Score: 8179.84
    SRGGB12_CSI2P,2028x1520/93.301 - Score: 7096
    SRGGB12_CSI2P,4056x2160/34.303 - Score: 1963.84
    SRGGB12_CSI2P,4056x3040/24.3861 - Score: 0

So there must be something else at play that is causing those white frames?

It's just so strange that it would be isolated to the 2x2 binned modes, even at low frame rates, because the full readout/4k modes operate just fine from what I've seen; and those ones do in fact operate at pixel rates in many cases approaching 300Mpix/s, which are still well below the 380Mpix/s limit.

@Carnarts
Copy link

@schoolpost Are you managing to record ok the uncropped 4056x3040/24 modes? Curious how you're managing that if so. Testing with Cinemate, the preview looks good but as soon as I record the preview drops frames making these modes unusable for me, it isn't dropping frames on the disk but at the camera.

@schoolpost
Copy link

schoolpost commented Sep 22, 2025

@schoolpost Are you managing to record ok the uncropped 4056x3040/24 modes? Curious how you're managing that if so. Testing with Cinemate, the preview looks good but as soon as I record the preview drops frames making these modes unusable for me, it isn't dropping frames on the disk but at the camera.

I don't believe that would a be driver related issue, more so application level and buffer management ( recycling buffers in a timely manner )

@6by9
Copy link
Contributor Author

6by9 commented Sep 22, 2025

You're right - it's 380MPix/s that libcamera limits the pixel rate to. My memory is going!
https://github.com/raspberrypi/libcamera/blob/main/src/ipa/rpi/controller/controller.cpp#L62-L78

Greater than 750MHz is still above RP1's spec, so it's still debatable as to whether it is the sensor setup or Pi misbehaving.
IMX477 spec is up to 2.1Gbit/s/lane, so it should be able to send data up to 1050MHz.

I haven't confirmed that the PLL configuration is still within the specs. Spec says the max multiplier value is 350.
....
A quick test says 924MHz uses a multiplier of 0x134 or 308. Scaling that linearly would give 1050MHz with a multiplier of 350.

The pixel rate PLL is always set to 840MHz, and that is sufficient for full res @60fps, so that shouldn't be a limit. Just as long as we set LINE_LENGTH_PCK to a sufficient value to be able to transmit all the data.

@6by9 6by9 force-pushed the rpi-6.12.y-imx477 branch 2 times, most recently from 0d3748c to 0aa0f94 Compare September 22, 2025 13:50
@6by9 6by9 marked this pull request as ready for review September 22, 2025 13:50
@6by9 6by9 requested a review from naushir September 22, 2025 13:50
@6by9
Copy link
Contributor Author

6by9 commented Sep 22, 2025

I'm happy with these now.
Behaviour at 450MHz is solid, with a slight increase in achievable framerate in each mode, plus gaining the 4056x2160 mode.

OLD:
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [120.05 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [50.03 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [40.01 fps - (0, 0)/4056x3040 crop]
                             4056x3040 [10.00 fps - (0, 0)/4056x3040 crop]

NEW:
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [125.83 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [65.36 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [46.49 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [16.72 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [11.89 fps - (0, 0)/4056x3040 crop]

At 750MHz we get

0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [199.84 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [105.95 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [75.36 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [27.48 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [19.53 fps - (0, 0)/4056x3040 crop]

On my module 831MHz is also stable and means the 4056x2160 mode can achieve 30fps. That's about the limit of where I'm prepared to say things are supported on the Pi.
(I can confirm schoolpost's findings that 945Mhz gives full frame at 24Hz, but the binned modes give pure white. Changing the blanking doesn't help, so it seems something fairly fundamental to the sensor, and I'm not intending to investigate further).

We have noticed an apparent gain oscillation when going from dark to light scenes at high frame rate, however that behaviour can also be reproduced with the old driver. I'm handing that one over to @naushir to investigate.

@6by9
Copy link
Contributor Author

6by9 commented Sep 22, 2025

Hang on, register 0x0820-0x0823 are meant to be REQ_LINK__BIT_RATE_MBPS, which we aren't being changed.
Also 0x080a-0x0819 are MIPI timing registers, so if we're not changing those then that may be upsetting things on the CSI2 interface.

@6by9 6by9 force-pushed the rpi-6.12.y-imx477 branch from 0aa0f94 to b3065f6 Compare September 22, 2025 16:02
@6by9
Copy link
Contributor Author

6by9 commented Sep 22, 2025

REQ_LINK__BIT_RATE_MBPS and Global MIPI Timings are now set sensibly, so I really am stopping fiddling now!

@6by9 6by9 force-pushed the rpi-6.12.y-imx477 branch from b3065f6 to 037368b Compare September 22, 2025 16:34
@schoolpost
Copy link

schoolpost commented Sep 23, 2025

As alluded to by @6by9, no changes in the white frame issue with the latest changes. ( I did notice some higher frame rates for the 10bit "990p" mode ) Would be great to have the mirrored sensor modes for both 10bit and 12bit as we did at some point earlier in these changes.

I will note that the exact point in which we go from valid frames to white frames occurs at the boundary of 939Mhz and 942Mhz ( this was both with this newer driver from today and the one from a few days ago ), I don't know if there some magic number component to this; maybe that provides some much needed context to why this is happening in the first place? I wish I could get a better idea, but without any reference to the datasheet/registers it's just a big guessing game...

Also strange that "990p" mode is unaffected by higher link frequency errors. only the other 2 binned modes....

Does some seem like everything else works, Thanks again @6by9

@Carnarts
Copy link

@schoolpost Are you managing to record ok the uncropped 4056x3040/24 modes? Curious how you're managing that if so. Testing with Cinemate, the preview looks good but as soon as I record the preview drops frames making these modes unusable for me, it isn't dropping frames on the disk but at the camera.

I don't believe that would a be driver related issue, more so application level and buffer management ( recycling buffers in a timely manner )

That sounds promising, so you think this is something which needs attention not in cinepi-raw but in cinemate?

@6by9
Copy link
Contributor Author

6by9 commented Sep 23, 2025

I may resurrect supporting 10 and 12 bit readout for all modes at a future date, but not now. Seeing as we are now computing the hblank minimum based on link frequency, bpp, width, etc, it may just fall out, but I'm meant to be working on other things.

Rereading the datasheet, whilst the A/D supports 10 or 12 bit conversion, there's the option of an 8 bit output image too. That should be simple to add too.

The white frames on the binned modes are likely something in the sensor.
The spec sheet claims 1080p@240fps, except that will be over 4 lanes and probably 10bit. It should be possible to get higher frame rates working, but not now. Sony's approach of producing a big spreadsheet of register values doesn't help us here.

My module works at 939MHz, but fails at 942MHz.
942MHz works out at 130.79fps. If the max for 1080p is 240fps on 4 lanes, we could be exceeding an intermediate pixel rate of the sensor. V4L2 doesn't give us an easy way to handle that though.

Register line_length_pix was being written by both the tables
of registers and the control handler for V4L2_CID_HBLANK.

Remove the duplication in the tables.

Signed-off-by: Dave Stevenson <[email protected]>
line_length_pix is a value that the developer wants to know,
so write the values in decimal.

Signed-off-by: Dave Stevenson <[email protected]>
The frame length default value doesn't change dynamically, and
neither does any of the other parameters that configure it,
so precompute it instead of working from a frame duration to
get to the value.

The minimum value was also computed, when actually the sensor
will take any value down to 4 lines.

Signed-off-by: Dave Stevenson <[email protected]>
This removes a load of boilerplate code around how registers
are grouped into multiple word values.

Signed-off-by: Dave Stevenson <[email protected]>
There are a fair number of registers duplicated in all the mode
tables, so move those into the common table.

Signed-off-by: Dave Stevenson <[email protected]>
For 4k30 recording we want 16:9 output, so add a cropped mode
to achieve this.

Signed-off-by: Dave Stevenson <[email protected]>
Rather than the hard coded PLL settings for fixed frequencies,
compute the PLL settings based on device tree, validating that
the specified rate can be achieved.

Signed-off-by: Dave Stevenson <[email protected]>
As we now support variable link frequency, compute the minimum
line_length value that the sensor will work with, and set
V4L2_CID_HBLANK based on that number.

Signed-off-by: Dave Stevenson <[email protected]>
Now that the link frequency can be varied, write the link bit
rate registers to reflect the speed being used.

Signed-off-by: Dave Stevenson <[email protected]>
The timing registers configured are for 450MHz.
If running at a different link frequency, use the automatic
timing control.

Signed-off-by: Dave Stevenson <[email protected]>
The sensor supports readout as 10 or 12 bit. As we are now
computing the horizontal blanking limits dynamically, adding
support for both readout modes falls out trivially, so add
them both.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9 6by9 force-pushed the rpi-6.12.y-imx477 branch from 037368b to 41a7fe6 Compare September 23, 2025 16:28
8 bit readout is only a reconfiguration of the CSI2 block,
and recomputation of horizontal blanking. Enable it.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9
Copy link
Contributor Author

6by9 commented Sep 23, 2025

I may resurrect supporting 10 and 12 bit readout for all modes at a future date, but not now. Seeing as we are now computing the hblank minimum based on link frequency, bpp, width, etc, it may just fall out, but I'm meant to be working on other things.

Rereading the datasheet, whilst the A/D supports 10 or 12 bit conversion, there's the option of an 8 bit output image too. That should be simple to add too.

I really shouldn't get distracted.

I've done the mods for 10 or 12 bit readout in all modes as it was effectively cherry-picking an existing commit.

At 450MHz, all modes work at either bit-depth.

At 750MHz, 4056x3040, 4056x2160, 2028x1520, and 2028x1080 are fine in either bit-depth.
1332x990 in 12 bit mode was giving very dark images. Increasing V4L2_CID_HBLANK from the minimum computed of 3643 to 4600 gives me a flash of an image, but libcamera almost immediately restores the value it wants.
Setting a minimum line_length_pix appears to work, and seeing as the other modes retain their max frame rate there seems to be no fallout.

8bit readout had resulted in magenta images in some modes, but retesting and I can't reproduce it. Ho hum. I've pushed the patch that adds it.
750MHz

Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [199.84 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [125.44 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [89.22 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [32.74 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [23.28 fps - (0, 0)/4056x3040 crop]
           'SRGGB12_CSI2P' : 1332x990 [142.47 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [105.95 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [75.36 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [27.48 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [19.53 fps - (0, 0)/4056x3040 crop]
           'SRGGB8' : 1332x990 [242.66 fps - (696, 528)/2664x1980 crop]
                      2028x1080 [153.70 fps - (0, 440)/4056x2160 crop]
                      2028x1520 [109.33 fps - (0, 0)/4056x3040 crop]
                      4056x2160 [40.50 fps - (0, 440)/4056x3040 crop]
                      4056x3040 [28.79 fps - (0, 0)/4056x3040 crop]

450MHz

Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [125.83 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [77.77 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [55.32 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [19.98 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [14.20 fps - (0, 0)/4056x3040 crop]
           'SRGGB12_CSI2P' : 1332x990 [106.18 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [65.36 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [46.49 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [16.72 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [11.89 fps - (0, 0)/4056x3040 crop]
           'SRGGB8' : 1332x990 [154.44 fps - (696, 528)/2664x1980 crop]
                      2028x1080 [96.02 fps - (0, 440)/4056x2160 crop]
                      2028x1520 [68.29 fps - (0, 0)/4056x3040 crop]
                      4056x2160 [24.82 fps - (0, 440)/4056x3040 crop]
                      4056x3040 [17.64 fps - (0, 0)/4056x3040 crop]

@sandyol55
Copy link

Hats off to 6by9 for allowing some distraction!!

These updated capabilities could give the HQ sensor a whole new range of potential applications.

On my system, testing link frequencies up to 909 MHz gave all 15 modes operating with no corrupted frames, and no fixed colour frames in any mode.

At 912MHz, and above, the 8-bit 1332x990 mode -(and only that mode)- showed some magenta-tinted break-up in the lower half of the image.

This pattern continued up to a maximum tested frequency of 1050MHZ where all 10-bit and 12-bit modes were still OK, as were the remaining 4 full width 8-bit modes.

Reported capabilities as below with a standard IMX219 V2 camera for comparison.

Link Frequency set to 909Mhz:-

Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@88000/imx477@1a)
   Modes: 'SRGGB10_CSI2P' : 1332x990 [236.29 fps - (696, 528)/2664x1980 crop]
                            2028x1080 [149.45 fps - (0, 440)/4056x2160 crop]
                            2028x1520 [106.30 fps - (0, 0)/4056x3040 crop]
                            4056x2160 [39.33 fps - (0, 440)/4056x3040 crop]
                            4056x3040 [27.96 fps - (0, 0)/4056x3040 crop]
          'SRGGB12_CSI2P' : 1332x990 [142.47 fps - (696, 528)/2664x1980 crop]
                            2028x1080 [126.58 fps - (0, 440)/4056x2160 crop]
                            2028x1520 [90.03 fps - (0, 0)/4056x3040 crop]
                            4056x2160 [33.05 fps - (0, 440)/4056x3040 crop]
                            4056x3040 [23.50 fps - (0, 0)/4056x3040 crop]
          'SRGGB8' : 1332x990 [285.47 fps - (696, 528)/2664x1980 crop]
                     2028x1080 [172.86 fps - (0, 440)/4056x2160 crop]
                     2028x1520 [122.96 fps - (0, 0)/4056x3040 crop]
                     4056x2160 [43.30 fps - (0, 440)/4056x3040 crop]
                     4056x3040 [30.78 fps - (0, 0)/4056x3040 crop]

1 : imx219 [3280x2464 10-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx219@10)
   Modes: 'SRGGB10_CSI2P' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
                            1640x1232 [83.70 fps - (0, 0)/3280x2464 crop]
                            1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
                            3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]
          'SRGGB8' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
                     1640x1232 [83.70 fps - (0, 0)/3280x2464 crop]
                     1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
                     3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]

Link Frequency set to 1050MHz:-

Available cameras
-----------------
0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@88000/imx477@1a)
   Modes: 'SRGGB10_CSI2P' : 1332x990 [267.09 fps - (696, 528)/2664x1980 crop]
                            2028x1080 [170.10 fps - (0, 440)/4056x2160 crop]
                            2028x1520 [120.99 fps - (0, 0)/4056x3040 crop]
                            4056x2160 [43.30 fps - (0, 440)/4056x3040 crop]
                            4056x3040 [30.78 fps - (0, 0)/4056x3040 crop]
          'SRGGB12_CSI2P' : 1332x990 [142.47 fps - (696, 528)/2664x1980 crop]
                            2028x1080 [130.63 fps - (0, 440)/4056x2160 crop]
                            2028x1520 [92.92 fps - (0, 0)/4056x3040 crop]
                            4056x2160 [37.93 fps - (0, 440)/4056x3040 crop]
                            4056x3040 [26.96 fps - (0, 0)/4056x3040 crop]
          'SRGGB8' : 1332x990 [287.03 fps - (696, 528)/2664x1980 crop]
                     2028x1080 [172.86 fps - (0, 440)/4056x2160 crop]
                     2028x1520 [122.96 fps - (0, 0)/4056x3040 crop]
                     4056x2160 [43.30 fps - (0, 440)/4056x3040 crop]
                     4056x3040 [30.78 fps - (0, 0)/4056x3040 crop]

1 : imx219 [3280x2464 10-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx219@10)
   Modes: 'SRGGB10_CSI2P' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
                            1640x1232 [83.70 fps - (0, 0)/3280x2464 crop]
                            1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
                            3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]
          'SRGGB8' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
                     1640x1232 [83.70 fps - (0, 0)/3280x2464 crop]
                     1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
                     3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]

I note that the 4 full-width 8-bit modes report the same fps performance at both 909 and 1050 MHz link frequencies, while the cropped 1332x990 mode reports slightly different values, 285.47 v 287.03 MHz.

@6by9
Copy link
Contributor Author

6by9 commented Sep 24, 2025

I'm done then. Over to @naushir to review.

@fliker09
Copy link

A stupid question - once this get merged, all these modes will be available in the standard 6.12 kernel, right? Will it still require dtoverlay to enable?

@6by9
Copy link
Contributor Author

6by9 commented Sep 25, 2025

A stupid question - once this get merged, all these modes will be available in the standard 6.12 kernel, right? Will it still require dtoverlay to enable?

8, 10, 12 bit readout for all modes will be available as standard even when the firmware autodetection is used.

The default link frequency will remain at 450MHz, giving

0 : imx477 [4056x3040 12-bit RGGB] (/base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [125.83 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [77.77 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [55.32 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [19.98 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [14.20 fps - (0, 0)/4056x3040 crop]
           'SRGGB12_CSI2P' : 1332x990 [106.18 fps - (696, 528)/2664x1980 crop]
                             2028x1080 [65.36 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [46.49 fps - (0, 0)/4056x3040 crop]
                             4056x2160 [16.72 fps - (0, 440)/4056x3040 crop]
                             4056x3040 [11.89 fps - (0, 0)/4056x3040 crop]
           'SRGGB8' : 1332x990 [154.44 fps - (696, 528)/2664x1980 crop]
                      2028x1080 [96.02 fps - (0, 440)/4056x2160 crop]
                      2028x1520 [68.29 fps - (0, 0)/4056x3040 crop]
                      4056x2160 [24.82 fps - (0, 440)/4056x3040 crop]
                      4056x3040 [17.64 fps - (0, 0)/4056x3040 crop]

which is a small bump in most modes.

At least initially increasing the link frequency will require a manual dtoverlay=imx477,link_frequency=N in config.txt. You've seen from the above that most of my testing has been on Pi5 where the SoC specs officially go up to 750MHz. Increasing above 500MHz on Pi0-4 or 750MHz on Pi5 will be considered outside of spec, so support will be limited.

I'll discuss with colleagues as to whether it is worth modding the Pi5 bootloader to automatically add an override to 750MHz for autodetected cameras, thereby increasing the default capabilities.
(It may get pushed to a pi5 override instead and do it to all autodetected cameras. #7057 is in progress adding a similar change to imx708, so we could have a performance increase on Pi5 there too).

@fliker09
Copy link

Awesome, thanks for the quick answer! Eagerly waiting for the merge then ^_^

One more thing, just to get a reality check. Do I understand it correctly that encoding at 2160p in H.264 in real-time is unachievable even on Pi 5? From what I read on pi forums - CPU just won't be able to keep up... Is MJPEG the only viable option? (and I guess RAW dumping should work too)

Not planning to start a discussion here, just wanted to understand the situation with real-world application of these new capabilities :-)

@6by9
Copy link
Contributor Author

6by9 commented Sep 25, 2025

One more thing, just to get a reality check. Do I understand it correctly that encoding at 2160p in H.264 in real-time is unachievable even on Pi 5? From what I read on pi forums - CPU just won't be able to keep up... Is MJPEG the only viable option? (and I guess RAW dumping should work too)

2160p frames can be encoded as H264, but the frame rate achievable will depend on encoding options. Definitely no B-frames, potentially 1 reference frame, bitrate may be limited due to the complexities of CABAC.
MJPEG is far simpler from an encoding complexity, but you should get better encoding efficiency with H264 on all I-frames mode with minimal extra computational complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants