OSDN Git Service

[media] vivid: the overlay API wasn't disabled completely for multiplanar
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 9 Mar 2015 15:34:32 +0000 (12:34 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 2 Apr 2015 23:28:16 +0000 (20:28 -0300)
If the vivid driver is loaded in multiplanar mode, then the capture overlay
functionality should be disabled. This wasn't fully done, which led to
v4l2-compliance errors.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/vivid/vivid-vid-cap.c

index 867a29a..550945a 100644 (file)
@@ -1012,8 +1012,12 @@ int vivid_vid_cap_cropcap(struct file *file, void *priv,
 int vidioc_enum_fmt_vid_overlay(struct file *file, void  *priv,
                                        struct v4l2_fmtdesc *f)
 {
+       struct vivid_dev *dev = video_drvdata(file);
        const struct vivid_fmt *fmt;
 
+       if (dev->multiplanar)
+               return -ENOTTY;
+
        if (f->index >= ARRAY_SIZE(formats_ovl))
                return -EINVAL;
 
@@ -1032,6 +1036,9 @@ int vidioc_g_fmt_vid_overlay(struct file *file, void *priv,
        struct v4l2_window *win = &f->fmt.win;
        unsigned clipcount = win->clipcount;
 
+       if (dev->multiplanar)
+               return -ENOTTY;
+
        win->w.top = dev->overlay_cap_top;
        win->w.left = dev->overlay_cap_left;
        win->w.width = compose->width;
@@ -1063,6 +1070,9 @@ int vidioc_try_fmt_vid_overlay(struct file *file, void *priv,
        struct v4l2_window *win = &f->fmt.win;
        int i, j;
 
+       if (dev->multiplanar)
+               return -ENOTTY;
+
        win->w.left = clamp_t(int, win->w.left,
                              -dev->fb_cap.fmt.width, dev->fb_cap.fmt.width);
        win->w.top = clamp_t(int, win->w.top,
@@ -1150,6 +1160,9 @@ int vivid_vid_cap_overlay(struct file *file, void *fh, unsigned i)
 {
        struct vivid_dev *dev = video_drvdata(file);
 
+       if (dev->multiplanar)
+               return -ENOTTY;
+
        if (i && dev->fb_vbase_cap == NULL)
                return -EINVAL;
 
@@ -1169,6 +1182,9 @@ int vivid_vid_cap_g_fbuf(struct file *file, void *fh,
 {
        struct vivid_dev *dev = video_drvdata(file);
 
+       if (dev->multiplanar)
+               return -ENOTTY;
+
        *a = dev->fb_cap;
        a->capability = V4L2_FBUF_CAP_BITMAP_CLIPPING |
                        V4L2_FBUF_CAP_LIST_CLIPPING;
@@ -1185,6 +1201,9 @@ int vivid_vid_cap_s_fbuf(struct file *file, void *fh,
        struct vivid_dev *dev = video_drvdata(file);
        const struct vivid_fmt *fmt;
 
+       if (dev->multiplanar)
+               return -ENOTTY;
+
        if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO))
                return -EPERM;