include/media/videobuf2-core.h
Source file repositories/reference/linux-study-clean/include/media/videobuf2-core.h
File Facts
- System
- Linux kernel
- Corpus path
include/media/videobuf2-core.h- Extension
.h- Size
- 52711 bytes
- Lines
- 1336
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mm_types.hlinux/mutex.hlinux/poll.hlinux/dma-buf.hlinux/bitops.hmedia/media-request.hmedia/frame_vector.h
Detected Declarations
struct vb2_fileio_datastruct vb2_threadio_datastruct vb2_bufferstruct vb2_mem_opsstruct vb2_planestruct vb2_queuestruct vb2_bufferstruct vb2_opsstruct vb2_buf_opsstruct vb2_queueenum vb2_memoryenum vb2_io_modesenum vb2_buffer_statefunction vb2_queue_allows_cache_hintsfunction vb2_is_streamingfunction vb2_fileio_is_activefunction vb2_get_num_buffersfunction vb2_is_busyfunction vb2_get_drv_privfunction vb2_set_plane_payloadfunction vb2_get_plane_payloadfunction vb2_plane_sizefunction vb2_start_streaming_calledfunction vb2_clear_last_buffer_dequeuedfunction vb2_get_buffer
Annotated Snippet
struct vb2_mem_ops {
void *(*alloc)(struct vb2_buffer *vb,
struct device *dev,
unsigned long size);
void (*put)(void *buf_priv);
struct dma_buf *(*get_dmabuf)(struct vb2_buffer *vb,
void *buf_priv,
unsigned long flags);
void *(*get_userptr)(struct vb2_buffer *vb,
struct device *dev,
unsigned long vaddr,
unsigned long size);
void (*put_userptr)(void *buf_priv);
void (*prepare)(void *buf_priv);
void (*finish)(void *buf_priv);
void *(*attach_dmabuf)(struct vb2_buffer *vb,
struct device *dev,
struct dma_buf *dbuf,
unsigned long size);
void (*detach_dmabuf)(void *buf_priv);
int (*map_dmabuf)(void *buf_priv);
void (*unmap_dmabuf)(void *buf_priv);
void *(*vaddr)(struct vb2_buffer *vb, void *buf_priv);
void *(*cookie)(struct vb2_buffer *vb, void *buf_priv);
unsigned int (*num_users)(void *buf_priv);
int (*mmap)(void *buf_priv, struct vm_area_struct *vma);
};
/**
* struct vb2_plane - plane information.
* @mem_priv: private data with this plane.
* @dbuf: dma_buf - shared buffer object.
* @dbuf_mapped: flag to show whether dbuf is mapped or not
* @dbuf_duplicated: boolean to show whether dbuf is duplicated with a
* previous plane of the buffer.
* @bytesused: number of bytes occupied by data in the plane (payload).
* @length: size of this plane (NOT the payload) in bytes. The maximum
* valid size is MAX_UINT - PAGE_SIZE.
* @min_length: minimum required size of this plane (NOT the payload) in bytes.
* @length is always greater or equal to @min_length, and like
* @length, it is limited to MAX_UINT - PAGE_SIZE.
* @m: Union with memtype-specific data.
* @m.offset: when memory in the associated struct vb2_buffer is
* %VB2_MEMORY_MMAP, equals the offset from the start of
* the device memory for this plane (or is a "cookie" that
* should be passed to mmap() called on the video node).
* @m.userptr: when memory is %VB2_MEMORY_USERPTR, a userspace pointer
* pointing to this plane.
* @m.fd: when memory is %VB2_MEMORY_DMABUF, a userspace file
* descriptor associated with this plane.
* @data_offset: offset in the plane to the start of data; usually 0,
* unless there is a header in front of the data.
*
* Should contain enough information to be able to cover all the fields
* of &struct v4l2_plane at videodev2.h.
*/
struct vb2_plane {
void *mem_priv;
struct dma_buf *dbuf;
unsigned int dbuf_mapped;
bool dbuf_duplicated;
unsigned int bytesused;
unsigned int length;
unsigned int min_length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
};
/**
* enum vb2_io_modes - queue access methods.
* @VB2_MMAP: driver supports MMAP with streaming API.
* @VB2_USERPTR: driver supports USERPTR with streaming API.
* @VB2_READ: driver supports read() style access.
* @VB2_WRITE: driver supports write() style access.
* @VB2_DMABUF: driver supports DMABUF with streaming API.
*/
enum vb2_io_modes {
VB2_MMAP = BIT(0),
VB2_USERPTR = BIT(1),
VB2_READ = BIT(2),
Annotation
- Immediate include surface: `linux/mm_types.h`, `linux/mutex.h`, `linux/poll.h`, `linux/dma-buf.h`, `linux/bitops.h`, `media/media-request.h`, `media/frame_vector.h`.
- Detected declarations: `struct vb2_fileio_data`, `struct vb2_threadio_data`, `struct vb2_buffer`, `struct vb2_mem_ops`, `struct vb2_plane`, `struct vb2_queue`, `struct vb2_buffer`, `struct vb2_ops`, `struct vb2_buf_ops`, `struct vb2_queue`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.