Re: [PATCH] media: v4l2: Fix the _MPLANE format check in v4l_enum_fmt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 6 Jun 2019 12:53:57 +0900
Tomasz Figa <tfiga@xxxxxxxxxxxx> wrote:

> On Thu, Jun 6, 2019 at 1:46 AM Boris Brezillon
> <boris.brezillon@xxxxxxxxxxxxx> wrote:
> >
> > CAP_M2M_MPLANE means the device supports _MPLANE formats for both
> > capture and output. Adjust the check to avoid EINVAL errors on
> > such devices.
> >
> > Fixes: 366c719d6479 ("media: v4l2: Get rid of ->vidioc_enum_fmt_vid_{cap,out}_mplane")
> > Reported-by: Maxime Jourdan <mjourdan@xxxxxxxxxxxx>
> > Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
> > ---
> >  drivers/media/v4l2-core/v4l2-ioctl.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> > index b4c73e8f23c5..ace9b9761bed 100644
> > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > @@ -1385,6 +1385,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
> >         struct video_device *vdev = video_devdata(file);
> >         struct v4l2_fmtdesc *p = arg;
> >         int ret = check_fmt(file, p->type);
> > +       u32 cap_mask;
> >
> >         if (ret)
> >                 return ret;
> > @@ -1393,7 +1394,9 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
> >         switch (p->type) {
> >         case V4L2_BUF_TYPE_VIDEO_CAPTURE:
> >         case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
> > -               if (!!(vdev->device_caps & V4L2_CAP_VIDEO_CAPTURE_MPLANE) !=
> > +               cap_mask = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
> > +                          V4L2_CAP_VIDEO_M2M_MPLANE;
> > +               if (!!(vdev->device_caps & cap_mask) !=  
> 
> Shouldn't devices that report V4L2_CAP_VIDEO_M2M_MPLANE have also
> V4L2_CAP_VIDEO_CAPTURE_MPLANE and V4L2_CAP_VIDEO_OUTPUT_MPLANE
> reported anyway?

That's the other option, force drivers that set
V4L2_CAP_VIDEO_M2M_MPLANE to also set
V4L2_CAP_VIDEO_{CAPTURE,OUTPUT}_MPLANE (or we can let the core do it).



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux