summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-12-12 16:27:59 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-23 15:20:40 +0300
commit11c8a2df2cf8c213e1970d548aee067887971ef8 (patch)
tree7e01d5e3b6b106468c4e8a8b4f574ccddb01045a
parentb671ae6bdc1ad77a63536c6f74940976b9b89322 (diff)
downloadlinux-11c8a2df2cf8c213e1970d548aee067887971ef8.tar.xz
[media] cx25821: add create_bufs support
Add support for the VIDIOC_CREATE_BUFS ioctl. This was missing in this driver and in vb2 it's trivial to add. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index 3497946c72ea..827c3c036ba3 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -146,9 +146,13 @@ static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fm
unsigned int sizes[], void *alloc_ctxs[])
{
struct cx25821_channel *chan = q->drv_priv;
+ unsigned size = (chan->fmt->depth * chan->width * chan->height) >> 3;
+
+ if (fmt && fmt->fmt.pix.sizeimage < size)
+ return -EINVAL;
*num_planes = 1;
- sizes[0] = (chan->fmt->depth * chan->width * chan->height) >> 3;
+ sizes[0] = fmt ? fmt->fmt.pix.sizeimage : size;
alloc_ctxs[0] = chan->dev->alloc_ctx;
return 0;
}
@@ -610,6 +614,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
.vidioc_reqbufs = vb2_ioctl_reqbufs,
.vidioc_prepare_buf = vb2_ioctl_prepare_buf,
+ .vidioc_create_bufs = vb2_ioctl_create_bufs,
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_qbuf = vb2_ioctl_qbuf,
.vidioc_dqbuf = vb2_ioctl_dqbuf,