From eaec420f530d376d6bb6e547a741203344619f47 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 8 May 2017 11:35:05 -0300 Subject: [media] v4l2-ioctl/exynos: fix G/S_SELECTION's type handling The type field in struct v4l2_selection is supposed to never use the _MPLANE variants. E.g. if the driver supports V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, then userspace should still pass V4L2_BUF_TYPE_VIDEO_CAPTURE. The reasons for this are lost in the mists of time, but it is really annoying. In addition, the exynos drivers didn't follow this rule and instead expected the _MPLANE type. To fix that code is added to the v4l2 core that maps the _MPLANE buffer types to their regular equivalents before calling the driver. Effectively this allows for userspace to use either _MPLANE or the regular buffer type. This keeps backwards compatibility while making things easier for userspace. Since drivers now never see the _MPLANE buffer types the exynos drivers had to be adapted as well. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Acked-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/media/platform/exynos-gsc/gsc-m2m.c') diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 82505025d96c..33611a46ce35 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -460,8 +460,8 @@ static int gsc_m2m_g_selection(struct file *file, void *fh, struct gsc_frame *frame; struct gsc_ctx *ctx = fh_to_ctx(fh); - if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && - (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)) + if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) && + (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)) return -EINVAL; frame = ctx_get_frame(ctx, s->type); @@ -503,8 +503,8 @@ static int gsc_m2m_s_selection(struct file *file, void *fh, cr.type = s->type; cr.c = s->r; - if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && - (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)) + if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) && + (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)) return -EINVAL; ret = gsc_try_crop(ctx, &cr); -- cgit