vb2_queue type question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: vb2_queue type question
- From: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
- Date: Mon, 22 Mar 2021 11:18:18 +0200
- Cc: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>, Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>, linux-media@xxxxxxxxxxxxxxx
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1
Hi Hans,
We were discussing this with Laurent and Sakari, I thought I'd ask if
you have any feedback on this.
struct vb2_queue has 'type' field, so you can only use a queue for
buffers of a single type. struct video_device has 'queue' field, so you
can only use a single queue for a video_device instance.
TI's SoCs have a CSI-2 receiver, with a bunch of DMA engines. The HW
doesn't care if we are currently capturing pixel buffers or metadata
buffers (I don't have experience with other HW, but I imagine this
shouldn't be a rare case). However, due to vb2_queue, the driver needs
to decide which one to support, which limits the possible use cases.
I was browsing the code, and afaics the type field doesn't do much. It
is, of course, used to reject queuing buffers of wrong type, and also
(mostly in mem-2-mem code) to find out if functions are called in input
or output context.
The latter one could be easily removed by just comparing the given queue
pointer to a stored pointer (e.g. queue == priv->input_queue).
Do you see any problems if we were to change the type field to
type_mask, allowing multiple buffer types per queue? Or even remove the
vb2_queue->type. This raises some questions, like should a queue contain
only buffers of a single type or can it contain a mix of buffers (I
think it shouldn't contain a mix of buffers), or can a queue's type_mask
contain both input and output types (I don't see why not).
An alternate which I tried was creating two vb2_queues, and switching
the video_device->queue at runtime based on set_format. It kind of
works, but I think the behavior is a bit unclear, and it might be
difficult to catch all the corner cases.
Tomi
[Index of Archives]
[Linux Input]
[Video for Linux]
[Gstreamer Embedded]
[Mplayer Users]
[Linux USB Devel]
[Linux Audio Users]
[Linux Kernel]
[Linux SCSI]
[Yosemite Backpacking]