aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/videobuf2-core.h
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-07-02 04:59:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 16:32:06 -0400
commit4c1ffcaad5070ea5bca9b8057bdd7b4925237bc0 (patch)
treecf8b068a37f23d7ca5ee30870ee8bd670c54c53f /include/media/videobuf2-core.h
parent5a5adf6b669cf1a3dd2af419cd68a4c491f384a3 (diff)
[media] videobuf2-core: add helper functions
Add helper functions to make it easier to adapt drivers to vb2. These helpers take care of core locking and check if the filehandle is the owner of the queue. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/videobuf2-core.h')
-rw-r--r--include/media/videobuf2-core.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 924e95e0a0a6..8dd9b6cc296b 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -417,4 +417,45 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
417 return 0; 417 return 0;
418} 418}
419 419
420/*
421 * The following functions are not part of the vb2 core API, but are simple
422 * helper functions that you can use in your struct v4l2_file_operations,
423 * struct v4l2_ioctl_ops and struct vb2_ops. They will serialize if vb2_queue->lock
424 * or video_device->lock is set, and they will set and test vb2_queue->owner
425 * to check if the calling filehandle is permitted to do the queuing operation.
426 */
427
428/* struct v4l2_ioctl_ops helpers */
429
430int vb2_ioctl_reqbufs(struct file *file, void *priv,
431 struct v4l2_requestbuffers *p);
432int vb2_ioctl_create_bufs(struct file *file, void *priv,
433 struct v4l2_create_buffers *p);
434int vb2_ioctl_prepare_buf(struct file *file, void *priv,
435 struct v4l2_buffer *p);
436int vb2_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *p);
437int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
438int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p);
439int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i);
440int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i);
441
442/* struct v4l2_file_operations helpers */
443
444int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma);
445int vb2_fop_release(struct file *file);
446ssize_t vb2_fop_write(struct file *file, char __user *buf,
447 size_t count, loff_t *ppos);
448ssize_t vb2_fop_read(struct file *file, char __user *buf,
449 size_t count, loff_t *ppos);
450unsigned int vb2_fop_poll(struct file *file, poll_table *wait);
451#ifndef CONFIG_MMU
452unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr,
453 unsigned long len, unsigned long pgoff, unsigned long flags);
454#endif
455
456/* struct vb2_ops helpers, only use if vq->lock is non-NULL. */
457
458void vb2_ops_wait_prepare(struct vb2_queue *vq);
459void vb2_ops_wait_finish(struct vb2_queue *vq);
460
420#endif /* _MEDIA_VIDEOBUF2_CORE_H */ 461#endif /* _MEDIA_VIDEOBUF2_CORE_H */