All of lore.kernel.org
 help / color / mirror / Atom feed
* vb2_queue type question
@ 2021-03-22  9:18 Tomi Valkeinen
  2021-03-22  9:49 ` Hans Verkuil
  0 siblings, 1 reply; 10+ messages in thread
From: Tomi Valkeinen @ 2021-03-22  9:18 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Laurent Pinchart, Sakari Ailus, linux-media

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-03-31  5:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  9:18 vb2_queue type question Tomi Valkeinen
2021-03-22  9:49 ` Hans Verkuil
2021-03-22  9:59   ` Laurent Pinchart
2021-03-22 10:08     ` Hans Verkuil
2021-03-22 10:30   ` Tomi Valkeinen
2021-03-26  9:57   ` Tomi Valkeinen
2021-03-26 10:18     ` Hans Verkuil
2021-03-30  8:18       ` Tomi Valkeinen
2021-03-30  8:56         ` Hans Verkuil
2021-03-31  5:22           ` Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.