#include <linux/atomic.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-vmalloc.h>
#include "uvcvideo.h"
static inline struct uvc_buffer *uvc_vbuf_to_buffer(struct vb2_v4l2_buffer *buf)
{ … }
static void uvc_queue_return_buffers(struct uvc_video_queue *queue,
enum uvc_buffer_state state)
{ … }
static int uvc_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static int uvc_buffer_prepare(struct vb2_buffer *vb)
{ … }
static void uvc_buffer_queue(struct vb2_buffer *vb)
{ … }
static void uvc_buffer_finish(struct vb2_buffer *vb)
{ … }
static int uvc_start_streaming(struct vb2_queue *vq, unsigned int count)
{ … }
static void uvc_stop_streaming(struct vb2_queue *vq)
{ … }
static const struct vb2_ops uvc_queue_qops = …;
static const struct vb2_ops uvc_meta_queue_qops = …;
int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
int drop_corrupted)
{ … }
void uvc_queue_release(struct uvc_video_queue *queue)
{ … }
int uvc_request_buffers(struct uvc_video_queue *queue,
struct v4l2_requestbuffers *rb)
{ … }
int uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
{ … }
int uvc_create_buffers(struct uvc_video_queue *queue,
struct v4l2_create_buffers *cb)
{ … }
int uvc_queue_buffer(struct uvc_video_queue *queue,
struct media_device *mdev, struct v4l2_buffer *buf)
{ … }
int uvc_export_buffer(struct uvc_video_queue *queue,
struct v4l2_exportbuffer *exp)
{ … }
int uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf,
int nonblocking)
{ … }
int uvc_queue_streamon(struct uvc_video_queue *queue, enum v4l2_buf_type type)
{ … }
int uvc_queue_streamoff(struct uvc_video_queue *queue, enum v4l2_buf_type type)
{ … }
int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma)
{ … }
#ifndef CONFIG_MMU
unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
unsigned long pgoff)
{
return vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0);
}
#endif
__poll_t uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
poll_table *wait)
{ … }
int uvc_queue_allocated(struct uvc_video_queue *queue)
{ … }
void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
{ … }
static struct uvc_buffer *
__uvc_queue_get_current_buffer(struct uvc_video_queue *queue)
{ … }
struct uvc_buffer *uvc_queue_get_current_buffer(struct uvc_video_queue *queue)
{ … }
static void uvc_queue_buffer_requeue(struct uvc_video_queue *queue,
struct uvc_buffer *buf)
{ … }
static void uvc_queue_buffer_complete(struct kref *ref)
{ … }
void uvc_queue_buffer_release(struct uvc_buffer *buf)
{ … }
struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
struct uvc_buffer *buf)
{ … }