The vb2 queue_setup function is very confusing since it is used for both VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS. Drivers often implement this incorrectly. This short series adds a new queue_info callback to use as a replacement of queue_setup. The queue_info callback just returns the number of planes and plane sizes of the current format (and optionally the devices to use to allocate each plane). After that vb2 uses that information to deal with everything else. This means that drivers that use queue_info can no longer fiddle with the number of buffers the caller wants to allocate. This is entirely controlled by q->min_queued_buffers and q->min_reqbufs_allocation. It makes both the vb2 code and the driver code much simpler. The first patch makes the vb2 changes, and the second patch converts the vivid driver to the new queue_info. Comments are very welcome. Regards, Hans Hans Verkuil (2): media: vb2: introduce queue_info to replace queue_setup media: vivid: convert queue_setup to queue_info .../media/common/videobuf2/videobuf2-core.c | 82 ++++++++++++++----- .../media/test-drivers/vivid/vivid-meta-cap.c | 17 ++-- .../media/test-drivers/vivid/vivid-meta-out.c | 27 +++--- .../media/test-drivers/vivid/vivid-sdr-cap.c | 16 ++-- .../test-drivers/vivid/vivid-touch-cap.c | 18 ++-- .../media/test-drivers/vivid/vivid-vbi-cap.c | 13 ++- .../media/test-drivers/vivid/vivid-vbi-out.c | 13 ++- .../media/test-drivers/vivid/vivid-vid-cap.c | 39 +++------ .../media/test-drivers/vivid/vivid-vid-out.c | 37 ++------- include/media/videobuf2-core.h | 10 +++ 10 files changed, 126 insertions(+), 146 deletions(-) -- 2.45.2