include/media/v4l2-mem2mem.h
Source file repositories/reference/linux-study-clean/include/media/v4l2-mem2mem.h
File Facts
- System
- Linux kernel
- Corpus path
include/media/v4l2-mem2mem.h- Extension
.h- Size
- 30722 bytes
- Lines
- 920
- 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.
- 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
media/videobuf2-v4l2.h
Detected Declarations
struct v4l2_m2m_opsstruct video_devicestruct v4l2_m2m_devstruct v4l2_m2m_queue_ctxstruct v4l2_m2m_ctxstruct v4l2_m2m_bufferfunction v4l2_m2m_buf_donefunction v4l2_m2m_clear_statefunction v4l2_m2m_mark_stoppedfunction v4l2_m2m_dst_buf_is_lastfunction v4l2_m2m_has_stoppedfunction v4l2_m2m_is_last_draining_src_buffunction v4l2_m2m_unregister_media_controllerfunction v4l2_m2m_set_src_bufferedfunction v4l2_m2m_set_dst_bufferedfunction v4l2_m2m_num_src_bufs_readyfunction v4l2_m2m_num_dst_bufs_readyfunction v4l2_m2m_next_src_buffunction v4l2_m2m_next_dst_buffunction v4l2_m2m_last_src_buffunction v4l2_m2m_last_dst_buffunction v4l2_m2m_for_each_dst_buffunction v4l2_m2m_get_dst_vqfunction v4l2_m2m_src_buf_removefunction v4l2_m2m_dst_buf_removefunction v4l2_m2m_src_buf_remove_by_buffunction v4l2_m2m_dst_buf_remove_by_buffunction v4l2_m2m_src_buf_remove_by_idxfunction v4l2_m2m_dst_buf_remove_by_idx
Annotated Snippet
struct v4l2_m2m_ops {
void (*device_run)(void *priv);
int (*job_ready)(void *priv);
void (*job_abort)(void *priv);
};
struct video_device;
struct v4l2_m2m_dev;
/**
* struct v4l2_m2m_queue_ctx - represents a queue for buffers ready to be
* processed
*
* @q: pointer to struct &vb2_queue
* @rdy_queue: List of V4L2 mem-to-mem queues
* @rdy_spinlock: spin lock to protect the struct usage
* @num_rdy: number of buffers ready to be processed
* @buffered: is the queue buffered?
*
* Queue for buffers ready to be processed as soon as this
* instance receives access to the device.
*/
struct v4l2_m2m_queue_ctx {
struct vb2_queue q;
struct list_head rdy_queue;
spinlock_t rdy_spinlock;
u8 num_rdy;
bool buffered;
};
/**
* struct v4l2_m2m_ctx - Memory to memory context structure
*
* @q_lock: struct &mutex lock
* @new_frame: valid in the device_run callback: if true, then this
* starts a new frame; if false, then this is a new slice
* for an existing frame. This is always true unless
* V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF is set, which
* indicates slicing support.
* @is_draining: indicates device is in draining phase
* @last_src_buf: indicate the last source buffer for draining
* @next_buf_last: next capture queud buffer will be tagged as last
* @has_stopped: indicate the device has been stopped
* @ignore_cap_streaming: If true, job_ready can be called even if the CAPTURE
* queue is not streaming. This allows firmware to
* analyze the bitstream header which arrives on the
* OUTPUT queue. The driver must implement the job_ready
* callback correctly to make sure that the requirements
* for actual decoding are met.
* @m2m_dev: opaque pointer to the internal data to handle M2M context
* @cap_q_ctx: Capture (output to memory) queue context
* @out_q_ctx: Output (input from memory) queue context
* @queue: List of memory to memory contexts
* @job_flags: Job queue flags, used internally by v4l2-mem2mem.c:
* %TRANS_QUEUED, %TRANS_RUNNING and %TRANS_ABORT.
* @finished: Wait queue used to signalize when a job queue finished.
* @priv: Instance private data
*
* The memory to memory context is specific to a file handle, NOT to e.g.
* a device.
*/
struct v4l2_m2m_ctx {
/* optional cap/out vb2 queues lock */
struct mutex *q_lock;
bool new_frame;
bool is_draining;
struct vb2_v4l2_buffer *last_src_buf;
bool next_buf_last;
bool has_stopped;
bool ignore_cap_streaming;
/* internal use only */
struct v4l2_m2m_dev *m2m_dev;
struct v4l2_m2m_queue_ctx cap_q_ctx;
struct v4l2_m2m_queue_ctx out_q_ctx;
/* For device job queue */
struct list_head queue;
unsigned long job_flags;
wait_queue_head_t finished;
void *priv;
};
Annotation
- Immediate include surface: `media/videobuf2-v4l2.h`.
- Detected declarations: `struct v4l2_m2m_ops`, `struct video_device`, `struct v4l2_m2m_dev`, `struct v4l2_m2m_queue_ctx`, `struct v4l2_m2m_ctx`, `struct v4l2_m2m_buffer`, `function v4l2_m2m_buf_done`, `function v4l2_m2m_clear_state`, `function v4l2_m2m_mark_stopped`, `function v4l2_m2m_dst_buf_is_last`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- 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.