Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
v4l2-mem2mem.h File Reference
#include <media/videobuf2-core.h>

Go to the source code of this file.

Data Structures

struct  v4l2_m2m_ops
 
struct  v4l2_m2m_queue_ctx
 
struct  v4l2_m2m_ctx
 
struct  v4l2_m2m_buffer
 

Functions

voidv4l2_m2m_get_curr_priv (struct v4l2_m2m_dev *m2m_dev)
 
struct vb2_queuev4l2_m2m_get_vq (struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type)
 
void v4l2_m2m_job_finish (struct v4l2_m2m_dev *m2m_dev, struct v4l2_m2m_ctx *m2m_ctx)
 
int v4l2_m2m_reqbufs (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_requestbuffers *reqbufs)
 
int v4l2_m2m_querybuf (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf)
 
int v4l2_m2m_qbuf (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf)
 
int v4l2_m2m_dqbuf (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf)
 
int v4l2_m2m_streamon (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type)
 
int v4l2_m2m_streamoff (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type)
 
unsigned int v4l2_m2m_poll (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct poll_table_struct *wait)
 
int v4l2_m2m_mmap (struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct vm_area_struct *vma)
 
struct v4l2_m2m_devv4l2_m2m_init (struct v4l2_m2m_ops *m2m_ops)
 
void v4l2_m2m_release (struct v4l2_m2m_dev *m2m_dev)
 
struct v4l2_m2m_ctxv4l2_m2m_ctx_init (struct v4l2_m2m_dev *m2m_dev, void *drv_priv, int(*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq))
 
void v4l2_m2m_ctx_release (struct v4l2_m2m_ctx *m2m_ctx)
 
void v4l2_m2m_buf_queue (struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb)
 
voidv4l2_m2m_next_buf (struct v4l2_m2m_queue_ctx *q_ctx)
 
voidv4l2_m2m_buf_remove (struct v4l2_m2m_queue_ctx *q_ctx)
 

Function Documentation

void v4l2_m2m_buf_queue ( struct v4l2_m2m_ctx m2m_ctx,
struct vb2_buffer vb 
)

v4l2_m2m_buf_queue() - add a buffer to the proper ready buffers list.

Call from buf_queue(), videobuf_queue_ops callback.

Definition at line 631 of file v4l2-mem2mem.c.

void* v4l2_m2m_buf_remove ( struct v4l2_m2m_queue_ctx q_ctx)

v4l2_m2m_buf_remove() - take off a buffer from the list of ready buffers and return it

Definition at line 118 of file v4l2-mem2mem.c.

struct v4l2_m2m_ctx* v4l2_m2m_ctx_init ( struct v4l2_m2m_dev m2m_dev,
void drv_priv,
int(*)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)  queue_init 
)
read

v4l2_m2m_ctx_init() - allocate and initialize a m2m context - driver's instance private data - a previously initialized m2m_dev struct - a callback for queue type-specific initialization function to be used for initializing videobuf_queues

Usually called from driver's open() function.

Definition at line 552 of file v4l2-mem2mem.c.

void v4l2_m2m_ctx_release ( struct v4l2_m2m_ctx m2m_ctx)

v4l2_m2m_ctx_release() - release m2m context

Usually called from driver's release() function.

Definition at line 595 of file v4l2-mem2mem.c.

int v4l2_m2m_dqbuf ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
struct v4l2_buffer buf 
)

v4l2_m2m_dqbuf() - dequeue a source or destination buffer, depending on the type

Definition at line 361 of file v4l2-mem2mem.c.

void* v4l2_m2m_get_curr_priv ( struct v4l2_m2m_dev m2m_dev)

v4l2_m2m_get_curr_priv() - return driver private data for the currently running instance or NULL if no instance is running

Definition at line 145 of file v4l2-mem2mem.c.

struct vb2_queue* v4l2_m2m_get_vq ( struct v4l2_m2m_ctx m2m_ctx,
enum v4l2_buf_type  type 
)
read

v4l2_m2m_get_vq() - return vb2_queue for the given type

Definition at line 80 of file v4l2-mem2mem.c.

struct v4l2_m2m_dev* v4l2_m2m_init ( struct v4l2_m2m_ops m2m_ops)
read

v4l2_m2m_init() - initialize per-driver m2m data

Usually called from driver's probe() function.

Definition at line 509 of file v4l2-mem2mem.c.

void v4l2_m2m_job_finish ( struct v4l2_m2m_dev m2m_dev,
struct v4l2_m2m_ctx m2m_ctx 
)

v4l2_m2m_job_finish() - inform the framework that a job has been finished and have it clean up

Called by a driver to yield back the device after it has finished with it. Should be called as soon as possible after reaching a state which allows other instances to take control of the device.

This function has to be called only after device_run() callback has been called on the driver. To prevent recursion, it should not be called directly from the device_run() callback though.

Definition at line 268 of file v4l2-mem2mem.c.

int v4l2_m2m_mmap ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
struct vm_area_struct vma 
)

v4l2_m2m_mmap() - source and destination queues-aware mmap multiplexer

Call from driver's mmap() function. Will handle mmap() for both queues seamlessly for videobuffer, which will receive normal per-queue offsets and proper videobuf queue pointers. The differentiation is made outside videobuf by adding a predefined offset to buffers from one of the queues and subtracting it before passing it back to videobuf. Only drivers (and thus applications) receive modified offsets.

Definition at line 487 of file v4l2-mem2mem.c.

void* v4l2_m2m_next_buf ( struct v4l2_m2m_queue_ctx q_ctx)

v4l2_m2m_next_buf() - return next buffer from the list of ready buffers

Definition at line 96 of file v4l2-mem2mem.c.

unsigned int v4l2_m2m_poll ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
struct poll_table_struct wait 
)

v4l2_m2m_poll() - poll replacement, for destination buffers only

Call from the driver's poll() function. Will poll both queues. If a buffer is available to dequeue (with dqbuf) from the source queue, this will indicate that a non-blocking write can be performed, while read will be returned in case of the destination queue.

Definition at line 410 of file v4l2-mem2mem.c.

int v4l2_m2m_qbuf ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
struct v4l2_buffer buf 
)

v4l2_m2m_qbuf() - enqueue a source or destination buffer, depending on the type

Definition at line 342 of file v4l2-mem2mem.c.

int v4l2_m2m_querybuf ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
struct v4l2_buffer buf 
)

v4l2_m2m_querybuf() - multi-queue-aware QUERYBUF multiplexer

See v4l2_m2m_mmap() documentation for details.

Definition at line 313 of file v4l2-mem2mem.c.

void v4l2_m2m_release ( struct v4l2_m2m_dev m2m_dev)

v4l2_m2m_release() - cleans up and frees a m2m_dev structure

Usually called from driver's remove() function.

Definition at line 537 of file v4l2-mem2mem.c.

int v4l2_m2m_reqbufs ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
struct v4l2_requestbuffers reqbufs 
)

v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer

Definition at line 298 of file v4l2-mem2mem.c.

int v4l2_m2m_streamoff ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
enum v4l2_buf_type  type 
)

v4l2_m2m_streamoff() - turn off streaming for a video queue

Definition at line 392 of file v4l2-mem2mem.c.

int v4l2_m2m_streamon ( struct file file,
struct v4l2_m2m_ctx m2m_ctx,
enum v4l2_buf_type  type 
)

v4l2_m2m_streamon() - turn on streaming for a video queue

Definition at line 374 of file v4l2-mem2mem.c.