V4L2-Ctl Userptr - buffers cannot be lower than 1000000 bytes - why?

Hello guys,
I got weird behavior. Maybe someone of you can explain it?

I have my own sensor driver which works well. But I have different modes, one of them being 1080x420 10bit resolution which throws the error, and the others being for example 1280x420 10bit and 960x540 10bit resolution without error.

When I do V4L2 QBuf, it says Invaled Argument when the bytes of the buffers is below 1000000. Why’s that? Where can I find the place in the source where it throws the error?

This happens in my own C++ program and also with v4l2-ctl with userptr.

Using mmap this does not happen.

Any ideas?
Best regards,
jb

What’s the error message? Have enable the log to check if can get more information.

echo -n 0xFFFF>/sys/module/videobuf2_core/parameters/debug

jetson@jetson:~$ sudo echo -n 0xFFFF>/sys/module/videobuf2_core/parameters/debug
-bash: /sys/module/videobuf2_core/parameters/debug: Permission denied

I get permission denied error for some reason, with and without sudo. Can you help me on this?

Thanks so far!
jb

Try sudo su first.

nvidia@nvidia-desktop:~$ sudo su
[sudo] password for nvidia:
root@nvidia-desktop:/home/nvidia# echo -n 0xFFFF>/sys/module/videobuf2_core/parameters/debug
root@nvidia-desktop:/home/nvidia# exit

This is what I got.

[ 1158.298283] vb2-core: __vb2_queue_alloc: allocated 4 buffers, 1 plane(s) each
[ 1158.298440] vb2-core: __qbuf_userptr: userspace address for plane 0 changed, reacquiring memory
[ 1158.298459] vb2-core: __qbuf_userptr: failed acquiring userspace memory for plane 0
[ 1158.298475] vb2-core: __buf_prepare: buffer preparation failed: -22

Any idea? @ShaneCCC
As a quick solution, I increased the buffer_size, so he does not throw an error, but after DQBuf, the buffer is all zero.
As explained above, the same sensor is working perfectly with higher framsizes above 1000000 bytes.

Best regards,
jb

I don’t have idea current. What’s the resolution need size smaller than 1M bytes.

As a quick solution, I increased the buffer_size, so he does not throw an error.

I now get data with this quick fix. Is there anything problematic with having too large buffers?
Resolution is 1080x420 10bit Bayer sensor.
Best regards,
jb

Could you check with mmap to check the buffer size with this resolution?