History log of /linux-master/include/media/videobuf2-v4l2.h
Revision Date Author Comments
# 2801f6f3 18-Jul-2022 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

media: videobuf2: Remove vb2_find_timestamp()

Now that we've transitioned all users to vb2_find_buffer API,
remove the unused vb2_find_timestamp().

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 9d042e45 11-Jul-2022 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

media: videobuf2: Introduce vb2_find_buffer()

All users of vb2_find_timestamp() combine it with vb2_get_buffer()
to retrieve a videobuf2 buffer, given a u64 timestamp.

Introduce an API for this use-case. Users will be converted to the new
API as follow-up commits.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 7101d127 18-Mar-2022 Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

media: videobuf2-v4l2: Expose vb2_queue_is_busy() to drivers

vb2 queue ownership is managed by the ioctl handler helpers
(vb2_ioctl_*). There are however use cases where drivers can benefit
from checking queue ownership, for instance when open-coding an ioctl
handler that needs to perform additional checks before calling the
corresponding vb2 operation.

Expose the vb2_queue_is_busy() function in the videobuf2-v4l2.h header,
and change its first argument to a struct vb2_queue pointer as the
function name implies it operates on a queue, not a video_device.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# a810ed0b 12-Apr-2021 Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

media: videobuf2-v4l2.c: add vb2_queue_change_type() helper

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@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# f729ef57 13-Jul-2020 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: videobuf2-v4l2.c: add vb2_video_unregister_device helper function

If a driver calls (_)vb2_fop_release(), then such a driver should also
call vb2_video_unregister_device() instead of video_unregister_device().
This helper will call vb2_queue_release() if a filehandle is marked as
owner of the queue. This ensures that at unregister time any streaming
is cancelled and all buffers are returned to userspace.

This is very useful for complex drivers since this stops all streaming
in all subdevs in the pipeline controlled by this video device. Otherwise
this would be delayed until the owner filehandle is closed, which can be
quite some time later.

Bonus points for ordering the includes :-)

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# b820935b 20-Jun-2020 Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

media: vb2: Print the queue pointer in debug messages

When debugging issues that involve more than one video queue, messages
related to multiple queues get interleaved without any easy way to tell
which queue they relate to. Fix this by adding a queue name to
vb2_queue, and printing it in all debug messages in the vb2 core and
V4L2 layers. If the name isn't set by drivers, it is automatically
filled with the queue direction and address.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 137272cd 11-Oct-2019 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: vb2: add V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF

This patch adds support for the V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF
flag.

It also adds a new V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF
capability.

Drivers should set vb2_queue->subsystem_flags to
VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF to indicate support
for this flag.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 03535e7a 24-Jan-2019 Hans Verkuil <hverkuil@xs4all.nl>

media: vb2: vb2_find_timestamp: drop restriction on buffer state

There really is no reason why vb2_find_timestamp can't just find
buffers in any state. Drop that part of the test.

This also means that vb->timestamp should only be set to 0 when
the driver doesn't copy timestamps.

This change allows for more efficient pipelining (i.e. you can use
a buffer for a reference frame even when it is queued).

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 245ede42 24-Oct-2018 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: vb2: add vb2_find_timestamp()

Use v4l2_timeval_to_ns instead of timeval_to_ns to ensure that
both kernelspace and userspace will use the same conversion
function.

Next add a new vb2_find_timestamp() function to find buffers
with a specific timestamp.

This function will only look at DEQUEUED and DONE buffers, i.e.
buffers that are already processed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 86f6bd3c 21-May-2018 Hans Verkuil <hans.verkuil@cisco.com>

media: videobuf2-v4l2: add vb2_request_queue/validate helpers

The generic vb2_request_validate helper function checks if
there are buffers in the request and if so, prepares (validates)
all objects in the request.

The generic vb2_request_queue helper function queues all buffer
objects in the validated request.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 394dc588 30-May-2018 Hans Verkuil <hans.verkuil@cisco.com>

media: videobuf2-v4l2: integrate with media requests

This implements the V4L2 part of the request support. The main
change is that vb2_qbuf and vb2_prepare_buf now have a new
media_device pointer. This required changes to several drivers
that did not use the vb2_ioctl_qbuf/prepare_buf helper functions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# db6e8d57 21-May-2018 Hans Verkuil <hans.verkuil@cisco.com>

media: vb2: store userspace data in vb2_v4l2_buffer

The userspace-provided plane data needs to be stored in
vb2_v4l2_buffer. Currently this information is applied by
__fill_vb2_buffer() which is called by the core prepare_buf
and qbuf functions, but when using requests these functions
aren't called yet since the buffer won't be prepared until
the media request is actually queued.

In the meantime this information has to be stored somewhere
and vb2_v4l2_buffer is a good place for it.

The __fill_vb2_buffer callback now just copies the relevant
information from vb2_v4l2_buffer into the planes array.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 9fbe71b4 09-Oct-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

media: vb2: add cross references at memops and v4l2 kernel-doc markups

Add cross-references where needed and add periods at the end of
each kernel-doc paragraph, in order to make it coherent with other
VB2 descriptions.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# c23e0cb8 03-Jul-2017 Al Viro <viro@zeniv.linux.org.uk>

media: annotate ->poll() instances

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# dba2d12a 08-Sep-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] videobuf2-v4l2: document two helper functions

Document vb2_ops_wait_prepare() and vb2_ops_wait_finish(),
in order to fix those two warnings:
Documentation/media/kapi/v4l2-dev.rst:166: WARNING: c:func reference target not found: vb2_ops_wait_prepare
Documentation/media/kapi/v4l2-dev.rst:166: WARNING: c:func reference target not found: vb2_ops_wait_finish

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# bf4404b4 08-Sep-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] videobuf2-v4l2.h: improve documentation

There are a few issues at the documentation: fields not documented,
bad cross refrences, etc.

Fix them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 24ade5b6 08-Sep-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] videobuf2-v4l2.h: get kernel-doc tags from C file

There are several functions documented at the C file. Move
them to the header, as this is the one used to build the
media books.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# af3bac1a 03-Nov-2015 Junghak Sung <jh1009.sung@samsung.com>

[media] media: videobuf2: Move vb2_fileio_data and vb2_thread to core part

Move things related with vb2 file I/O and vb2_thread without doing any
functional changes. After that, videobuf2-internal.h is removed because
it is not necessary any more.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# d6dd645e 03-Nov-2015 Junghak Sung <jh1009.sung@samsung.com>

[media] media: videobuf2: Move timestamp to vb2_buffer

Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer
for common use, and change its type to u64 in order to handling
y2038 problem. This patch also includes all device drivers' changes related to
this restructuring.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 3c5be988 06-Oct-2015 Junghak Sung <jh1009.sung@samsung.com>

[media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2

Move v4l2-specific stuff from videobu2-core to videobuf2-v4l2
without doing any functional changes.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# bed04f93 06-Oct-2015 Junghak Sung <jh1009.sung@samsung.com>

[media] media: videobuf2: Replace v4l2-specific data with vb2 data

Simple changes that replace v4l2-specific data with vb2 data
in videobuf2-core.

enum v4l2_buf_type --> int
enum v4l2_memory --> enum vb2_memory
VIDEO_MAX_FRAME --> VB2_MAX_FRAME
VIDEO_MAX_PLANES --> VB2_MAX_PLANES
struct v4l2_fh *owner --> void *owner
V4L2_TYPE_IS_MULTIPLANAR() --> is_multiplanar
V4L2_TYPE_IS_OUTPUT() --> is_output

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# d383b579 01-Oct-2015 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] DocBook: Remove a warning at videobuf2-v4l2.h

There's no need to document to_foo() macros, and the macro is
badly documented anyway. That removes this warning:
include/media/videobuf2-v4l2.h:43: warning: No description found for parameter 'vb'

While here, remove the parenthesis for container_of(). The
countainer_of() already have parenthesis inside it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 2d700715 22-Sep-2015 Junghak Sung <jh1009.sung@samsung.com>

[media] media: videobuf2: Restructure vb2_buffer

Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.

Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}

Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};

v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;

__u32 flags;
__u32 field;
struct timeval timestamp;
struct v4l2_timecode timecode;
__u32 sequence;
};

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# c139990e 22-Sep-2015 Junghak Sung <jh1009.sung@samsung.com>

[media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2

Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
echo $file
sed "s/$str1/$str2/g" $file > $file.out
mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/"

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>