V4l2 - userptr - max queue size on

Hello,i am trying to use v4l2 to capture frames, with zero copy.
i need to keep buffer 300 frames, however it seems that v4l2 limits the queue to 32
(call VIDIOC_REQBUFS returns count=32).

anything i can do ro change limit ?

this looks like a duplicated topic, let’s using Topic 265425 to follow-up.

Thank you for your reply.
i have implemented and executed a simple work around .
it seems to me that it is working , but i would really appriciate your opinion about the workaround.

is this workaround is good or am i missing anything ?

Details about the workaround below.

Thank you !

  1. request v4l2buffers
    request from from v4l2 4 buffers , as usual

  2. buffers allocation
    usually, we would allocate only 4 buffers.
    instead, in the workaround:

    • init simple buffers array with 300 pointers to shared memory
    • init integer called next_buffers_index_to_driver with 0
  3. enqueue before start streaming
    without the workaround, we would enqueue all the items in the buffers array (4 items).
    with the workaround:
    - enqueue first 4 items from buffers array , not all the the items in buffers array (300 items)
    - init some integer : next_buffers_index_to_driver to 4.
    note: the rest of the 296 buffers will be queueued later on, one by one, after processing image.

  4. after processing image
    without the workaround, we enqueue that very same buffer to v4l2.
    with the workaroud,
    change the address pointed by v4l2 to the next buffer in the 300 items cyclic buffer.
    enqueue that buffer to v4l2 queue.
    this way, v4l2 thinks it has 4 buffers, but instead it will use 300 buffers :-)

       here is the code for this step (after processing image)
             next_buffers_index_to_driver = (next_buffers_index_to_driver +1 ) %  300;
             buf.m.userptr = (unsigned long) buffers[next_buffers_index_to_driver].start;
             if (-1 == xioctl(fd, VIDIOC_QBUF, &buf))

hello regine.issan,

it should works, but may I know what’t the real use-case.
don’t it have huge delay for 1st capture frame arrived? for example, as you queue all the frames, user-space received 1st capture frame after 300th frame has captured.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.