Re: [PATCH v2 1/3] media: videobuf2-v4l2.c: add vb2_queue_change_type() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tomasz,

On 04/06/2021 14:13, Tomasz Figa wrote:
Hi Tomi,

On Mon, Apr 12, 2021 at 02:02:09PM +0300, Tomi Valkeinen wrote:
On some platforms a video device can capture either video data or
metadata. The driver can implement vidioc functions for both video and
metadata, and use a single vb2_queue for the buffers. However, vb2_queue
requires choosing a single buffer type, which conflicts with the idea of
capturing either video or metadata.

The buffer type of vb2_queue can be changed, but it's not obvious how
this should be done in the drivers. To help this, add a new helper
function vb2_queue_change_type() which ensures the correct checks and
documents how it can be used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
---
  drivers/media/common/videobuf2/videobuf2-v4l2.c | 14 ++++++++++++++
  include/media/videobuf2-v4l2.h                  | 15 +++++++++++++++
  2 files changed, 29 insertions(+)


Good to see you contributing to the media subsystem. Not sure if you
still remember me from the Common Display Framework discussions. ;)

I barely remember CDF... ;)

Anyway, thanks for the patch. I think the code itself is okay, but I'm
wondering why the driver couldn't just have two queues, one for each
type?

There was an email thread about this:

https://www.spinics.net/lists/linux-media/msg189144.html

struct video_device has 'queue' field, so if you have two queues, you'd need to change the vd->queue based on the format. Possibly that could be a solution too (and, if I recall right, that's what I initially tried as a quick hack). Changing the whole queue sounds riskier than changing just the type.

 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]

  Powered by Linux