[0/2] libcamera: simple: Enable RPi's unicam+SoftISP
mbox series

Message ID 20250709134229.135949-1-uajain@igalia.com
Headers show
Series
  • libcamera: simple: Enable RPi's unicam+SoftISP
Related show

Message

Umang Jain July 9, 2025, 1:42 p.m. UTC
Couple of patches to stream RPi+IMX219 setup with simple pipeline
handler and SoftISP.

Patch 1/2 fixes up bayer pattern changes on the sensor due to transforms
being applied, which then configures the video node correctly.

Patch 2/2 enables the unicam driver in simple pipeline handler with
SoftISP.

Demo/Test:
```
uajain1@uajain:~/libcamera$ LIBCAMERA_LOG_LEVELS=SimplePipeline:0 ./build-soft/src/apps/cam/cam -c1 -swidth=640,height=480 -C
[11:19:01.616919614] [1594]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/uajain1/libcamera/build-soft/src/ipa' to the IPA search path
[11:19:01.632115916] [1594]  INFO Camera camera_manager.cpp:326 libcamera v0.5.1+48-e019f6ba
[11:19:01.703818520] [1595] DEBUG SimplePipeline simple.cpp:1712 Sensor found for /dev/media0
[11:19:01.705714926] [1595] DEBUG SimplePipeline simple.cpp:479 Found capture device unicam-image
[11:19:01.726536697] [1595] DEBUG SimplePipeline simple.cpp:553 Found pipeline: [imx219 10-0010|0] -> [0|unicam-image]
[11:19:01.886387895] [1595]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/uajain1/libcamera/src/ipa/simple/data'
[11:19:01.886763989] [1595]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'
[11:19:01.889230603] [1595]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/uajain1/libcamera/src/ipa/simple/data'
[11:19:01.902451281] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB10_1X10
[11:19:01.903327531] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 640x480 in pixel formats [ RG10, pRAA ]
[11:19:01.905158676] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB10_1X10
[11:19:01.905657322] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 1640x1232 in pixel formats [ RG10, pRAA ]
[11:19:01.907001593] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB10_1X10
[11:19:01.907442843] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 1920x1080 in pixel formats [ RG10, pRAA ]
[11:19:01.908831801] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB10_1X10
[11:19:01.909281020] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 3280x2464 in pixel formats [ RG10, pRAA ]
[11:19:01.910646228] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB8_1X8
[11:19:01.911075239] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 640x480 in pixel formats [ RGGB ]
[11:19:01.912636072] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB8_1X8
[11:19:01.913076697] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 1640x1232 in pixel formats [ RGGB ]
[11:19:01.914325968] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB8_1X8
[11:19:01.914727687] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 1920x1080 in pixel formats [ RGGB ]
[11:19:01.915933520] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB8_1X8
[11:19:01.916384458] [1595] DEBUG SimplePipeline simple.cpp:694 Adding configuration for 3280x2464 in pixel formats [ RGGB ]
[11:19:01.922179510] [1594] DEBUG SimplePipeline simple.cpp:1122 Largest stream size is 3272x2464
[11:19:01.922443208] [1594] DEBUG SimplePipeline simple.cpp:1174 Picked 3280x2464-SRGGB10_1X10 -> 3280x2464-SRGGB10 for max stream size 3272x2464
[11:19:01.923014249] [1594] DEBUG SimplePipeline simple.cpp:1122 Largest stream size is 640x480
[11:19:01.923137843] [1594] DEBUG SimplePipeline simple.cpp:1174 Picked 640x480-SRGGB10_1X10 -> 640x480-SRGGB10 for max stream size 640x480
[11:19:01.923285239] [1594] DEBUG SimplePipeline simple.cpp:1223 Adjusting size from 640x480 to 636x480
Camera configuration adjusted
Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0
[11:19:01.923578781] [1594] DEBUG SimplePipeline simple.cpp:1122 Largest stream size is 636x480
[11:19:01.923698312] [1594] DEBUG SimplePipeline simple.cpp:1174 Picked 640x480-SRGGB10_1X10 -> 640x480-SRGGB10 for max stream size 636x480
[11:19:01.923864874] [1594]  INFO Camera camera.cpp:1205 configuring streams: (0) 636x480-ABGR8888/Unset
[11:19:01.925430812] [1595] DEBUG SimplePipeline simple.cpp:843 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SBGGR10_1X10
[11:19:01.929379301] [1595]  INFO IPASoft soft_simple.cpp:264 IPASoft: Exposure 4-1759, gain 1-10.6667 (0.0966667)
cam0: Capture until user interrupts by SIGINT
40742.019745 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 1221120
40742.053071 (30.01 fps) cam0-stream0 seq: 000001 bytesused: 1221120
40742.086400 (30.00 fps) cam0-stream0 seq: 000002 bytesused: 1221120
40742.186379 (10.00 fps) cam0-stream0 seq: 000005 bytesused: 1221120
40742.319686 (7.50 fps) cam0-stream0 seq: 000009 bytesused: 1221120
40742.419668 (10.00 fps) cam0-stream0 seq: 000012 bytesused: 1221120
40742.552976 (7.50 fps) cam0-stream0 seq: 000016 bytesused: 1221120
40742.652957 (10.00 fps) cam0-stream0 seq: 000019 bytesused: 1221120
40742.786264 (7.50 fps) cam0-stream0 seq: 000023 bytesused: 1221120
40742.886247 (10.00 fps) cam0-stream0 seq: 000026 bytesused: 1221120
40743.019553 (7.50 fps) cam0-stream0 seq: 000030 bytesused: 1221120
40743.119535 (10.00 fps) cam0-stream0 seq: 000033 bytesused: 1221120
40743.252843 (7.50 fps) cam0-stream0 seq: 000037 bytesused: 1221120
40743.352824 (10.00 fps) cam0-stream0 seq: 000040 bytesused: 1221120
40743.486131 (7.50 fps) cam0-stream0 seq: 000044 bytesused: 1221120
40743.586113 (10.00 fps) cam0-stream0 seq: 000047 bytesused: 1221120
40743.719421 (7.50 fps) cam0-stream0 seq: 000051 bytesused: 1221120
40743.819402 (10.00 fps) cam0-stream0 seq: 000054 bytesused: 1221120
```

Question:
Unicam does support packed and unpacked CSI2 pixel formats. Would it be
in interest for simple pipeline handler to support the packed formats ?
or is it something specific to RPi (and we shouldn't include that in the
generic simple pipeline handler) ?

Umang Jain (2):
  libcamera: simple: Detect Bayer pattern change during configure()
  libcamera: simple: Support RPi's unicam CSI-2 receiver

 src/libcamera/pipeline/simple/simple.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)