Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l2-mem2mem: add support for prepare_buf

This was never added for some reason, so add it now.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
e68cf471 f00245c2

+32
+28
drivers/media/v4l2-core/v4l2-mem2mem.c
··· 427 427 EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); 428 428 429 429 /** 430 + * v4l2_m2m_prepare_buf() - prepare a source or destination buffer, depending on 431 + * the type 432 + */ 433 + int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 434 + struct v4l2_buffer *buf) 435 + { 436 + struct vb2_queue *vq; 437 + int ret; 438 + 439 + vq = v4l2_m2m_get_vq(m2m_ctx, buf->type); 440 + ret = vb2_prepare_buf(vq, buf); 441 + if (!ret) 442 + v4l2_m2m_try_schedule(m2m_ctx); 443 + 444 + return ret; 445 + } 446 + EXPORT_SYMBOL_GPL(v4l2_m2m_prepare_buf); 447 + 448 + /** 430 449 * v4l2_m2m_create_bufs() - create a source or destination buffer, depending 431 450 * on the type 432 451 */ ··· 829 810 return v4l2_m2m_dqbuf(file, fh->m2m_ctx, buf); 830 811 } 831 812 EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_dqbuf); 813 + 814 + int v4l2_m2m_ioctl_prepare_buf(struct file *file, void *priv, 815 + struct v4l2_buffer *buf) 816 + { 817 + struct v4l2_fh *fh = file->private_data; 818 + 819 + return v4l2_m2m_prepare_buf(file, fh->m2m_ctx, buf); 820 + } 821 + EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_prepare_buf); 832 822 833 823 int v4l2_m2m_ioctl_expbuf(struct file *file, void *priv, 834 824 struct v4l2_exportbuffer *eb)
+4
include/media/v4l2-mem2mem.h
··· 116 116 struct v4l2_buffer *buf); 117 117 int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 118 118 struct v4l2_buffer *buf); 119 + int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 120 + struct v4l2_buffer *buf); 119 121 int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 120 122 struct v4l2_create_buffers *create); 121 123 ··· 250 248 struct v4l2_buffer *buf); 251 249 int v4l2_m2m_ioctl_dqbuf(struct file *file, void *fh, 252 250 struct v4l2_buffer *buf); 251 + int v4l2_m2m_ioctl_prepare_buf(struct file *file, void *fh, 252 + struct v4l2_buffer *buf); 253 253 int v4l2_m2m_ioctl_streamon(struct file *file, void *fh, 254 254 enum v4l2_buf_type type); 255 255 int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh,