From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28167C04AB5 for ; Thu, 6 Jun 2019 06:52:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F289D20868 for ; Thu, 6 Jun 2019 06:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726040AbfFFGwE (ORCPT ); Thu, 6 Jun 2019 02:52:04 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:55720 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725267AbfFFGwE (ORCPT ); Thu, 6 Jun 2019 02:52:04 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id D230D263955; Thu, 6 Jun 2019 07:52:02 +0100 (BST) Date: Thu, 6 Jun 2019 08:51:59 +0200 From: Boris Brezillon To: Tomasz Figa Cc: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Sakari Ailus , Linux Media Mailing List , kernel@collabora.com, Hirokazu Honda , Nicolas Dufresne , Sylwester Nawrocki , Maxime Jourdan Subject: Re: [PATCH] media: v4l2: Fix the _MPLANE format check in v4l_enum_fmt() Message-ID: <20190606085159.3454aecb@collabora.com> In-Reply-To: References: <20190605164625.5109-1-boris.brezillon@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Thu, 6 Jun 2019 12:53:57 +0900 Tomasz Figa wrote: > On Thu, Jun 6, 2019 at 1:46 AM Boris Brezillon > 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 > > Signed-off-by: Boris Brezillon > > --- > > 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).