1.20. V4L2 Memory to Memory functions and data structures¶
-
struct
v4l2_m2m_ops
¶ mem-to-mem device driver callbacks
Definition
struct v4l2_m2m_ops {
void (* device_run) (void *priv);
int (* job_ready) (void *priv);
void (* job_abort) (void *priv);
void (* lock) (void *priv);
void (* unlock) (void *priv);
};
Members
void (*)(void *priv) device_run
- required. Begin the actual job (transaction) inside this
callback.
The job does NOT have to end before this callback returns
(and it will be the usual case). When the job finishes,
v4l2_m2m_job_finish()
has to be called. int (*)(void *priv) job_ready
- optional. Should return 0 if the driver does not have a job fully prepared to run yet (i.e. it will not be able to finish a transaction without sleeping). If not provided, it will be assumed that one source and one destination buffer are all that is required for the driver to perform one full transaction. This method may not sleep.
void (*)(void *priv) job_abort
- required. Informs the driver that it has to abort the currently
running transaction as soon as possible (i.e. as soon as it can
stop the device safely; e.g. in the next interrupt handler),
even if the transaction would not have been finished by then.
After the driver performs the necessary steps, it has to call
v4l2_m2m_job_finish()
(as if the transaction ended normally). This function does not have to (and will usually not) wait until the device enters a state when it can be stopped. void (*)(void *priv) lock
- optional. Define a driver’s own lock callback, instead of using m2m_ctx->q_lock.
void (*)(void *priv) unlock
- optional. Define a driver’s own unlock callback, instead of using m2m_ctx->q_lock.
-
unsigned int
v4l2_m2m_num_src_bufs_ready
(struct v4l2_m2m_ctx * m2m_ctx)¶ return the number of source buffers ready for use
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
unsigned int
v4l2_m2m_num_dst_bufs_ready
(struct v4l2_m2m_ctx * m2m_ctx)¶ return the number of destination buffers ready for use
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
void *
v4l2_m2m_next_src_buf
(struct v4l2_m2m_ctx * m2m_ctx)¶ return next source buffer from the list of ready buffers
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
void *
v4l2_m2m_next_dst_buf
(struct v4l2_m2m_ctx * m2m_ctx)¶ return next destination buffer from the list of ready buffers
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
struct vb2_queue *
v4l2_m2m_get_src_vq
(struct v4l2_m2m_ctx * m2m_ctx)¶ return vb2_queue for source buffers
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
struct vb2_queue *
v4l2_m2m_get_dst_vq
(struct v4l2_m2m_ctx * m2m_ctx)¶ return vb2_queue for destination buffers
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
void *
v4l2_m2m_src_buf_remove
(struct v4l2_m2m_ctx * m2m_ctx)¶ take off a source buffer from the list of ready buffers and return it
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx
-
void *
v4l2_m2m_dst_buf_remove
(struct v4l2_m2m_ctx * m2m_ctx)¶ take off a destination buffer from the list of ready buffers and return it
Parameters
struct v4l2_m2m_ctx * m2m_ctx
- pointer to struct v4l2_m2m_ctx