v4l2 for slow consumer apps

Regine Issan regine.issan at gmail.com
Sun Sep 3 14:29:49 UTC 2023


Hello,

i am trying to use v4l2 to capture frames, with zero copy.
to support set of consumers running in dockers,
I am using userptr mode (pointing to shared memeory).
to support “slow” consumers, i need to keep buffer 300 frames.

Problem:
when i call VIDIOC_REQBUFS with count > 32 ,
it returns a struct with req.count = 32
(meaning, it allocated only 32 buffers).

questions are:

       question1:
       assume i keep using userptr mode,
        is there anything to do request buffer of 300 pointers (in userptr
mode) ?
        i have been reading several links about that question but non of
them worked

      question2:
      assuming i keep using userptr mode,

      i was thinking about the idea below.

     has anyone tried it ? any reason it will not work ?

          a. allocte a private  queue of 300 buffers to shared memeory.

           b.each time  i get frame from v4l2,

           b.1  dequeue the frame from v4l2 queue (with 32 items)
           b.2 enqueue it to private queue (with 300 items
          b.3 dequeue  pointer from provate queue (with 300 ietms
           b.4 enqueue that pointer to v4l2 buffer (with 32 items)

       quesiton3:
       should i try r\w mode instead userptr
       in r\w mode, i we call select and then read , providing read and
address.
       i was thinking about the following idea:
       manage a cyclic buffer with 300 pointers to shared memory.
      each time i will call read , i will provide the point to the shared
memory
      what are the disadvantages of that mode comparing to userptr ?
PS:
i read that r\w mode does not provide time stamptsm but i am not sure that
does that mean and what are the implications.

   question4:
   would you recommend any other v4l2 mode to support the requirements ?

question5:
if i will use dmabufs mode, i will eoncounter the same issue (failing on
request bufs)

   1.

<https://forums.developer.nvidia.com/t/v4l2-limitations/265289#environment-details-details-1>Environment
details details

AGX Orin
Ubunto, 20.04.6 LTS, Release 20.04, Codename: focal
linux kernel: 5.10.104-tegra
l4t 35.1.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230903/1a8736e0/attachment.htm>


More information about the gstreamer-devel mailing list