diff options
Diffstat (limited to 'drivers/media/platform/sh_veu.c')
-rw-r--r-- | drivers/media/platform/sh_veu.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index d6ab33e7060a..82c39f305b54 100644 --- a/drivers/media/platform/sh_veu.c +++ b/drivers/media/platform/sh_veu.c @@ -865,32 +865,14 @@ static const struct v4l2_ioctl_ops sh_veu_ioctl_ops = { /* ========== Queue operations ========== */ static int sh_veu_queue_setup(struct vb2_queue *vq, - const void *parg, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]) { - const struct v4l2_format *f = parg; struct sh_veu_dev *veu = vb2_get_drv_priv(vq); - struct sh_veu_vfmt *vfmt; - unsigned int size, count = *nbuffers; - - if (f) { - const struct v4l2_pix_format *pix = &f->fmt.pix; - const struct sh_veu_format *fmt = sh_veu_find_fmt(f); - struct v4l2_format ftmp = *f; - - if (fmt->fourcc != pix->pixelformat) - return -EINVAL; - sh_veu_try_fmt(&ftmp, fmt); - if (ftmp.fmt.pix.width != pix->width || - ftmp.fmt.pix.height != pix->height) - return -EINVAL; - size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth : - pix->width * pix->height * fmt->depth / fmt->ydepth; - } else { - vfmt = sh_veu_get_vfmt(veu, vq->type); - size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth; - } + struct sh_veu_vfmt *vfmt = sh_veu_get_vfmt(veu, vq->type); + unsigned int count = *nbuffers; + unsigned int size = vfmt->bytesperline * vfmt->frame.height * + vfmt->fmt->depth / vfmt->fmt->ydepth; if (count < 2) *nbuffers = count = 2; @@ -900,6 +882,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq, *nbuffers = count; } + if (*nplanes) { + alloc_ctxs[0] = veu->alloc_ctx; + return sizes[0] < size ? -EINVAL : 0; + } + *nplanes = 1; sizes[0] = size; alloc_ctxs[0] = veu->alloc_ctx; |