aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/videobuf2-core.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-09-28 08:23:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:28:29 -0400
commit2d86401c2cbfce9f99b08ba168bdb60b2eb7796e (patch)
tree9834559c467d9dac3dfa8f5cdafca599132fd9ff /include/media/videobuf2-core.h
parentfc714e70dd063e6887d09872ac6158b0c20cc817 (diff)
[media] V4L: vb2: add support for buffers of different sizes on a single queue
The two recently added ioctl()s VIDIOC_CREATE_BUFS and VIDIOC_PREPARE_BUF allow user-space applications to allocate video buffers of different sizes and hand them over to the driver for fast switching between different frame formats. This patch adds support for buffers of different sizes on the same buffer-queue to vb2. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/videobuf2-core.h')
-rw-r--r--include/media/videobuf2-core.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 692e35c232a9..55c57d3d3e63 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -169,13 +169,21 @@ struct vb2_buffer {
169/** 169/**
170 * struct vb2_ops - driver-specific callbacks 170 * struct vb2_ops - driver-specific callbacks
171 * 171 *
172 * @queue_setup: called from a VIDIOC_REQBUFS handler, before 172 * @queue_setup: called from VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS
173 * memory allocation; driver should return the required 173 * handlers before memory allocation, or, if
174 * number of buffers in num_buffers, the required number 174 * *num_planes != 0, after the allocation to verify a
175 * of planes per buffer in num_planes; the size of each 175 * smaller number of buffers. Driver should return
176 * plane should be set in the sizes[] array and optional 176 * the required number of buffers in *num_buffers, the
177 * per-plane allocator specific context in alloc_ctxs[] 177 * required number of planes per buffer in *num_planes; the
178 * array 178 * size of each plane should be set in the sizes[] array
179 * and optional per-plane allocator specific context in the
180 * alloc_ctxs[] array. When called from VIDIOC_REQBUFS,
181 * fmt == NULL, the driver has to use the currently
182 * configured format and *num_buffers is the total number
183 * of buffers, that are being allocated. When called from
184 * VIDIOC_CREATE_BUFS, fmt != NULL and it describes the
185 * target frame format. In this case *num_buffers are being
186 * allocated additionally to q->num_buffers.
179 * @wait_prepare: release any locks taken while calling vb2 functions; 187 * @wait_prepare: release any locks taken while calling vb2 functions;
180 * it is called before an ioctl needs to wait for a new 188 * it is called before an ioctl needs to wait for a new
181 * buffer to arrive; required to avoid a deadlock in 189 * buffer to arrive; required to avoid a deadlock in
@@ -188,11 +196,11 @@ struct vb2_buffer {
188 * perform additional buffer-related initialization; 196 * perform additional buffer-related initialization;
189 * initialization failure (return != 0) will prevent 197 * initialization failure (return != 0) will prevent
190 * queue setup from completing successfully; optional 198 * queue setup from completing successfully; optional
191 * @buf_prepare: called every time the buffer is queued from userspace; 199 * @buf_prepare: called every time the buffer is queued from userspace
192 * drivers may perform any initialization required before 200 * and from the VIDIOC_PREPARE_BUF ioctl; drivers may
193 * each hardware operation in this callback; 201 * perform any initialization required before each hardware
194 * if an error is returned, the buffer will not be queued 202 * operation in this callback; if an error is returned, the
195 * in driver; optional 203 * buffer will not be queued in driver; optional
196 * @buf_finish: called before every dequeue of the buffer back to 204 * @buf_finish: called before every dequeue of the buffer back to
197 * userspace; drivers may perform any operations required 205 * userspace; drivers may perform any operations required
198 * before userspace accesses the buffer; optional 206 * before userspace accesses the buffer; optional
@@ -300,6 +308,9 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q);
300int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); 308int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
301int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); 309int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
302 310
311int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
312int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
313
303int vb2_queue_init(struct vb2_queue *q); 314int vb2_queue_init(struct vb2_queue *q);
304 315
305void vb2_queue_release(struct vb2_queue *q); 316void vb2_queue_release(struct vb2_queue *q);