Commit 5548a382 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] media: vb2: Clarify queue_setup() and buf_prepare() usage documentation

Explain how the two operations must handle formats and validate buffer
sizes when used with VIDIOC_CREATE_BUFS.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent c09aada7
...@@ -219,8 +219,9 @@ struct vb2_buffer { ...@@ -219,8 +219,9 @@ struct vb2_buffer {
* configured format and *num_buffers is the total number * configured format and *num_buffers is the total number
* of buffers, that are being allocated. When called from * of buffers, that are being allocated. When called from
* VIDIOC_CREATE_BUFS, fmt != NULL and it describes the * VIDIOC_CREATE_BUFS, fmt != NULL and it describes the
* target frame format. In this case *num_buffers are being * target frame format (if the format isn't valid the
* allocated additionally to q->num_buffers. * callback must return -EINVAL). In this case *num_buffers
* are being allocated additionally to q->num_buffers.
* @wait_prepare: release any locks taken while calling vb2 functions; * @wait_prepare: release any locks taken while calling vb2 functions;
* it is called before an ioctl needs to wait for a new * it is called before an ioctl needs to wait for a new
* buffer to arrive; required to avoid a deadlock in * buffer to arrive; required to avoid a deadlock in
...@@ -236,8 +237,10 @@ struct vb2_buffer { ...@@ -236,8 +237,10 @@ struct vb2_buffer {
* @buf_prepare: called every time the buffer is queued from userspace * @buf_prepare: called every time the buffer is queued from userspace
* and from the VIDIOC_PREPARE_BUF ioctl; drivers may * and from the VIDIOC_PREPARE_BUF ioctl; drivers may
* perform any initialization required before each hardware * perform any initialization required before each hardware
* operation in this callback; if an error is returned, the * operation in this callback; drivers that support
* buffer will not be queued in driver; optional * VIDIOC_CREATE_BUFS must also validate the buffer size;
* if an error is returned, the buffer will not be queued
* in driver; optional
* @buf_finish: called before every dequeue of the buffer back to * @buf_finish: called before every dequeue of the buffer back to
* userspace; drivers may perform any operations required * userspace; drivers may perform any operations required
* before userspace accesses the buffer; optional * before userspace accesses the buffer; optional
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment