diff options
Diffstat (limited to 'include/media/videobuf2-core.h')
-rw-r--r-- | include/media/videobuf2-core.h | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index ea55c08eddfb..a15d1f1b319e 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -105,6 +105,7 @@ enum vb2_fileio_flags { | |||
105 | /** | 105 | /** |
106 | * enum vb2_buffer_state - current video buffer state | 106 | * enum vb2_buffer_state - current video buffer state |
107 | * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control | 107 | * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control |
108 | * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver | ||
108 | * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver | 109 | * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver |
109 | * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used | 110 | * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used |
110 | * in a hardware operation | 111 | * in a hardware operation |
@@ -116,6 +117,7 @@ enum vb2_fileio_flags { | |||
116 | */ | 117 | */ |
117 | enum vb2_buffer_state { | 118 | enum vb2_buffer_state { |
118 | VB2_BUF_STATE_DEQUEUED, | 119 | VB2_BUF_STATE_DEQUEUED, |
120 | VB2_BUF_STATE_PREPARED, | ||
119 | VB2_BUF_STATE_QUEUED, | 121 | VB2_BUF_STATE_QUEUED, |
120 | VB2_BUF_STATE_ACTIVE, | 122 | VB2_BUF_STATE_ACTIVE, |
121 | VB2_BUF_STATE_DONE, | 123 | VB2_BUF_STATE_DONE, |
@@ -167,13 +169,21 @@ struct vb2_buffer { | |||
167 | /** | 169 | /** |
168 | * struct vb2_ops - driver-specific callbacks | 170 | * struct vb2_ops - driver-specific callbacks |
169 | * | 171 | * |
170 | * @queue_setup: called from a VIDIOC_REQBUFS handler, before | 172 | * @queue_setup: called from VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS |
171 | * memory allocation; driver should return the required | 173 | * handlers before memory allocation, or, if |
172 | * number of buffers in num_buffers, the required number | 174 | * *num_planes != 0, after the allocation to verify a |
173 | * of planes per buffer in num_planes; the size of each | 175 | * smaller number of buffers. Driver should return |
174 | * plane should be set in the sizes[] array and optional | 176 | * the required number of buffers in *num_buffers, the |
175 | * per-plane allocator specific context in alloc_ctxs[] | 177 | * required number of planes per buffer in *num_planes; the |
176 | * 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. | ||
177 | * @wait_prepare: release any locks taken while calling vb2 functions; | 187 | * @wait_prepare: release any locks taken while calling vb2 functions; |
178 | * 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 |
179 | * buffer to arrive; required to avoid a deadlock in | 189 | * buffer to arrive; required to avoid a deadlock in |
@@ -186,11 +196,11 @@ struct vb2_buffer { | |||
186 | * perform additional buffer-related initialization; | 196 | * perform additional buffer-related initialization; |
187 | * initialization failure (return != 0) will prevent | 197 | * initialization failure (return != 0) will prevent |
188 | * queue setup from completing successfully; optional | 198 | * queue setup from completing successfully; optional |
189 | * @buf_prepare: called every time the buffer is queued from userspace; | 199 | * @buf_prepare: called every time the buffer is queued from userspace |
190 | * drivers may perform any initialization required before | 200 | * and from the VIDIOC_PREPARE_BUF ioctl; drivers may |
191 | * each hardware operation in this callback; | 201 | * perform any initialization required before each hardware |
192 | * if an error is returned, the buffer will not be queued | 202 | * operation in this callback; if an error is returned, the |
193 | * in driver; optional | 203 | * buffer will not be queued in driver; optional |
194 | * @buf_finish: called before every dequeue of the buffer back to | 204 | * @buf_finish: called before every dequeue of the buffer back to |
195 | * userspace; drivers may perform any operations required | 205 | * userspace; drivers may perform any operations required |
196 | * before userspace accesses the buffer; optional | 206 | * before userspace accesses the buffer; optional |
@@ -216,9 +226,9 @@ struct vb2_buffer { | |||
216 | * pre-queued buffers before calling STREAMON | 226 | * pre-queued buffers before calling STREAMON |
217 | */ | 227 | */ |
218 | struct vb2_ops { | 228 | struct vb2_ops { |
219 | int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers, | 229 | int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt, |
220 | unsigned int *num_planes, unsigned int sizes[], | 230 | unsigned int *num_buffers, unsigned int *num_planes, |
221 | void *alloc_ctxs[]); | 231 | unsigned int sizes[], void *alloc_ctxs[]); |
222 | 232 | ||
223 | void (*wait_prepare)(struct vb2_queue *q); | 233 | void (*wait_prepare)(struct vb2_queue *q); |
224 | void (*wait_finish)(struct vb2_queue *q); | 234 | void (*wait_finish)(struct vb2_queue *q); |
@@ -298,6 +308,9 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q); | |||
298 | int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); | 308 | int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); |
299 | int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); | 309 | int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); |
300 | 310 | ||
311 | int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); | ||
312 | int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); | ||
313 | |||
301 | int vb2_queue_init(struct vb2_queue *q); | 314 | int vb2_queue_init(struct vb2_queue *q); |
302 | 315 | ||
303 | void vb2_queue_release(struct vb2_queue *q); | 316 | void vb2_queue_release(struct vb2_queue *q); |
@@ -309,6 +322,13 @@ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); | |||
309 | int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); | 322 | int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); |
310 | 323 | ||
311 | int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); | 324 | int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); |
325 | #ifndef CONFIG_MMU | ||
326 | unsigned long vb2_get_unmapped_area(struct vb2_queue *q, | ||
327 | unsigned long addr, | ||
328 | unsigned long len, | ||
329 | unsigned long pgoff, | ||
330 | unsigned long flags); | ||
331 | #endif | ||
312 | unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait); | 332 | unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait); |
313 | size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, | 333 | size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, |
314 | loff_t *ppos, int nonblock); | 334 | loff_t *ppos, int nonblock); |