Linux Kernel
3.7.1
|
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-core.h>
Go to the source code of this file.
Data Structures | |
struct | vb2_fileio_buf |
struct | vb2_fileio_data |
Macros | |
#define | dprintk(level, fmt, arg...) |
#define | call_memop(q, op, args...) |
#define | call_qop(q, op, args...) (((q)->ops->op) ? ((q)->ops->op(args)) : 0) |
#define | V4L2_BUFFER_STATE_FLAGS |
Definition at line 36 of file videobuf2-core.c.
Definition at line 40 of file videobuf2-core.c.
Definition at line 30 of file videobuf2-core.c.
#define V4L2_BUFFER_STATE_FLAGS |
Definition at line 43 of file videobuf2-core.c.
EXPORT_SYMBOL | ( | vb2_querybuf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_reqbufs | ) |
EXPORT_SYMBOL_GPL | ( | vb2_create_bufs | ) |
EXPORT_SYMBOL_GPL | ( | vb2_plane_vaddr | ) |
EXPORT_SYMBOL_GPL | ( | vb2_plane_cookie | ) |
EXPORT_SYMBOL_GPL | ( | vb2_buffer_done | ) |
EXPORT_SYMBOL_GPL | ( | vb2_prepare_buf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_qbuf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_wait_for_all_buffers | ) |
EXPORT_SYMBOL_GPL | ( | vb2_dqbuf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_streamon | ) |
EXPORT_SYMBOL_GPL | ( | vb2_streamoff | ) |
EXPORT_SYMBOL_GPL | ( | vb2_mmap | ) |
EXPORT_SYMBOL_GPL | ( | vb2_get_unmapped_area | ) |
EXPORT_SYMBOL_GPL | ( | vb2_poll | ) |
EXPORT_SYMBOL_GPL | ( | vb2_queue_init | ) |
EXPORT_SYMBOL_GPL | ( | vb2_queue_release | ) |
EXPORT_SYMBOL_GPL | ( | vb2_read | ) |
EXPORT_SYMBOL_GPL | ( | vb2_write | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_reqbufs | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_create_bufs | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_prepare_buf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_querybuf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_qbuf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_dqbuf | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_streamon | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ioctl_streamoff | ) |
EXPORT_SYMBOL_GPL | ( | vb2_fop_mmap | ) |
EXPORT_SYMBOL_GPL | ( | vb2_fop_release | ) |
EXPORT_SYMBOL_GPL | ( | vb2_fop_write | ) |
EXPORT_SYMBOL_GPL | ( | vb2_fop_read | ) |
EXPORT_SYMBOL_GPL | ( | vb2_fop_poll | ) |
EXPORT_SYMBOL_GPL | ( | vb2_fop_get_unmapped_area | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ops_wait_prepare | ) |
EXPORT_SYMBOL_GPL | ( | vb2_ops_wait_finish | ) |
MODULE_AUTHOR | ( | "Pawel Osciak <[email protected]> | , |
Marek Szyprowski" | |||
) |
MODULE_LICENSE | ( | "GPL" | ) |
void vb2_buffer_done | ( | struct vb2_buffer * | vb, |
enum vb2_buffer_state | state | ||
) |
vb2_buffer_done() - inform videobuf that an operation on a buffer is finished : vb2_buffer returned from the driver : either VB2_BUF_STATE_DONE if the operation finished successfully or VB2_BUF_STATE_ERROR if the operation finished with an error
This function should be called by the driver after a hardware operation on a buffer is finished and the buffer may be returned to userspace. The driver cannot use this buffer anymore until it is queued back to it by videobuf by the means of buf_queue callback. Only buffers previously queued to the driver by buf_queue can be passed to this function.
Definition at line 789 of file videobuf2-core.c.
int vb2_create_bufs | ( | struct vb2_queue * | q, |
struct v4l2_create_buffers * | create | ||
) |
vb2_create_bufs() - Wrapper for __create_bufs() that also verifies the memory and type values. : videobuf2 queue : creation parameters, passed from userspace to vidioc_create_bufs handler in driver
Definition at line 724 of file videobuf2-core.c.
vb2_dqbuf() - Dequeue a buffer to the userspace : videobuf2 queue : buffer structure passed from userspace to vidioc_dqbuf handler in driver : if true, this call will not sleep waiting for a buffer if no buffers ready for dequeuing are present. Normally the driver would be passing (file->f_flags & O_NONBLOCK) here
Should be called from vidioc_dqbuf ioctl handler of a driver. This function: 1) verifies the passed buffer, 2) calls buf_finish callback in the driver (if provided), in which driver can perform any additional operations that may be required before returning the buffer to userspace, such as cache sync, 3) the buffer struct members are filled with relevant information for the userspace.
The return values from this function are intended to be directly returned from vidioc_dqbuf handler in driver.
Definition at line 1326 of file videobuf2-core.c.
unsigned long vb2_fop_get_unmapped_area | ( | struct file * | file, |
unsigned long | addr, | ||
unsigned long | len, | ||
unsigned long | pgoff, | ||
unsigned long | flags | ||
) |
Definition at line 2356 of file videobuf2-core.c.
int vb2_fop_mmap | ( | struct file * | file, |
struct vm_area_struct * | vma | ||
) |
Definition at line 2250 of file videobuf2-core.c.
unsigned int vb2_fop_poll | ( | struct file * | file, |
poll_table * | wait | ||
) |
Definition at line 2314 of file videobuf2-core.c.
Definition at line 2292 of file videobuf2-core.c.
Definition at line 2258 of file videobuf2-core.c.
Definition at line 2270 of file videobuf2-core.c.
unsigned long vb2_get_unmapped_area | ( | struct vb2_queue * | q, |
unsigned long | addr, | ||
unsigned long | len, | ||
unsigned long | pgoff, | ||
unsigned long | flags | ||
) |
Definition at line 1611 of file videobuf2-core.c.
Definition at line 2166 of file videobuf2-core.c.
Definition at line 2218 of file videobuf2-core.c.
Definition at line 2188 of file videobuf2-core.c.
Definition at line 2208 of file videobuf2-core.c.
Definition at line 2199 of file videobuf2-core.c.
Definition at line 2147 of file videobuf2-core.c.
int vb2_ioctl_streamoff | ( | struct file * | file, |
void * | priv, | ||
enum v4l2_buf_type | i | ||
) |
Definition at line 2238 of file videobuf2-core.c.
int vb2_ioctl_streamon | ( | struct file * | file, |
void * | priv, | ||
enum v4l2_buf_type | i | ||
) |
Definition at line 2228 of file videobuf2-core.c.
int vb2_mmap | ( | struct vb2_queue * | q, |
struct vm_area_struct * | vma | ||
) |
vb2_mmap() - map video buffers into application address space : videobuf2 queue : vma passed to the mmap file operation handler in the driver
Should be called from mmap file operation handler of a driver. This function maps one plane of one of the available video buffers to userspace. To map whole video memory allocated on reqbufs, this function has to be called once per each plane per each buffer previously allocated.
When the userspace application calls mmap, it passes to it an offset returned to it earlier by the means of vidioc_querybuf handler. That offset acts as a "cookie", which is then used to identify the plane to be mapped. This function finds a plane with a matching offset and a mapping is performed by the means of a provided memory operation.
The return values from this function are intended to be directly returned from the mmap handler in driver.
Definition at line 1561 of file videobuf2-core.c.
Definition at line 2374 of file videobuf2-core.c.
Definition at line 2368 of file videobuf2-core.c.
void* vb2_plane_cookie | ( | struct vb2_buffer * | vb, |
unsigned int | plane_no | ||
) |
vb2_plane_cookie() - Return allocator specific cookie for the given plane : vb2_buffer to which the plane in question belongs to : plane number for which the cookie is to be returned
This function returns an allocator specific cookie for a given plane if available, NULL otherwise. The allocator should provide some simple static inline function, which would convert this cookie to the allocator specific type that can be used directly by the driver to access the buffer. This can be for example physical address, pointer to scatter list or IOMMU mapping.
Definition at line 766 of file videobuf2-core.c.
void* vb2_plane_vaddr | ( | struct vb2_buffer * | vb, |
unsigned int | plane_no | ||
) |
vb2_plane_vaddr() - Return a kernel virtual address of a given plane : vb2_buffer to which the plane in question belongs to : plane number for which the address is to be returned
This function returns a kernel virtual address of a given plane if such a mapping exist, NULL otherwise.
Definition at line 743 of file videobuf2-core.c.
Definition at line 1663 of file videobuf2-core.c.
int vb2_prepare_buf | ( | struct vb2_queue * | q, |
struct v4l2_buffer * | b | ||
) |
vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel : videobuf2 queue : buffer structure passed from userspace to vidioc_prepare_buf handler in driver
Should be called from vidioc_prepare_buf ioctl handler of a driver. This function: 1) verifies the passed buffer, 2) calls buf_prepare callback in the driver (if provided), in which driver-specific buffer initialization can be performed,
The return values from this function are intended to be directly returned from vidioc_prepare_buf handler in driver.
Definition at line 1015 of file videobuf2-core.c.
int vb2_qbuf | ( | struct vb2_queue * | q, |
struct v4l2_buffer * | b | ||
) |
vb2_qbuf() - Queue a buffer from userspace : videobuf2 queue : buffer structure passed from userspace to vidioc_qbuf handler in driver
Should be called from vidioc_qbuf ioctl handler of a driver. This function: 1) verifies the passed buffer, 2) if necessary, calls buf_prepare callback in the driver (if provided), in which driver-specific buffer initialization can be performed, 3) if streaming is on, queues the buffer in driver by the means of buf_queue callback for processing.
The return values from this function are intended to be directly returned from vidioc_qbuf handler in driver.
Definition at line 1081 of file videobuf2-core.c.
int vb2_querybuf | ( | struct vb2_queue * | q, |
struct v4l2_buffer * | b | ||
) |
vb2_querybuf() - query video buffer information : videobuf queue : buffer struct passed from userspace to vidioc_querybuf handler in driver
Should be called from vidioc_querybuf ioctl handler in driver. This function will verify the passed v4l2_buffer structure and fill the relevant information for the userspace.
The return values from this function are intended to be directly returned from vidioc_querybuf handler in driver.
Definition at line 408 of file videobuf2-core.c.
vb2_queue_init() - initialize a videobuf2 queue : videobuf2 queue; this structure should be allocated in driver
The vb2_queue structure should be allocated by the driver. The driver is responsible of clearing it's content and setting initial values for some required entries before calling this function. q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer to the struct vb2_queue description in include/media/videobuf2-core.h for more information.
Definition at line 1738 of file videobuf2-core.c.
vb2_queue_release() - stop streaming, release the queue and free memory : videobuf2 queue
This function stops streaming and performs necessary clean ups, including freeing video buffer memory. The driver is responsible for freeing the vb2_queue structure itself.
Definition at line 1772 of file videobuf2-core.c.
size_t vb2_read | ( | struct vb2_queue * | q, |
char __user * | data, | ||
size_t | count, | ||
loff_t * | ppos, | ||
int | nonblocking | ||
) |
Definition at line 2116 of file videobuf2-core.c.
int vb2_reqbufs | ( | struct vb2_queue * | q, |
struct v4l2_requestbuffers * | req | ||
) |
vb2_reqbufs() - Wrapper for __reqbufs() that also verifies the memory and type values. : videobuf2 queue : struct passed from userspace to vidioc_reqbufs handler in driver
Definition at line 618 of file videobuf2-core.c.
int vb2_streamoff | ( | struct vb2_queue * | q, |
enum v4l2_buf_type | type | ||
) |
vb2_streamoff - stop streaming : videobuf2 queue : type argument passed from userspace to vidioc_streamoff handler
Should be called from vidioc_streamoff handler of a driver. This function: 1) verifies current state, 2) stop streaming and dequeues any queued buffers, including those previously passed to the driver (after waiting for the driver to finish).
This call can be used for pausing playback. The return values from this function are intended to be directly returned from vidioc_streamoff handler in the driver
Definition at line 1485 of file videobuf2-core.c.
int vb2_streamon | ( | struct vb2_queue * | q, |
enum v4l2_buf_type | type | ||
) |
vb2_streamon - start streaming : videobuf2 queue : type argument passed from userspace to vidioc_streamon handler
Should be called from vidioc_streamon handler of a driver. This function: 1) verifies current state 2) passes any previously queued buffers to the driver and starts streaming
The return values from this function are intended to be directly returned from vidioc_streamon handler in the driver.
Definition at line 1425 of file videobuf2-core.c.
vb2_wait_for_all_buffers() - wait until all buffers are given back to vb2 : videobuf2 queue
This function will wait until all buffers that have been given to the driver by buf_queue() are given back to vb2 with vb2_buffer_done(). It doesn't call wait_prepare, wait_finish pair. It is intended to be called with all locks taken, for example from stop_streaming() callback.
Definition at line 1293 of file videobuf2-core.c.