media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure

Adding a reference count to the v4l2_m2m_dev structure allow safely
sharing it across multiple hardware nodes. This can be used to prevent
running jobs concurrently on m2m cores that have some internal resource
sharing.

Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
[hverkuil: fix typos in v4l2_m2m_put documentation]
This commit is contained in:
Nicolas Dufresne authored and Hans Verkuil committed 2026-01-05 15:56:31 +01:00
1 parent 3e92d7e493
commit db6b97a4f8
2 files changed
+44

No files matched your search

+21
View File
@@ -547,6 +547,27 @@ v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
*/
void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
/**
* v4l2_m2m_get() - take a reference to the m2m_dev structure
*
* @m2m_dev: opaque pointer to the internal data to handle M2M context
*
* This is used to share the M2M device across multiple devices. This
* can be used to avoid scheduling two hardware nodes concurrently.
*/
void v4l2_m2m_get(struct v4l2_m2m_dev *m2m_dev);
/**
* v4l2_m2m_put() - remove a reference to the m2m_dev structure
*
* @m2m_dev: opaque pointer to the internal data to handle M2M context
*
* Once the M2M device has no more references, v4l2_m2m_release() will be
* called automatically. Users of this method should never call
* v4l2_m2m_release() directly. See v4l2_m2m_get() for more details.
*/
void v4l2_m2m_put(struct v4l2_m2m_dev *m2m_dev);
/**
* v4l2_m2m_ctx_init() - allocate and initialize a m2m context
*