[{"id":24301,"web_url":"https://patchwork.libcamera.org/comment/24301/","msgid":"<Yuj99ZyXzPc1YZUA@pendragon.ideasonboard.com>","date":"2022-08-02T10:35:33","subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: v4l2_subdevice:\n\tChange V4L2Subdevice::Whence","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch :-)\n\nOn Mon, Aug 01, 2022 at 03:05:36AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> From: Jacopo Mondi <jacopo@jmondi.org>\n> \n> The V4L2Subdevice::Whence enumerations defines two values that should\n> correspond to the V4L2_SUBDEV_FORMAT_ACTIVE and V4L2_SUBDEV_FORMAT_TRY\n> definitions.\n> \n> The V4L2 symbols are defined as:\n> \n> \tV4L2_SUBDEV_FORMAT_TRY = 0,\n> \tV4L2_SUBDEV_FORMAT_ACTIVE = 1,\n> \n> While the libcamera defined enumeration is:\n> \n> \tenum Whence {\n> \t\tActiveFormat,\n> \t\tTryFormat,\n> \t}\n> \n> As V4L2Subdevice::Whence values are used to populate data types\n> defined in v4l2-subdev.h used as arguments to VIDIOC_SUBDEV_*\n> ioctls, the V4L2Subdevice class is required to adjust their value as:\n> \n>        subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n>                        : V4L2_SUBDEV_FORMAT_TRY;\n> \n> Drop the adjustment by defining :\n> \n> \tWhence::TryFormat = V4L2_SUBDEV_FORMAT_TRY;\n> \tWhence::ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE;\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/v4l2_subdevice.h | 6 ++++--\n>  src/libcamera/v4l2_subdevice.cpp            | 6 ++----\n>  2 files changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> index 6fda52ada41b..2db392d5e37a 100644\n> --- a/include/libcamera/internal/v4l2_subdevice.h\n> +++ b/include/libcamera/internal/v4l2_subdevice.h\n> @@ -13,6 +13,8 @@\n>  #include <string>\n>  #include <vector>\n>  \n> +#include <linux/v4l2-subdev.h>\n> +\n>  #include <libcamera/base/class.h>\n>  #include <libcamera/base/log.h>\n>  \n> @@ -44,8 +46,8 @@ public:\n>  \tusing Formats = std::map<unsigned int, std::vector<SizeRange>>;\n>  \n>  \tenum Whence {\n> -\t\tActiveFormat,\n> -\t\tTryFormat,\n> +\t\tTryFormat = V4L2_SUBDEV_FORMAT_TRY,\n> +\t\tActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,\n>  \t};\n>  \n>  \texplicit V4L2Subdevice(const MediaEntity *entity);\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 98a3911aa7df..37960b76a044 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -416,8 +416,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n>  \t\t\t     Whence whence)\n>  {\n>  \tstruct v4l2_subdev_format subdevFmt = {};\n> -\tsubdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n> -\t\t\t: V4L2_SUBDEV_FORMAT_TRY;\n> +\tsubdevFmt.which = whence;\n>  \tsubdevFmt.pad = pad;\n>  \n>  \tint ret = ioctl(VIDIOC_SUBDEV_G_FMT, &subdevFmt);\n> @@ -452,8 +451,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n>  \t\t\t     Whence whence)\n>  {\n>  \tstruct v4l2_subdev_format subdevFmt = {};\n> -\tsubdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n> -\t\t\t: V4L2_SUBDEV_FORMAT_TRY;\n> +\tsubdevFmt.which = whence;\n>  \tsubdevFmt.pad = pad;\n>  \tsubdevFmt.format.width = format->size.width;\n>  \tsubdevFmt.format.height = format->size.height;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 253B1BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Aug 2022 10:35:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D45D363313;\n\tTue,  2 Aug 2022 12:35:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B3280603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 12:35:38 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 50F8D25B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 12:35:38 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659436539;\n\tbh=GmNhrzYM1h7M9dm37Sb/kFg1PZJUVtDou36j5yag5g4=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=mC+Uz8/TNdzMwYDvSaptQXuYHnjalb8/Fff1pBtxz8W1GIScpf+ZOxAYFcrDxhxjj\n\tpB8QghlKbuB9v3o3Yy0IUTLWS7jazNx3/0YC0dg1JnZoGOisbpOxMjsZ8L15Lbto0F\n\tYpi/RbBA90RVeQzJTl63RXHSu0O8oLKDlGS5FikiN0ywHk/fPn0Ay4Br2y2KegeNYH\n\to0ahyRrOJMg4eAd86A1vOieBdE7oH3mOmX+m5giP7ev71m3fvCVh7K/Df8XlgF2NmG\n\tXem9xtXDaFW57ScIlJIT4KZEe/M+EAXXRhONOJyaWuyHss6RwoTZGRam152b+WTk1u\n\t32/TNXcHhHKOQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659436538;\n\tbh=GmNhrzYM1h7M9dm37Sb/kFg1PZJUVtDou36j5yag5g4=;\n\th=Date:From:To:Subject:References:In-Reply-To:From;\n\tb=eNwiXcLkzQECPSZppzeSVoMdyKQVk6MNQ1Hon4PzsTIk90RXw98MMTQh/2f4SDXrP\n\tYwcWiBNPx/IUAsqcmAATVDIMbSw5rIokrb0gMnrVMRlhvAJE59ya227bNdbS5FQHGD\n\tzCvYYBq/q/hUYsPEuUU/PYK9hgjq1JBav/cfJ9tY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"eNwiXcLk\"; dkim-atps=neutral","Date":"Tue, 2 Aug 2022 13:35:33 +0300","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<Yuj99ZyXzPc1YZUA@pendragon.ideasonboard.com>","References":"<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>\n\t<20220801000543.3501-7-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220801000543.3501-7-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: v4l2_subdevice:\n\tChange V4L2Subdevice::Whence","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24337,"web_url":"https://patchwork.libcamera.org/comment/24337/","msgid":"<165952770682.3981176.9040482793131482669@Monstersaurus>","date":"2022-08-03T11:55:06","subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: v4l2_subdevice:\n\tChange V4L2Subdevice::Whence","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2022-08-02 11:35:33)\n> Hi Jacopo,\n> \n> Thank you for the patch :-)\n> \n> On Mon, Aug 01, 2022 at 03:05:36AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> > From: Jacopo Mondi <jacopo@jmondi.org>\n> > \n> > The V4L2Subdevice::Whence enumerations defines two values that should\n> > correspond to the V4L2_SUBDEV_FORMAT_ACTIVE and V4L2_SUBDEV_FORMAT_TRY\n> > definitions.\n> > \n> > The V4L2 symbols are defined as:\n> > \n> >       V4L2_SUBDEV_FORMAT_TRY = 0,\n> >       V4L2_SUBDEV_FORMAT_ACTIVE = 1,\n> > \n> > While the libcamera defined enumeration is:\n> > \n> >       enum Whence {\n> >               ActiveFormat,\n> >               TryFormat,\n> >       }\n> > \n> > As V4L2Subdevice::Whence values are used to populate data types\n> > defined in v4l2-subdev.h used as arguments to VIDIOC_SUBDEV_*\n> > ioctls, the V4L2Subdevice class is required to adjust their value as:\n> > \n> >        subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n> >                        : V4L2_SUBDEV_FORMAT_TRY;\n> > \n> > Drop the adjustment by defining :\n> > \n> >       Whence::TryFormat = V4L2_SUBDEV_FORMAT_TRY;\n> >       Whence::ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE;\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThis makes sense to me too!\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> > ---\n> >  include/libcamera/internal/v4l2_subdevice.h | 6 ++++--\n> >  src/libcamera/v4l2_subdevice.cpp            | 6 ++----\n> >  2 files changed, 6 insertions(+), 6 deletions(-)\n> > \n> > diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\n> > index 6fda52ada41b..2db392d5e37a 100644\n> > --- a/include/libcamera/internal/v4l2_subdevice.h\n> > +++ b/include/libcamera/internal/v4l2_subdevice.h\n> > @@ -13,6 +13,8 @@\n> >  #include <string>\n> >  #include <vector>\n> >  \n> > +#include <linux/v4l2-subdev.h>\n> > +\n> >  #include <libcamera/base/class.h>\n> >  #include <libcamera/base/log.h>\n> >  \n> > @@ -44,8 +46,8 @@ public:\n> >       using Formats = std::map<unsigned int, std::vector<SizeRange>>;\n> >  \n> >       enum Whence {\n> > -             ActiveFormat,\n> > -             TryFormat,\n> > +             TryFormat = V4L2_SUBDEV_FORMAT_TRY,\n> > +             ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,\n> >       };\n> >  \n> >       explicit V4L2Subdevice(const MediaEntity *entity);\n> > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > index 98a3911aa7df..37960b76a044 100644\n> > --- a/src/libcamera/v4l2_subdevice.cpp\n> > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > @@ -416,8 +416,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n> >                            Whence whence)\n> >  {\n> >       struct v4l2_subdev_format subdevFmt = {};\n> > -     subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n> > -                     : V4L2_SUBDEV_FORMAT_TRY;\n> > +     subdevFmt.which = whence;\n> >       subdevFmt.pad = pad;\n> >  \n> >       int ret = ioctl(VIDIOC_SUBDEV_G_FMT, &subdevFmt);\n> > @@ -452,8 +451,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,\n> >                            Whence whence)\n> >  {\n> >       struct v4l2_subdev_format subdevFmt = {};\n> > -     subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE\n> > -                     : V4L2_SUBDEV_FORMAT_TRY;\n> > +     subdevFmt.which = whence;\n> >       subdevFmt.pad = pad;\n> >       subdevFmt.format.width = format->size.width;\n> >       subdevFmt.format.height = format->size.height;\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 97CAFC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Aug 2022 11:55:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1A84A63310;\n\tWed,  3 Aug 2022 13:55:11 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 153A5603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Aug 2022 13:55:10 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A020F30B;\n\tWed,  3 Aug 2022 13:55:09 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659527711;\n\tbh=Ezuc56wQTO9Gzwh890cl5lF7vsjzxJzZpIWN6oNsu8c=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=pQSvClUrL8o3Vr/NgGrlWAUkstLFUMwnFC+u8CwWrp5r79CAz+vc28NBIziPs/Fyd\n\tTEMuTHWIgBZ63pFr92uf79FfxNvj8VpEhP/MHjax+BxryDHwW4KxShKsSvSPfr0HN1\n\tAtJownenxbi27wPVFV93T50+CicaD0RfoElg5tGV8F5h3mn6J6yQj2IvDnhGQAx6oy\n\tpZ6wt7Rt6kXxrH9CMu1TH+4mWC+sYkZIuvy40/cigSC38B3NaZxa8zEQyznFSjycsN\n\tiYKo1/QqO1UahBU70bjCi1UeqtnEuQiybyvnMhbRSo78mTTpe4D3MNQGxzr2obS1Fi\n\t1Rr0SUsnGVZDQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659527709;\n\tbh=Ezuc56wQTO9Gzwh890cl5lF7vsjzxJzZpIWN6oNsu8c=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=uBMS198wHRfJtJeRW+V58U4WDDVhzKd+hQCuwB8r1tQG2buLkYHnsWQOHLONQYL73\n\tT8HBSVZVavBP7nmMif86NzmnujdAR/wtUXAi5oYqhB003/A9rAgEQcZ91MVvLzz7ko\n\txL7wSP/JekbaTaHVInihiO0PK/yGqRXaMV9t1NjE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uBMS198w\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<Yuj99ZyXzPc1YZUA@pendragon.ideasonboard.com>","References":"<20220801000543.3501-1-laurent.pinchart@ideasonboard.com>\n\t<20220801000543.3501-7-laurent.pinchart@ideasonboard.com>\n\t<Yuj99ZyXzPc1YZUA@pendragon.ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 03 Aug 2022 12:55:06 +0100","Message-ID":"<165952770682.3981176.9040482793131482669@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: v4l2_subdevice:\n\tChange V4L2Subdevice::Whence","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]