| Message ID | 20260609225356.23383-1-robert.mader@collabora.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series |
|
| Related | show |
Notes from the weekly call:
Before merging the patch, Hans requested that it should be tested on at
least one driver that actually honors the requested value
* This is not the case on the devices I tested so far (qcom-camss,
Librem5/imx7-csi, Pinephone/sun6i-csi) - it only happens
accidentally if the driver happens to choose a matching stride at
certain resolutions.
* Vivid *should* support it but unfortunately can't be used with the
simple pipeline handler / the gpu-isp atm.
* It *might* work on the RPi 4/5. I'll try to test that - if I'm not
able to with the hardware I have around, Milan offered to test the
patch later this week.
How to test:
Just check the logs from a command like "cam -c some-device -s
width=1920,height=1080 --capture=1"
If the driver honors the request there shouldn't be any info logs
containing "Input buffer stride ignored by the driver." or "Importing
input buffer with DMABuf import failed, falling back to upload". The
reported strides should change between before this patch and with it,
though, and always be a multiple of 256 - i.e. instead of e.g.
INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5104
the logs should contain
INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5120
Otherwise, if the driver does not honor the request, at least at certain
resolutions you should get logs like:
INFO SimplePipeline simple.cpp:1568 Input buffer stride ignored by the driver. Requested 5120, got 5104
...
INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5104
...
INFO Debayer debayer_egl.cpp:523 Importing input buffer with DMABuf import failed, falling back to upload
Note that the last log will not always appear, it just becomes more likely.
Hi Robert, I tried to test it on RPi 4 with IMX219 but: Robert Mader <robert.mader@collabora.com> writes: > Notes from the weekly call: > > Before merging the patch, Hans requested that it should be tested on at least one driver that actually > honors the requested value > > * This is not the case on the devices I tested so far (qcom-camss, > Librem5/imx7-csi, Pinephone/sun6i-csi) - it only happens > accidentally if the driver happens to choose a matching stride at > certain resolutions. > * Vivid *should* support it but unfortunately can't be used with the > simple pipeline handler / the gpu-isp atm. > * It *might* work on the RPi 4/5. I'll try to test that - if I'm not > able to with the hardware I have around, Milan offered to test the > patch later this week. > > How to test: > > Just check the logs from a command like "cam -c some-device -s width=1920,height=1080 --capture=1" > > If the driver honors the request there shouldn't be any info logs containing "Input buffer stride > ignored by the driver." or "Importing input buffer with DMABuf import failed, falling back to > upload". Unfortunately, I get "DMABuf import failed" also in master, because eglCreateImageKHR fails. > The reported strides should change between before this patch and with > it, though, and always be a multiple of 256 - i.e. instead of e.g. > > INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5104 > > the logs should contain > > INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5120 > > Otherwise, if the driver does not honor the request, at least at certain resolutions you should get logs > like: > > INFO SimplePipeline simple.cpp:1568 Input buffer stride ignored by the driver. Requested 5120, got 5104 > ... > INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5104 > ... > INFO Debayer debayer_egl.cpp:523 Importing input buffer with DMABuf import failed, falling back to upload > > Note that the last log will not always appear, it just becomes more likely.
Hey Milan, thanks a lot for testing! On 10.06.26 22:16, Milan Zamazal wrote: > Hi Robert, > > I tried to test it on RPi 4 with IMX219 but: > > Robert Mader<robert.mader@collabora.com> writes: > >> Notes from the weekly call: >> >> Before merging the patch, Hans requested that it should be tested on at least one driver that actually >> honors the requested value >> >> * This is not the case on the devices I tested so far (qcom-camss, >> Librem5/imx7-csi, Pinephone/sun6i-csi) - it only happens >> accidentally if the driver happens to choose a matching stride at >> certain resolutions. >> * Vivid *should* support it but unfortunately can't be used with the >> simple pipeline handler / the gpu-isp atm. >> * It *might* work on the RPi 4/5. I'll try to test that - if I'm not >> able to with the hardware I have around, Milan offered to test the >> patch later this week. >> >> How to test: >> >> Just check the logs from a command like "cam -c some-device -s width=1920,height=1080 --capture=1" >> >> If the driver honors the request there shouldn't be any info logs containing "Input buffer stride >> ignored by the driver." or "Importing input buffer with DMABuf import failed, falling back to >> upload". > Unfortunately, I get "DMABuf import failed" also in master, because > eglCreateImageKHR fails. Just to make sure I understand you correctly: 1. You do see he "DMABuf import failed" *with* this patch on top of master, correct? (sorry, I assume that was the case, just to be fully sure) 2. Do you also see the newly introduced "Input buffer stride ignored by the driver." log? That would be the most important bit - otherwise there's a chance that the import fails *despite* a correct stride. On some GPUs can happen if e.g. the buffer size is too big for the hardware and the driver needs to allocate multiple buffers internally - should *not* happen with 1920x1080, but might with 4k. 3. Did you double-check if the reported stride is a multiple of 256 (in the log similar to "INFO SoftwareIsp software_isp.cpp:293 Input 4080x3072-GRBG-10-CSI2P stride 5120")? Or, to make it quicker for you: could you post command and output you tried? That would be super helpful :)
Robert Mader <robert.mader@collabora.com> writes: > Hey Milan, thanks a lot for testing! > > On 10.06.26 22:16, Milan Zamazal wrote: >> Hi Robert, >> >> I tried to test it on RPi 4 with IMX219 but: >> >> Robert Mader<robert.mader@collabora.com> writes: >> >>> Notes from the weekly call: >>> >>> Before merging the patch, Hans requested that it should be tested on at least one driver that actually >>> honors the requested value >>> >>> * This is not the case on the devices I tested so far (qcom-camss, >>> Librem5/imx7-csi, Pinephone/sun6i-csi) - it only happens >>> accidentally if the driver happens to choose a matching stride at >>> certain resolutions. >>> * Vivid *should* support it but unfortunately can't be used with the >>> simple pipeline handler / the gpu-isp atm. >>> * It *might* work on the RPi 4/5. I'll try to test that - if I'm not >>> able to with the hardware I have around, Milan offered to test the >>> patch later this week. >>> >>> How to test: >>> >>> Just check the logs from a command like "cam -c some-device -s width=1920,height=1080 --capture=1" >>> >>> If the driver honors the request there shouldn't be any info logs containing "Input buffer stride >>> ignored by the driver." or "Importing input buffer with DMABuf import failed, falling back to >>> upload". >> Unfortunately, I get "DMABuf import failed" also in master, because >> eglCreateImageKHR fails. > > Just to make sure I understand you correctly: > > 1. You do see he "DMABuf import failed" *with* this patch on top of > master, correct? (sorry, I assume that was the case, just to be > fully sure) With or without. On master, without your patch, I get the error due to eglCreateImageKHR failure. Which is BTW reported only on debug level, so apparently kind of expected. FWIW, I'll additionally test on TI AM69 tomorrow, but considering the state of the drivers I have there, I don't hope for much. > 2. Do you also see the newly introduced "Input buffer stride ignored by > the driver." log? That would be the most important bit - otherwise > there's a chance that the import fails *despite* a correct stride. > On some GPUs can happen if e.g. the buffer size is too big for the > hardware and the driver needs to allocate multiple buffers > internally - should *not* happen with 1920x1080, but might with 4k. > 3. Did you double-check if the reported stride is a multiple of 256 (in > the log similar to "INFO SoftwareIsp software_isp.cpp:293 Input > 4080x3072-GRBG-10-CSI2P stride 5120")? > > Or, to make it quicker for you: could you post command and output you tried? That would be super helpful > :) The following is from master. Your patch changes the stride to 6656 as expected, I don't think there are other differences. LIBCAMERA_LOG_LEVEL='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 pdm@raspberrypi ~/libcamera> LIBCAMERA_LOG_LEVEL='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 [0:05:02.512812002] [1483] INFO Camera camera_manager.cpp:340 libcamera v0.7.1 [0:05:02.513406409] [1486] INFO IPAManager ipa_manager.cpp:148 libcamera is not installed. Adding '/home/pdm/libcamera/build-swisp/src/ipa' to the IPA search path [0:05:02.632238687] [1486] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' [0:05:02.632491687] [1486] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' [0:05:02.632543668] [1486] WARN IPAProxy ipa_proxy.cpp:196 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to '/home/pdm/libcamera/src/ipa/simple/data/uncalibrated.yaml' [0:05:02.633761168] [1486] INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler simple Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0 [0:05:02.634298261] [1483] INFO Camera camera.cpp:1216 configuring streams: (0) 1920x1080-ABGR8888/sRGB [0:05:02.634508354] [1486] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) [0:05:02.634620335] [1486] INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 [0:05:02.688558502] [1488] INFO eGL egl.cpp:318 EGL: EGL_VERSION: 1.4 [0:05:02.688673631] [1488] INFO eGL egl.cpp:319 EGL: EGL_VENDOR: Mesa Project [0:05:02.688714187] [1488] INFO eGL egl.cpp:320 EGL: EGL_CLIENT_APIS: OpenGL OpenGL_ES [0:05:02.688751946] [1488] INFO eGL egl.cpp:321 EGL: EGL_EXTENSIONS: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_surface_compression EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display [0:05:02.697301446] [1488] INFO eGL egl.cpp:362 EGL: GL_VERSION: OpenGL ES 3.1 Mesa 24.2.8-1~bpo12+rpt4 cam0: Capture 1 frames [0:05:02.865147335] [1488] INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload 302.818358 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 8294400 pdm@raspberrypi ~/libcamera> LIBCAMERA_LOG_LEVELS='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 [0:05:10.625925849] [1520] INFO Camera camera_manager.cpp:340 libcamera v0.7.1 [0:05:10.626395497] [1523] DEBUG Camera camera_manager.cpp:73 Starting camera manager [0:05:10.626607164] [1523] INFO IPAManager ipa_manager.cpp:148 libcamera is not installed. Adding '/home/pdm/libcamera/build-swisp/src/ipa' to the IPA search path [0:05:10.627003182] [1523] DEBUG IPAModule ipa_module.cpp:333 ipa_soft_simple.so: IPA module /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so is signed [0:05:10.627093516] [1523] DEBUG IPAManager ipa_manager.cpp:240 Loaded IPA module '/home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so' [0:05:10.637506682] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "rpi-hevc-dec" created from /dev/media0 [0:05:10.637579441] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media0 due to 1 missing dependencies [0:05:10.637892849] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media0 found [0:05:10.637916534] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media0: rpi-hevc-dec [0:05:10.638138423] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-codec" created from /dev/media4 [0:05:10.638163682] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media4 due to 5 missing dependencies [0:05:10.639455664] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media4 found [0:05:10.639476256] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media4: bcm2835-codec [0:05:10.639638571] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-isp" created from /dev/media2 [0:05:10.639661293] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media2 due to 4 missing dependencies [0:05:10.639831071] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-isp" created from /dev/media3 [0:05:10.639853090] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media3 due to 4 missing dependencies [0:05:10.640924793] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media2 found [0:05:10.640983682] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media2: bcm2835-isp [0:05:10.642008775] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media3 found [0:05:10.642030460] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media3: bcm2835-isp [0:05:10.642312275] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "unicam" created from /dev/media1 [0:05:10.642496516] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media1 due to 1 missing dependencies [0:05:10.642756238] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media1 found [0:05:10.642775756] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media1: unicam [0:05:10.643246812] [1523] DEBUG Camera camera_manager.cpp:143 Found registered pipeline handler 'simple' [0:05:10.643309571] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:355 Successful match for media device "unicam" [0:05:10.643364312] [1523] DEBUG SimplePipeline simple.cpp:1905 Sensor found for /dev/media1 [0:05:10.643404386] [1523] DEBUG SimplePipeline simple.cpp:503 Found capture device unicam-image [0:05:10.643448997] [1523] DEBUG CameraSensor camera_sensor_raw.cpp:213 imx219 10-0010: unsupported number of sinks (0) or sources (1) [0:05:10.643529590] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Exposure (0x00980911) [0:05:10.643588293] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Flip (0x00980914) [0:05:10.643613923] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Flip (0x00980915) [0:05:10.643638608] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Orientation (0x009a0922) [0:05:10.643676256] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Sensor Rotation (0x009a0923) [0:05:10.643702386] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Blanking (0x009e0901) [0:05:10.643725534] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Blanking (0x009e0902) [0:05:10.643749201] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Analogue Gain (0x009e0903) [0:05:10.643771738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Red Pixel Value (0x009e0904) [0:05:10.643794441] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Red) Pixel Value (0x009e0905) [0:05:10.643816997] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Blue Pixel Value (0x009e0906) [0:05:10.643840312] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Blue) Pixel Value (0x009e0907) [0:05:10.643864497] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Link Frequency (0x009f0901) [0:05:10.643889867] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Pixel Rate (0x009f0902) [0:05:10.643915756] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Test Pattern (0x009f0903) [0:05:10.643947367] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Digital Gain (0x009f0905) [0:05:10.644858312] [1523] DEBUG CameraSensor camera_sensor_legacy.cpp:1028 'imx219 10-0010': Apply test pattern mode 0 [0:05:10.644958404] [1523] DEBUG CameraSensor camera_sensor.cpp:476 Entity 'imx219 10-0010' matched by CameraSensorLegacy [0:05:10.644994516] [1523] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Exposure [0:05:10.645016238] [1523] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 1 and priority write flag 0 for Analogue Gain [0:05:10.645056775] [1523] DEBUG SimplePipeline simple.cpp:577 Found pipeline: [imx219 10-0010|0] -> [0|unicam-image] [0:05:10.645123460] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Exposure (0x00980911) [0:05:10.645155071] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Flip (0x00980914) [0:05:10.645178682] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Flip (0x00980915) [0:05:10.645203071] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Orientation (0x009a0922) [0:05:10.645235738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Sensor Rotation (0x009a0923) [0:05:10.645260478] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Blanking (0x009e0901) [0:05:10.645283275] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Blanking (0x009e0902) [0:05:10.645305812] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Analogue Gain (0x009e0903) [0:05:10.645330145] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Red Pixel Value (0x009e0904) [0:05:10.645352738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Red) Pixel Value (0x009e0905) [0:05:10.645375256] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Blue Pixel Value (0x009e0906) [0:05:10.645397719] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Blue) Pixel Value (0x009e0907) [0:05:10.645421312] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Link Frequency (0x009f0901) [0:05:10.645446201] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Pixel Rate (0x009f0902) [0:05:10.645471182] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Test Pattern (0x009f0903) [0:05:10.645502423] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Digital Gain (0x009f0905) [0:05:10.645577016] [1523] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[20:cap]: Opened device platform:fe801000.csi: unicam: unicam [0:05:10.645737756] [1523] DEBUG DmaBufAllocator dma_buf_allocator.cpp:112 Using /dev/dma_heap/linux,cma [0:05:10.676996182] [1523] DEBUG IPAManager ipa_manager.cpp:310 IPA module /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so signature is valid [0:05:10.677424978] [1523] DEBUG IPAProxy soft_ipa_proxy.cpp:44 initializing soft proxy in thread: loading IPA from /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so [0:05:10.681140312] [1523] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' [0:05:10.681370997] [1523] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' [0:05:10.681421275] [1523] WARN IPAProxy ipa_proxy.cpp:196 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to '/home/pdm/libcamera/src/ipa/simple/data/uncalibrated.yaml' [0:05:10.681741053] [1523] DEBUG IPASoft soft_simple.cpp:127 IPASoft: Tuning file version 1 [0:05:10.681844312] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'BlackLevel' [0:05:10.681888756] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Awb' [0:05:10.681941071] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Adjust' [0:05:10.681986330] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Agc' [0:05:10.682243627] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB10_1X10/RAW [0:05:10.682333478] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 640x480 in pixel formats [ RG10, pRAA ] [0:05:10.682467904] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB10_1X10/RAW [0:05:10.682520960] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1640x1232 in pixel formats [ RG10, pRAA ] [0:05:10.682627201] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB10_1X10/RAW [0:05:10.682679219] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1920x1080 in pixel formats [ RG10, pRAA ] [0:05:10.682786978] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB10_1X10/RAW [0:05:10.682838238] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 3280x2464 in pixel formats [ RG10, pRAA ] [0:05:10.682944664] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB8_1X8/RAW [0:05:10.682994182] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 640x480 in pixel formats [ RGGB ] [0:05:10.683101830] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB8_1X8/RAW [0:05:10.683150015] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1640x1232 in pixel formats [ RGGB ] [0:05:10.683251460] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB8_1X8/RAW [0:05:10.683297719] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1920x1080 in pixel formats [ RGGB ] [0:05:10.683399534] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB8_1X8/RAW [0:05:10.683445738] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 3280x2464 in pixel formats [ RGGB ] [0:05:10.683544941] [1523] INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler simple [0:05:10.683590571] [1523] DEBUG SimplePipeline simple.cpp:2029 Matched on device: /dev/media1 [0:05:10.683627830] [1523] DEBUG Camera camera_manager.cpp:164 Pipeline handler "simple" matched [0:05:10.683929756] [1523] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 3272x2464 [0:05:10.683978812] [1523] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 [0:05:10.684045497] [1523] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 3272x2464 and max raw stream size 0x0 [0:05:10.684094256] [1523] DEBUG SimplePipeline simple.cpp:1327 Unspecified color space set to sRGB [0:05:10.684133090] [1523] DEBUG SimplePipeline simple.cpp:1391 Adjusting bufferCount from 0 to 4 [0:05:10.684259553] [1520] DEBUG Camera camera.cpp:1151 streams configuration: (0) 3272x2464-ABGR8888/sRGB [0:05:10.684345164] [1520] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 1920x1080 [0:05:10.684389386] [1520] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 [0:05:10.684429738] [1520] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 1920x1080 and max raw stream size 0x0 Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0 [0:05:10.684607793] [1520] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 1920x1080 [0:05:10.684671275] [1520] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 [0:05:10.684721997] [1520] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 1920x1080 and max raw stream size 0x0 [0:05:10.684799090] [1520] INFO Camera camera.cpp:1216 configuring streams: (0) 1920x1080-ABGR8888/sRGB [0:05:10.684969238] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SBGGR10_1X10/RAW [0:05:10.685085330] [1523] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) [0:05:10.685180553] [1523] INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 [0:05:10.688248127] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.690984590] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.693705608] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.696425627] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.696553090] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 [0:05:10.696622349] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 [0:05:10.696669682] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 [0:05:10.696712034] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 [0:05:10.696757053] [1520] DEBUG Camera camera.cpp:1408 Starting capture [0:05:10.721391515] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1336 /dev/video0[20:cap]: 4 buffers requested. [0:05:10.721580441] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.721635071] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.721683997] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.721734478] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous [0:05:10.740284015] [1525] INFO eGL egl.cpp:318 EGL: EGL_VERSION: 1.4 [0:05:10.740395534] [1525] INFO eGL egl.cpp:319 EGL: EGL_VENDOR: Mesa Project [0:05:10.740434052] [1525] INFO eGL egl.cpp:320 EGL: EGL_CLIENT_APIS: OpenGL OpenGL_ES [0:05:10.740471756] [1525] INFO eGL egl.cpp:321 EGL: EGL_EXTENSIONS: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_surface_compression EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display [0:05:10.749028682] [1525] INFO eGL egl.cpp:362 EGL: GL_VERSION: OpenGL ES 3.1 Mesa 24.2.8-1~bpo12+rpt4 [0:05:10.749214682] [1525] DEBUG Debayer debayer_egl.cpp:619 Available fragment shader texture units 24 [0:05:10.779853090] [1525] DEBUG eGL egl.cpp:539 Shader length is 1720 [0:05:10.779992071] [1525] DEBUG eGL egl.cpp:546 Shader source = #version 100 #extension GL_OES_EGL_image_external: enable #define SWAP_BLUE #define RAW10P /* SPDX-License-Identifier: BSD-2-Clause */ /* From http://jgt.akpeters.com/papers/McGuire08/ Efficient, High-Quality Bayer Demosaic Filtering on GPUs Morgan McGuire This paper appears in issue Volume 13, Number 4. --------------------------------------------------------- Copyright (c) 2008, Morgan McGuire. All rights reserved. Modified by Linaro Ltd to integrate it into libcamera. Copyright (C) 2021, Linaro */ //Vertex Shader attribute vec4 vertexIn; attribute vec2 textureIn; uniform mat4 proj_matrix; uniform vec2 tex_size; /* The texture size in pixels */ uniform vec2 tex_step; /** Pixel position of the first red pixel in the */ /** Bayer pattern. [{0,1}, {0, 1}]*/ uniform vec2 tex_bayer_first_red; /** .xy = Pixel being sampled in the fragment shader on the range [0, 1] .zw = ...on the range [0, sourceSize], offset by firstRed */ varying vec4 center; /** center.x + (-2/w, -1/w, 1/w, 2/w); These are the x-positions */ /** of the adjacent pixels.*/ varying vec4 xCoord; /** center.y + (-2/h, -1/h, 1/h, 2/h); These are the y-positions */ /** of the adjacent pixels.*/ varying vec4 yCoord; uniform float stride_factor; void main(void) { center.xy = vec2(textureIn.x * stride_factor, textureIn.y); center.zw = textureIn * tex_size + tex_bayer_first_red; xCoord = center.x + vec4(-2.0 * tex_step.x, -tex_step.x, tex_step.x, 2.0 * tex_step.x); yCoord = center.y + vec4(-2.0 * tex_step.y, -tex_step.y, tex_step.y, 2.0 * tex_step.y); gl_Position = proj_matrix * vertexIn; } [0:05:10.780585201] [1525] DEBUG eGL egl.cpp:539 Shader length is 6307 [0:05:10.780617775] [1525] DEBUG eGL egl.cpp:546 Shader source = #version 100 #extension GL_OES_EGL_image_external: enable #define SWAP_BLUE #define RAW10P /* SPDX-License-Identifier: BSD-2-Clause */ /* From http://jgt.akpeters.com/papers/McGuire08/ Efficient, High-Quality Bayer Demosaic Filtering on GPUs Morgan McGuire This paper appears in issue Volume 13, Number 4. --------------------------------------------------------- Copyright (c) 2008, Morgan McGuire. All rights reserved. Modified by Linaro Ltd to integrate it into libcamera. Copyright (C) 2021, Linaro */ //Pixel Shader #ifdef GL_ES precision highp float; #endif /** Monochrome RGBA or GL_LUMINANCE Bayer encoded texture.*/ uniform sampler2D tex_y; varying vec4 center; varying vec4 yCoord; varying vec4 xCoord; uniform mat3 ccm; uniform vec3 blacklevel; uniform float gamma; uniform float contrastExp; float apply_contrast(float value) { // Apply simple S-curve if (value < 0.5) return 0.5 * pow(value / 0.5, contrastExp); else return 1.0 - 0.5 * pow((1.0 - value) / 0.5, contrastExp); } void main(void) { vec3 rgb; #if defined(RAW10P) #define pixel(p) p.r / 4.0 + p.g * 64.0 #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) #elif defined(RAW12P) #define pixel(p) p.r / 16.0 + p.g * 16.0 #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) #else #define fetch(x, y) texture2D(tex_y, vec2(x, y)).r #endif float C = fetch(center.x, center.y); // ( 0, 0) const vec4 kC = vec4( 4.0, 6.0, 5.0, 5.0) / 8.0; // Determine which of four types of pixels we are on. vec2 alternate = mod(floor(center.zw), 2.0); vec4 Dvec = vec4( fetch(xCoord[1], yCoord[1]), // (-1,-1) fetch(xCoord[1], yCoord[2]), // (-1, 1) fetch(xCoord[2], yCoord[1]), // ( 1,-1) fetch(xCoord[2], yCoord[2])); // ( 1, 1) vec4 PATTERN = (kC.xyz * C).xyzz; // Can also be a dot product with (1,1,1,1) on hardware where that is // specially optimized. // Equivalent to: D = Dvec[0] + Dvec[1] + Dvec[2] + Dvec[3]; Dvec.xy += Dvec.zw; Dvec.x += Dvec.y; vec4 value = vec4( fetch(center.x, yCoord[0]), // ( 0,-2) fetch(center.x, yCoord[1]), // ( 0,-1) fetch(xCoord[0], center.y), // (-2, 0) fetch(xCoord[1], center.y)); // (-1, 0) vec4 temp = vec4( fetch(center.x, yCoord[3]), // ( 0, 2) fetch(center.x, yCoord[2]), // ( 0, 1) fetch(xCoord[3], center.y), // ( 2, 0) fetch(xCoord[2], center.y)); // ( 1, 0) // Even the simplest compilers should be able to constant-fold these to // avoid the division. // Note that on scalar processors these constants force computation of some // identical products twice. const vec4 kA = vec4(-1.0, -1.5, 0.5, -1.0) / 8.0; const vec4 kB = vec4( 2.0, 0.0, 0.0, 4.0) / 8.0; const vec4 kD = vec4( 0.0, 2.0, -1.0, -1.0) / 8.0; // Conserve constant registers and take advantage of free swizzle on load #define kE (kA.xywz) #define kF (kB.xywz) value += temp; // There are five filter patterns (identity, cross, checker, // theta, phi). Precompute the terms from all of them and then // use swizzles to assign to color channels. // // Channel Matches // x cross (e.g., EE G) // y checker (e.g., EE B) // z theta (e.g., EO R) // w phi (e.g., EO R) #define A (value[0]) #define B (value[1]) #define D (Dvec.x) #define E (value[2]) #define F (value[3]) // Avoid zero elements. On a scalar processor this saves two MADDs // and it has no effect on a vector processor. PATTERN.yzw += (kD.yz * D).xyy; PATTERN += (kA.xyz * A).xyzx + (kE.xyw * E).xyxz; PATTERN.xw += kB.xw * B; PATTERN.xz += kF.xz * F; rgb = (alternate.y == 0.0) ? ((alternate.x == 0.0) ? vec3(C, PATTERN.xy) : vec3(PATTERN.z, C, PATTERN.w)) : ((alternate.x == 0.0) ? vec3(PATTERN.w, C, PATTERN.z) : vec3(PATTERN.yx, C)); rgb = rgb - blacklevel; /* * CCM is a 3x3 in the format * * +--------------+----------------+---------------+ * | RedRedGain | RedGreenGain | RedBlueGain | * +--------------+----------------+---------------+ * | GreenRedGain | GreenGreenGain | GreenBlueGain | * +--------------+----------------+---------------+ * | BlueRedGain | BlueGreenGain | BlueBlueGain | * +--------------+----------------+---------------+ * * Rout = RedRedGain * Rin + RedGreenGain * Gin + RedBlueGain * Bin * Gout = GreenRedGain * Rin + GreenGreenGain * Gin + GreenBlueGain * Bin * Bout = BlueRedGain * Rin + BlueGreenGain * Gin + BlueBlueGain * Bin * * We upload to the GPU without transposition glUniformMatrix3f(.., .., GL_FALSE, ccm); * * CPU * float ccm [] = { * RedRedGain, RedGreenGain, RedBlueGain, * GreenRedGain, GreenGreenGain, GreenBlueGain, * BlueRedGain, BlueGreenGain, BlueBlueGain, * }; * * GPU * ccm = { * RedRedGain, GreenRedGain, BlueRedGain, * RedGreenGain, GreenGreenGain, BlueGreenGain, * RedBlueGain, GreenBlueGain, BlueBlueGain, * } * * However the indexing for the mat data-type is column major hence * ccm[0][0] = RedRedGain, ccm[0][1] = RedGreenGain, ccm[0][2] = RedBlueGain * */ float rin, gin, bin; rin = rgb.r; gin = rgb.g; bin = rgb.b; rgb.r = (rin * ccm[0][0]) + (gin * ccm[0][1]) + (bin * ccm[0][2]); rgb.g = (rin * ccm[1][0]) + (gin * ccm[1][1]) + (bin * ccm[1][2]); rgb.b = (rin * ccm[2][0]) + (gin * ccm[2][1]) + (bin * ccm[2][2]); /* * Contrast */ rgb = clamp(rgb, 0.0, 1.0); rgb.r = apply_contrast(rgb.r); rgb.g = apply_contrast(rgb.g); rgb.b = apply_contrast(rgb.b); /* Apply gamma after colour correction */ rgb = pow(rgb, vec3(gamma)); #if defined (SWAP_BLUE) gl_FragColor = vec4(rgb.bgr, 1.0); #else gl_FragColor = vec4(rgb, 1.0); #endif } [0:05:10.780912793] [1525] DEBUG Debayer debayer_egl.cpp:128 vertexIn 0 textureIn 1 tex_y 5 ccm 6 blacklevel 7 gamma 8 contrastExp 9 tex_step 2 tex_size 1 stride_factor 4 tex_bayer_first_red 3 proj_matrix 0 [0:05:10.781016478] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 0 [0:05:10.816694775] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 1 [0:05:10.816752164] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 2 [0:05:10.816776756] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 3 cam0: Capture 1 frames [0:05:10.897460552] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1855 /dev/video0[20:cap]: Dequeuing buffer 0 [0:05:10.897643126] [1525] DEBUG eGL egl.cpp:168 eglCreateImageKHR fail [0:05:10.897697812] [1525] INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload ...
Thanks! On 11.06.26 11:33, Milan Zamazal wrote: > Robert Mader<robert.mader@collabora.com> writes: > > >> Just to make sure I understand you correctly: >> >> 1. You do see he "DMABuf import failed" *with* this patch on top of >> master, correct? (sorry, I assume that was the case, just to be >> fully sure) > With or without. On master, without your patch, I get the error due to > eglCreateImageKHR failure. Which is BTW reported only on debug level, > so apparently kind of expected. After the mentioned debug print this is printed once at info level: INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload > > FWIW, I'll additionally test on TI AM69 tomorrow, but considering the > state of the drivers I have there, I don't hope for much. > >> 2. Do you also see the newly introduced "Input buffer stride ignored by >> the driver." log? That would be the most important bit - otherwise >> there's a chance that the import fails *despite* a correct stride. >> On some GPUs can happen if e.g. the buffer size is too big for the >> hardware and the driver needs to allocate multiple buffers >> internally - should *not* happen with 1920x1080, but might with 4k. >> 3. Did you double-check if the reported stride is a multiple of 256 (in >> the log similar to "INFO SoftwareIsp software_isp.cpp:293 Input >> 4080x3072-GRBG-10-CSI2P stride 5120")? >> >> Or, to make it quicker for you: could you post command and output you tried? That would be super helpful >> :) > The following is from master. Your patch changes the stride to 6656 as > expected, I don't think there are other differences. That means instead of INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 you get INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6565 and there is no Info log containing "Input buffer stride ignored by the driver."? If that's the case, then the patch works as expected on RPi - and we can land it \o/ Do you mind giving you T-B? P.S.: The fact that the direct import still fails despite using the requested buffer alignment is likely due to the input buffer size - it wouldn't surprise me if 3280x2464 is simply too big for the RPi4 GPU. You might be more lucky trying "width=1280,height=720" as output size, as that should allow the sensor to run at 1920x1080. But that's not directly related to this patch. > > LIBCAMERA_LOG_LEVEL='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 > > pdm@raspberrypi ~/libcamera> LIBCAMERA_LOG_LEVEL='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 > [0:05:02.512812002] [1483] INFO Camera camera_manager.cpp:340 libcamera v0.7.1 > [0:05:02.513406409] [1486] INFO IPAManager ipa_manager.cpp:148 libcamera is not installed. Adding '/home/pdm/libcamera/build-swisp/src/ipa' to the IPA search path > [0:05:02.632238687] [1486] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' > [0:05:02.632491687] [1486] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' > [0:05:02.632543668] [1486] WARN IPAProxy ipa_proxy.cpp:196 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to '/home/pdm/libcamera/src/ipa/simple/data/uncalibrated.yaml' > [0:05:02.633761168] [1486] INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler simple > Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0 > [0:05:02.634298261] [1483] INFO Camera camera.cpp:1216 configuring streams: (0) 1920x1080-ABGR8888/sRGB > [0:05:02.634508354] [1486] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) > [0:05:02.634620335] [1486] INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 > [0:05:02.688558502] [1488] INFO eGL egl.cpp:318 EGL: EGL_VERSION: 1.4 > [0:05:02.688673631] [1488] INFO eGL egl.cpp:319 EGL: EGL_VENDOR: Mesa Project > [0:05:02.688714187] [1488] INFO eGL egl.cpp:320 EGL: EGL_CLIENT_APIS: OpenGL OpenGL_ES > [0:05:02.688751946] [1488] INFO eGL egl.cpp:321 EGL: EGL_EXTENSIONS: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_surface_compression EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display > [0:05:02.697301446] [1488] INFO eGL egl.cpp:362 EGL: GL_VERSION: OpenGL ES 3.1 Mesa 24.2.8-1~bpo12+rpt4 > cam0: Capture 1 frames > [0:05:02.865147335] [1488] INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload > 302.818358 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 8294400 > pdm@raspberrypi ~/libcamera> LIBCAMERA_LOG_LEVELS='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 > [0:05:10.625925849] [1520] INFO Camera camera_manager.cpp:340 libcamera v0.7.1 > [0:05:10.626395497] [1523] DEBUG Camera camera_manager.cpp:73 Starting camera manager > [0:05:10.626607164] [1523] INFO IPAManager ipa_manager.cpp:148 libcamera is not installed. Adding '/home/pdm/libcamera/build-swisp/src/ipa' to the IPA search path > [0:05:10.627003182] [1523] DEBUG IPAModule ipa_module.cpp:333 ipa_soft_simple.so: IPA module /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so is signed > [0:05:10.627093516] [1523] DEBUG IPAManager ipa_manager.cpp:240 Loaded IPA module '/home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so' > [0:05:10.637506682] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "rpi-hevc-dec" created from /dev/media0 > [0:05:10.637579441] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media0 due to 1 missing dependencies > [0:05:10.637892849] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media0 found > [0:05:10.637916534] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media0: rpi-hevc-dec > [0:05:10.638138423] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-codec" created from /dev/media4 > [0:05:10.638163682] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media4 due to 5 missing dependencies > [0:05:10.639455664] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media4 found > [0:05:10.639476256] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media4: bcm2835-codec > [0:05:10.639638571] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-isp" created from /dev/media2 > [0:05:10.639661293] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media2 due to 4 missing dependencies > [0:05:10.639831071] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-isp" created from /dev/media3 > [0:05:10.639853090] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media3 due to 4 missing dependencies > [0:05:10.640924793] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media2 found > [0:05:10.640983682] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media2: bcm2835-isp > [0:05:10.642008775] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media3 found > [0:05:10.642030460] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media3: bcm2835-isp > [0:05:10.642312275] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "unicam" created from /dev/media1 > [0:05:10.642496516] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media1 due to 1 missing dependencies > [0:05:10.642756238] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media1 found > [0:05:10.642775756] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media1: unicam > [0:05:10.643246812] [1523] DEBUG Camera camera_manager.cpp:143 Found registered pipeline handler 'simple' > [0:05:10.643309571] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:355 Successful match for media device "unicam" > [0:05:10.643364312] [1523] DEBUG SimplePipeline simple.cpp:1905 Sensor found for /dev/media1 > [0:05:10.643404386] [1523] DEBUG SimplePipeline simple.cpp:503 Found capture device unicam-image > [0:05:10.643448997] [1523] DEBUG CameraSensor camera_sensor_raw.cpp:213 imx219 10-0010: unsupported number of sinks (0) or sources (1) > [0:05:10.643529590] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Exposure (0x00980911) > [0:05:10.643588293] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Flip (0x00980914) > [0:05:10.643613923] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Flip (0x00980915) > [0:05:10.643638608] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Orientation (0x009a0922) > [0:05:10.643676256] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Sensor Rotation (0x009a0923) > [0:05:10.643702386] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Blanking (0x009e0901) > [0:05:10.643725534] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Blanking (0x009e0902) > [0:05:10.643749201] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Analogue Gain (0x009e0903) > [0:05:10.643771738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Red Pixel Value (0x009e0904) > [0:05:10.643794441] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Red) Pixel Value (0x009e0905) > [0:05:10.643816997] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Blue Pixel Value (0x009e0906) > [0:05:10.643840312] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Blue) Pixel Value (0x009e0907) > [0:05:10.643864497] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Link Frequency (0x009f0901) > [0:05:10.643889867] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Pixel Rate (0x009f0902) > [0:05:10.643915756] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Test Pattern (0x009f0903) > [0:05:10.643947367] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Digital Gain (0x009f0905) > [0:05:10.644858312] [1523] DEBUG CameraSensor camera_sensor_legacy.cpp:1028 'imx219 10-0010': Apply test pattern mode 0 > [0:05:10.644958404] [1523] DEBUG CameraSensor camera_sensor.cpp:476 Entity 'imx219 10-0010' matched by CameraSensorLegacy > [0:05:10.644994516] [1523] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Exposure > [0:05:10.645016238] [1523] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 1 and priority write flag 0 for Analogue Gain > [0:05:10.645056775] [1523] DEBUG SimplePipeline simple.cpp:577 Found pipeline: [imx219 10-0010|0] -> [0|unicam-image] > [0:05:10.645123460] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Exposure (0x00980911) > [0:05:10.645155071] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Flip (0x00980914) > [0:05:10.645178682] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Flip (0x00980915) > [0:05:10.645203071] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Orientation (0x009a0922) > [0:05:10.645235738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Sensor Rotation (0x009a0923) > [0:05:10.645260478] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Blanking (0x009e0901) > [0:05:10.645283275] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Blanking (0x009e0902) > [0:05:10.645305812] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Analogue Gain (0x009e0903) > [0:05:10.645330145] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Red Pixel Value (0x009e0904) > [0:05:10.645352738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Red) Pixel Value (0x009e0905) > [0:05:10.645375256] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Blue Pixel Value (0x009e0906) > [0:05:10.645397719] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Blue) Pixel Value (0x009e0907) > [0:05:10.645421312] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Link Frequency (0x009f0901) > [0:05:10.645446201] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Pixel Rate (0x009f0902) > [0:05:10.645471182] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Test Pattern (0x009f0903) > [0:05:10.645502423] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Digital Gain (0x009f0905) > [0:05:10.645577016] [1523] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[20:cap]: Opened device platform:fe801000.csi: unicam: unicam > [0:05:10.645737756] [1523] DEBUG DmaBufAllocator dma_buf_allocator.cpp:112 Using /dev/dma_heap/linux,cma > [0:05:10.676996182] [1523] DEBUG IPAManager ipa_manager.cpp:310 IPA module /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so signature is valid > [0:05:10.677424978] [1523] DEBUG IPAProxy soft_ipa_proxy.cpp:44 initializing soft proxy in thread: loading IPA from /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so > [0:05:10.681140312] [1523] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' > [0:05:10.681370997] [1523] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' > [0:05:10.681421275] [1523] WARN IPAProxy ipa_proxy.cpp:196 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to '/home/pdm/libcamera/src/ipa/simple/data/uncalibrated.yaml' > [0:05:10.681741053] [1523] DEBUG IPASoft soft_simple.cpp:127 IPASoft: Tuning file version 1 > [0:05:10.681844312] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'BlackLevel' > [0:05:10.681888756] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Awb' > [0:05:10.681941071] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Adjust' > [0:05:10.681986330] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Agc' > [0:05:10.682243627] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB10_1X10/RAW > [0:05:10.682333478] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 640x480 in pixel formats [ RG10, pRAA ] > [0:05:10.682467904] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB10_1X10/RAW > [0:05:10.682520960] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1640x1232 in pixel formats [ RG10, pRAA ] > [0:05:10.682627201] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB10_1X10/RAW > [0:05:10.682679219] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1920x1080 in pixel formats [ RG10, pRAA ] > [0:05:10.682786978] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB10_1X10/RAW > [0:05:10.682838238] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 3280x2464 in pixel formats [ RG10, pRAA ] > [0:05:10.682944664] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB8_1X8/RAW > [0:05:10.682994182] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 640x480 in pixel formats [ RGGB ] > [0:05:10.683101830] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB8_1X8/RAW > [0:05:10.683150015] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1640x1232 in pixel formats [ RGGB ] > [0:05:10.683251460] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB8_1X8/RAW > [0:05:10.683297719] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1920x1080 in pixel formats [ RGGB ] > [0:05:10.683399534] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB8_1X8/RAW > [0:05:10.683445738] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 3280x2464 in pixel formats [ RGGB ] > [0:05:10.683544941] [1523] INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler simple > [0:05:10.683590571] [1523] DEBUG SimplePipeline simple.cpp:2029 Matched on device: /dev/media1 > [0:05:10.683627830] [1523] DEBUG Camera camera_manager.cpp:164 Pipeline handler "simple" matched > [0:05:10.683929756] [1523] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 3272x2464 > [0:05:10.683978812] [1523] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 > [0:05:10.684045497] [1523] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 3272x2464 and max raw stream size 0x0 > [0:05:10.684094256] [1523] DEBUG SimplePipeline simple.cpp:1327 Unspecified color space set to sRGB > [0:05:10.684133090] [1523] DEBUG SimplePipeline simple.cpp:1391 Adjusting bufferCount from 0 to 4 > [0:05:10.684259553] [1520] DEBUG Camera camera.cpp:1151 streams configuration: (0) 3272x2464-ABGR8888/sRGB > [0:05:10.684345164] [1520] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 1920x1080 > [0:05:10.684389386] [1520] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 > [0:05:10.684429738] [1520] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 1920x1080 and max raw stream size 0x0 > Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0 > [0:05:10.684607793] [1520] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 1920x1080 > [0:05:10.684671275] [1520] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 > [0:05:10.684721997] [1520] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 1920x1080 and max raw stream size 0x0 > [0:05:10.684799090] [1520] INFO Camera camera.cpp:1216 configuring streams: (0) 1920x1080-ABGR8888/sRGB > [0:05:10.684969238] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SBGGR10_1X10/RAW > [0:05:10.685085330] [1523] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) > [0:05:10.685180553] [1523] INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 > [0:05:10.688248127] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.690984590] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.693705608] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.696425627] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.696553090] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 > [0:05:10.696622349] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 > [0:05:10.696669682] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 > [0:05:10.696712034] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 > [0:05:10.696757053] [1520] DEBUG Camera camera.cpp:1408 Starting capture > [0:05:10.721391515] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1336 /dev/video0[20:cap]: 4 buffers requested. > [0:05:10.721580441] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.721635071] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.721683997] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.721734478] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous > [0:05:10.740284015] [1525] INFO eGL egl.cpp:318 EGL: EGL_VERSION: 1.4 > [0:05:10.740395534] [1525] INFO eGL egl.cpp:319 EGL: EGL_VENDOR: Mesa Project > [0:05:10.740434052] [1525] INFO eGL egl.cpp:320 EGL: EGL_CLIENT_APIS: OpenGL OpenGL_ES > [0:05:10.740471756] [1525] INFO eGL egl.cpp:321 EGL: EGL_EXTENSIONS: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_surface_compression EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display > [0:05:10.749028682] [1525] INFO eGL egl.cpp:362 EGL: GL_VERSION: OpenGL ES 3.1 Mesa 24.2.8-1~bpo12+rpt4 > [0:05:10.749214682] [1525] DEBUG Debayer debayer_egl.cpp:619 Available fragment shader texture units 24 > [0:05:10.779853090] [1525] DEBUG eGL egl.cpp:539 Shader length is 1720 > [0:05:10.779992071] [1525] DEBUG eGL egl.cpp:546 Shader source = #version 100 > #extension GL_OES_EGL_image_external: enable > #define SWAP_BLUE > #define RAW10P > /* SPDX-License-Identifier: BSD-2-Clause */ > /* > Fromhttp://jgt.akpeters.com/papers/McGuire08/ > > Efficient, High-Quality Bayer Demosaic Filtering on GPUs > > Morgan McGuire > > This paper appears in issue Volume 13, Number 4. > --------------------------------------------------------- > Copyright (c) 2008, Morgan McGuire. All rights reserved. > > Modified by Linaro Ltd to integrate it into libcamera. > Copyright (C) 2021, Linaro > */ > > //Vertex Shader > > attribute vec4 vertexIn; > attribute vec2 textureIn; > > uniform mat4 proj_matrix; > > uniform vec2 tex_size; /* The texture size in pixels */ > uniform vec2 tex_step; > > /** Pixel position of the first red pixel in the */ > /** Bayer pattern. [{0,1}, {0, 1}]*/ > uniform vec2 tex_bayer_first_red; > > /** .xy = Pixel being sampled in the fragment shader on the range [0, 1] > .zw = ...on the range [0, sourceSize], offset by firstRed */ > varying vec4 center; > > /** center.x + (-2/w, -1/w, 1/w, 2/w); These are the x-positions */ > /** of the adjacent pixels.*/ > varying vec4 xCoord; > > /** center.y + (-2/h, -1/h, 1/h, 2/h); These are the y-positions */ > /** of the adjacent pixels.*/ > varying vec4 yCoord; > > uniform float stride_factor; > > void main(void) { > center.xy = vec2(textureIn.x * stride_factor, textureIn.y); > center.zw = textureIn * tex_size + tex_bayer_first_red; > > xCoord = center.x + vec4(-2.0 * tex_step.x, > -tex_step.x, tex_step.x, 2.0 * tex_step.x); > yCoord = center.y + vec4(-2.0 * tex_step.y, > -tex_step.y, tex_step.y, 2.0 * tex_step.y); > > gl_Position = proj_matrix * vertexIn; > } > > [0:05:10.780585201] [1525] DEBUG eGL egl.cpp:539 Shader length is 6307 > [0:05:10.780617775] [1525] DEBUG eGL egl.cpp:546 Shader source = #version 100 > #extension GL_OES_EGL_image_external: enable > #define SWAP_BLUE > #define RAW10P > /* SPDX-License-Identifier: BSD-2-Clause */ > /* > Fromhttp://jgt.akpeters.com/papers/McGuire08/ > > Efficient, High-Quality Bayer Demosaic Filtering on GPUs > > Morgan McGuire > > This paper appears in issue Volume 13, Number 4. > --------------------------------------------------------- > Copyright (c) 2008, Morgan McGuire. All rights reserved. > > Modified by Linaro Ltd to integrate it into libcamera. > Copyright (C) 2021, Linaro > */ > > //Pixel Shader > #ifdef GL_ES > precision highp float; > #endif > > /** Monochrome RGBA or GL_LUMINANCE Bayer encoded texture.*/ > uniform sampler2D tex_y; > varying vec4 center; > varying vec4 yCoord; > varying vec4 xCoord; > uniform mat3 ccm; > uniform vec3 blacklevel; > uniform float gamma; > uniform float contrastExp; > > float apply_contrast(float value) > { > // Apply simple S-curve > if (value < 0.5) > return 0.5 * pow(value / 0.5, contrastExp); > else > return 1.0 - 0.5 * pow((1.0 - value) / 0.5, contrastExp); > } > > void main(void) { > vec3 rgb; > > #if defined(RAW10P) > #define pixel(p) p.r / 4.0 + p.g * 64.0 > #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) > #elif defined(RAW12P) > #define pixel(p) p.r / 16.0 + p.g * 16.0 > #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) > #else > #define fetch(x, y) texture2D(tex_y, vec2(x, y)).r > #endif > > float C = fetch(center.x, center.y); // ( 0, 0) > const vec4 kC = vec4( 4.0, 6.0, 5.0, 5.0) / 8.0; > > // Determine which of four types of pixels we are on. > vec2 alternate = mod(floor(center.zw), 2.0); > > vec4 Dvec = vec4( > fetch(xCoord[1], yCoord[1]), // (-1,-1) > fetch(xCoord[1], yCoord[2]), // (-1, 1) > fetch(xCoord[2], yCoord[1]), // ( 1,-1) > fetch(xCoord[2], yCoord[2])); // ( 1, 1) > > vec4 PATTERN = (kC.xyz * C).xyzz; > > // Can also be a dot product with (1,1,1,1) on hardware where that is > // specially optimized. > // Equivalent to: D = Dvec[0] + Dvec[1] + Dvec[2] + Dvec[3]; > Dvec.xy += Dvec.zw; > Dvec.x += Dvec.y; > > vec4 value = vec4( > fetch(center.x, yCoord[0]), // ( 0,-2) > fetch(center.x, yCoord[1]), // ( 0,-1) > fetch(xCoord[0], center.y), // (-2, 0) > fetch(xCoord[1], center.y)); // (-1, 0) > > vec4 temp = vec4( > fetch(center.x, yCoord[3]), // ( 0, 2) > fetch(center.x, yCoord[2]), // ( 0, 1) > fetch(xCoord[3], center.y), // ( 2, 0) > fetch(xCoord[2], center.y)); // ( 1, 0) > > // Even the simplest compilers should be able to constant-fold these to > // avoid the division. > // Note that on scalar processors these constants force computation of some > // identical products twice. > const vec4 kA = vec4(-1.0, -1.5, 0.5, -1.0) / 8.0; > const vec4 kB = vec4( 2.0, 0.0, 0.0, 4.0) / 8.0; > const vec4 kD = vec4( 0.0, 2.0, -1.0, -1.0) / 8.0; > > // Conserve constant registers and take advantage of free swizzle on load > #define kE (kA.xywz) > #define kF (kB.xywz) > > value += temp; > > // There are five filter patterns (identity, cross, checker, > // theta, phi). Precompute the terms from all of them and then > // use swizzles to assign to color channels. > // > // Channel Matches > // x cross (e.g., EE G) > // y checker (e.g., EE B) > // z theta (e.g., EO R) > // w phi (e.g., EO R) > #define A (value[0]) > #define B (value[1]) > #define D (Dvec.x) > #define E (value[2]) > #define F (value[3]) > > // Avoid zero elements. On a scalar processor this saves two MADDs > // and it has no effect on a vector processor. > PATTERN.yzw += (kD.yz * D).xyy; > > PATTERN += (kA.xyz * A).xyzx + (kE.xyw * E).xyxz; > PATTERN.xw += kB.xw * B; > PATTERN.xz += kF.xz * F; > > rgb = (alternate.y == 0.0) ? > ((alternate.x == 0.0) ? > vec3(C, PATTERN.xy) : > vec3(PATTERN.z, C, PATTERN.w)) : > ((alternate.x == 0.0) ? > vec3(PATTERN.w, C, PATTERN.z) : > vec3(PATTERN.yx, C)); > > rgb = rgb - blacklevel; > > /* > * CCM is a 3x3 in the format > * > * +--------------+----------------+---------------+ > * | RedRedGain | RedGreenGain | RedBlueGain | > * +--------------+----------------+---------------+ > * | GreenRedGain | GreenGreenGain | GreenBlueGain | > * +--------------+----------------+---------------+ > * | BlueRedGain | BlueGreenGain | BlueBlueGain | > * +--------------+----------------+---------------+ > * > * Rout = RedRedGain * Rin + RedGreenGain * Gin + RedBlueGain * Bin > * Gout = GreenRedGain * Rin + GreenGreenGain * Gin + GreenBlueGain * Bin > * Bout = BlueRedGain * Rin + BlueGreenGain * Gin + BlueBlueGain * Bin > * > * We upload to the GPU without transposition glUniformMatrix3f(.., .., GL_FALSE, ccm); > * > * CPU > * float ccm [] = { > * RedRedGain, RedGreenGain, RedBlueGain, > * GreenRedGain, GreenGreenGain, GreenBlueGain, > * BlueRedGain, BlueGreenGain, BlueBlueGain, > * }; > * > * GPU > * ccm = { > * RedRedGain, GreenRedGain, BlueRedGain, > * RedGreenGain, GreenGreenGain, BlueGreenGain, > * RedBlueGain, GreenBlueGain, BlueBlueGain, > * } > * > * However the indexing for the mat data-type is column major hence > * ccm[0][0] = RedRedGain, ccm[0][1] = RedGreenGain, ccm[0][2] = RedBlueGain > * > */ > float rin, gin, bin; > rin = rgb.r; > gin = rgb.g; > bin = rgb.b; > > rgb.r = (rin * ccm[0][0]) + (gin * ccm[0][1]) + (bin * ccm[0][2]); > rgb.g = (rin * ccm[1][0]) + (gin * ccm[1][1]) + (bin * ccm[1][2]); > rgb.b = (rin * ccm[2][0]) + (gin * ccm[2][1]) + (bin * ccm[2][2]); > > /* > * Contrast > */ > rgb = clamp(rgb, 0.0, 1.0); > rgb.r = apply_contrast(rgb.r); > rgb.g = apply_contrast(rgb.g); > rgb.b = apply_contrast(rgb.b); > > /* Apply gamma after colour correction */ > rgb = pow(rgb, vec3(gamma)); > > #if defined (SWAP_BLUE) > gl_FragColor = vec4(rgb.bgr, 1.0); > #else > gl_FragColor = vec4(rgb, 1.0); > #endif > } > > [0:05:10.780912793] [1525] DEBUG Debayer debayer_egl.cpp:128 vertexIn 0 textureIn 1 tex_y 5 ccm 6 blacklevel 7 gamma 8 contrastExp 9 tex_step 2 tex_size 1 stride_factor 4 tex_bayer_first_red 3 proj_matrix 0 > [0:05:10.781016478] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 0 > [0:05:10.816694775] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 1 > [0:05:10.816752164] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 2 > [0:05:10.816776756] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 3 > cam0: Capture 1 frames > [0:05:10.897460552] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1855 /dev/video0[20:cap]: Dequeuing buffer 0 > [0:05:10.897643126] [1525] DEBUG eGL egl.cpp:168 eglCreateImageKHR fail > [0:05:10.897697812] [1525] INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload > ... >
On 11.06.26 11:51, Robert Mader wrote: >> The following is from master. Your patch changes the stride to 6656 as >> expected, I don't think there are other differences. > > That means instead of > > INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 > > you get > > INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6565 Sorry, I meant INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6556 of course. I find it slightly confusing that this is *smaller* than the driver-preferred 6560 (3280*2) - but then 6556 is the value `PixelFormatInfo::stride()` calculates and the driver successfully uses it - so 🤷
Robert Mader <robert.mader@collabora.com> writes: > Thanks! > > On 11.06.26 11:33, Milan Zamazal wrote: >> Robert Mader<robert.mader@collabora.com> writes: >> >> >>> Just to make sure I understand you correctly: >>> >>> 1. You do see he "DMABuf import failed" *with* this patch on top of >>> master, correct? (sorry, I assume that was the case, just to be >>> fully sure) >> With or without. On master, without your patch, I get the error due to >> eglCreateImageKHR failure. Which is BTW reported only on debug level, >> so apparently kind of expected. > After the mentioned debug print this is printed once at info level: > > INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload > >> >> FWIW, I'll additionally test on TI AM69 tomorrow, but considering the >> state of the drivers I have there, I don't hope for much. >> >>> 2. Do you also see the newly introduced "Input buffer stride ignored by >>> the driver." log? That would be the most important bit - otherwise >>> there's a chance that the import fails *despite* a correct stride. >>> On some GPUs can happen if e.g. the buffer size is too big for the >>> hardware and the driver needs to allocate multiple buffers >>> internally - should *not* happen with 1920x1080, but might with 4k. >>> 3. Did you double-check if the reported stride is a multiple of 256 (in >>> the log similar to "INFO SoftwareIsp software_isp.cpp:293 Input >>> 4080x3072-GRBG-10-CSI2P stride 5120")? >>> >>> Or, to make it quicker for you: could you post command and output you tried? That would be super helpful >>> :) >> The following is from master. Your patch changes the stride to 6656 as >> expected, I don't think there are other differences. > > That means instead of > > INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 > > you get > > INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6565 The stride with your patch is 6656. > and there is no Info log containing "Input buffer stride ignored by the driver."? There is no such message, the check passes. > If that's the case, then the patch works as expected on RPi - and we can land it \o/ Excellent! > Do you mind giving you T-B? Will do. > P.S.: The fact that the direct import still fails despite using the requested buffer alignment is likely due to the input buffer size - it wouldn't surprise me if 3280x2464 is simply too big for the > RPi4 GPU. You might be more lucky trying "width=1280,height=720" as output size, as that should allow the sensor to run at 1920x1080. But that's not directly related to this patch. I tried width=636,height=480, resulting in "Input 640x480-BGGR-10 stride 1280", but I still get the error. >> >> LIBCAMERA_LOG_LEVEL='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 >> >> pdm@raspberrypi ~/libcamera> LIBCAMERA_LOG_LEVEL='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 >> [0:05:02.512812002] [1483] INFO Camera camera_manager.cpp:340 libcamera v0.7.1 >> [0:05:02.513406409] [1486] INFO IPAManager ipa_manager.cpp:148 libcamera is not installed. Adding '/home/pdm/libcamera/build-swisp/src/ipa' to the IPA search path >> [0:05:02.632238687] [1486] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' >> [0:05:02.632491687] [1486] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' >> [0:05:02.632543668] [1486] WARN IPAProxy ipa_proxy.cpp:196 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to '/home/pdm/libcamera/src/ipa/simple/data/uncalibrated.yaml' >> [0:05:02.633761168] [1486] INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler simple >> Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0 >> [0:05:02.634298261] [1483] INFO Camera camera.cpp:1216 configuring streams: (0) 1920x1080-ABGR8888/sRGB >> [0:05:02.634508354] [1486] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) >> [0:05:02.634620335] [1486] INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 >> [0:05:02.688558502] [1488] INFO eGL egl.cpp:318 EGL: EGL_VERSION: 1.4 >> [0:05:02.688673631] [1488] INFO eGL egl.cpp:319 EGL: EGL_VENDOR: Mesa Project >> [0:05:02.688714187] [1488] INFO eGL egl.cpp:320 EGL: EGL_CLIENT_APIS: OpenGL OpenGL_ES >> [0:05:02.688751946] [1488] INFO eGL egl.cpp:321 EGL: EGL_EXTENSIONS: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_surface_compression EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display >> [0:05:02.697301446] [1488] INFO eGL egl.cpp:362 EGL: GL_VERSION: OpenGL ES 3.1 Mesa 24.2.8-1~bpo12+rpt4 >> cam0: Capture 1 frames >> [0:05:02.865147335] [1488] INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload >> 302.818358 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 8294400 >> pdm@raspberrypi ~/libcamera> LIBCAMERA_LOG_LEVELS='*:DEBUG' ./build-swisp/src/apps/cam/cam -c1 -C1 -s width=1920,height=1080 >> [0:05:10.625925849] [1520] INFO Camera camera_manager.cpp:340 libcamera v0.7.1 >> [0:05:10.626395497] [1523] DEBUG Camera camera_manager.cpp:73 Starting camera manager >> [0:05:10.626607164] [1523] INFO IPAManager ipa_manager.cpp:148 libcamera is not installed. Adding '/home/pdm/libcamera/build-swisp/src/ipa' to the IPA search path >> [0:05:10.627003182] [1523] DEBUG IPAModule ipa_module.cpp:333 ipa_soft_simple.so: IPA module /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so is signed >> [0:05:10.627093516] [1523] DEBUG IPAManager ipa_manager.cpp:240 Loaded IPA module '/home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so' >> [0:05:10.637506682] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "rpi-hevc-dec" created from /dev/media0 >> [0:05:10.637579441] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media0 due to 1 missing dependencies >> [0:05:10.637892849] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media0 found >> [0:05:10.637916534] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media0: rpi-hevc-dec >> [0:05:10.638138423] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-codec" created from /dev/media4 >> [0:05:10.638163682] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media4 due to 5 missing dependencies >> [0:05:10.639455664] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media4 found >> [0:05:10.639476256] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media4: bcm2835-codec >> [0:05:10.639638571] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-isp" created from /dev/media2 >> [0:05:10.639661293] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media2 due to 4 missing dependencies >> [0:05:10.639831071] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "bcm2835-isp" created from /dev/media3 >> [0:05:10.639853090] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media3 due to 4 missing dependencies >> [0:05:10.640924793] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media2 found >> [0:05:10.640983682] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media2: bcm2835-isp >> [0:05:10.642008775] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media3 found >> [0:05:10.642030460] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media3: bcm2835-isp >> [0:05:10.642312275] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:267 New media device "unicam" created from /dev/media1 >> [0:05:10.642496516] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:109 Defer media device /dev/media1 due to 1 missing dependencies >> [0:05:10.642756238] [1523] DEBUG DeviceEnumerator device_enumerator_udev.cpp:344 All dependencies for media device /dev/media1 found >> [0:05:10.642775756] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:295 Added device /dev/media1: unicam >> [0:05:10.643246812] [1523] DEBUG Camera camera_manager.cpp:143 Found registered pipeline handler 'simple' >> [0:05:10.643309571] [1523] DEBUG DeviceEnumerator device_enumerator.cpp:355 Successful match for media device "unicam" >> [0:05:10.643364312] [1523] DEBUG SimplePipeline simple.cpp:1905 Sensor found for /dev/media1 >> [0:05:10.643404386] [1523] DEBUG SimplePipeline simple.cpp:503 Found capture device unicam-image >> [0:05:10.643448997] [1523] DEBUG CameraSensor camera_sensor_raw.cpp:213 imx219 10-0010: unsupported number of sinks (0) or sources (1) >> [0:05:10.643529590] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Exposure (0x00980911) >> [0:05:10.643588293] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Flip (0x00980914) >> [0:05:10.643613923] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Flip (0x00980915) >> [0:05:10.643638608] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Orientation (0x009a0922) >> [0:05:10.643676256] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Sensor Rotation (0x009a0923) >> [0:05:10.643702386] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Blanking (0x009e0901) >> [0:05:10.643725534] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Blanking (0x009e0902) >> [0:05:10.643749201] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Analogue Gain (0x009e0903) >> [0:05:10.643771738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Red Pixel Value (0x009e0904) >> [0:05:10.643794441] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Red) Pixel Value (0x009e0905) >> [0:05:10.643816997] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Blue Pixel Value (0x009e0906) >> [0:05:10.643840312] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Blue) Pixel Value (0x009e0907) >> [0:05:10.643864497] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Link Frequency (0x009f0901) >> [0:05:10.643889867] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Pixel Rate (0x009f0902) >> [0:05:10.643915756] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Test Pattern (0x009f0903) >> [0:05:10.643947367] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Digital Gain (0x009f0905) >> [0:05:10.644858312] [1523] DEBUG CameraSensor camera_sensor_legacy.cpp:1028 'imx219 10-0010': Apply test pattern mode 0 >> [0:05:10.644958404] [1523] DEBUG CameraSensor camera_sensor.cpp:476 Entity 'imx219 10-0010' matched by CameraSensorLegacy >> [0:05:10.644994516] [1523] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Exposure >> [0:05:10.645016238] [1523] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 1 and priority write flag 0 for Analogue Gain >> [0:05:10.645056775] [1523] DEBUG SimplePipeline simple.cpp:577 Found pipeline: [imx219 10-0010|0] -> [0|unicam-image] >> [0:05:10.645123460] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Exposure (0x00980911) >> [0:05:10.645155071] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Flip (0x00980914) >> [0:05:10.645178682] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Flip (0x00980915) >> [0:05:10.645203071] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Orientation (0x009a0922) >> [0:05:10.645235738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Camera Sensor Rotation (0x009a0923) >> [0:05:10.645260478] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Vertical Blanking (0x009e0901) >> [0:05:10.645283275] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Horizontal Blanking (0x009e0902) >> [0:05:10.645305812] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Analogue Gain (0x009e0903) >> [0:05:10.645330145] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Red Pixel Value (0x009e0904) >> [0:05:10.645352738] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Red) Pixel Value (0x009e0905) >> [0:05:10.645375256] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Blue Pixel Value (0x009e0906) >> [0:05:10.645397719] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Green (Blue) Pixel Value (0x009e0907) >> [0:05:10.645421312] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Link Frequency (0x009f0901) >> [0:05:10.645446201] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Pixel Rate (0x009f0902) >> [0:05:10.645471182] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Test Pattern (0x009f0903) >> [0:05:10.645502423] [1523] DEBUG V4L2 v4l2_device.cpp:743 'imx219 10-0010': Control: Digital Gain (0x009f0905) >> [0:05:10.645577016] [1523] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[20:cap]: Opened device platform:fe801000.csi: unicam: unicam >> [0:05:10.645737756] [1523] DEBUG DmaBufAllocator dma_buf_allocator.cpp:112 Using /dev/dma_heap/linux,cma >> [0:05:10.676996182] [1523] DEBUG IPAManager ipa_manager.cpp:310 IPA module /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so signature is valid >> [0:05:10.677424978] [1523] DEBUG IPAProxy soft_ipa_proxy.cpp:44 initializing soft proxy in thread: loading IPA from /home/pdm/libcamera/build-swisp/src/ipa/simple/ipa_soft_simple.so >> [0:05:10.681140312] [1523] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' >> [0:05:10.681370997] [1523] INFO IPAProxy ipa_proxy.cpp:73 libcamera is not installed. Loading IPA configuration from '/home/pdm/libcamera/src/ipa/simple/data' >> [0:05:10.681421275] [1523] WARN IPAProxy ipa_proxy.cpp:196 Configuration file 'imx219.yaml' not found for IPA module 'simple', falling back to '/home/pdm/libcamera/src/ipa/simple/data/uncalibrated.yaml' >> [0:05:10.681741053] [1523] DEBUG IPASoft soft_simple.cpp:127 IPASoft: Tuning file version 1 >> [0:05:10.681844312] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'BlackLevel' >> [0:05:10.681888756] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Awb' >> [0:05:10.681941071] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Adjust' >> [0:05:10.681986330] [1523] DEBUG IPAModuleAlgo module.h:103 IPASoft: Instantiated algorithm 'Agc' >> [0:05:10.682243627] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB10_1X10/RAW >> [0:05:10.682333478] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 640x480 in pixel formats [ RG10, pRAA ] >> [0:05:10.682467904] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB10_1X10/RAW >> [0:05:10.682520960] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1640x1232 in pixel formats [ RG10, pRAA ] >> [0:05:10.682627201] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB10_1X10/RAW >> [0:05:10.682679219] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1920x1080 in pixel formats [ RG10, pRAA ] >> [0:05:10.682786978] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB10_1X10/RAW >> [0:05:10.682838238] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 3280x2464 in pixel formats [ RG10, pRAA ] >> [0:05:10.682944664] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 640x480-SRGGB8_1X8/RAW >> [0:05:10.682994182] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 640x480 in pixel formats [ RGGB ] >> [0:05:10.683101830] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1640x1232-SRGGB8_1X8/RAW >> [0:05:10.683150015] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1640x1232 in pixel formats [ RGGB ] >> [0:05:10.683251460] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 1920x1080-SRGGB8_1X8/RAW >> [0:05:10.683297719] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 1920x1080 in pixel formats [ RGGB ] >> [0:05:10.683399534] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SRGGB8_1X8/RAW >> [0:05:10.683445738] [1523] DEBUG SimplePipeline simple.cpp:718 Adding configuration for 3280x2464 in pixel formats [ RGGB ] >> [0:05:10.683544941] [1523] INFO Camera camera_manager.cpp:223 Adding camera '/base/soc/i2c0mux/i2c@1/imx219@10' for pipeline handler simple >> [0:05:10.683590571] [1523] DEBUG SimplePipeline simple.cpp:2029 Matched on device: /dev/media1 >> [0:05:10.683627830] [1523] DEBUG Camera camera_manager.cpp:164 Pipeline handler "simple" matched >> [0:05:10.683929756] [1523] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 3272x2464 >> [0:05:10.683978812] [1523] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 >> [0:05:10.684045497] [1523] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 3272x2464 and max raw stream size 0x0 >> [0:05:10.684094256] [1523] DEBUG SimplePipeline simple.cpp:1327 Unspecified color space set to sRGB >> [0:05:10.684133090] [1523] DEBUG SimplePipeline simple.cpp:1391 Adjusting bufferCount from 0 to 4 >> [0:05:10.684259553] [1520] DEBUG Camera camera.cpp:1151 streams configuration: (0) 3272x2464-ABGR8888/sRGB >> [0:05:10.684345164] [1520] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 1920x1080 >> [0:05:10.684389386] [1520] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 >> [0:05:10.684429738] [1520] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 1920x1080 and max raw stream size 0x0 >> Using camera /base/soc/i2c0mux/i2c@1/imx219@10 as cam0 >> [0:05:10.684607793] [1520] DEBUG SimplePipeline simple.cpp:1167 Largest processed stream size is 1920x1080 >> [0:05:10.684671275] [1520] DEBUG SimplePipeline simple.cpp:1169 Largest raw stream size is 0x0 >> [0:05:10.684721997] [1520] DEBUG SimplePipeline simple.cpp:1245 Picked 3280x2464-SRGGB10_1X10/Unset -> 3280x2464-SRGGB10 for max processed stream size 1920x1080 and max raw stream size 0x0 >> [0:05:10.684799090] [1520] INFO Camera camera.cpp:1216 configuring streams: (0) 1920x1080-ABGR8888/sRGB >> [0:05:10.684969238] [1523] DEBUG SimplePipeline simple.cpp:872 Link 'imx219 10-0010'[0] -> 'unicam-image'[0]: configured with format 3280x2464-SBGGR10_1X10/RAW >> [0:05:10.685085330] [1523] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) >> [0:05:10.685180553] [1523] INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6560 >> [0:05:10.688248127] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.690984590] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.693705608] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.696425627] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.696553090] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 >> [0:05:10.696622349] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 >> [0:05:10.696669682] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 >> [0:05:10.696712034] [1520] DEBUG Request request.cpp:370 Created request - cookie: 0 >> [0:05:10.696757053] [1520] DEBUG Camera camera.cpp:1408 Starting capture >> [0:05:10.721391515] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1336 /dev/video0[20:cap]: 4 buffers requested. >> [0:05:10.721580441] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.721635071] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.721683997] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.721734478] [1523] DEBUG Buffer framebuffer.cpp:358 Buffer is contiguous >> [0:05:10.740284015] [1525] INFO eGL egl.cpp:318 EGL: EGL_VERSION: 1.4 >> [0:05:10.740395534] [1525] INFO eGL egl.cpp:319 EGL: EGL_VENDOR: Mesa Project >> [0:05:10.740434052] [1525] INFO eGL egl.cpp:320 EGL: EGL_CLIENT_APIS: OpenGL OpenGL_ES >> [0:05:10.740471756] [1525] INFO eGL egl.cpp:321 EGL: EGL_EXTENSIONS: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_config_select_group EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_surface_compression EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_gl_interop EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_MESA_x11_native_visual_id EGL_WL_bind_wayland_display >> [0:05:10.749028682] [1525] INFO eGL egl.cpp:362 EGL: GL_VERSION: OpenGL ES 3.1 Mesa 24.2.8-1~bpo12+rpt4 >> [0:05:10.749214682] [1525] DEBUG Debayer debayer_egl.cpp:619 Available fragment shader texture units 24 >> [0:05:10.779853090] [1525] DEBUG eGL egl.cpp:539 Shader length is 1720 >> [0:05:10.779992071] [1525] DEBUG eGL egl.cpp:546 Shader source = #version 100 >> #extension GL_OES_EGL_image_external: enable >> #define SWAP_BLUE >> #define RAW10P >> /* SPDX-License-Identifier: BSD-2-Clause */ >> /* >> Fromhttp://jgt.akpeters.com/papers/McGuire08/ >> >> Efficient, High-Quality Bayer Demosaic Filtering on GPUs >> >> Morgan McGuire >> >> This paper appears in issue Volume 13, Number 4. >> --------------------------------------------------------- >> Copyright (c) 2008, Morgan McGuire. All rights reserved. >> >> Modified by Linaro Ltd to integrate it into libcamera. >> Copyright (C) 2021, Linaro >> */ >> >> //Vertex Shader >> >> attribute vec4 vertexIn; >> attribute vec2 textureIn; >> >> uniform mat4 proj_matrix; >> >> uniform vec2 tex_size; /* The texture size in pixels */ >> uniform vec2 tex_step; >> >> /** Pixel position of the first red pixel in the */ >> /** Bayer pattern. [{0,1}, {0, 1}]*/ >> uniform vec2 tex_bayer_first_red; >> >> /** .xy = Pixel being sampled in the fragment shader on the range [0, 1] >> .zw = ...on the range [0, sourceSize], offset by firstRed */ >> varying vec4 center; >> >> /** center.x + (-2/w, -1/w, 1/w, 2/w); These are the x-positions */ >> /** of the adjacent pixels.*/ >> varying vec4 xCoord; >> >> /** center.y + (-2/h, -1/h, 1/h, 2/h); These are the y-positions */ >> /** of the adjacent pixels.*/ >> varying vec4 yCoord; >> >> uniform float stride_factor; >> >> void main(void) { >> center.xy = vec2(textureIn.x * stride_factor, textureIn.y); >> center.zw = textureIn * tex_size + tex_bayer_first_red; >> >> xCoord = center.x + vec4(-2.0 * tex_step.x, >> -tex_step.x, tex_step.x, 2.0 * tex_step.x); >> yCoord = center.y + vec4(-2.0 * tex_step.y, >> -tex_step.y, tex_step.y, 2.0 * tex_step.y); >> >> gl_Position = proj_matrix * vertexIn; >> } >> >> [0:05:10.780585201] [1525] DEBUG eGL egl.cpp:539 Shader length is 6307 >> [0:05:10.780617775] [1525] DEBUG eGL egl.cpp:546 Shader source = #version 100 >> #extension GL_OES_EGL_image_external: enable >> #define SWAP_BLUE >> #define RAW10P >> /* SPDX-License-Identifier: BSD-2-Clause */ >> /* >> Fromhttp://jgt.akpeters.com/papers/McGuire08/ >> >> Efficient, High-Quality Bayer Demosaic Filtering on GPUs >> >> Morgan McGuire >> >> This paper appears in issue Volume 13, Number 4. >> --------------------------------------------------------- >> Copyright (c) 2008, Morgan McGuire. All rights reserved. >> >> Modified by Linaro Ltd to integrate it into libcamera. >> Copyright (C) 2021, Linaro >> */ >> >> //Pixel Shader >> #ifdef GL_ES >> precision highp float; >> #endif >> >> /** Monochrome RGBA or GL_LUMINANCE Bayer encoded texture.*/ >> uniform sampler2D tex_y; >> varying vec4 center; >> varying vec4 yCoord; >> varying vec4 xCoord; >> uniform mat3 ccm; >> uniform vec3 blacklevel; >> uniform float gamma; >> uniform float contrastExp; >> >> float apply_contrast(float value) >> { >> // Apply simple S-curve >> if (value < 0.5) >> return 0.5 * pow(value / 0.5, contrastExp); >> else >> return 1.0 - 0.5 * pow((1.0 - value) / 0.5, contrastExp); >> } >> >> void main(void) { >> vec3 rgb; >> >> #if defined(RAW10P) >> #define pixel(p) p.r / 4.0 + p.g * 64.0 >> #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) >> #elif defined(RAW12P) >> #define pixel(p) p.r / 16.0 + p.g * 16.0 >> #define fetch(x, y) pixel(texture2D(tex_y, vec2(x, y))) >> #else >> #define fetch(x, y) texture2D(tex_y, vec2(x, y)).r >> #endif >> >> float C = fetch(center.x, center.y); // ( 0, 0) >> const vec4 kC = vec4( 4.0, 6.0, 5.0, 5.0) / 8.0; >> >> // Determine which of four types of pixels we are on. >> vec2 alternate = mod(floor(center.zw), 2.0); >> >> vec4 Dvec = vec4( >> fetch(xCoord[1], yCoord[1]), // (-1,-1) >> fetch(xCoord[1], yCoord[2]), // (-1, 1) >> fetch(xCoord[2], yCoord[1]), // ( 1,-1) >> fetch(xCoord[2], yCoord[2])); // ( 1, 1) >> >> vec4 PATTERN = (kC.xyz * C).xyzz; >> >> // Can also be a dot product with (1,1,1,1) on hardware where that is >> // specially optimized. >> // Equivalent to: D = Dvec[0] + Dvec[1] + Dvec[2] + Dvec[3]; >> Dvec.xy += Dvec.zw; >> Dvec.x += Dvec.y; >> >> vec4 value = vec4( >> fetch(center.x, yCoord[0]), // ( 0,-2) >> fetch(center.x, yCoord[1]), // ( 0,-1) >> fetch(xCoord[0], center.y), // (-2, 0) >> fetch(xCoord[1], center.y)); // (-1, 0) >> >> vec4 temp = vec4( >> fetch(center.x, yCoord[3]), // ( 0, 2) >> fetch(center.x, yCoord[2]), // ( 0, 1) >> fetch(xCoord[3], center.y), // ( 2, 0) >> fetch(xCoord[2], center.y)); // ( 1, 0) >> >> // Even the simplest compilers should be able to constant-fold these to >> // avoid the division. >> // Note that on scalar processors these constants force computation of some >> // identical products twice. >> const vec4 kA = vec4(-1.0, -1.5, 0.5, -1.0) / 8.0; >> const vec4 kB = vec4( 2.0, 0.0, 0.0, 4.0) / 8.0; >> const vec4 kD = vec4( 0.0, 2.0, -1.0, -1.0) / 8.0; >> >> // Conserve constant registers and take advantage of free swizzle on load >> #define kE (kA.xywz) >> #define kF (kB.xywz) >> >> value += temp; >> >> // There are five filter patterns (identity, cross, checker, >> // theta, phi). Precompute the terms from all of them and then >> // use swizzles to assign to color channels. >> // >> // Channel Matches >> // x cross (e.g., EE G) >> // y checker (e.g., EE B) >> // z theta (e.g., EO R) >> // w phi (e.g., EO R) >> #define A (value[0]) >> #define B (value[1]) >> #define D (Dvec.x) >> #define E (value[2]) >> #define F (value[3]) >> >> // Avoid zero elements. On a scalar processor this saves two MADDs >> // and it has no effect on a vector processor. >> PATTERN.yzw += (kD.yz * D).xyy; >> >> PATTERN += (kA.xyz * A).xyzx + (kE.xyw * E).xyxz; >> PATTERN.xw += kB.xw * B; >> PATTERN.xz += kF.xz * F; >> >> rgb = (alternate.y == 0.0) ? >> ((alternate.x == 0.0) ? >> vec3(C, PATTERN.xy) : >> vec3(PATTERN.z, C, PATTERN.w)) : >> ((alternate.x == 0.0) ? >> vec3(PATTERN.w, C, PATTERN.z) : >> vec3(PATTERN.yx, C)); >> >> rgb = rgb - blacklevel; >> >> /* >> * CCM is a 3x3 in the format >> * >> * +--------------+----------------+---------------+ >> * | RedRedGain | RedGreenGain | RedBlueGain | >> * +--------------+----------------+---------------+ >> * | GreenRedGain | GreenGreenGain | GreenBlueGain | >> * +--------------+----------------+---------------+ >> * | BlueRedGain | BlueGreenGain | BlueBlueGain | >> * +--------------+----------------+---------------+ >> * >> * Rout = RedRedGain * Rin + RedGreenGain * Gin + RedBlueGain * Bin >> * Gout = GreenRedGain * Rin + GreenGreenGain * Gin + GreenBlueGain * Bin >> * Bout = BlueRedGain * Rin + BlueGreenGain * Gin + BlueBlueGain * Bin >> * >> * We upload to the GPU without transposition glUniformMatrix3f(.., .., GL_FALSE, ccm); >> * >> * CPU >> * float ccm [] = { >> * RedRedGain, RedGreenGain, RedBlueGain, >> * GreenRedGain, GreenGreenGain, GreenBlueGain, >> * BlueRedGain, BlueGreenGain, BlueBlueGain, >> * }; >> * >> * GPU >> * ccm = { >> * RedRedGain, GreenRedGain, BlueRedGain, >> * RedGreenGain, GreenGreenGain, BlueGreenGain, >> * RedBlueGain, GreenBlueGain, BlueBlueGain, >> * } >> * >> * However the indexing for the mat data-type is column major hence >> * ccm[0][0] = RedRedGain, ccm[0][1] = RedGreenGain, ccm[0][2] = RedBlueGain >> * >> */ >> float rin, gin, bin; >> rin = rgb.r; >> gin = rgb.g; >> bin = rgb.b; >> >> rgb.r = (rin * ccm[0][0]) + (gin * ccm[0][1]) + (bin * ccm[0][2]); >> rgb.g = (rin * ccm[1][0]) + (gin * ccm[1][1]) + (bin * ccm[1][2]); >> rgb.b = (rin * ccm[2][0]) + (gin * ccm[2][1]) + (bin * ccm[2][2]); >> >> /* >> * Contrast >> */ >> rgb = clamp(rgb, 0.0, 1.0); >> rgb.r = apply_contrast(rgb.r); >> rgb.g = apply_contrast(rgb.g); >> rgb.b = apply_contrast(rgb.b); >> >> /* Apply gamma after colour correction */ >> rgb = pow(rgb, vec3(gamma)); >> >> #if defined (SWAP_BLUE) >> gl_FragColor = vec4(rgb.bgr, 1.0); >> #else >> gl_FragColor = vec4(rgb, 1.0); >> #endif >> } >> >> [0:05:10.780912793] [1525] DEBUG Debayer debayer_egl.cpp:128 vertexIn 0 textureIn 1 tex_y 5 ccm 6 blacklevel 7 gamma 8 contrastExp 9 tex_step 2 tex_size 1 stride_factor 4 tex_bayer_first_red 3 proj_matrix 0 >> [0:05:10.781016478] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 0 >> [0:05:10.816694775] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 1 >> [0:05:10.816752164] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 2 >> [0:05:10.816776756] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1783 /dev/video0[20:cap]: Queueing buffer 3 >> cam0: Capture 1 frames >> [0:05:10.897460552] [1523] DEBUG V4L2 v4l2_videodevice.cpp:1855 /dev/video0[20:cap]: Dequeuing buffer 0 >> [0:05:10.897643126] [1525] DEBUG eGL egl.cpp:168 eglCreateImageKHR fail >> [0:05:10.897697812] [1525] INFO Debayer debayer_egl.cpp:525 Importing input buffer with DMABuf import failed, falling back to upload >> ... >>
Robert Mader <robert.mader@collabora.com> writes: > The most common reason dmabuf import with createInputDMABufTexture2D() > fails is that V4L2 drivers use stride alignments that are not sufficient > (too small) for GPUs, preventing the later from directly using input > buffers and forcing us to do relatively expensive uploads (i.e. copies) > of the buffer contents. > > Thus let's request a compatible stride alignment from the V4L2 driver, > which may or may not respect the value. From the v4l2_pix_format -> > bytesperline docs: >> Both applications and drivers can set this field to request padding >> bytes at the end of each line. Drivers however may ignore the value >> requested by the application, returning width times bytes per pixel >> or a larger value required by the hardware. That implies applications >> can just set this field to zero to get a reasonable default. > > The approach works as follows: > 1. Before setting the input format, query into the debayer class for a > preferred stride based on the bayer format and width. For DebayerCpu > this returns 0, i.e. let the V4L2 driver decide, while for DebayerEGL > the "magic" stride alignment of 256 bytes is used, which is known > to work with all known/common GPUs and already used for output > buffers. Right now there doesn't exist any API to query the correct > value - in many cases it is 64 or 128 - however if e.g. a new EGL > extension will provide it in the future, we can easily implement it > in the new function. Alternatively a config value or env var could be > added there if the need arises. > 2. Pass the calculated stride to V4L2VideoDevice::setFormat(), which > again sets it as the bytesperline value. > 3. The V4L2 driver will update bytesperline with the value it actually > chose to use. Compare the requested and actual strides and log an info > message if the driver did not honor the request, hinting users at what > could be improved about the kernel driver. > > Signed-off-by: Robert Mader <robert.mader@collabora.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> # rpi4+imx219 > --- > > Changes in V3: > - Renamed getPreferredInputStride() to preferredInputStride() > > Changes in V2: > - Updated the commit message to be much more verbose and hopefully easy > to understand. > - Minor cleanups and fixes for docs and CI. > > Previous version: https://patchwork.libcamera.org/patch/26810/ > --- > .../libcamera/internal/software_isp/software_isp.h | 1 + > src/libcamera/pipeline/simple/simple.cpp | 12 ++++++++++++ > src/libcamera/software_isp/debayer.cpp | 8 ++++++++ > src/libcamera/software_isp/debayer.h | 1 + > src/libcamera/software_isp/debayer_egl.cpp | 7 +++++++ > src/libcamera/software_isp/debayer_egl.h | 1 + > src/libcamera/software_isp/software_isp.cpp | 13 +++++++++++++ > 7 files changed, 43 insertions(+) > > diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h > index 86cb8f8de..4f72dce9b 100644 > --- a/include/libcamera/internal/software_isp/software_isp.h > +++ b/include/libcamera/internal/software_isp/software_isp.h > @@ -61,6 +61,7 @@ public: > > std::tuple<unsigned int, unsigned int> > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); > + uint32_t preferredInputStride(const PixelFormat &inputFormat, const Size &size); > > int configure(const StreamConfiguration &inputCfg, > const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs, > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index c6fe12d65..e26f438d9 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -1542,6 +1542,11 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) > captureFormat.fourcc = videoFormat; > captureFormat.size = pipeConfig->captureSize; > > + uint32_t requested_bpl = 0; > + if (data->swIsp_) > + requested_bpl = data->swIsp_->preferredInputStride(videoFormat.toPixelFormat(), pipeConfig->captureSize); > + captureFormat.planes[0].bpl = requested_bpl; > + > ret = video->setFormat(&captureFormat); > if (ret) > return ret; > @@ -1561,6 +1566,13 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) > return -EINVAL; > } > > + if (requested_bpl && captureFormat.planes[0].bpl != requested_bpl) { > + LOG(SimplePipeline, Info) > + << "Input buffer stride ignored by the driver. " > + << "Requested " << requested_bpl > + << ", got " << captureFormat.planes[0].bpl; > + } > + > /* Configure the converter if needed. */ > std::vector<std::reference_wrapper<const StreamConfiguration>> outputCfgs; > data->useConversion_ = config->needConversion(); > diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp > index 2d7abfb83..56446f55d 100644 > --- a/src/libcamera/software_isp/debayer.cpp > +++ b/src/libcamera/software_isp/debayer.cpp > @@ -103,6 +103,14 @@ Debayer::~Debayer() > * there is no valid output config > */ > > +/** > + * \fn uint32_t Debayer::preferredInputStride(const PixelFormat &inputFormat, const Size &size) > + * Get the preferred input stride in bytes for the given input format and size > + * \param[in] inputFormat The input format > + * \param[in] size The input size (width and height in pixels) > + * \return The preferred input stride in bytes or 0 if there is no preference > + */ > + > /** > * \fn void Debayer::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) > * \brief Process the bayer data into the requested format > diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h > index a2a17ec18..28f1b857b 100644 > --- a/src/libcamera/software_isp/debayer.h > +++ b/src/libcamera/software_isp/debayer.h > @@ -46,6 +46,7 @@ public: > > virtual std::tuple<unsigned int, unsigned int> > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; > + virtual uint32_t preferredInputStride([[maybe_unused]] const PixelFormat &inputFormat, [[maybe_unused]] const Size &size) { return 0; } > > virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) = 0; > virtual int start() { return 0; } > diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp > index 8e52b45ae..fd8de3942 100644 > --- a/src/libcamera/software_isp/debayer_egl.cpp > +++ b/src/libcamera/software_isp/debayer_egl.cpp > @@ -21,6 +21,7 @@ > > #include <libcamera/formats.h> > > +#include "libcamera/internal/formats.h" > #include "libcamera/internal/framebuffer.h" > > #include "../glsl_shaders.h" > @@ -387,6 +388,12 @@ DebayerEGL::strideAndFrameSize(const PixelFormat &outputFormat, const Size &size > return std::make_tuple(stride, stride * size.height); > } > > +uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const Size &size) > +{ > + const PixelFormatInfo &info = PixelFormatInfo::info(inputFormat); > + return info.stride(size.width, 0, 256); > +} > + > void DebayerEGL::setShaderVariableValues(const DebayerParams ¶ms) > { > /* > diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h > index 875e7cfc5..943410fdd 100644 > --- a/src/libcamera/software_isp/debayer_egl.h > +++ b/src/libcamera/software_isp/debayer_egl.h > @@ -50,6 +50,7 @@ public: > > std::vector<PixelFormat> formats(PixelFormat input) override; > std::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) override; > + uint32_t preferredInputStride(const PixelFormat &inputFormat, const Size &size) override; > > void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) override; > int start() override; > diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp > index 781cf02f8..19f83e611 100644 > --- a/src/libcamera/software_isp/software_isp.cpp > +++ b/src/libcamera/software_isp/software_isp.cpp > @@ -255,6 +255,19 @@ SoftwareIsp::strideAndFrameSize(const PixelFormat &outputFormat, const Size &siz > return debayer_->strideAndFrameSize(outputFormat, size); > } > > +/** > + * Get the preferred input stride in bytes for the given input format and size > + * \param[in] inputFormat The input format > + * \param[in] size The input size (width and height in pixels) > + * \return The preferred input stride in bytes or 0 if there is no preference > + */ > +uint32_t SoftwareIsp::preferredInputStride(const PixelFormat &inputFormat, const Size &size) > +{ > + ASSERT(debayer_); > + > + return debayer_->preferredInputStride(inputFormat, size); > +} > + > /** > * \brief Configure the SoftwareIsp object according to the passed in parameters > * \param[in] inputCfg The input configuration
On 11.06.26 15:20, Milan Zamazal wrote: >> Do you mind giving you T-B? > Will do. Thanks! >> P.S.: The fact that the direct import still fails despite using the requested buffer alignment is likely due to the input buffer size - it wouldn't surprise me if 3280x2464 is simply too big for the >> RPi4 GPU. You might be more lucky trying "width=1280,height=720" as output size, as that should allow the sensor to run at 1920x1080. But that's not directly related to this patch. > I tried width=636,height=480, resulting in "Input 640x480-BGGR-10 stride > 1280", but I still get the error. I see - sounds like there's something broken on the on the GPU driver side. Unfortunate, but nothing to block the patch on.
Milan Zamazal <mzamazal@redhat.com> writes: > FWIW, I'll additionally test on TI AM69 tomorrow, but considering the > state of the drivers I have there, I don't hope for much. [0:25:15.799025257] [4449] INFO SimplePipeline simple.cpp:1570 Input buffer stride ignored by the driver. Requested 6656, got 6560 [0:25:15.799078733] [4449] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) [0:25:15.799140915] [4449] INFO SoftwareIsp software_isp.cpp:293 Input 3280x2464-RGGB-10 stride 6560 Which means the failure part works as expected too. :-)
Quoting Milan Zamazal (2026-06-11 14:23:07) > Robert Mader <robert.mader@collabora.com> writes: > > > The most common reason dmabuf import with createInputDMABufTexture2D() > > fails is that V4L2 drivers use stride alignments that are not sufficient > > (too small) for GPUs, preventing the later from directly using input > > buffers and forcing us to do relatively expensive uploads (i.e. copies) > > of the buffer contents. > > > > Thus let's request a compatible stride alignment from the V4L2 driver, > > which may or may not respect the value. From the v4l2_pix_format -> > > bytesperline docs: > >> Both applications and drivers can set this field to request padding > >> bytes at the end of each line. Drivers however may ignore the value > >> requested by the application, returning width times bytes per pixel > >> or a larger value required by the hardware. That implies applications > >> can just set this field to zero to get a reasonable default. > > > > The approach works as follows: > > 1. Before setting the input format, query into the debayer class for a > > preferred stride based on the bayer format and width. For DebayerCpu > > this returns 0, i.e. let the V4L2 driver decide, while for DebayerEGL > > the "magic" stride alignment of 256 bytes is used, which is known > > to work with all known/common GPUs and already used for output > > buffers. Right now there doesn't exist any API to query the correct > > value - in many cases it is 64 or 128 - however if e.g. a new EGL > > extension will provide it in the future, we can easily implement it > > in the new function. Alternatively a config value or env var could be > > added there if the need arises. > > 2. Pass the calculated stride to V4L2VideoDevice::setFormat(), which > > again sets it as the bytesperline value. > > 3. The V4L2 driver will update bytesperline with the value it actually > > chose to use. Compare the requested and actual strides and log an info > > message if the driver did not honor the request, hinting users at what > > could be improved about the kernel driver. > > > > Signed-off-by: Robert Mader <robert.mader@collabora.com> > > Tested-by: Milan Zamazal <mzamazal@redhat.com> # rpi4+imx219 Ohh, did this 'honor' the alignment and work ? I see your test that reports everything worked when the stride couldn't be honored, so I guess this is the other side. Anyway, I think that means maybe we have enough confidence to merge this? Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> But I'll wait a bit before merging. > > > --- > > > > Changes in V3: > > - Renamed getPreferredInputStride() to preferredInputStride() > > > > Changes in V2: > > - Updated the commit message to be much more verbose and hopefully easy > > to understand. > > - Minor cleanups and fixes for docs and CI. > > > > Previous version: https://patchwork.libcamera.org/patch/26810/ > > --- > > .../libcamera/internal/software_isp/software_isp.h | 1 + > > src/libcamera/pipeline/simple/simple.cpp | 12 ++++++++++++ > > src/libcamera/software_isp/debayer.cpp | 8 ++++++++ > > src/libcamera/software_isp/debayer.h | 1 + > > src/libcamera/software_isp/debayer_egl.cpp | 7 +++++++ > > src/libcamera/software_isp/debayer_egl.h | 1 + > > src/libcamera/software_isp/software_isp.cpp | 13 +++++++++++++ > > 7 files changed, 43 insertions(+) > > > > diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h > > index 86cb8f8de..4f72dce9b 100644 > > --- a/include/libcamera/internal/software_isp/software_isp.h > > +++ b/include/libcamera/internal/software_isp/software_isp.h > > @@ -61,6 +61,7 @@ public: > > > > std::tuple<unsigned int, unsigned int> > > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); > > + uint32_t preferredInputStride(const PixelFormat &inputFormat, const Size &size); > > > > int configure(const StreamConfiguration &inputCfg, > > const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs, > > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > > index c6fe12d65..e26f438d9 100644 > > --- a/src/libcamera/pipeline/simple/simple.cpp > > +++ b/src/libcamera/pipeline/simple/simple.cpp > > @@ -1542,6 +1542,11 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) > > captureFormat.fourcc = videoFormat; > > captureFormat.size = pipeConfig->captureSize; > > > > + uint32_t requested_bpl = 0; > > + if (data->swIsp_) > > + requested_bpl = data->swIsp_->preferredInputStride(videoFormat.toPixelFormat(), pipeConfig->captureSize); > > + captureFormat.planes[0].bpl = requested_bpl; > > + > > ret = video->setFormat(&captureFormat); > > if (ret) > > return ret; > > @@ -1561,6 +1566,13 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) > > return -EINVAL; > > } > > > > + if (requested_bpl && captureFormat.planes[0].bpl != requested_bpl) { > > + LOG(SimplePipeline, Info) > > + << "Input buffer stride ignored by the driver. " > > + << "Requested " << requested_bpl > > + << ", got " << captureFormat.planes[0].bpl; > > + } > > + > > /* Configure the converter if needed. */ > > std::vector<std::reference_wrapper<const StreamConfiguration>> outputCfgs; > > data->useConversion_ = config->needConversion(); > > diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp > > index 2d7abfb83..56446f55d 100644 > > --- a/src/libcamera/software_isp/debayer.cpp > > +++ b/src/libcamera/software_isp/debayer.cpp > > @@ -103,6 +103,14 @@ Debayer::~Debayer() > > * there is no valid output config > > */ > > > > +/** > > + * \fn uint32_t Debayer::preferredInputStride(const PixelFormat &inputFormat, const Size &size) > > + * Get the preferred input stride in bytes for the given input format and size > > + * \param[in] inputFormat The input format > > + * \param[in] size The input size (width and height in pixels) > > + * \return The preferred input stride in bytes or 0 if there is no preference > > + */ > > + > > /** > > * \fn void Debayer::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) > > * \brief Process the bayer data into the requested format > > diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h > > index a2a17ec18..28f1b857b 100644 > > --- a/src/libcamera/software_isp/debayer.h > > +++ b/src/libcamera/software_isp/debayer.h > > @@ -46,6 +46,7 @@ public: > > > > virtual std::tuple<unsigned int, unsigned int> > > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; > > + virtual uint32_t preferredInputStride([[maybe_unused]] const PixelFormat &inputFormat, [[maybe_unused]] const Size &size) { return 0; } > > > > virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) = 0; > > virtual int start() { return 0; } > > diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp > > index 8e52b45ae..fd8de3942 100644 > > --- a/src/libcamera/software_isp/debayer_egl.cpp > > +++ b/src/libcamera/software_isp/debayer_egl.cpp > > @@ -21,6 +21,7 @@ > > > > #include <libcamera/formats.h> > > > > +#include "libcamera/internal/formats.h" > > #include "libcamera/internal/framebuffer.h" > > > > #include "../glsl_shaders.h" > > @@ -387,6 +388,12 @@ DebayerEGL::strideAndFrameSize(const PixelFormat &outputFormat, const Size &size > > return std::make_tuple(stride, stride * size.height); > > } > > > > +uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const Size &size) > > +{ > > + const PixelFormatInfo &info = PixelFormatInfo::info(inputFormat); > > + return info.stride(size.width, 0, 256); > > +} > > + > > void DebayerEGL::setShaderVariableValues(const DebayerParams ¶ms) > > { > > /* > > diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h > > index 875e7cfc5..943410fdd 100644 > > --- a/src/libcamera/software_isp/debayer_egl.h > > +++ b/src/libcamera/software_isp/debayer_egl.h > > @@ -50,6 +50,7 @@ public: > > > > std::vector<PixelFormat> formats(PixelFormat input) override; > > std::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) override; > > + uint32_t preferredInputStride(const PixelFormat &inputFormat, const Size &size) override; > > > > void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) override; > > int start() override; > > diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp > > index 781cf02f8..19f83e611 100644 > > --- a/src/libcamera/software_isp/software_isp.cpp > > +++ b/src/libcamera/software_isp/software_isp.cpp > > @@ -255,6 +255,19 @@ SoftwareIsp::strideAndFrameSize(const PixelFormat &outputFormat, const Size &siz > > return debayer_->strideAndFrameSize(outputFormat, size); > > } > > > > +/** > > + * Get the preferred input stride in bytes for the given input format and size > > + * \param[in] inputFormat The input format > > + * \param[in] size The input size (width and height in pixels) > > + * \return The preferred input stride in bytes or 0 if there is no preference > > + */ > > +uint32_t SoftwareIsp::preferredInputStride(const PixelFormat &inputFormat, const Size &size) > > +{ > > + ASSERT(debayer_); > > + > > + return debayer_->preferredInputStride(inputFormat, size); > > +} > > + > > /** > > * \brief Configure the SoftwareIsp object according to the passed in parameters > > * \param[in] inputCfg The input configuration >
On 11.06.26 12:02, Robert Mader wrote: > > Sorry, I meant > > INFO SoftwareIsp software_isp.cpp:280 Input 3280x2464-BGGR-10 stride 6556 > > of course. > > I find it slightly confusing that this is *smaller* than the > driver-preferred 6560 (3280*2) - but then 6556 is the value > `PixelFormatInfo::stride()` calculates and the driver successfully > uses it - so 🤷 > Sorry, I'm blind. Milan reported that the stride goes from 6560 to 6656 (not 6556). I.e. as expected the stride / the padding got bigger - and is now a multiple of 256.
On 12.06.26 12:44, Milan Zamazal wrote: > Milan Zamazal<mzamazal@redhat.com> writes: > >> FWIW, I'll additionally test on TI AM69 tomorrow, but considering the >> state of the drivers I have there, I don't hope for much. > [0:25:15.799025257] [4449] INFO SimplePipeline simple.cpp:1570 Input buffer stride ignored by the driver. Requested 6656, got 6560 > [0:25:15.799078733] [4449] INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3522, gain 1-10.6667 (0.0966667) > [0:25:15.799140915] [4449] INFO SoftwareIsp software_isp.cpp:293 Input 3280x2464-RGGB-10 stride 6560 > > Which means the failure part works as expected too. :-) Perfect, thanks for testing that as well!
On 12.06.26 13:04, Kieran Bingham wrote: > Quoting Milan Zamazal (2026-06-11 14:23:07) > >> Tested-by: Milan Zamazal <mzamazal@redhat.com> # rpi4+imx219 > Ohh, did this 'honor' the alignment and work ? Yes, the V4L2 driver honors the alignment / bytesperline. The import fails on the GPU-side non-the-less, however - most likely for unrelated reasons (I suspect something to be wrong with the GPU kernel driver or Mesa - V3D is a bit special with regards to dmabuf imports when using the linear modifier). In any case, the patch seems to work as expected. > I see your test that reports everything worked when the stride couldn't > be honored, so I guess this is the other side. > > Anyway, I think that means maybe we have enough confidence to merge > this? Having one V4L2 driver successfully accepting the bytesperline parameter was the one requirement raised by Hans - so unless something new comes up we should be good to go AFAICS. > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > But I'll wait a bit before merging. Thanks!
diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index 86cb8f8de..4f72dce9b 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -61,6 +61,7 @@ public: std::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); + uint32_t preferredInputStride(const PixelFormat &inputFormat, const Size &size); int configure(const StreamConfiguration &inputCfg, const std::vector<std::reference_wrapper<const StreamConfiguration>> &outputCfgs, diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index c6fe12d65..e26f438d9 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1542,6 +1542,11 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) captureFormat.fourcc = videoFormat; captureFormat.size = pipeConfig->captureSize; + uint32_t requested_bpl = 0; + if (data->swIsp_) + requested_bpl = data->swIsp_->preferredInputStride(videoFormat.toPixelFormat(), pipeConfig->captureSize); + captureFormat.planes[0].bpl = requested_bpl; + ret = video->setFormat(&captureFormat); if (ret) return ret; @@ -1561,6 +1566,13 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) return -EINVAL; } + if (requested_bpl && captureFormat.planes[0].bpl != requested_bpl) { + LOG(SimplePipeline, Info) + << "Input buffer stride ignored by the driver. " + << "Requested " << requested_bpl + << ", got " << captureFormat.planes[0].bpl; + } + /* Configure the converter if needed. */ std::vector<std::reference_wrapper<const StreamConfiguration>> outputCfgs; data->useConversion_ = config->needConversion(); diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 2d7abfb83..56446f55d 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -103,6 +103,14 @@ Debayer::~Debayer() * there is no valid output config */ +/** + * \fn uint32_t Debayer::preferredInputStride(const PixelFormat &inputFormat, const Size &size) + * Get the preferred input stride in bytes for the given input format and size + * \param[in] inputFormat The input format + * \param[in] size The input size (width and height in pixels) + * \return The preferred input stride in bytes or 0 if there is no preference + */ + /** * \fn void Debayer::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params) * \brief Process the bayer data into the requested format diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index a2a17ec18..28f1b857b 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -46,6 +46,7 @@ public: virtual std::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) = 0; + virtual uint32_t preferredInputStride([[maybe_unused]] const PixelFormat &inputFormat, [[maybe_unused]] const Size &size) { return 0; } virtual void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) = 0; virtual int start() { return 0; } diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 8e52b45ae..fd8de3942 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -21,6 +21,7 @@ #include <libcamera/formats.h> +#include "libcamera/internal/formats.h" #include "libcamera/internal/framebuffer.h" #include "../glsl_shaders.h" @@ -387,6 +388,12 @@ DebayerEGL::strideAndFrameSize(const PixelFormat &outputFormat, const Size &size return std::make_tuple(stride, stride * size.height); } +uint32_t DebayerEGL::preferredInputStride(const PixelFormat &inputFormat, const Size &size) +{ + const PixelFormatInfo &info = PixelFormatInfo::info(inputFormat); + return info.stride(size.width, 0, 256); +} + void DebayerEGL::setShaderVariableValues(const DebayerParams ¶ms) { /* diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h index 875e7cfc5..943410fdd 100644 --- a/src/libcamera/software_isp/debayer_egl.h +++ b/src/libcamera/software_isp/debayer_egl.h @@ -50,6 +50,7 @@ public: std::vector<PixelFormat> formats(PixelFormat input) override; std::tuple<unsigned int, unsigned int> strideAndFrameSize(const PixelFormat &outputFormat, const Size &size) override; + uint32_t preferredInputStride(const PixelFormat &inputFormat, const Size &size) override; void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) override; int start() override; diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 781cf02f8..19f83e611 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -255,6 +255,19 @@ SoftwareIsp::strideAndFrameSize(const PixelFormat &outputFormat, const Size &siz return debayer_->strideAndFrameSize(outputFormat, size); } +/** + * Get the preferred input stride in bytes for the given input format and size + * \param[in] inputFormat The input format + * \param[in] size The input size (width and height in pixels) + * \return The preferred input stride in bytes or 0 if there is no preference + */ +uint32_t SoftwareIsp::preferredInputStride(const PixelFormat &inputFormat, const Size &size) +{ + ASSERT(debayer_); + + return debayer_->preferredInputStride(inputFormat, size); +} + /** * \brief Configure the SoftwareIsp object according to the passed in parameters * \param[in] inputCfg The input configuration