Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
vb2_ops Struct Reference

#include <videobuf2-core.h>

Data Fields

int(* queue_setup )(struct vb2_queue *q, const struct v4l2_format *fmt, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], void *alloc_ctxs[])
 
void(* wait_prepare )(struct vb2_queue *q)
 
void(* wait_finish )(struct vb2_queue *q)
 
int(* buf_init )(struct vb2_buffer *vb)
 
int(* buf_prepare )(struct vb2_buffer *vb)
 
int(* buf_finish )(struct vb2_buffer *vb)
 
void(* buf_cleanup )(struct vb2_buffer *vb)
 
int(* start_streaming )(struct vb2_queue *q, unsigned int count)
 
int(* stop_streaming )(struct vb2_queue *q)
 
void(* buf_queue )(struct vb2_buffer *vb)
 

Detailed Description

struct vb2_ops - driver-specific callbacks

: called from VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS handlers before memory allocation, or, if *num_planes != 0, after the allocation to verify a smaller number of buffers. Driver should return the required number of buffers in *num_buffers, the required number of planes per buffer in *num_planes; the size of each plane should be set in the sizes[] array and optional per-plane allocator specific context in the alloc_ctxs[] array. When called from VIDIOC_REQBUFS, fmt == NULL, the driver has to use the currently configured format and *num_buffers is the total number of buffers, that are being allocated. When called from VIDIOC_CREATE_BUFS, fmt != NULL and it describes the target frame format. In this case *num_buffers are being allocated additionally to q->num_buffers. : release any locks taken while calling vb2 functions; it is called before an ioctl needs to wait for a new buffer to arrive; required to avoid a deadlock in blocking access type : reacquire all locks released in the previous callback; required to continue operation after sleeping while waiting for a new buffer to arrive : called once after allocating a buffer (in MMAP case) or after acquiring a new USERPTR buffer; drivers may perform additional buffer-related initialization; initialization failure (return != 0) will prevent queue setup from completing successfully; optional : called every time the buffer is queued from userspace and from the VIDIOC_PREPARE_BUF ioctl; drivers may perform any initialization required before each hardware operation in this callback; if an error is returned, the buffer will not be queued in driver; optional : called before every dequeue of the buffer back to userspace; drivers may perform any operations required before userspace accesses the buffer; optional : called once before the buffer is freed; drivers may perform any additional cleanup; optional : called once to enter 'streaming' state; the driver may receive buffers with callback before is called; the driver gets the number of already queued buffers in count parameter; driver can return an error if hardware fails or not enough buffers has been queued, in such case all buffers that have been already given by the callback are invalidated. : called when 'streaming' state must be disabled; driver should stop any DMA transactions or wait until they finish and give back all buffers it got from buf_queue() callback; may use vb2_wait_for_all_buffers() function : passes buffer vb to the driver; driver may start hardware operation on this buffer; driver should give the buffer back by calling vb2_buffer_done() function; it is allways called after calling STREAMON ioctl; might be called before start_streaming callback if user pre-queued buffers before calling STREAMON

Definition at line 228 of file videobuf2-core.h.

Field Documentation

void(* buf_cleanup)(struct vb2_buffer *vb)

Definition at line 239 of file videobuf2-core.h.

int(* buf_finish)(struct vb2_buffer *vb)

Definition at line 238 of file videobuf2-core.h.

int(* buf_init)(struct vb2_buffer *vb)

Definition at line 236 of file videobuf2-core.h.

int(* buf_prepare)(struct vb2_buffer *vb)

Definition at line 237 of file videobuf2-core.h.

void(* buf_queue)(struct vb2_buffer *vb)

Definition at line 244 of file videobuf2-core.h.

int(* queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], void *alloc_ctxs[])

Definition at line 229 of file videobuf2-core.h.

int(* start_streaming)(struct vb2_queue *q, unsigned int count)

Definition at line 241 of file videobuf2-core.h.

int(* stop_streaming)(struct vb2_queue *q)

Definition at line 242 of file videobuf2-core.h.

void(* wait_finish)(struct vb2_queue *q)

Definition at line 234 of file videobuf2-core.h.

void(* wait_prepare)(struct vb2_queue *q)

Definition at line 233 of file videobuf2-core.h.


The documentation for this struct was generated from the following file: