nutron
Posts: 16
Joined: Sat Apr 28, 2018 3:36 am

Re: Official V4L2 driver

Wed Aug 28, 2019 8:46 pm

Thanks

drmatt
Posts: 37
Joined: Sat Sep 07, 2019 3:47 am

Re: Official V4L2 driver

Sat Sep 07, 2019 4:17 am

Thank you for all your work on this driver.

The camera's analog and digital gains can be set indirectly via V4L2_CID_ISO_SENSITIVITY, but it looks like there are only a few discrete steps available. This does not, for instance, allow the v2 camera gain to be set to 1, since the lowest ISO of 100 is tuned to about 1.84. It would be useful to be able to have finer-grained control over these parameters.

I've been able to set the gains via MMAL calls in python/picamera, and I believe there is also a pending PR that will allow them to be set directly via the analog_gain and digital_gain members of the PiCamera class.

Is there any plan to directly expose the camera's analog and digital gain parameters via V4L2 (perhaps V4L2_CID_ANALOGUE_GAIN and V4L2_CID_GAIN)?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Sun Sep 08, 2019 7:48 am

I hadn't any plans to add analog and digital gain controls to the v4l2 driver, but it can be done by anyone. Pull requests are always welcome.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

drmatt
Posts: 37
Joined: Sat Sep 07, 2019 3:47 am

Re: Official V4L2 driver

Mon Sep 09, 2019 1:12 am

I hadn't any plans to add analog and digital gain controls to the v4l2 driver, but it can be done by anyone. Pull requests are always welcome.
Understood, thanks. Digging around a bit in the raspberry pi linux repo, it looks like a good place to start would be drivers/staging/vc04_services/bcm2835-camera/ (specifically controls.c, bmc2835-camera.h, mmal-parameters.h). So I'll next read up on how to build and test.

bhjel
Posts: 56
Joined: Tue Jan 01, 2019 2:00 am

Re: Official V4L2 driver

Thu Sep 12, 2019 2:43 am

Any thoughts on adding a 4x4 binning, 320x240 "mode 8" to the v4l2 driver for the imx219? This would be immensely useful for our computer vision application.

FPSUsername
Posts: 5
Joined: Tue Oct 31, 2017 9:08 pm

Re: Official V4L2 driver

Mon Sep 23, 2019 3:30 pm

6by9 wrote:
Sun Jul 26, 2015 8:14 pm
gjimenez wrote:Hi, Is roi supported now on the official v4l2 driver?
Not yet. I got the initial part working following on from byterg's initial patch, but need to ensure that it is the correct way within the V4L2 framework and gets advertised correctly.
Hello,

I developed a driver for a sensor that supports ROI modes, yet it doesn't seem that the V4L2 driver has any information regarding this.
If you did implement ROI mode, did you crop a ROI from a full frame or did you actually implement the sensor's ROI mode?
Do you have a source code that I could look at?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Mon Sep 23, 2019 3:53 pm

bhjel wrote:
Thu Sep 12, 2019 2:43 am
Any thoughts on adding a 4x4 binning, 320x240 "mode 8" to the v4l2 driver for the imx219? This would be immensely useful for our computer vision application.
There is an open offer that if someone provides a full register set in a shape that can be merged into raspiraw then I would look at merging it into the firmware. There is a half attempt at https://github.com/6by9/raspiraw/pull/21, but it's not as a new mode that I can integrate easily.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Mon Sep 23, 2019 5:03 pm

FPSUsername wrote:
Mon Sep 23, 2019 3:30 pm
6by9 wrote:
Sun Jul 26, 2015 8:14 pm
gjimenez wrote:Hi, Is roi supported now on the official v4l2 driver?
Not yet. I got the initial part working following on from byterg's initial patch, but need to ensure that it is the correct way within the V4L2 framework and gets advertised correctly.
Hello,

I developed a driver for a sensor that supports ROI modes, yet it doesn't seem that the V4L2 driver has any information regarding this.
If you did implement ROI mode, did you crop a ROI from a full frame or did you actually implement the sensor's ROI mode?
Do you have a source code that I could look at?
Using what framework?
This thread is about the bcm2835-v4l2 driver that makes use of the (closed source) firmware drivers for accessing the camera. There is also the bcm2835-unicam (open source) CSI2 driver that allows adding of Linux kernel drivers for sensors

I don't see how you can have done the former.
The latter doesn't have the g_selection and s_selection ops implemented, but they're trivial to do. I suspect it's pretty much a copy paste of unicam_s_edid/unicam_g_edid in just forwarding the request straight through to the sensor subdev in https://github.com/raspberrypi/linux/bl ... 5-unicam.c
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

hazeii
Posts: 31
Joined: Sat Apr 25, 2015 8:33 am

Re: Official V4L2 driver

Fri Nov 15, 2019 1:40 pm

Hopefully a simple question, is there any automatic gain control or similar going on behind the scenes (i.e. in the firmware)? We're using a lot of Pis with V2 cameras for computer vision in controlled environments (basically closed tanks with fixed LED lighting), and on some of them we're getting occasionaly substantial brightness variations in the camera images, generally over a period of a few seconds.

So far we've tried turning off all the obvious 'auto' controls in v4l2 (gain, iso, exposure etc) but it doesn't seem to fix the issue (which is intermittent and so far been difficult to reproduce locally). I've looked through the driver code and we seem to covered all the controls, hence we were wondering if there's anything in the firmware that could cause it, i.e. some sort of noise reduction or other auto-adjustment? Any pointers or suggestions gratefully received!

User avatar
mike632t
Posts: 104
Joined: Sat May 19, 2012 7:56 pm
Location: UK
Contact: Website

Re: Official V4L2 driver

Sun Dec 29, 2019 3:25 pm

Found this post mentioning the little connector on the camera board which turned out to be the reason my pi's camera stopped working after an upgrade.

Good advice to check the connectors from 6by9, looks like that little one can just pop off, though I had to take the case apart to check.
6by9 wrote:
Thu Sep 07, 2017 3:59 pm
KeithG wrote:
Thu Sep 07, 2017 3:44 pm
vcgencmd get_camera returns
supported=1 detected=0
I take it this does not look good
I have removed the camera ribbon both ends and reconnected it. No change.
That means the GPU can't talk to the camera over the I2C bus, so totally unrelated to the V4L2 driver.
The quick things to check:
- flex connectors are the correct way up and seated properly (sounds like you've already done that one)
- if a V1.3 camera module, does the LED come on?
- the little connector between the camera PCB and the camera module itself can become dislodged. Push down on top of it to make sure it is fully home.
...
And you've just replied with that last one being the cause!

johnjones
Posts: 17
Joined: Sat Jun 03, 2017 5:09 am

Re: Official V4L2 driver

Mon Dec 30, 2019 2:07 pm

Hi amazing people

Is it possible to capture full FOV 3280x2464 video through the V4L2 pi 4 driver ?

(what would be the framerate with a pi 4 doing nothing else and optimised for capture)

I was reading documentation and I found a weird mode options....
what is the difference between the mode 2 and 3 for the Version 2.x (IMX219) camera because this page lists no differences :
https://www.raspberrypi.org/documentati ... /camera.md

thanks

John Jones

aserranoh
Posts: 1
Joined: Tue Apr 28, 2020 8:55 pm

Re: Official V4L2 driver

Tue Apr 28, 2020 9:09 pm

Hello,

First of all, thantk-you for all the people involved in the developement of the Raspberry Pi software.
I am trying to use the camera module 2 to stream video directly in h264 format to another PC. I am using gstreamer, and the following pipe for that:

Code: Select all

gst-launch-1.0 -e v4l2src device=/dev/video0 do-timestamp=true ! video/x-264,width=640,height=480,framerate=30/1 ! h264parse ! rtph264pay config-interval=1 ! gdppay ! udpsink host=192.168.1.2 port=5000
but it gives me the following error:

Code: Select all

Call to S_FMT failed for H264 @ 640x480: Invalid argument
At the same time, if I take a look at dmesg, I see the following:

Code: Select all

bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -3
On the contrary, if I use the following gstreamer pipe:

Code: Select all

gst-launch-1.0 -v v4l2src device=/dev/video0 ! decodebin ! filesink location=capture1.raw
It records a file, and I see for the verbose output of gstreamer that it's capturing in the format YUY2, 3280x2160, framerate=90/1. So it seems the camera works, at least using this default format. But if I try to capture H264, it gives an error.

I am using the official RPI sources for the kernel (version 4.19.115-v8+) and the firmware stable branch (as downloaded two days ago).

Somebody can help me please? Any help will be super appreciated!

Cheers

Antonio

dgalland
Posts: 69
Joined: Tue Aug 27, 2019 8:20 am

Re: Official V4L2 driver

Mon Nov 02, 2020 7:22 pm

Hi,
After making an application in Python with Picamera I explore out of curiosity the other API V4l2 and libcamera by bringing out all my memories in C and C ++.
With the native V4l2 driver (on top of mmal) I manage to adjust the controls and capture an image but I do not see how to query the value of the camera parameters, for example if auto exposure is chosen can we know the 'exposure for a frame?
Does anyone have an answer to this question?
Regards

therealdavidp
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 302
Joined: Tue Jan 07, 2020 9:15 am

Re: Official V4L2 driver

Tue Nov 03, 2020 8:21 am

Hi

I wasn't totally sure I understood exactly what you were asking, but I'll try to answer at least in relation to libcamera. I'll refer to some of the source code for their qcam demo application.

Libcamera works by having the application submits "requests" for images (the Camera::queueRequest method, see for example libcamera/src/qcam/main_window.cpp line 788). When a request "completes" it gives you frame buffers from the camera (you have to connect your own callback to Camera::requestCompleted, see libcamera/src/qcam/main_window.cpp line 517).

A completed request also contains a field for "metadata", which contains the kind of information you're after, see for example libcamera/src/qcam/dng_writer.cpp line 595.

We're actually in the process of producing libcamera versions of our traditional "raspicam" apps, unfortunately it's been taking a little time to roll them out. However, I'm hoping they'll give users some helpful examples of how to drive libcamera.

dgalland
Posts: 69
Joined: Tue Aug 27, 2019 8:20 am

Re: Official V4L2 driver

Tue Nov 03, 2020 11:36 am

Thank you for your reply
Yes I saw that it was possible with libcamera which I am also exploring.
But my question was more about the "old" V4L2 driver

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Tue Nov 03, 2020 11:52 am

No, there is no way to get the camera parameters out through the bcm2835-v4l2 driver. The V4L2 API doesn't provide an easy mechanism to do that.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Nanaki636
Posts: 7
Joined: Fri Nov 20, 2020 3:46 pm

Re: Official V4L2 driver

Fri Apr 23, 2021 9:10 am

drmatt wrote:
Mon Sep 09, 2019 1:12 am
I hadn't any plans to add analog and digital gain controls to the v4l2 driver, but it can be done by anyone. Pull requests are always welcome.
Understood, thanks. Digging around a bit in the raspberry pi linux repo, it looks like a good place to start would be drivers/staging/vc04_services/bcm2835-camera/ (specifically controls.c, bmc2835-camera.h, mmal-parameters.h). So I'll next read up on how to build and test.
Did you get around to doing this? If not I'll give it a go.

Nanaki636
Posts: 7
Joined: Fri Nov 20, 2020 3:46 pm

Re: Official V4L2 driver

Fri Apr 23, 2021 1:18 pm

Nanaki636 wrote:
Fri Apr 23, 2021 9:10 am
drmatt wrote:
Mon Sep 09, 2019 1:12 am
I hadn't any plans to add analog and digital gain controls to the v4l2 driver, but it can be done by anyone. Pull requests are always welcome.
Understood, thanks. Digging around a bit in the raspberry pi linux repo, it looks like a good place to start would be drivers/staging/vc04_services/bcm2835-camera/ (specifically controls.c, bmc2835-camera.h, mmal-parameters.h). So I'll next read up on how to build and test.
Did you get around to doing this? If not I'll give it a go.
I've just come across this file for the v4l2 drivers. https://github.com/raspberrypi/linux/bl ... c/imx477.c

I can see defines for the gains and there is a switch loop inside a v4l2set control which can set the gains? Is this driver used by default by V4L2 when I call the ioctls? Anytime I pass V4L2_CID_ANALOGUE_GAIN or any of the other v4l2 controls they come back as unsupported.
(I am trying to access the camera via CSI rather than I2C so maybe that's it and I'm looking in the wrong place)

Nanaki636
Posts: 7
Joined: Fri Nov 20, 2020 3:46 pm

Re: Official V4L2 driver

Fri Apr 23, 2021 2:48 pm

Nanaki636 wrote:
Fri Apr 23, 2021 1:18 pm
Nanaki636 wrote:
Fri Apr 23, 2021 9:10 am
drmatt wrote:
Mon Sep 09, 2019 1:12 am


Understood, thanks. Digging around a bit in the raspberry pi linux repo, it looks like a good place to start would be drivers/staging/vc04_services/bcm2835-camera/ (specifically controls.c, bmc2835-camera.h, mmal-parameters.h). So I'll next read up on how to build and test.
Did you get around to doing this? If not I'll give it a go.
I've just come across this file for the v4l2 drivers. https://github.com/raspberrypi/linux/bl ... c/imx477.c

I can see defines for the gains and there is a switch loop inside a v4l2set control which can set the gains? Is this driver used by default by V4L2 when I call the ioctls? Anytime I pass V4L2_CID_ANALOGUE_GAIN or any of the other v4l2 controls they come back as unsupported.
(I am trying to access the camera via CSI rather than I2C so maybe that's it and I'm looking in the wrong place)
For anyone else, you need to add dtoverlay=imx477 # HiQ camera to /boot/config.txt (haven't tested it yet it may fall on its sword). I'm guessing this is a normal process for choosing between drivers on a linux/raspberry system.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Fri Apr 23, 2021 3:22 pm

Nanaki636 wrote:
Fri Apr 23, 2021 2:48 pm
Nanaki636 wrote:
Fri Apr 23, 2021 1:18 pm
I've just come across this file for the v4l2 drivers. https://github.com/raspberrypi/linux/bl ... c/imx477.c

I can see defines for the gains and there is a switch loop inside a v4l2set control which can set the gains? Is this driver used by default by V4L2 when I call the ioctls? Anytime I pass V4L2_CID_ANALOGUE_GAIN or any of the other v4l2 controls they come back as unsupported.
(I am trying to access the camera via CSI rather than I2C so maybe that's it and I'm looking in the wrong place)
For anyone else, you need to add dtoverlay=imx477 # HiQ camera to /boot/config.txt (haven't tested it yet it may fall on its sword). I'm guessing this is a normal process for choosing between drivers on a linux/raspberry system.
Two very different sets of drivers.
The drivers in the kernel tree at /drivers/media/i2c/ for imx477, imx219, and ov5647 when combined with the appropriate overlays and the bcm2835-unicam driver will deliver you the raw Bayer frames from the sensor. This is how it is used with libcamera, but the raw device has no AGC/AE/AWB.

Without that dtoverlay line you get the bcm2835_v4l2 driver, which uses the firmware camera stack, and that's what this thread is about. This will give you fully processed images (even H264 or JPEG encoded if you wish).
That stack does not have the overrides for V4L2_CID_ANALOGUE_GAIN as yet (although it's only the kernel shim that is missing it).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Nanaki636
Posts: 7
Joined: Fri Nov 20, 2020 3:46 pm

Re: Official V4L2 driver

Mon Apr 26, 2021 10:54 am

6by9 wrote:
Fri Apr 23, 2021 3:22 pm
Nanaki636 wrote:
Fri Apr 23, 2021 2:48 pm
Nanaki636 wrote:
Fri Apr 23, 2021 1:18 pm
I've just come across this file for the v4l2 drivers. https://github.com/raspberrypi/linux/bl ... c/imx477.c

I can see defines for the gains and there is a switch loop inside a v4l2set control which can set the gains? Is this driver used by default by V4L2 when I call the ioctls? Anytime I pass V4L2_CID_ANALOGUE_GAIN or any of the other v4l2 controls they come back as unsupported.
(I am trying to access the camera via CSI rather than I2C so maybe that's it and I'm looking in the wrong place)
For anyone else, you need to add dtoverlay=imx477 # HiQ camera to /boot/config.txt (haven't tested it yet it may fall on its sword). I'm guessing this is a normal process for choosing between drivers on a linux/raspberry system.
Two very different sets of drivers.
The drivers in the kernel tree at /drivers/media/i2c/ for imx477, imx219, and ov5647 when combined with the appropriate overlays and the bcm2835-unicam driver will deliver you the raw Bayer frames from the sensor. This is how it is used with libcamera, but the raw device has no AGC/AE/AWB.

Without that dtoverlay line you get the bcm2835_v4l2 driver, which uses the firmware camera stack, and that's what this thread is about. This will give you fully processed images (even H264 or JPEG encoded if you wish).
That stack does not have the overrides for V4L2_CID_ANALOGUE_GAIN as yet (although it's only the kernel shim that is missing it).
Thank you,

I just realised this, while trying to use libAv to decode some frames(whoops!). I think the problem when the frames are not jpeg encoded is that it takes too long to process them after they have been received(I'll double check that but I'm sure I've hit that problem in the past).

Regarding the gain settings and looking at the V4L2-IMX477 driver I think the works been done there. If its a case of merging IMX477(gain defines, registers and functions) into V4L2-firmware driver I could do that. If I remember right there's a switch statement that sets options depending on the V4L2 setting that is sent. I'd just have to plug the V4L2-IMX477 gain functions in there.

What I don't know is how the otg flag works and what would need to be changed for a custom driver to be selected at kernel load time. Is this selection made based on .so names(at this point if you know of any resources I could read it would be appreciated)?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Mon Apr 26, 2021 2:32 pm

Nanaki636 wrote:
Mon Apr 26, 2021 10:54 am
I just realised this, while trying to use libAv to decode some frames(whoops!). I think the problem when the frames are not jpeg encoded is that it takes too long to process them after they have been received(I'll double check that but I'm sure I've hit that problem in the past).

Regarding the gain settings and looking at the V4L2-IMX477 driver I think the works been done there. If its a case of merging IMX477(gain defines, registers and functions) into V4L2-firmware driver I could do that. If I remember right there's a switch statement that sets options depending on the V4L2 setting that is sent. I'd just have to plug the V4L2-IMX477 gain functions in there.

What I don't know is how the otg flag works and what would need to be changed for a custom driver to be selected at kernel load time. Is this selection made based on .so names(at this point if you know of any resources I could read it would be appreciated)?
The firmware is closed source and does not have a mechanism for loading an alternate sensor driver (no one would be able to create a suitable driver anyway).

I suspect that all is required is a mapping from V4L2_CID_ANALOGUE_GAIN to MMAL control MMAL_PARAMETER_ANALOG_GAIN in controls.c, with appropriate scaling of the parameter (not that V4L2 has a defined meaning for the values of V4L2_CID_ANALOGUE_GAIN - they're sensor specific).
The question is whether there is a requirement for any other parameter to be in a particular state in addition to setting that parameter.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Nanaki636
Posts: 7
Joined: Fri Nov 20, 2020 3:46 pm

Re: Official V4L2 driver

Mon Apr 26, 2021 3:57 pm

6by9 wrote:
Mon Apr 26, 2021 2:32 pm
Nanaki636 wrote:
Mon Apr 26, 2021 10:54 am
I just realised this, while trying to use libAv to decode some frames(whoops!). I think the problem when the frames are not jpeg encoded is that it takes too long to process them after they have been received(I'll double check that but I'm sure I've hit that problem in the past).

Regarding the gain settings and looking at the V4L2-IMX477 driver I think the works been done there. If its a case of merging IMX477(gain defines, registers and functions) into V4L2-firmware driver I could do that. If I remember right there's a switch statement that sets options depending on the V4L2 setting that is sent. I'd just have to plug the V4L2-IMX477 gain functions in there.

What I don't know is how the otg flag works and what would need to be changed for a custom driver to be selected at kernel load time. Is this selection made based on .so names(at this point if you know of any resources I could read it would be appreciated)?
The firmware is closed source and does not have a mechanism for loading an alternate sensor driver (no one would be able to create a suitable driver anyway).

I suspect that all is required is a mapping from V4L2_CID_ANALOGUE_GAIN to MMAL control MMAL_PARAMETER_ANALOG_GAIN in controls.c, with appropriate scaling of the parameter (not that V4L2 has a defined meaning for the values of V4L2_CID_ANALOGUE_GAIN - they're sensor specific).
The question is whether there is a requirement for any other parameter to be in a particular state in addition to setting that parameter.
That's logical, my guess is that it must be to do with AWB and AGC. I bet these have to run in tandem of a sorts otherwise the images would look 'bad'. I also read that an analogue gain parameter of zero causes the camera to deliver black frames(analogue gain * sensor Charge) in a really simplified model. It kinda makes sense to hide it, even for that reason alone. If you know or find out I'd be interested to hear why the controls are not included as a standard via the v4l2-firmware.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12102
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Official V4L2 driver

Mon Apr 26, 2021 4:19 pm

Nanaki636 wrote:
Mon Apr 26, 2021 3:57 pm
That's logical, my guess is that it must be to do with AWB and AGC. I bet these have to run in tandem of a sorts otherwise the images would look 'bad'. I also read that an analogue gain parameter of zero causes the camera to deliver black frames(analogue gain * sensor Charge) in a really simplified model. It kinda makes sense to hide it, even for that reason alone. If you know or find out I'd be interested to hear why the controls are not included as a standard via the v4l2-firmware.
Most sensors will not support a gain less than x1.0.

It's which V4L2 controls need to interact, which is generally documented in the V4L2 spec.
eg https://www.kernel.org/doc/html/latest/ ... amera.html
V4L2_CID_ISO_SENSITIVITY requires V4L2_CID_ISO_SENSITIVITY_AUTO to be set to V4L2_CID_ISO_SENSITIVITY_MANUAL.
V4L2_CID_EXPOSURE_ABSOLUTE requires V4L2_CID_EXPOSURE_AUTO to be set to V4L2_EXPOSURE_MANUAL.
V4L2_CID_ANALOGUE_GAIN doesn't list any similar requirements, but that's because it's largely intended for raw image sensors (such as provided by dtoverlay=imx477) rather than more complex imaging stacks.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Nanaki636
Posts: 7
Joined: Fri Nov 20, 2020 3:46 pm

Re: Official V4L2 driver

Tue May 04, 2021 4:16 pm

6by9 wrote:
Mon Apr 26, 2021 4:19 pm
Nanaki636 wrote:
Mon Apr 26, 2021 3:57 pm
That's logical, my guess is that it must be to do with AWB and AGC. I bet these have to run in tandem of a sorts otherwise the images would look 'bad'. I also read that an analogue gain parameter of zero causes the camera to deliver black frames(analogue gain * sensor Charge) in a really simplified model. It kinda makes sense to hide it, even for that reason alone. If you know or find out I'd be interested to hear why the controls are not included as a standard via the v4l2-firmware.
Most sensors will not support a gain less than x1.0.

It's which V4L2 controls need to interact, which is generally documented in the V4L2 spec.
eg https://www.kernel.org/doc/html/latest/ ... amera.html
V4L2_CID_ISO_SENSITIVITY requires V4L2_CID_ISO_SENSITIVITY_AUTO to be set to V4L2_CID_ISO_SENSITIVITY_MANUAL.
V4L2_CID_EXPOSURE_ABSOLUTE requires V4L2_CID_EXPOSURE_AUTO to be set to V4L2_EXPOSURE_MANUAL.
V4L2_CID_ANALOGUE_GAIN doesn't list any similar requirements, but that's because it's largely intended for raw image sensors (such as provided by dtoverlay=imx477) rather than more complex imaging stacks.
The analogue control has been put the in the driver and V4L2 picks up the control. Changing parameters doesn't seem to have any affect on the gain. Perhaps its because rational numbers are generated by n/1. Might leave that there and vigorously set and unset scene mode although I feel this doesn't give end user great control of camera.

Is the code that runs on the GPU available ?

Return to “Camera board”