mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
media: v4l2: Add mem2mem helpers for REMOVE_BUFS ioctl
Create v4l2-mem2mem helpers for VIDIOC_REMOVE_BUFS ioctl and make test drivers use it. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
a3293a8538
commit
2f2419502f
@ -1345,6 +1345,7 @@ static const struct v4l2_ioctl_ops vicodec_ioctl_ops = {
|
||||
.vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf,
|
||||
.vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs,
|
||||
.vidioc_expbuf = v4l2_m2m_ioctl_expbuf,
|
||||
.vidioc_remove_bufs = v4l2_m2m_ioctl_remove_bufs,
|
||||
|
||||
.vidioc_streamon = v4l2_m2m_ioctl_streamon,
|
||||
.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
|
||||
|
@ -221,6 +221,7 @@ static const struct v4l2_ioctl_ops vimc_capture_ioctl_ops = {
|
||||
.vidioc_expbuf = vb2_ioctl_expbuf,
|
||||
.vidioc_streamon = vb2_ioctl_streamon,
|
||||
.vidioc_streamoff = vb2_ioctl_streamoff,
|
||||
.vidioc_remove_bufs = vb2_ioctl_remove_bufs,
|
||||
};
|
||||
|
||||
static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture,
|
||||
|
@ -539,6 +539,7 @@ const struct v4l2_ioctl_ops visl_ioctl_ops = {
|
||||
.vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf,
|
||||
.vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs,
|
||||
.vidioc_expbuf = v4l2_m2m_ioctl_expbuf,
|
||||
.vidioc_remove_bufs = v4l2_m2m_ioctl_remove_bufs,
|
||||
|
||||
.vidioc_streamon = v4l2_m2m_ioctl_streamon,
|
||||
.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
|
||||
|
@ -769,6 +769,7 @@ static const struct v4l2_ioctl_ops vivid_ioctl_ops = {
|
||||
.vidioc_expbuf = vb2_ioctl_expbuf,
|
||||
.vidioc_streamon = vb2_ioctl_streamon,
|
||||
.vidioc_streamoff = vb2_ioctl_streamoff,
|
||||
.vidioc_remove_bufs = vb2_ioctl_remove_bufs,
|
||||
|
||||
.vidioc_enum_input = vivid_enum_input,
|
||||
.vidioc_g_input = vivid_g_input,
|
||||
|
@ -1386,6 +1386,21 @@ int v4l2_m2m_ioctl_create_bufs(struct file *file, void *priv,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_create_bufs);
|
||||
|
||||
int v4l2_m2m_ioctl_remove_bufs(struct file *file, void *priv,
|
||||
struct v4l2_remove_buffers *remove)
|
||||
{
|
||||
struct v4l2_fh *fh = file->private_data;
|
||||
struct vb2_queue *q = v4l2_m2m_get_vq(fh->m2m_ctx, remove->type);
|
||||
|
||||
if (!q)
|
||||
return -EINVAL;
|
||||
if (q->type != remove->type)
|
||||
return -EINVAL;
|
||||
|
||||
return vb2_core_remove_bufs(q, remove->index, remove->count);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_remove_bufs);
|
||||
|
||||
int v4l2_m2m_ioctl_querybuf(struct file *file, void *priv,
|
||||
struct v4l2_buffer *buf)
|
||||
{
|
||||
|
@ -867,6 +867,8 @@ int v4l2_m2m_ioctl_reqbufs(struct file *file, void *priv,
|
||||
struct v4l2_requestbuffers *rb);
|
||||
int v4l2_m2m_ioctl_create_bufs(struct file *file, void *fh,
|
||||
struct v4l2_create_buffers *create);
|
||||
int v4l2_m2m_ioctl_remove_bufs(struct file *file, void *priv,
|
||||
struct v4l2_remove_buffers *d);
|
||||
int v4l2_m2m_ioctl_querybuf(struct file *file, void *fh,
|
||||
struct v4l2_buffer *buf);
|
||||
int v4l2_m2m_ioctl_expbuf(struct file *file, void *fh,
|
||||
|
Loading…
Reference in New Issue
Block a user