diff options
Diffstat (limited to 'drivers/media/pci/tw68/tw68-video.c')
-rw-r--r-- | drivers/media/pci/tw68/tw68-video.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 46642ef9151b..2e71af15ddb0 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -376,28 +376,28 @@ static int tw68_buffer_count(unsigned int size, unsigned int count) /* ------------------------------------------------------------- */ /* vb2 queue operations */ -static int tw68_queue_setup(struct vb2_queue *q, const void *parg, +static int tw68_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], void *alloc_ctxs[]) { - const struct v4l2_format *fmt = parg; struct tw68_dev *dev = vb2_get_drv_priv(q); unsigned tot_bufs = q->num_buffers + *num_buffers; + unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; - sizes[0] = (dev->fmt->depth * dev->width * dev->height) >> 3; + if (tot_bufs < 2) + tot_bufs = 2; + tot_bufs = tw68_buffer_count(size, tot_bufs); + *num_buffers = tot_bufs - q->num_buffers; alloc_ctxs[0] = dev->alloc_ctx; /* - * We allow create_bufs, but only if the sizeimage is the same as the + * We allow create_bufs, but only if the sizeimage is >= as the * current sizeimage. The tw68_buffer_count calculation becomes quite * difficult otherwise. */ - if (fmt && fmt->fmt.pix.sizeimage < sizes[0]) - return -EINVAL; + if (*num_planes) + return sizes[0] < size ? -EINVAL : 0; *num_planes = 1; - if (tot_bufs < 2) - tot_bufs = 2; - tot_bufs = tw68_buffer_count(sizes[0], tot_bufs); - *num_buffers = tot_bufs - q->num_buffers; + sizes[0] = size; return 0; } |