Git Product home page Git Product logo

Comments (52)

naushir avatar naushir commented on June 5, 2024 1

Given that libcamera-apps works, it might be worth running ldd $(which libcamera-hello) and ldd $(which qcam) and see if they both use the same set of libcamera* libraries.

from libcamera.

kralo avatar kralo commented on June 5, 2024 1

I have sent out a patch to libcamera that prints more verbose information which file it has read with which version number. That at least improves the speed of discovery.

Then I will let you experts ponder what the right fix is regarding the locale.

I'll let this ticket stay open until a solution is found. I consider this reported to libcamera, because kb has seen it. ok?

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

I think this is fixed by ipa: raspberrypi: Rename ov9281.json to ov9281_mono.json

You could probably check by renaming it yourself:
cp /usr/share/libcamera/ipa/raspberrypi/ov9281.json /usr/share/libcamera/ipa/raspberrypi/ov9281_mono.json

from libcamera.

kralo avatar kralo commented on June 5, 2024

No, this is not it. I did this already.
I tried with a fresh image:
If I hadn't the ov9281_mono.json, I'd get Configuration file 'ov9281_mono.json' not found for IPA module 'raspberrypi' .

The crash must be something different.

 $ sha256sum /usr/share/libcamera/ipa/raspberrypi/ov9281*
9061ae2ff165e698cf9d2d4596ac3617a5e57bbcf6fb2822534fd75a29413a46  /usr/share/libcamera/ipa/raspberrypi/ov9281.json
9061ae2ff165e698cf9d2d4596ac3617a5e57bbcf6fb2822534fd75a29413a46  /usr/share/libcamera/ipa/raspberrypi/ov9281_mono.json

from libcamera.

kralo avatar kralo commented on June 5, 2024

looks like a null-pointer in agc

RPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(
controller_.getAlgorithm("agc"));
agc->setMaxShutter(maxShutter);

[0:22:43.790661572] [1955]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[0:22:43.791217455] [2018]  INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P

Thread 3 "qcam" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ff1ac0ec0 (LWP 2018)]
libcamera::ipa::RPi::IPARPi::applyFrameDurations (this=this@entry=0x7fe400b4a0, minFrameDuration=..., maxFrameDuration=...) at ../src/ipa/raspberrypi/raspberrypi.cpp:1188
1188	../src/ipa/raspberrypi/raspberrypi.cpp: Datei oder Verzeichnis nicht gefunden.
(gdb) bt full
#0  libcamera::ipa::RPi::IPARPi::applyFrameDurations (this=this@entry=0x7fe400b4a0, minFrameDuration=..., maxFrameDuration=...) at ../src/ipa/raspberrypi/raspberrypi.cpp:1188
        minSensorFrameDuration = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = <optimized out>}, <No data fields>}
        maxSensorFrameDuration = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = <optimized out>}, <No data fields>}
        maxShutter = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = 298143300}, <No data fields>}
        agc = 0x0
#1  0x0000007ff1273c44 in libcamera::ipa::RPi::IPARPi::configure (this=0x7fe400b4a0, sensorInfo=..., streamConfig=..., entityControls=..., ipaConfig=..., controls=0x7ff1abf808, result=0x7ff1abfbe0)
    at ../src/ipa/raspberrypi/raspberrypi.cpp:447
        agcStatus = {totalExposureValue = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = 1.0692881439089619e-305}, <No data fields>}, 
          targetExposureValue = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = 2.694985824870251e-312}, <No data fields>}, shutterTime = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {
              __r = 2.7153664286214199e-312}, <No data fields>}, analogueGain = 2.7149669349069046e-312, exposureMode = "8h~\366\177\000\000\000 \000\000\344\177\000\000\000\060\000\000\000\000\000\000\000\270\026\254\361\177\000\000", 
          constraintMode = "\370\000\000\000\000\000\000\000 \024\002\344\177\000\000\000\200\202\000\344\177\000\000\000`\202\000\344\177\000\000", 
          meteringMode = "p\202\000\344\177\000\000\000P\366\253\361\177\000\000\000\070h~\366\177\000\000\000 \000\000\344\177\000\000", ev = 4.3477776834029696e-322, 
          flickerPeriod = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = 2.7149669762898431e-312}, <No data fields>}, floatingRegionEnable = 248, 
          fixedShutter = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = 2.713834217556906e-312}, <No data fields>}, fixedAnalogueGain = 2.7138337831743902e-312, digitalGain = 2.7149669369226924e-312, 
          locked = -469638208}
        ctrls = {validator_ = 0x0, idmap_ = 0x7fe40213e8, infoMap_ = 0x7fe400b550, controls_ = std::unordered_map with 0 elements}
        __func__ = "configure"
        ctrlMap = std::unordered_map with 545460846768 elements<error reading variable: Cannot access memory at address 0x10003>
        minSensorFrameDuration = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = <optimized out>}, <No data fields>}
        maxSensorFrameDuration = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = <optimized out>}, <No data fields>}
        maxShutter = {<std::chrono::duration<double, std::ratio<1, 1000000000> >> = {__r = 2.7138337838858447e-312}, <No data fields>}
        exposureMin = <optimized out>
#2  0x0000007ff7f4cf20 in libcamera::RPiCameraData::configureIPA (this=this@entry=0x7fe401de50, config=config@entry=0x55556fd730, result=result@entry=0x7ff1abfbe0) at ../src/libcamera/pipeline/raspberrypi/raspberrypi.cpp:1648

[...]

from libcamera.

naushir avatar naushir commented on June 5, 2024
[1:09:03.517415563] [1407]  WARN RPiController controller.cpp:43 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.
[1:09:03.517478394] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "version"
[1:09:03.517501375] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "target"
[1:09:03.517523800] [1407]  WARN RPiController controller.cpp:80 No algorithm found for "algorithms"

You should not be seeing any of these error messages. I suggest you pull the latest libcamera and libcamera-apps builds from apt to reset your environment and try again.

Would you be able to also run the camera-bug-report command, and share the output file here please?

from libcamera.

kralo avatar kralo commented on June 5, 2024

You should not be seeing any of these error messages. I suggest you pull the latest libcamera and libcamera-apps builds from apt to reset your environment and try again.

What do you mean? To my knowledge, these are the latest:

** libcamera-hello --version **
libcamera-apps build: b89cc36c3872 19-10-2022 (13:16:48)
libcamera build: v0.0.1+21-7c855784

bug-report.txt

from libcamera.

naushir avatar naushir commented on June 5, 2024

Those log messages suggest the ov9281 tuning file installed on your system is an old format file. The new format file can be found in the latest releases such as https://github.com/raspberrypi/libcamera/blob/main/src/ipa/raspberrypi/data/ov9281.json

from libcamera.

kralo avatar kralo commented on June 5, 2024

no, that's not it

$ sha256sum /usr/share/libcamera/ipa/raspberrypi/ov9281*
9061ae2ff165e698cf9d2d4596ac3617a5e57bbcf6fb2822534fd75a29413a46  /usr/share/libcamera/ipa/raspberrypi/ov9281.json
9061ae2ff165e698cf9d2d4596ac3617a5e57bbcf6fb2822534fd75a29413a46  /usr/share/libcamera/ipa/raspberrypi/ov9281_mono.json

$ qcam
[2:10:50.998620443] [2524]  INFO Camera camera_manager.cpp:293 libcamera v0.0.1+21-7c855784
[2:10:51.018150792] [2531]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[2:10:51.018213439] [2531]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[2:10:51.025287009] [2531]  WARN RPiController controller.cpp:43 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.
[2:10:51.025363378] [2531]  WARN RPiController controller.cpp:80 No algorithm found for "version"
[2:10:51.025390489] [2531]  WARN RPiController controller.cpp:80 No algorithm found for "target"
[2:10:51.025414544] [2531]  WARN RPiController controller.cpp:80 No algorithm found for "algorithms"
[2:10:51.032754129] [2531]  INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media3 and ISP device /dev/media0
[2:10:53.547034117] [2524]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[2:10:53.548144043] [2531]  INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
Speicherzugriffsfehler

Edited to add:
For everybody's reference, this currently returns the hashes above, i.e.

$ wget -q https://raw.githubusercontent.com/raspberrypi/libcamera/main/src/ipa/raspberrypi/data/ov9281.json -O - | sha256sum
9061ae2ff165e698cf9d2d4596ac3617a5e57bbcf6fb2822534fd75a29413a46  -

from libcamera.

naushir avatar naushir commented on June 5, 2024

Those are indeed the up-to-date versions of the libraries. I can't see what exactly is going wrong unfortunately. I'll get hold of an ov9281 and give it a try myself.

from libcamera.

naushir avatar naushir commented on June 5, 2024

Starting with a new clean 32-bit image, and doing a sudo apt update && sudo apt upgrade, I have the same version as you are running:

pi@raspberrypi:~ $ libcamera-hello --version
libcamera-apps build: b89cc36c3872 19-10-2022 (13:11:40)
libcamera build: v0.0.1+21-7c855784

Once I do a sudo cp /usr/share/libcamera/ipa/raspberrypi/ov9281.json /usr/share/libcamera/ipa/raspberrypi/ov9281_mono.json - which is needed until we bump our libcamera tree to the latest version, my ov9281 works as expected:

pi@raspberrypi:~ $ libcamera-hello -t 0 -n
[0:07:47.977371654] [6644]  INFO Camera camera_manager.cpp:293 libcamera v0.0.1+21-7c855784
[0:07:47.994261997] [6645]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[0:07:47.994311071] [6645]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:07:48.003940641] [6645]  INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media3 and ISP device /dev/media0
[0:07:48.004556437] [6644]  INFO Camera camera.cpp:1026 configuring streams: (0) 640x400-YUV420
[0:07:48.005383473] [6645]  INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 640x400-Y10_1X10 - Selected unicam format: 640x400-Y10P
[0:07:48.014349284] [6648]  WARN IPARPI raspberrypi.cpp:927 Could not set SATURATION - no ccm algorithm
[0:07:48.014422802] [6648]  WARN IPARPI raspberrypi.cpp:942 Could not set SHARPNESS - no sharpen algorithm
[0:07:48.014513673] [6648]  WARN IPARPI raspberrypi.cpp:859 Could not set AWB_MODE - no AWB algorithm

You can ignore the last three warning messages, they really ought to be removed for any mono sensor.

With manually building and installing the up-to-date libcamera tree at commit aa7b374054c7, I don't need to do the sudo cp /usr/share/libcamera/ipa/raspberrypi/ov9281.json /usr/share/libcamera/ipa/raspberrypi/ov9281_mono.json and again the ov9281 works as expected for me.

@kralo are you able to manually build/install the latest libcamera tree on your setup. Alternatively, you might try sudo apt purge libcamera0 libcamera-apps and sudo apt install libcamera0 libcamera-apps to do a reinstall. It feels like there is something inconsistent in your environment that is causing this issue.

from libcamera.

kralo avatar kralo commented on June 5, 2024

2022-09-22-raspios-bullseye-armhf.img.xz image is fine.
fresh -arm64 crashes on first try.

on (fresh)

Linux raspberrypi 5.15.61-v8+ #1579 SMP PREEMPT Fri Aug 26 11:16:44 BST 2022 aarch64 GNU/Linux

libcamera-apps build: 1bf0ccacf2ef 31-08-2022 (16:21:49)
libcamera build: v0.0.0+3866-0c55e522

and same with updated

Linux raspberrypi 5.15.76-v8+ #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 aarch64 GNU/Linux

libcamera-apps build: 73ab09fcf408 09-11-2022 (14:58:13)
libcamera build: v0.0.1+54-d528119f

btw, I am running $ qcam, not libcamera-hello. Libcamera-hello shows the same output as yours.

Aren't you able to reproduce this?

from libcamera.

naushir avatar naushir commented on June 5, 2024

Aren't you able to reproduce this?

Unfortunately I have not been able to reproduce. I will try again with a fresh image in case I did something wrong.

EDIT: Running qcam on a freshly created and updated 64-bit OS build seems to be fine for me as well. The version strings match yours in the above comment:

libcamera-apps build: 73ab09fcf408 09-11-2022 (14:58:13)
libcamera build: v0.0.1+54-d528119f
pi@rpi:~ $ uname -a
Linux raspberrypi 5.15.76-v8+ #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 aarch64 GNU/Linux

from libcamera.

NatGr avatar NatGr commented on June 5, 2024

Hello all,

I've got the same problem as @kralo but I'm using an imx477 sensor.

I think the bug is caused by an interaction between QT and recent versions of libcamera.
I did not face this bug with qcam first, but with a custom program using both libcamera and qt. I've got another version of the program that does not use qt and it runs fine.

Both of these programs are a few months old and ran fine with old versions of libcamera (git20220705+f30ad033-1) but the qt version (as well as qcam) doesn't work with the latest releases (git20221109+d528119f-1).

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

@NatGr Are you compiling these applications yourself? Are you compiling libcamera yourself? I'm worried we're hitting ABI instability issues here or multiple installed versions. You may need to recompile your custom application to match the updated libcamera install.

It sounds like your issue may be independent, please create a new/separate issue and paste a full backtrace / log of the crash - and if possible - use gdb to identify exactly where the crash is occurring that you are seeing.

from libcamera.

NatGr avatar NatGr commented on June 5, 2024

I'm compiling my two applications myself but libcamera and qcam come from the package manager.
I've recompiled my applications between the different installations of libcamera.

Here is a backtrace of qcam. I just mentionned my application to give a bit of context, I don't think it's worth creating another issue but I'll do it if you disagree.

LIBCAMERA_LOG_LEVELS=*:DEBUG gdb qcam
Starting program: /usr/bin/qcam
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ff22abec0 (LWP 45404)]
[604:32:13.631291451] [45401] DEBUG IPAModule ipa_module.cpp:329 ipa_rpi.so: IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so is signed
[604:32:13.631664319] [45401] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so'
[604:32:13.631835984] [45401] DEBUG IPAModule ipa_module.cpp:329 ipa_vimc.so: IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_vimc.so is signed
[604:32:13.631962483] [45401] DEBUG IPAManager ipa_manager.cpp:245 Loaded IPA module '/usr/lib/aarch64-linux-gnu/libcamera/ipa_vimc.so'
[604:32:13.632139445] [45401] INFO Camera camera_manager.cpp:293 libcamera v0.0.1+54-d528119f
[New Thread 0x7ff19b5ec0 (LWP 45406)]
[604:32:13.632882255] [45406] DEBUG Camera camera_manager.cpp:106 Starting camera manager
[604:32:13.640450906] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "rpivid" created from /dev/media0
[604:32:13.640507739] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media0 due to 1 missing dependencies
[604:32:13.640947051] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media0 found
[604:32:13.640973013] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: rpivid
[604:32:13.641272215] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-codec" created from /dev/media3
[604:32:13.641301233] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media3 due to 5 missing dependencies
[604:32:13.643412645] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media3 found
[604:32:13.643468533] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media3: bcm2835-codec
[604:32:13.643793568] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-isp" created from /dev/media1
[604:32:13.643833123] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media1 due to 4 missing dependencies
[604:32:13.644213269] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "bcm2835-isp" created from /dev/media2
[604:32:13.644247657] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media2 due to 4 missing dependencies
[604:32:13.646105070] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media1 found
[604:32:13.646175533] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media1: bcm2835-isp
[604:32:13.647939928] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media2 found
[604:32:13.647995854] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media2: bcm2835-isp
[604:32:13.648499702] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:224 New media device "unicam" created from /dev/media4
[604:32:13.648830348] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:95 Defer media device /dev/media4 due to 2 missing dependencies
[604:32:13.649653638] [45406] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media4 found
[604:32:13.649687731] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media4: unicam
[604:32:13.650098302] [45406] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerRPi'
[604:32:13.650169264] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "unicam"
[604:32:13.650218912] [45406] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "bcm2835-isp"
[604:32:13.650435651] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Exposure (0x00980911)
[604:32:13.650525466] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Horizontal Flip (0x00980914)
[604:32:13.650555336] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Vertical Flip (0x00980915)
[604:32:13.650589021] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Camera Orientation (0x009a0922)
[604:32:13.650629483] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Camera Sensor Rotation (0x009a0923)
[604:32:13.650661335] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Vertical Blanking (0x009e0901)
[604:32:13.650690131] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Horizontal Blanking (0x009e0902)
[604:32:13.650729131] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Analogue Gain (0x009e0903)
[604:32:13.650760538] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Red Pixel Value (0x009e0904)
[604:32:13.650789630] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Green (Red) Pixel Value (0x009e0905)
[604:32:13.650817908] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Blue Pixel Value (0x009e0906)
[604:32:13.650845075] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Green (Blue) Pixel Value (0x009e0907)
[604:32:13.650875482] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Pixel Rate (0x009f0902)
[604:32:13.650903259] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Test Pattern (0x009f0903)
[604:32:13.650948944] [45406] DEBUG V4L2 v4l2_device.cpp:627 'imx477 10-001a': Control: Digital Gain (0x009f0905)
[604:32:13.651925549] [45406] DEBUG CameraSensor camera_sensor.cpp:368 'imx477 10-001a': No static test pattern map for 'imx477'
[604:32:13.655165434] [45406] DEBUG IPAManager ipa_manager.cpp:303 IPA module /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so signature is valid
[604:32:13.655337747] [45406] DEBUG IPAProxy raspberrypi_ipa_proxy.cpp:45 initializing raspberrypi proxy: loading IPA from /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so
[604:32:13.692465249] [45406] WARN RPiController controller.cpp:43 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.
[604:32:13.692546323] [45406] WARN RPiController controller.cpp:80 No algorithm found for "version"
[604:32:13.692567897] [45406] WARN RPiController controller.cpp:80 No algorithm found for "target"
[604:32:13.692587989] [45406] WARN RPiController controller.cpp:80 No algorithm found for "algorithms"
[604:32:13.693231577] [45406] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[16:cap]: Opened device platform:fe801000.csi: unicam: unicam
[604:32:13.693639371] [45406] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video1[17:cap]: Opened device platform:fe801000.csi: unicam: unicam
[604:32:13.693737759] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Red Balance (0x0098090e)
[604:32:13.693813258] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Blue Balance (0x0098090f)
[604:32:13.693844536] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Colour Correction Matrix (0x009819e1)
[604:32:13.693876739] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Lens Shading (0x009819e2)
[604:32:13.693908517] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Black Level (0x009819e3)
[604:32:13.693938461] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Green Equalisation (0x009819e4)
[604:32:13.693968146] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Gamma (0x009819e5)
[604:32:13.694000572] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Denoise (0x009819e6)
[604:32:13.694035016] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Sharpen (0x009819e7)
[604:32:13.694088942] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Defective Pixel Correction (0x009819e8)
[604:32:13.694126682] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Colour Denoise (0x009819e9)
[604:32:13.694157052] [45406] DEBUG V4L2 v4l2_device.cpp:627 /dev/video13[18:cap]: Control: Digital Gain (0x009f0905)
[604:32:13.694208552] [45406] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video13[18:out]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[604:32:13.694420476] [45406] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video14[19:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[604:32:13.694514772] [45406] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video15[20:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[604:32:13.694586753] [45406] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video16[21:cap]: Opened device platform:bcm2835-isp: bcm2835-isp: bcm2835-isp
[604:32:13.694641697] [45406] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 3 and priority write flag 0 for Horizontal Blanking
[604:32:13.694683660] [45406] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 3 and priority write flag 1 for Vertical Blanking
[604:32:13.694706641] [45406] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Exposure
[604:32:13.694729419] [45406] DEBUG DelayedControls delayed_controls.cpp:99 Set a delay of 2 and priority write flag 0 for Analogue Gain
[604:32:13.694852992] [45406] INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media1
[604:32:13.694887843] [45406] DEBUG Camera camera_manager.cpp:161 Pipeline handler "PipelineHandlerRPi" matched
[604:32:13.694916899] [45406] DEBUG RPI raspberrypi.cpp:1199 Unable to acquire a Unicam instance
[604:32:13.694939473] [45406] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'SimplePipelineHandler'
[604:32:13.694966435] [45406] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerUVC'
[604:32:13.694990491] [45406] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerVimc'
[New Thread 0x7ff09deec0 (LWP 45407)]
qt.qpa.xcb: QXcbConnection: XCB error: 5 (BadAtom), sequence: 499, resource id: 0, major code: 20 (GetProperty), minor code: 0

At This point the selection dialog appears and when I click on Ok:

[604:32:23.960448110] [45401] DEBUG RPI raspberrypi.cpp:570 Try color space sYCC
[604:32:23.960625183] [45401] DEBUG Camera camera.cpp:967 streams configuration: (0) 800x600-NV12
[604:32:23.960874181] [45401] DEBUG RPI raspberrypi.cpp:570 Try color space sYCC
[604:32:23.961122772] [45401] DEBUG RPI raspberrypi.cpp:570 Try color space sYCC
[604:32:23.961191234] [45401] INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[604:32:23.961437807] [45406] DEBUG RPI raspberrypi.cpp:167 Format: 1332x990 fmt SRGGB10 Score: 1235.05 (best 1235.05)
[604:32:23.961566176] [45406] DEBUG RPI raspberrypi.cpp:167 Format: 2028x1080 fmt SRGGB12 Score: 631.167 (best 631.167)
[604:32:23.961621324] [45406] DEBUG RPI raspberrypi.cpp:167 Format: 2028x1520 fmt SRGGB12 Score: 537.329 (best 537.329)
[604:32:23.961672675] [45406] DEBUG RPI raspberrypi.cpp:167 Format: 4056x3040 fmt SRGGB12 Score: 1424.33 (best 537.329)
[604:32:23.961935692] [45406] INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
[604:32:23.962476633] [45406] DEBUG RPI raspberrypi.cpp:832 Setting ISP Output0 to 800x600-XB24
[604:32:23.964117899] [45406] DEBUG RPI raspberrypi.cpp:846 Stream ISP Output0 has color space sYCC
[604:32:23.964227565] [45406] DEBUG RPI raspberrypi.cpp:912 Setting ISP Output1 (internal) to 400x300-YU12
Thread 3 "qcam" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ff19b5ec0 (LWP 45406)]
0x0000007ff116108c in libcamera::ipa::RPi::IPARPi::applyFrameDurations(libcamera::utils::Duration, libcamera::utils::Duration) ()
from /usr/lib/aarch64-linux-gnu/libcamera/ipa_rpi.so

from libcamera.

kralo avatar kralo commented on June 5, 2024

So, to recap:

I get the crash in libcamera::ipa::RPi::IPARPi::applyFrameDurations (this=this@entry=0x7fe000c280, minFrameDuration=..., maxFrameDuration=...) at ../src/ipa/raspberrypi/raspberrypi.cpp:1188 with an arducam ov9281 and qcam on a fresh 64bit image.

@NatGr gets it with imx447 at the same function.

I just tested and get the crash with an inno-maker ov9281 also. This is with qcam from

libcamera-tools:
  Installiert:           0~git20221109+d528119f-1

qcam works when compiled from source, libcamera v.0.0.1+71-2b1e1cd1 (from git.libcamera.org )
qcam works when compiled from source, libcamera v.0.0.0+4052-d528119f (from github.com/raspberrypi/libcamera )

The packaged libcamera0 and libcamera-tools repo
20220705+f30ad033 works
20220826+3fad116f crashes before selecting a camera
20221018+7c855784 does not detect a camera/offer to select one
20221109+d528119f crashes after selecting a camera, as reported.

@naushir you really have a working qcam on aarch64 ? do earlier packaged versions work for you as well?

Might there be something off with the packaging?

from libcamera.

naushir avatar naushir commented on June 5, 2024

@naushir you really have a working qcam on aarch64 ? do earlier packaged versions work for you as well?

It definitely works for me. When I get some spare time, I'll try reverting to earlier packages and test out.

from libcamera.

kralo avatar kralo commented on June 5, 2024

This does not tell me anything.

$ diff <( ldd $(which libcamera-hello) | grep libcam ) <(ldd $(which qcam)| grep libcam )
1,3c1,2
< 	libcamera_app.so => /lib/aarch64-linux-gnu/libcamera_app.so (0x0000007f98023000)
< 	libcamera.so.0.0.1 => /lib/aarch64-linux-gnu/libcamera.so.0.0.1 (0x0000007f97b00000)
< 	libcamera-base.so.0.0.1 => /lib/aarch64-linux-gnu/libcamera-base.so.0.0.1 (0x0000007f97acb000)
---
> 	libcamera.so.0.0.1 => /lib/aarch64-linux-gnu/libcamera.so.0.0.1 (0x0000007f94db4000)
> 	libcamera-base.so.0.0.1 => /lib/aarch64-linux-gnu/libcamera-base.so.0.0.1 (0x0000007f94d7f000)

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

@naushir could this because libcamera-apps are setting some environment variable that gets used which isn't set in qcam or anything like that ?

from libcamera.

naushir avatar naushir commented on June 5, 2024

@naushir could this because libcamera-apps are setting some environment variable that gets used which isn't set in qcam or anything like that ?

The only env variable it sets (as far as I'm aware) is for the tuning file, if a custom one is specified on the command line.

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

Ok - shouldn't be that then. This is very perplexing that it is crashing in the core code/ipa with qcam, but not libcamera-apps.

@kralo - could you check with 'cam' ... something like cam -c1 -C20 --metadata

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

@kralo Do you know how to use git-bisect ?

If you can identify a specific commit in these ranges it may be enlightening.

20220705+f30ad033 works
20220826+3fad116f crashes before selecting a camera
20221018+7c855784 does not detect a camera/offer to select one
20221109+d528119f crashes after selecting a camera, as reported.

from libcamera.

kralo avatar kralo commented on June 5, 2024

If you can identify a specific commit in these ranges it may be enlightening.

As i wrote earlier, I can compile the latest tips without problems.

Thats why I suggested something was off with the packaging.

I have been trying to recompile the deb from source, but it hangs when compiling. I suppose the packages are cross-built ?

from libcamera.

kralo avatar kralo commented on June 5, 2024
  • could you check with 'cam' ... something like cam -c1 -C20 --metadata

You have a hint where it is packaged?

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

As i wrote earlier, I can compile the latest tips without problems.

That's why I've asked to bisect ... bisect means compile in stages between the failing version and the working version to see which commit introduces the issue.

if cam isn't packaged- that's up to RPi. When you build from source, it's build/src/apps/cam/cam -c1 -C20 --metadata - but if that's already known to work it's not going to tell us much.

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

If you have known working versions, and known bad versions:

from libcamera.

kralo avatar kralo commented on June 5, 2024

I know how to bisect.

Please explain to me the search trajectory.

qcam works when compiled from source, libcamera v.0.0.0+4052-d528119f (from github.com/raspberrypi/libcamera )

The packaged libcamera0 and libcamera-tools repo
20220705+f30ad033 works
20220826+3fad116f crashes before selecting a camera
20221018+7c855784 does not detect a camera/offer to select one
20221109+d528119f crashes after selecting a camera, as reported.

When I compile the current tip of rpi/libcamera, which is d528119, it works.
When I use the packaged version, which claims the same commit hash, it doesn't. Thats why I suppose there is something awry with the packaging.

Where should I go with bisecting? I don't have a "known bad" commit, because when I compile myself, it works.

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

Ok - I hadn't realised your reference to the 'bad' and 'good' commits were the same.
So I'm out of ideas. If it works when you build, but not when you install from a package ... then there must be a conflict somewhere, but it might be up to Raspberry Pi packaging team to investigate. I have no more leads for the libcamera side.

from libcamera.

naushir avatar naushir commented on June 5, 2024

So I'm out of ideas. If it works when you build, but not when you install from a package ... then there must be a conflict somewhere, but it might be up to Raspberry Pi packaging team to investigate. I have no more leads for the libcamera side.

Given that it works as expected for me with the exact same packages, I have run out of ideas as well. We will be making a new package release imminently, so let's see what happens there.

from libcamera.

kralo avatar kralo commented on June 5, 2024

I got the sources via apt and rebuilt. I can produce an equally "broken" version.

What really bogs me is the error about the "format of the tuning file", when it is in reality "2.0" but the parser does not seem to understand it. I added additional output but cannot believe it can not parse "2.0".

@raspberrypi:~/fromaptsource/libcamera-0~git20221109+d528119f $  ./build/src/apps/qcam/qcam
[17:44:42.308347767] [20739]  INFO IPAManager ipa_manager.cpp:143 libcamera is not installed. Adding '/home/poi/fromaptsource/libcamera-0~git20221109+d528119f/build/src/ipa' to the IPA search path
[17:44:42.369501181] [20739]  INFO Camera camera_manager.cpp:293 libcamera v0.0.1+54-d528119f
[17:44:42.403485528] [20743]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[17:44:42.403636081] [20743]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[17:44:43.196465572] [20743]  INFO IPAProxy ipa_proxy.cpp:130 libcamera is not installed. Loading IPA configuration from '/home/poi/fromaptsource/libcamera-0~git20221109+d528119f/src/ipa/raspberrypi/data'

[17:44:43.230420864] [20743]  WARN RPiController controller.cpp:43  read contents is val? 1 read contents is dict? 0 read contents is list? 0 read contents parsevald 4711 read contents parsevals 2.0 tuning file /home/poi/fromaptsource/libcamera-0~git20221109+d528119f/src/ipa/raspberrypi/data/ov9281_mono.json got version 1 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.

[17:44:43.230544769] [20743]  WARN RPiController controller.cpp:87 No algorithm found for "version"
[17:44:43.230568769] [20743]  WARN RPiController controller.cpp:87 No algorithm found for "target"
[17:44:43.230589787] [20743]  WARN RPiController controller.cpp:87 No algorithm found for "algorithms"
[17:44:43.233845846] [20743]  INFO RPI raspberrypi.cpp:1414 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media4 and ISP device /dev/media0
[17:44:44.716778171] [20739]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[17:44:44.717172239] [20743]  INFO RPI raspberrypi.cpp:800 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
Speicherzugriffsfehler
poi@raspberrypi:~/fromaptsource/libcamera-0~git20221109+d528119f $ head /home/poi/fromaptsource/libcamera-0~git20221109+d528119f/src/ipa/raspberrypi/data/ov9281_mono.json
{
    "version": 2.0,
    "target": "bcm2835",
    "algorithms": [
        {
            "rpi.black_level":
            {
                "black_level": 4096
            }
        },

from libcamera.

naushir avatar naushir commented on June 5, 2024

What really bogs me is the error about the "format of the tuning file", when it is in reality "2.0" but the parser does not seem to understand it. I added additional output but cannot believe it can not parse "2.0".

Erm... that seems very strange indeed! libcamera uses the libyaml parser that gets included as a meson subproject:

[wrap-git]
directory = libyaml
url = https://github.com/yaml/libyaml
# tags/0.2.5
revision = 2c891fc7a770e8ba2fec34fc6b545c672beb37e6

I don't know too much about meson subprojects, but if you already have libyaml installed in your system, it may not re-build as part of the libcamera build. In such cases, it is possible that you may have a different version from my setup causing a failure.

from libcamera.

kralo avatar kralo commented on June 5, 2024

hmm, but it does not seem to be relevant? It is not even downloaded ?

~/libcamera $ meson subprojects update
Updating libyuv...
  -> Not used.
Updating pybind11...
  -> Not used.
Updating gtest...
  -> Subproject has not changed, or the new source/patch needs to be extracted on the same location.
     In that case, delete subprojects/googletest-release-1.11.0 and run meson --reconfigure
Updating libyaml...
  -> Not used.

from libcamera.

kralo avatar kralo commented on June 5, 2024

When I remove libyaml-dev via apt, I cannot build.
You probably have the same output from meson --reconfigure build ?
Dependency yaml-0.1 found: YES 0.2.2 (cached)

sudo apt-cache policy libyaml-dev
libyaml-dev:
  Installiert:           0.2.2-1
  Installationskandidat: 0.2.2-1

from libcamera.

naushir avatar naushir commented on June 5, 2024

I don't have libyaml-dev installed on my system. On meson --reconfigure I get:

Run-time dependency yaml-0.1 found: NO (tried pkgconfig and cmake)
Executing subproject libyaml method cmake

libyaml| Found CMake: /usr/bin/cmake (3.18.4)

| Configuring the build directory with CMake version 3.18.4
| Running CMake with: -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|   - build directory:          /home/pi/libcamera/build_debug/subprojects/libyaml/__CMake_build
|   - source directory:         /home/pi/libcamera/subprojects/libyaml
|   - toolchain file:           /home/pi/libcamera/build_debug/subprojects/libyaml/__CMake_build/CMakeMesonToolchainFile.cmake
|   - preload file:             /usr/local/lib/python3.9/dist-packages/mesonbuild/cmake/data/preload.cmake
|   - trace args:               --trace-expand --trace-format=json-v1 --no-warn-unused-cli --trace-redirect=cmake_trace.txt
|   - disabled policy warnings: [CMP0025, CMP0047, CMP0056, CMP0060, CMP0065, CMP0066, CMP0067, CMP0082, CMP0089, CMP0102]

| Running with expanded trace output on.
| Not searching for unused variables given on the command line.
| Trace will be written to cmake_trace.txt
| -- The C compiler identification is GNU 10.2.1
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /usr/lib/ccache/cc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Configuring done
| -- Generating done
| -- Build files have been written to: /home/pi/libcamera/build_debug/subprojects/libyaml/__CMake_build

libyaml| CMake configuration: SUCCEEDED
libyaml| CMake project yaml has 42 build targets.

cmake-ast| Processing generated meson AST
cmake-ast| Build file: /home/pi/libcamera/build_debug/subprojects/libyaml/meson.build

libyaml| Project name: yaml
libyaml| Project version: undefined
libyaml| C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
libyaml| C linker for the host machine: cc ld.bfd 2.35.2
libyaml| Build targets in project: 65
libyaml| Subproject libyaml finished.

from libcamera.

kralo avatar kralo commented on June 5, 2024

@kbingham this looks like a veritable libcamera issue to me.

Fasten your seatbelts, I think this is a locale issue ( "2.0" style vs. "2,0" style)

Crashes

~/libcamera $ LC_ALL=de_DE.utf8 build/src/apps/qcam/qcam
[4:49:47.873586126] [19013]  INFO IPAManager ipa_manager.cpp:143 libcamera is not installed. Adding '/home/poi/libcamera/build/src/ipa' to the IPA search path
[4:49:47.877398139] [19013]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+dirty (2022-11-24T15:36:41+01:00)
[4:49:47.917714936] [19017]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[4:49:47.917901192] [19017]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[4:49:47.990538396] [19017]  INFO IPAProxy ipa_proxy.cpp:130 libcamera is not installed. Loading IPA configuration from '/home/poi/libcamera/src/ipa/raspberrypi/data'
[4:49:47.995112786] [19017]  WARN RPiController controller.cpp:43 This format of the tuning file /home/poi/libcamera/src/ipa/raspberrypi/data/ov9281_mono.json will be deprecated soon! 
 Read version 2.0 Please use the convert_tuning.py utility to update to version 2.0.
[4:49:47.995599241] [19017]  WARN RPiController controller.cpp:82 No algorithm found for "version"
[4:49:47.995696795] [19017]  WARN RPiController controller.cpp:82 No algorithm found for "target"
[4:49:47.995752516] [19017]  WARN RPiController controller.cpp:82 No algorithm found for "algorithms"
[4:49:48.005672839] [19017]  INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media4 and ISP device /dev/media1
Stream configuration adjusted to  800x600-XBGR8888
[4:49:49.181872248] [19013]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[4:49:49.183382335] [19017]  INFO RPI raspberrypi.cpp:766 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
Speicherzugriffsfehler

works

:~/libcamera $ LC_ALL=C build/src/apps/qcam/qcam
[4:49:57.560169480] [19021]  INFO IPAManager ipa_manager.cpp:143 libcamera is not installed. Adding '/home/poi/libcamera/build/src/ipa' to the IPA search path
[4:49:57.563881883] [19021]  INFO Camera camera_manager.cpp:299 libcamera v0.0.2+dirty (2022-11-24T15:36:41+01:00)
[4:49:57.601007787] [19025]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[4:49:57.601134952] [19025]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[4:49:57.673525123] [19025]  INFO IPAProxy ipa_proxy.cpp:130 libcamera is not installed. Loading IPA configuration from '/home/poi/libcamera/src/ipa/raspberrypi/data'
[4:49:57.695481438] [19025]  INFO RPI raspberrypi.cpp:1386 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media4 and ISP device /dev/media1
Stream configuration adjusted to  800x600-XBGR8888
[4:49:59.095307080] [19021]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[4:49:59.096842907] [19025]  INFO RPI raspberrypi.cpp:766 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
Zero-copy enabled
libpng warning: iCCP: known incorrect sRGB profile

I have stepped into YamlObject::get

errno = 0;
double value = std::strtod(value_.c_str(), &end);
if ('\0' != *end || errno == ERANGE)
return std::nullopt;

And the situation is

(gdb) p value_
$4 = "2.0"
(gdb) p end
$5 = 0x7fe0014a59 ".0"
(gdb) p value
$6 = 2

This suggests that strtod has parsed until the dot. And the comparison in l. 288 fails

For example with the german system, see 1

the packaged qcam also works with LC_ALL=C qcam

I don't know a quick remedy. looks like strtod_l is a candidate, but I don't see through the targeted c++ std versions.

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

Yikes - How does that exhibit itself as a difference from when run when installed as a package, vs run from a self built tree?

from libcamera.

kralo avatar kralo commented on June 5, 2024

I see no difference when accounting for that, i.e. I have a libcamera tip that I can crash or use, depending on which LC_ALL I prepend

from libcamera.

naushir avatar naushir commented on June 5, 2024

@kralo great debugging. Is this something that can be solved if the "version" tag is read as a string instead of a float like it currently does?

If this does impact any float type numbers... there are plenty more in the tuning files to be read :(

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

If this does impact any float type numbers... there are plenty more in the tuning files to be read :(

Indeed - and there may be other locales with the same (but different) issue :-(

iRfgc
https://german.stackexchange.com/questions/49204/in-germany-commas-are-used-as-decimal-separators-in-numbers-so-what-character

from libcamera.

naushir avatar naushir commented on June 5, 2024

I wonder if we need to use something like this in libcamera?

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

Given we define the yaml files in a specific locale , we could also set the locale when parsing (and then restore it after?)
https://en.cppreference.com/w/cpp/locale/setlocale

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

I wonder if we need to use something like this in libcamera?

haha you beat me to it. The only thing there is we could only set it while parsing, so we'd have to 'get' the existing locale and cache it to then restore after parsers have completed. Otherwise we could end up affecting other application behavious.

from libcamera.

naushir avatar naushir commented on June 5, 2024

Given we define the yaml files in a specific locale , we could also set the locale when parsing (and then restore it after?) https://en.cppreference.com/w/cpp/locale/setlocale

I got there first :-)

from libcamera.

naushir avatar naushir commented on June 5, 2024

I'll let this ticket stay open until a solution is found. I consider this reported to libcamera, because kb has seen it. ok?

Sounds good, thanks for the debugging here!

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

Discussing this more today, I think the solution will be that we'll implement our own (non-locale affected) version of strtod in our utils::strtod() namespace which shouldn't be affected by this locale issue.

from libcamera.

pinchartl avatar pinchartl commented on June 5, 2024

The libc implementations we support (glibc, musl, uclibc and bionic) all provide stdtod_l() which takes the desired locale as an extra parameter. We could use those (possibly with an alias in utils::, and a rule in checkstyle.py to catch usage to plain strtod()).

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

The libc implementations we support (glibc, musl, uclibc and bionic) all provide stdtod_l() which takes the desired locale as an extra parameter. We could use those (possibly with an alias in utils::, and a rule in checkstyle.py to catch usage to plain strtod()).

Aha, and that's even what @kralo suggested in #29 (comment)

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

Also now reported separately on our bugzilla.

https://bugs.libcamera.org/show_bug.cgi?id=174

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

@kralo I'm not able to replicate this issue locally - even if I generate a de_DE.utf8 locale ... so I'm struggling to validate this. But regardless I've thrown this patch together to test.
And I can't upload a patch here so I've pushed a branch - could you test this branch please?

https://github.com/kbingham/libcamera/tree/kbingham/clocale - or specifically this commit kbingham/libcamera@3025a88

from libcamera.

kbingham avatar kbingham commented on June 5, 2024

The fix for this has now been merged upstream at https://git.libcamera.org/libcamera/libcamera.git/commit/?id=e8ae254970cfdeb1b5aba307a95a3189b09c9784

Please let me know if this resolves the issue fully for you.

from libcamera.

kralo avatar kralo commented on June 5, 2024

I was just able to positively assert that qcam crashes on kbingham/libcamera@0081e4e6 (parent to e8ae254), but it works with kbingham/libcamera@e8ae2549.

~/libcamera_upstream $  build/src/apps/qcam/qcam

[1:21:44.253074176] [5219]  INFO IPAManager ipa_manager.cpp:143 libcamera is not installed. Adding '/home/r/libcamera_upstream/build/src/ipa' to the IPA search path
[1:21:44.259211493] [5219]  INFO Camera camera_manager.cpp:299 libcamera v0.0.3+13-0081e4e6
[1:21:44.279150882] [5227]  WARN CameraSensorProperties camera_sensor_properties.cpp:195 No static properties available for 'ov9281'
[1:21:44.279292435] [5227]  WARN CameraSensorProperties camera_sensor_properties.cpp:197 Please consider updating the camera sensor properties database
[1:21:44.345368289] [5227]  INFO IPAProxy ipa_proxy.cpp:130 libcamera is not installed. Loading IPA configuration from '/home/r/libcamera_upstream/src/ipa/raspberrypi/data'
[1:21:44.349326712] [5227]  WARN RPiController controller.cpp:43 This format of the tuning file will be deprecated soon! Please use the convert_tuning.py utility to update to version 2.0.
[1:21:44.349596578] [5227]  WARN RPiController controller.cpp:80 No algorithm found for "version"
[1:21:44.349668836] [5227]  WARN RPiController controller.cpp:80 No algorithm found for "target"
[1:21:44.349724298] [5227]  WARN RPiController controller.cpp:80 No algorithm found for "algorithms"
[1:21:44.357580478] [5227]  INFO RPI raspberrypi.cpp:1387 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media0 and ISP device /dev/media2
Stream configuration adjusted to  800x600-XBGR8888
[1:21:46.251619292] [5219]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[1:21:46.257018101] [5227]  INFO RPI raspberrypi.cpp:767 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
Speicherzugriffsfehler

Same with rpi/libcamera 0684c373 - it crashes by default, but not when your patch applied by hand:

$ libcamera_rpi_patched/build/src/apps/qcam/qcam

[1:47:23.051809807] [6952]  INFO IPAManager ipa_manager.cpp:143 libcamera is not installed. Adding '/home/r/libcamera_rpi_patched/build/src/ipa' to the IPA search path
[1:47:23.058469685] [6952]  INFO Camera camera_manager.cpp:299 libcamera v0.0.0+4116-0684c373-dirty (2023-01-04T14:42:04+01:00)
[1:47:23.079581323] [6957]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'ov9281'
[1:47:23.079755080] [6957]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[1:47:23.152413209] [6957]  INFO IPAProxy ipa_proxy.cpp:130 libcamera is not installed. Loading IPA configuration from '/home/r/libcamera_rpi_patched/src/ipa/raspberrypi/data'
[1:47:23.176843916] [6957]  INFO RPI raspberrypi.cpp:1423 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media0 and ISP device /dev/media2
[1:47:24.695791745] [6952]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-XBGR8888
[1:47:24.698408360] [6957]  INFO RPI raspberrypi.cpp:803 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y10_1X10 - Selected unicam format: 1280x800-Y10P
Zero-copy enabled
(working very nicely...)
r@rt:~ $

Thank you very much for your work on this, @kbingham !

Rpi folks might consider a new release ?

from libcamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.