On 21/05/18 18:59, Ezequiel Garcia wrote:
> From: Gustavo Padovan <gustavo.pado...@collabora.com>
> 
> The cobalt driver may reorder the capture buffers so we need to report
> it as such.
> 
> v3: set formats as unordered
> v2: use vb2_ops_set_unordered() helper
> 
> Signed-off-by: Gustavo Padovan <gustavo.pado...@collabora.com>
> Signed-off-by: Ezequiel Garcia <ezequ...@collabora.com>
> ---
>  drivers/media/pci/cobalt/cobalt-v4l2.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c 
> b/drivers/media/pci/cobalt/cobalt-v4l2.c
> index e2a4c705d353..ccca1a96df90 100644
> --- a/drivers/media/pci/cobalt/cobalt-v4l2.c
> +++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
> @@ -430,6 +430,7 @@ static const struct vb2_ops cobalt_qops = {
>       .stop_streaming = cobalt_stop_streaming,
>       .wait_prepare = vb2_ops_wait_prepare,
>       .wait_finish = vb2_ops_wait_finish,
> +     .is_unordered = vb2_ops_is_unordered,
>  };
>  
>  /* V4L2 ioctls */
> @@ -695,14 +696,17 @@ static int cobalt_enum_fmt_vid_cap(struct file *file, 
> void *priv_fh,
>       case 0:
>               strlcpy(f->description, "YUV 4:2:2", sizeof(f->description));
>               f->pixelformat = V4L2_PIX_FMT_YUYV;
> +             f->flags |= V4L2_FMT_FLAG_UNORDERED;
>               break;
>       case 1:
>               strlcpy(f->description, "RGB24", sizeof(f->description));
>               f->pixelformat = V4L2_PIX_FMT_RGB24;
> +             f->flags |= V4L2_FMT_FLAG_UNORDERED;
>               break;
>       case 2:
>               strlcpy(f->description, "RGB32", sizeof(f->description));
>               f->pixelformat = V4L2_PIX_FMT_BGR32;
> +             f->flags |= V4L2_FMT_FLAG_UNORDERED;

Rather than adding this for every case, just move it out of the switch and
set it just before the 'return 0'.

Regards,

        Hans

>               break;
>       default:
>               return -EINVAL;
> 

Reply via email to