Index | Thread | Search

From:
Marcus Glocker <marcus@nazgul.ch>
Subject:
Re: sys/uvideo: avoid one bcopy when reads into mmaped memory
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
tech@openbsd.org
Date:
Sat, 1 Mar 2025 13:25:56 +0100

Download raw body.

Thread
On Sat, Mar 01, 2025 at 10:57:25AM GMT, Kirill A. Korinsky wrote:

> On Sat, 01 Mar 2025 09:38:03 +0100,
> Marcus Glocker <marcus@nazgul.ch> wrote:
> >
> > Though, I would prefer if we could do the selection of the buffer in
> > the isoc case before we enter the isoc frame loop, instead of calling
> > the buffer selection function every time in the stream header function.
> >
> 
> Indeed, it make sence and should decrease wasting resources when frame will
> be droped anyway.
> 
> > Also, I would leave the V4L2_BUF_FLAG_QUEUED flagging for when we
> > insert the new frame in to our queue.
> >
> 
> Linux kernel has such description for this flag:
> 
>         Internally drivers maintain two buffer queues, an incoming and
>         outgoing queue. When this flag is set, the buffer is currently on
>         the incoming queue. It automatically moves to the outgoing queue
>         after the buffer has been filled (capture devices) or displayed
>         (output devices). Drivers set or clear this flag when the
>         VIDIOC_QUERYBUF ioctl is called. After (successful) calling the
>         VIDIOC_QBUF ioctl it is always set and after VIDIOC_DQBUF always
>         cleared
> 
> it looks for me as a kind of mutex which is used to mark a buffer as busy
> for incomming data, and to prevent it from be used for something else.
> 
> From another hand uvideo_qbuf never updates flags on user land's v4l2_buf.
> So, from application point of view it doesn't matter when we update flags.
> 
> Probably we need cleanit up, but it should be done as dedicated step.

I agree.  Lets clean this up with a separate diff.