I try to capture a number of images using the Video4Linux API. The camera is triggered from our software via i2c. With each trigger command. The camera captures a new images and sends the image data to the Jetson. This works, but somehow the first two frames after starting the camera in Video4Linux are missing. After triggering a third time, I am able to receive all subsequent images. So it seems there is an image queue that needs to fill up before it outputs some images to user space.
Is it possible to change this behavior so that every image is becomes available in our V4L application?
there’s by default to queue two buffers internally before sending to user-space.
for example, $public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c
void tegra_channel_ring_buffer(struct tegra_channel *chan,
struct vb2_v4l2_buffer *vb,
struct timespec *ts, int state)
...
/* release buffer N at N+2 frame start event */
if (chan->num_buffers >= (chan->capture_queue_depth - 1))
free_ring_buffers(chan, 1);
you may also enable debug flag, there’s dev_dbg() messages to evaluate the initial capture latency between videobuf queue and first captured frame release to user-space.
for example, below steps to enable channel.c dynamic debug flag.
$ sudo -i
# cd /sys/kernel/debug/dynamic_debug/
# echo file channel.c +p > control