[{"id":14448,"web_url":"https://patchwork.libcamera.org/comment/14448/","msgid":"<X/Rgzct3sMUDxSsN@pendragon.ideasonboard.com>","date":"2021-01-05T12:51:25","subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","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 Tue, Jan 05, 2021 at 01:31:25PM +0100, Jacopo Mondi wrote:\n> Initialize the pixel array properties in the UVC pipeline handler as\n> they're now initialized in the CameraSensor class, which the UVC\n> pipeline handler does not ue.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index 7cb310e20511..1efced949762 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -509,6 +509,19 @@ int UVCCameraData::init(MediaDevice *media)\n>  \tproperties_.set(properties::Location, properties::CameraLocationExternal);\n>  \tproperties_.set(properties::Model, utils::toAscii(media->model()));\n>  \n> +\t/*\n> +\t * Get the current format in order to initialize the sensor array\n> +\t * properties.\n> +\t */\n\nCould we use the largest format instead ? Otherwise, if the current\nformat isn't the largest, we'll end up with a pixel array size that is\nsmaller than what the camera could produce.\n\nOther than that this is exactly what I had in mind.\n\n> +\tV4L2DeviceFormat format;\n> +\tret = video_->getFormat(&format);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tproperties_.set(properties::PixelArraySize, format.size);\n> +\tproperties_.set(properties::PixelArrayActiveAreas,\n> +\t\t\t{ Rectangle(format.size) });\n> +\n>  \t/* Initialise the supported controls. */\n>  \tControlInfoMap::Map ctrls;\n>","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 576A9C0F1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Jan 2021 12:51:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE13962012;\n\tTue,  5 Jan 2021 13:51:39 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9088462012\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Jan 2021 13:51:38 +0100 (CET)","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 ECB403D7;\n\tTue,  5 Jan 2021 13:51:37 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Z00r6w7J\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1609851098;\n\tbh=BGe+yQyZRlhJ/o2uJOXVbBq1EYZfTvUcnL+hqNwetMw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Z00r6w7JOdASuidcjQ5/4y4ulmm/ObExkJ1IXlb72PDSVeDDFmsa3Q9FGbldZbo03\n\tm5Rv9sBCqEniTZmbNugbviVdx8DzrKrFzfoxE3+VimQaErPoipdvVxRvGBnSdQV7i9\n\toJ7/sOmLsYlV0gb5uVqcdqFkTp+uQApRMyHl6gZI=","Date":"Tue, 5 Jan 2021 14:51:25 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X/Rgzct3sMUDxSsN@pendragon.ideasonboard.com>","References":"<20210105123128.617543-1-jacopo@jmondi.org>\n\t<20210105123128.617543-8-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210105123128.617543-8-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14450,"web_url":"https://patchwork.libcamera.org/comment/14450/","msgid":"<20210105134503.fmw4nq2mv7qo67pe@uno.localdomain>","date":"2021-01-05T13:45:03","subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Tue, Jan 05, 2021 at 02:51:25PM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Tue, Jan 05, 2021 at 01:31:25PM +0100, Jacopo Mondi wrote:\n> > Initialize the pixel array properties in the UVC pipeline handler as\n> > they're now initialized in the CameraSensor class, which the UVC\n> > pipeline handler does not ue.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 +++++++++++++\n> >  1 file changed, 13 insertions(+)\n> >\n> > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > index 7cb310e20511..1efced949762 100644\n> > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > @@ -509,6 +509,19 @@ int UVCCameraData::init(MediaDevice *media)\n> >  \tproperties_.set(properties::Location, properties::CameraLocationExternal);\n> >  \tproperties_.set(properties::Model, utils::toAscii(media->model()));\n> >\n> > +\t/*\n> > +\t * Get the current format in order to initialize the sensor array\n> > +\t * properties.\n> > +\t */\n>\n> Could we use the largest format instead ? Otherwise, if the current\n> format isn't the largest, we'll end up with a pixel array size that is\n> smaller than what the camera could produce.\n>\n\nI (wrongly) assumed the default size is usually the largest available\none.\n\nWould something like:\n\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -8,6 +8,7 @@\n #include <algorithm>\n #include <fstream>\n #include <iomanip>\n+#include <limits>\n #include <math.h>\n #include <memory>\n #include <tuple>\n@@ -514,6 +515,8 @@ int UVCCameraData::init(MediaDevice *media)\n         * properties.\n         */\n        V4L2DeviceFormat format;\n+       format.size.width = std::numeric_limits<unsigned int>::max();\n+       format.size.height = format.size.width;\n        ret = video_->getFormat(&format);\n        if (ret)\n                return ret;\n\nwork better ?\n\n> Other than that this is exactly what I had in mind.\n>\n> > +\tV4L2DeviceFormat format;\n> > +\tret = video_->getFormat(&format);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tproperties_.set(properties::PixelArraySize, format.size);\n> > +\tproperties_.set(properties::PixelArrayActiveAreas,\n> > +\t\t\t{ Rectangle(format.size) });\n> > +\n> >  \t/* Initialise the supported controls. */\n> >  \tControlInfoMap::Map ctrls;\n> >\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 12863C0F1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Jan 2021 13:44:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A181A625AC;\n\tTue,  5 Jan 2021 14:44:50 +0100 (CET)","from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76FF062012\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Jan 2021 14:44:49 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id D9BC2240003;\n\tTue,  5 Jan 2021 13:44:48 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 5 Jan 2021 14:45:03 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210105134503.fmw4nq2mv7qo67pe@uno.localdomain>","References":"<20210105123128.617543-1-jacopo@jmondi.org>\n\t<20210105123128.617543-8-jacopo@jmondi.org>\n\t<X/Rgzct3sMUDxSsN@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<X/Rgzct3sMUDxSsN@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14461,"web_url":"https://patchwork.libcamera.org/comment/14461/","msgid":"<X/Z7ZgUqS/RjfHIF@pendragon.ideasonboard.com>","date":"2021-01-07T03:09:26","subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Tue, Jan 05, 2021 at 02:45:03PM +0100, Jacopo Mondi wrote:\n> On Tue, Jan 05, 2021 at 02:51:25PM +0200, Laurent Pinchart wrote:\n> > On Tue, Jan 05, 2021 at 01:31:25PM +0100, Jacopo Mondi wrote:\n> > > Initialize the pixel array properties in the UVC pipeline handler as\n> > > they're now initialized in the CameraSensor class, which the UVC\n> > > pipeline handler does not ue.\n> > >\n> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > ---\n> > >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 +++++++++++++\n> > >  1 file changed, 13 insertions(+)\n> > >\n> > > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > index 7cb310e20511..1efced949762 100644\n> > > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > @@ -509,6 +509,19 @@ int UVCCameraData::init(MediaDevice *media)\n> > >  \tproperties_.set(properties::Location, properties::CameraLocationExternal);\n> > >  \tproperties_.set(properties::Model, utils::toAscii(media->model()));\n> > >\n> > > +\t/*\n> > > +\t * Get the current format in order to initialize the sensor array\n> > > +\t * properties.\n> > > +\t */\n> >\n> > Could we use the largest format instead ? Otherwise, if the current\n> > format isn't the largest, we'll end up with a pixel array size that is\n> > smaller than what the camera could produce.\n> >\n> \n> I (wrongly) assumed the default size is usually the largest available\n> one.\n> \n> Would something like:\n> \n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -8,6 +8,7 @@\n>  #include <algorithm>\n>  #include <fstream>\n>  #include <iomanip>\n> +#include <limits>\n>  #include <math.h>\n>  #include <memory>\n>  #include <tuple>\n> @@ -514,6 +515,8 @@ int UVCCameraData::init(MediaDevice *media)\n>          * properties.\n>          */\n>         V4L2DeviceFormat format;\n> +       format.size.width = std::numeric_limits<unsigned int>::max();\n> +       format.size.height = format.size.width;\n>         ret = video_->getFormat(&format);\n>         if (ret)\n>                 return ret;\n> \n> work better ?\n\nThat won't change anything, getFormat() retrieves the current format,\nthe format argument is output only. tryFormat() would be an option, but\nit will only give you the largest size for the default pixel format. The\nbest option is to retrieve the largest size from video_->formats().\n\n> > Other than that this is exactly what I had in mind.\n> >\n> > > +\tV4L2DeviceFormat format;\n> > > +\tret = video_->getFormat(&format);\n> > > +\tif (ret)\n> > > +\t\treturn ret;\n> > > +\n> > > +\tproperties_.set(properties::PixelArraySize, format.size);\n> > > +\tproperties_.set(properties::PixelArrayActiveAreas,\n> > > +\t\t\t{ Rectangle(format.size) });\n> > > +\n> > >  \t/* Initialise the supported controls. */\n> > >  \tControlInfoMap::Map ctrls;\n> > >","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 F2292C0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 Jan 2021 03:09:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 895E3631AC;\n\tThu,  7 Jan 2021 04:09:40 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 617C66010E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 Jan 2021 04:09:39 +0100 (CET)","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 C9C722E0;\n\tThu,  7 Jan 2021 04:09:38 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OF6Oa5Iu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1609988979;\n\tbh=am1z0QprI9HfJvy4tu+SgdjL/z1uj3zLJ7ejupOKAV8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OF6Oa5IuoDtKjnHrpIOR90WuyW5P479x+8+xzXxn6QnOvd1s2gmAXfW6vYg90CuNM\n\t9gvuo2hpObMG6xYRduEp0fgkJuC1F5iqhi5L0WWyMUp41sRCR/uR37c9AVxa99Yjqj\n\tTDHIRcRvWcP/483Z77JDZant1bggn9vL5nFZ3iEk=","Date":"Thu, 7 Jan 2021 05:09:26 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X/Z7ZgUqS/RjfHIF@pendragon.ideasonboard.com>","References":"<20210105123128.617543-1-jacopo@jmondi.org>\n\t<20210105123128.617543-8-jacopo@jmondi.org>\n\t<X/Rgzct3sMUDxSsN@pendragon.ideasonboard.com>\n\t<20210105134503.fmw4nq2mv7qo67pe@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210105134503.fmw4nq2mv7qo67pe@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14464,"web_url":"https://patchwork.libcamera.org/comment/14464/","msgid":"<20210107074219.osipklkeyimg7u7f@uno.localdomain>","date":"2021-01-07T07:42:19","subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Thu, Jan 07, 2021 at 05:09:26AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> On Tue, Jan 05, 2021 at 02:45:03PM +0100, Jacopo Mondi wrote:\n> > On Tue, Jan 05, 2021 at 02:51:25PM +0200, Laurent Pinchart wrote:\n> > > On Tue, Jan 05, 2021 at 01:31:25PM +0100, Jacopo Mondi wrote:\n> > > > Initialize the pixel array properties in the UVC pipeline handler as\n> > > > they're now initialized in the CameraSensor class, which the UVC\n> > > > pipeline handler does not ue.\n> > > >\n> > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > > ---\n> > > >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 +++++++++++++\n> > > >  1 file changed, 13 insertions(+)\n> > > >\n> > > > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > > index 7cb310e20511..1efced949762 100644\n> > > > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > > @@ -509,6 +509,19 @@ int UVCCameraData::init(MediaDevice *media)\n> > > >  \tproperties_.set(properties::Location, properties::CameraLocationExternal);\n> > > >  \tproperties_.set(properties::Model, utils::toAscii(media->model()));\n> > > >\n> > > > +\t/*\n> > > > +\t * Get the current format in order to initialize the sensor array\n> > > > +\t * properties.\n> > > > +\t */\n> > >\n> > > Could we use the largest format instead ? Otherwise, if the current\n> > > format isn't the largest, we'll end up with a pixel array size that is\n> > > smaller than what the camera could produce.\n> > >\n> >\n> > I (wrongly) assumed the default size is usually the largest available\n> > one.\n> >\n> > Would something like:\n> >\n> > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > @@ -8,6 +8,7 @@\n> >  #include <algorithm>\n> >  #include <fstream>\n> >  #include <iomanip>\n> > +#include <limits>\n> >  #include <math.h>\n> >  #include <memory>\n> >  #include <tuple>\n> > @@ -514,6 +515,8 @@ int UVCCameraData::init(MediaDevice *media)\n> >          * properties.\n> >          */\n> >         V4L2DeviceFormat format;\n> > +       format.size.width = std::numeric_limits<unsigned int>::max();\n> > +       format.size.height = format.size.width;\n> >         ret = video_->getFormat(&format);\n> >         if (ret)\n> >                 return ret;\n> >\n> > work better ?\n>\n> That won't change anything, getFormat() retrieves the current format,\n> the format argument is output only. tryFormat() would be an option, but\n> it will only give you the largest size for the default pixel format. The\n> best option is to retrieve the largest size from video_->formats().\n\nOuch, I mean 'setFormat()' with a V4L2DeviceFormat with sizes =\nMAX_INT. But as you suggested, that would work for the current\npixelformat only.\n\nLooking into the formats() map might be a better option.\n\nThanks\n   j\n\n>\n> > > Other than that this is exactly what I had in mind.\n> > >\n> > > > +\tV4L2DeviceFormat format;\n> > > > +\tret = video_->getFormat(&format);\n> > > > +\tif (ret)\n> > > > +\t\treturn ret;\n> > > > +\n> > > > +\tproperties_.set(properties::PixelArraySize, format.size);\n> > > > +\tproperties_.set(properties::PixelArrayActiveAreas,\n> > > > +\t\t\t{ Rectangle(format.size) });\n> > > > +\n> > > >  \t/* Initialise the supported controls. */\n> > > >  \tControlInfoMap::Map ctrls;\n> > > >\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 1C044C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 Jan 2021 07:42:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7ACD5631D0;\n\tThu,  7 Jan 2021 08:42:06 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C44536010E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 Jan 2021 08:42:04 +0100 (CET)","from uno.localdomain (mob-31-157-123-127.net.vodafone.it\n\t[31.157.123.127]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 13E122000D;\n\tThu,  7 Jan 2021 07:42:03 +0000 (UTC)"],"X-Originating-IP":"31.157.123.127","Date":"Thu, 7 Jan 2021 08:42:19 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210107074219.osipklkeyimg7u7f@uno.localdomain>","References":"<20210105123128.617543-1-jacopo@jmondi.org>\n\t<20210105123128.617543-8-jacopo@jmondi.org>\n\t<X/Rgzct3sMUDxSsN@pendragon.ideasonboard.com>\n\t<20210105134503.fmw4nq2mv7qo67pe@uno.localdomain>\n\t<X/Z7ZgUqS/RjfHIF@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<X/Z7ZgUqS/RjfHIF@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize\n\tthe pixel array properties","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]