aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2013-09-14 17:39:04 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-12-04 12:34:24 -0500
commit8e6e8f93f7cb3452b1c00da8a30d01558628d913 (patch)
tree0f1a5f470a68299a1f607be4b2426e9484bbd348 /include
parent2e1ab9cb94a257dcd7561601be44ca8b35b27365 (diff)
[media] V4L: Add mem2mem ioctl and file operation helpers
This patch adds ioctl helpers to the V4L2 mem-to-mem API, so we can avoid several ioctl handlers in the mem-to-mem video node drivers that are simply a pass-through to the v4l2_m2m_* calls. These helpers will only be useful for drivers that use same mutex for both OUTPUT and CAPTURE queue, which is the case for all currently in tree v4l2 m2m drivers. In order to use the helpers the drivers are required to use struct v4l2_fh. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/v4l2-fh.h4
-rw-r--r--include/media/v4l2-mem2mem.h24
2 files changed, 28 insertions, 0 deletions
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 528cdaf622e1..803516775162 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -45,6 +45,10 @@ struct v4l2_fh {
45 struct list_head available; /* Dequeueable event */ 45 struct list_head available; /* Dequeueable event */
46 unsigned int navailable; 46 unsigned int navailable;
47 u32 sequence; 47 u32 sequence;
48
49#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
50 struct v4l2_m2m_ctx *m2m_ctx;
51#endif
48}; 52};
49 53
50/* 54/*
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 44542a20ab81..12ea5a6a4331 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -64,6 +64,9 @@ struct v4l2_m2m_queue_ctx {
64}; 64};
65 65
66struct v4l2_m2m_ctx { 66struct v4l2_m2m_ctx {
67 /* optional cap/out vb2 queues lock */
68 struct mutex *q_lock;
69
67/* private: internal use only */ 70/* private: internal use only */
68 struct v4l2_m2m_dev *m2m_dev; 71 struct v4l2_m2m_dev *m2m_dev;
69 72
@@ -229,5 +232,26 @@ static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
229 return v4l2_m2m_buf_remove(&m2m_ctx->cap_q_ctx); 232 return v4l2_m2m_buf_remove(&m2m_ctx->cap_q_ctx);
230} 233}
231 234
235/* v4l2 ioctl helpers */
236
237int v4l2_m2m_ioctl_reqbufs(struct file *file, void *priv,
238 struct v4l2_requestbuffers *rb);
239int v4l2_m2m_ioctl_create_bufs(struct file *file, void *fh,
240 struct v4l2_create_buffers *create);
241int v4l2_m2m_ioctl_querybuf(struct file *file, void *fh,
242 struct v4l2_buffer *buf);
243int v4l2_m2m_ioctl_expbuf(struct file *file, void *fh,
244 struct v4l2_exportbuffer *eb);
245int v4l2_m2m_ioctl_qbuf(struct file *file, void *fh,
246 struct v4l2_buffer *buf);
247int v4l2_m2m_ioctl_dqbuf(struct file *file, void *fh,
248 struct v4l2_buffer *buf);
249int v4l2_m2m_ioctl_streamon(struct file *file, void *fh,
250 enum v4l2_buf_type type);
251int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh,
252 enum v4l2_buf_type type);
253int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma);
254unsigned int v4l2_m2m_fop_poll(struct file *file, poll_table *wait);
255
232#endif /* _MEDIA_V4L2_MEM2MEM_H */ 256#endif /* _MEDIA_V4L2_MEM2MEM_H */
233 257