(1) Can nvbuffer be used across threads?
We get v4l2 buf with V4L2_MEMORY_DMABUF type after VIDIOC_DQBUF, but we want to process this buffer in another thread. In this way, we want to get the next buffer in time. Is it feasible?
(2) Can i get the number of v4l2 buffers which are ready to DQBUF?
>> Q1
may I know what’s your actual use-case?
it’s two thread approach in low-level VI driver to enqueue/dequeue a capture buffer.
for instance, $public_sources/kernel_src/kernel/nvidia-oot/drivers/media/platform/tegra/camera/vi/vi5_fops.c
>> Q2
did you meant the index of the capture buffer? please refer to vbuf->sequence.
for instance, $public_sources/kernel_src/kernel/nvidia-oot/drivers/media/platform/tegra/camera/vi/vi5_fops.c
>> Q1
My application scenario is that after obtaining camera image data using a V4L2 DMA buffer, due to the fact that my processing time is longer than the frame rate, the current buffer data at the application layer has not been fully processed when the next V4L2 buffer arrives. Therefore, without making an additional copy of the data, I would like to pass this NV buffer to another thread for processing. Is this feasible?
>> Q2
Is there a way at the application layer to determine how many V4L2 buffers in the driver are in a ready state?
>> Q1
you may using appsink.
or… you may try to drop frames, or lower the frame-rate for testing.
>> Q2
there’s a queue for saving capture buffer,
you may check with below for the total number of buffers that are being allocated,
for instance, $public_sources/kernel_src/kernel/nvidia-oot/drivers/media/platform/tegra/camera/vi/channel.c
static int tegra_channel_queue_setup(...)
{
...
if (vi->fops && vi->fops->vi_setup_queue)
return vi->fops->vi_setup_queue(chan, nbuffers);