#define pr_fmt(fmt) …
#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 <linux/freezer.h>
#include <linux/kthread.h>
#include <media/videobuf2-core.h>
#include <media/v4l2-mc.h>
#include <trace/events/vb2.h>
#define PLANE_INDEX_BITS …
#define PLANE_INDEX_SHIFT …
#define PLANE_INDEX_MASK …
#define MAX_BUFFER_INDEX …
#define BUFFER_INDEX_MASK …
#if BIT(PLANE_INDEX_BITS) != VIDEO_MAX_PLANES
#error PLANE_INDEX_BITS order must be equal to VIDEO_MAX_PLANES
#endif
static int debug;
module_param(debug, int, 0644);
#define dprintk(q, level, fmt, arg...) …
#ifdef CONFIG_VIDEO_ADV_DEBUG
#define log_memop(vb, op) …
#define call_memop(vb, op, args...) …
#define call_ptr_memop(op, vb, args...) …
#define call_void_memop(vb, op, args...) …
#define log_qop(q, op) …
#define call_qop(q, op, args...) …
#define call_void_qop(q, op, args...) …
#define log_vb_qop(vb, op, args...) …
#define call_vb_qop(vb, op, args...) …
#define call_void_vb_qop(vb, op, args...) …
#else
#define call_memop …
#define call_ptr_memop …
#define call_void_memop …
#define call_qop …
#define call_void_qop …
#define call_vb_qop …
#define call_void_vb_qop …
#endif
#define call_bufop(q, op, args...) …
#define call_void_bufop(q, op, args...) …
static void __vb2_queue_cancel(struct vb2_queue *q);
static const char *vb2_state_name(enum vb2_buffer_state s)
{ … }
static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
{ … }
static void __vb2_buf_mem_free(struct vb2_buffer *vb)
{ … }
static void __vb2_buf_userptr_put(struct vb2_buffer *vb)
{ … }
static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p)
{ … }
static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb)
{ … }
static void __vb2_buf_mem_prepare(struct vb2_buffer *vb)
{ … }
static void __vb2_buf_mem_finish(struct vb2_buffer *vb)
{ … }
static void __setup_offsets(struct vb2_buffer *vb)
{ … }
static void init_buffer_cache_hints(struct vb2_queue *q, struct vb2_buffer *vb)
{ … }
static void vb2_queue_add_buffer(struct vb2_queue *q, struct vb2_buffer *vb, unsigned int index)
{ … }
static void vb2_queue_remove_buffer(struct vb2_buffer *vb)
{ … }
static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
unsigned int num_buffers, unsigned int num_planes,
const unsigned int plane_sizes[VB2_MAX_PLANES],
unsigned int *first_index)
{ … }
static void __vb2_free_mem(struct vb2_queue *q, unsigned int start, unsigned int count)
{ … }
static void __vb2_queue_free(struct vb2_queue *q, unsigned int start, unsigned int count)
{ … }
bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
{ … }
EXPORT_SYMBOL(…);
static bool __buffers_in_use(struct vb2_queue *q)
{ … }
void vb2_core_querybuf(struct vb2_queue *q, struct vb2_buffer *vb, void *pb)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __verify_userptr_ops(struct vb2_queue *q)
{ … }
static int __verify_mmap_ops(struct vb2_queue *q)
{ … }
static int __verify_dmabuf_ops(struct vb2_queue *q)
{ … }
int vb2_verify_memory_type(struct vb2_queue *q,
enum vb2_memory memory, unsigned int type)
{ … }
EXPORT_SYMBOL(…);
static void set_queue_coherency(struct vb2_queue *q, bool non_coherent_mem)
{ … }
static bool verify_coherency_flags(struct vb2_queue *q, bool non_coherent_mem)
{ … }
static int vb2_core_allocated_buffers_storage(struct vb2_queue *q)
{ … }
static void vb2_core_free_buffers_storage(struct vb2_queue *q)
{ … }
int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
unsigned int flags, unsigned int *count)
{ … }
EXPORT_SYMBOL_GPL(…);
int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
unsigned int flags, unsigned int *count,
unsigned int requested_planes,
const unsigned int requested_sizes[],
unsigned int *first_index)
{ … }
EXPORT_SYMBOL_GPL(…);
void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no)
{ … }
EXPORT_SYMBOL_GPL(…);
void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no)
{ … }
EXPORT_SYMBOL_GPL(…);
void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
{ … }
EXPORT_SYMBOL_GPL(…);
void vb2_discard_done(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __prepare_mmap(struct vb2_buffer *vb)
{ … }
static int __prepare_userptr(struct vb2_buffer *vb)
{ … }
static int __prepare_dmabuf(struct vb2_buffer *vb)
{ … }
static void __enqueue_in_driver(struct vb2_buffer *vb)
{ … }
static int __buf_prepare(struct vb2_buffer *vb)
{ … }
static int vb2_req_prepare(struct media_request_object *obj)
{ … }
static void __vb2_dqbuf(struct vb2_buffer *vb);
static void vb2_req_unprepare(struct media_request_object *obj)
{ … }
static void vb2_req_queue(struct media_request_object *obj)
{ … }
static void vb2_req_unbind(struct media_request_object *obj)
{ … }
static void vb2_req_release(struct media_request_object *obj)
{ … }
static const struct media_request_object_ops vb2_core_req_ops = …;
bool vb2_request_object_is_buffer(struct media_request_object *obj)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int vb2_request_buffer_cnt(struct media_request *req)
{ … }
EXPORT_SYMBOL_GPL(…);
int vb2_core_prepare_buf(struct vb2_queue *q, struct vb2_buffer *vb, void *pb)
{ … }
EXPORT_SYMBOL_GPL(…);
int vb2_core_remove_bufs(struct vb2_queue *q, unsigned int start, unsigned int count)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vb2_start_streaming(struct vb2_queue *q)
{ … }
int vb2_core_qbuf(struct vb2_queue *q, struct vb2_buffer *vb, void *pb,
struct media_request *req)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking)
{ … }
static int __vb2_get_done_vb(struct vb2_queue *q, struct vb2_buffer **vb,
void *pb, int nonblocking)
{ … }
int vb2_wait_for_all_buffers(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
static void __vb2_dqbuf(struct vb2_buffer *vb)
{ … }
int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb,
bool nonblocking)
{ … }
EXPORT_SYMBOL_GPL(…);
static void __vb2_queue_cancel(struct vb2_queue *q)
{ … }
int vb2_core_streamon(struct vb2_queue *q, unsigned int type)
{ … }
EXPORT_SYMBOL_GPL(…);
void vb2_queue_error(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
int vb2_core_streamoff(struct vb2_queue *q, unsigned int type)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __find_plane_by_offset(struct vb2_queue *q, unsigned long offset,
struct vb2_buffer **vb, unsigned int *plane)
{ … }
int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type,
struct vb2_buffer *vb, unsigned int plane, unsigned int flags)
{ … }
EXPORT_SYMBOL_GPL(…);
int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifndef CONFIG_MMU
unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
unsigned long addr,
unsigned long len,
unsigned long pgoff,
unsigned long flags)
{
unsigned long offset = pgoff << PAGE_SHIFT;
struct vb2_buffer *vb;
unsigned int plane;
void *vaddr;
int ret;
mutex_lock(&q->mmap_lock);
ret = __find_plane_by_offset(q, offset, &vb, &plane);
if (ret)
goto unlock;
vaddr = vb2_plane_vaddr(vb, plane);
mutex_unlock(&q->mmap_lock);
return vaddr ? (unsigned long)vaddr : -EINVAL;
unlock:
mutex_unlock(&q->mmap_lock);
return ret;
}
EXPORT_SYMBOL_GPL(vb2_get_unmapped_area);
#endif
int vb2_core_queue_init(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __vb2_init_fileio(struct vb2_queue *q, int read);
static int __vb2_cleanup_fileio(struct vb2_queue *q);
void vb2_core_queue_release(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
__poll_t vb2_core_poll(struct vb2_queue *q, struct file *file,
poll_table *wait)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vb2_fileio_buf { … };
struct vb2_fileio_data { … };
static int __vb2_init_fileio(struct vb2_queue *q, int read)
{ … }
static int __vb2_cleanup_fileio(struct vb2_queue *q)
{ … }
static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_t count,
loff_t *ppos, int nonblock, int read)
{ … }
size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
loff_t *ppos, int nonblocking)
{ … }
EXPORT_SYMBOL_GPL(…);
size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count,
loff_t *ppos, int nonblocking)
{ … }
EXPORT_SYMBOL_GPL(…);
struct vb2_threadio_data { … };
static int vb2_thread(void *data)
{ … }
int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv,
const char *thread_name)
{ … }
EXPORT_SYMBOL_GPL(…);
int vb2_thread_stop(struct vb2_queue *q)
{ … }
EXPORT_SYMBOL_GPL(…);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);