[{"id":23970,"web_url":"https://patchwork.libcamera.org/comment/23970/","msgid":"<20220719155432.wo7qcpjsat74gkx4@uno.localdomain>","date":"2022-07-19T15:54:32","subject":"Re: [libcamera-devel] [RFC PATCH 1/2] libcamera: v4l2_videodevice:\n\tGet formats even if no framesizes","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Paul,\n\nOn Tue, Jul 19, 2022 at 09:10:02PM +0900, Paul Elder via libcamera-devel wrote:\n> V4L2VideoDevice::formats() returns an empty list of formats if enumSizes\n> fails, including if the driver doesn't implement ENUM_FRAMESIZES.\n>\n> Add an optional ignoreSizes parameter to formats() so that it can still\n> be used when the pipeline handler knows that its driver doesn't\n> implement ENUM_FRAMESIZES.\n\nI think we shall require drivers to implement ENUM_FRAMESIZES, instead\nof allowing them to ignore it.\n\nI'm surprised the rkisp1 capture device does not support\n.vidioc_enum_framesizes(). Should that be fixed in the driver ?\n\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  include/libcamera/internal/v4l2_videodevice.h |  2 +-\n>  src/libcamera/v4l2_videodevice.cpp            | 12 ++++++++----\n>  2 files changed, 9 insertions(+), 5 deletions(-)\n>\n> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> index 8525acbc..6cc9be85 100644\n> --- a/include/libcamera/internal/v4l2_videodevice.h\n> +++ b/include/libcamera/internal/v4l2_videodevice.h\n> @@ -205,7 +205,7 @@ public:\n>  \tint getFormat(V4L2DeviceFormat *format);\n>  \tint tryFormat(V4L2DeviceFormat *format);\n>  \tint setFormat(V4L2DeviceFormat *format);\n> -\tFormats formats(uint32_t code = 0);\n> +\tFormats formats(uint32_t code = 0, bool ignoreSizes = false);\n>\n>  \tint setSelection(unsigned int target, Rectangle *rect);\n>\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 63911339..b8bd4bc4 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1045,14 +1045,18 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n>   *\n>   * \\return A list of the supported video device formats\n>   */\n> -V4L2VideoDevice::Formats V4L2VideoDevice::formats(uint32_t code)\n> +V4L2VideoDevice::Formats V4L2VideoDevice::formats(uint32_t code, bool ignoreSizes)\n>  {\n>  \tFormats formats;\n>\n>  \tfor (V4L2PixelFormat pixelFormat : enumPixelformats(code)) {\n> -\t\tstd::vector<SizeRange> sizes = enumSizes(pixelFormat);\n> -\t\tif (sizes.empty())\n> -\t\t\treturn {};\n> +\t\tstd::vector<SizeRange> sizes;\n> +\n> +\t\tif (!ignoreSizes) {\n> +\t\t\tsizes = enumSizes(pixelFormat);\n> +\t\t\tif (sizes.empty())\n> +\t\t\t\treturn {};\n> +\t\t}\n>\n>  \t\tif (formats.find(pixelFormat) != formats.end()) {\n>  \t\t\tLOG(V4L2, Error)\n> --\n> 2.30.2\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 6AF08BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jul 2022 15:54:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF57E63312;\n\tTue, 19 Jul 2022 17:54:35 +0200 (CEST)","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 E581D603F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jul 2022 17:54:34 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 6EFB32000E;\n\tTue, 19 Jul 2022 15:54:34 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658246075;\n\tbh=b5Rmyxm/7tzWe4cWL6AKDar4DdlJh0m2/22YWKPeg20=;\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:Cc:\n\tFrom;\n\tb=nYDC7GyNJ5FF/ozp7s6o0zSPCOTBGN5kORCIefsolk1+eV7+wJove8vWvgVdGxoih\n\tmkjKezaB291sB6J0hEOzt9pCHq4iS283jyiVBdXERgabwpeKOt6tcgPUtGHrXwSaA6\n\tsHWIjk04oaAkyR42rUKJGHi+oAXH3sdyIEoDZykBGnGa2AwGbR0DitJrbguJ4jRZGq\n\t6UptBjQuHAjuOCt8dq+Ho0fs2udYLaan4cUN4jV24kWw6GRv8VZD6mtFGe0zfHsisO\n\t6sli2xP369DlJwqfLnvrsDKFdNjYe24JYfd/ic0Eh4UkHoN6ssPz7YoIuuWl5GxGmk\n\tkQ9WpaNaBlMIg==","Date":"Tue, 19 Jul 2022 17:54:32 +0200","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20220719155432.wo7qcpjsat74gkx4@uno.localdomain>","References":"<20220719121003.1829916-1-paul.elder@ideasonboard.com>\n\t<20220719121003.1829916-2-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220719121003.1829916-2-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 1/2] libcamera: v4l2_videodevice:\n\tGet formats even if no framesizes","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23976,"web_url":"https://patchwork.libcamera.org/comment/23976/","msgid":"<Ytcj1hkvuhzUTW0X@pendragon.ideasonboard.com>","date":"2022-07-19T21:36:22","subject":"Re: [libcamera-devel] [RFC PATCH 1/2] libcamera: v4l2_videodevice:\n\tGet formats even if no framesizes","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello,\n\nOn Tue, Jul 19, 2022 at 05:54:32PM +0200, Jacopo Mondi via libcamera-devel wrote:\n> On Tue, Jul 19, 2022 at 09:10:02PM +0900, Paul Elder via libcamera-devel wrote:\n> > V4L2VideoDevice::formats() returns an empty list of formats if enumSizes\n> > fails, including if the driver doesn't implement ENUM_FRAMESIZES.\n> >\n> > Add an optional ignoreSizes parameter to formats() so that it can still\n> > be used when the pipeline handler knows that its driver doesn't\n> > implement ENUM_FRAMESIZES.\n> \n> I think we shall require drivers to implement ENUM_FRAMESIZES, instead\n> of allowing them to ignore it.\n> \n> I'm surprised the rkisp1 capture device does not support\n> .vidioc_enum_framesizes(). Should that be fixed in the driver ?\n\nGood question. It should be fairly easy, as it should report a single\nrange with the min/max values corresponding to the absolute limits of\nthe hardware, and it would allow deferring the question of whether or\nnot we require all drivers to report sizes (as well as the bikeshedding\non the bool argument to formats() :-)).\n\n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > ---\n> >  include/libcamera/internal/v4l2_videodevice.h |  2 +-\n> >  src/libcamera/v4l2_videodevice.cpp            | 12 ++++++++----\n> >  2 files changed, 9 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\n> > index 8525acbc..6cc9be85 100644\n> > --- a/include/libcamera/internal/v4l2_videodevice.h\n> > +++ b/include/libcamera/internal/v4l2_videodevice.h\n> > @@ -205,7 +205,7 @@ public:\n> >  \tint getFormat(V4L2DeviceFormat *format);\n> >  \tint tryFormat(V4L2DeviceFormat *format);\n> >  \tint setFormat(V4L2DeviceFormat *format);\n> > -\tFormats formats(uint32_t code = 0);\n> > +\tFormats formats(uint32_t code = 0, bool ignoreSizes = false);\n> >\n> >  \tint setSelection(unsigned int target, Rectangle *rect);\n> >\n> > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > index 63911339..b8bd4bc4 100644\n> > --- a/src/libcamera/v4l2_videodevice.cpp\n> > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > @@ -1045,14 +1045,18 @@ int V4L2VideoDevice::trySetFormatSingleplane(V4L2DeviceFormat *format, bool set)\n> >   *\n> >   * \\return A list of the supported video device formats\n> >   */\n> > -V4L2VideoDevice::Formats V4L2VideoDevice::formats(uint32_t code)\n> > +V4L2VideoDevice::Formats V4L2VideoDevice::formats(uint32_t code, bool ignoreSizes)\n> >  {\n> >  \tFormats formats;\n> >\n> >  \tfor (V4L2PixelFormat pixelFormat : enumPixelformats(code)) {\n> > -\t\tstd::vector<SizeRange> sizes = enumSizes(pixelFormat);\n> > -\t\tif (sizes.empty())\n> > -\t\t\treturn {};\n> > +\t\tstd::vector<SizeRange> sizes;\n> > +\n> > +\t\tif (!ignoreSizes) {\n> > +\t\t\tsizes = enumSizes(pixelFormat);\n> > +\t\t\tif (sizes.empty())\n> > +\t\t\t\treturn {};\n> > +\t\t}\n> >\n> >  \t\tif (formats.find(pixelFormat) != formats.end()) {\n> >  \t\t\tLOG(V4L2, Error)","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 3C176BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jul 2022 21:36:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A0A2463312;\n\tTue, 19 Jul 2022 23:36:58 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 102D1603F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jul 2022 23:36:57 +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 667426EE;\n\tTue, 19 Jul 2022 23:36:56 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658266618;\n\tbh=AFYACO7zv3MJ04e5TQWyfk0SZtB8XmTu4H+KPPpqAxE=;\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:Cc:\n\tFrom;\n\tb=HFEgIF70AZUo67rNgE23WLa4QBBY2aMlsVnin85FLSK1nJsJnhPjnz+nIQDI6HvXu\n\tpW5F5TTp/7cFmQh+gN1gEDIvalrralOztjG9VXZZdAIIttIkGljv7vNx1SmbC1LzyT\n\tQ84mEdKzvo3VJRvtRyqYZ90HuPiAYLrGjnxd66et4b8a9dFcK9KUm5Up15P8S6h3Xi\n\tp8/pfN7ntnk8ObYYRJc/rX5W3o6umzQqkbmsar3ZI0F4nUp3BDS2FFS3NqpmxsP8Zz\n\tVIQewIDQoj4AhIpB6cZMnFlUh14FWca46yJcnFwrrpP4XquLAERiTwcofIcBNyPX2/\n\tKTPMruy9SkqwA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658266616;\n\tbh=AFYACO7zv3MJ04e5TQWyfk0SZtB8XmTu4H+KPPpqAxE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ehSZSSrB5pn3CdEpdKvhK5aQd30+KpjGtrRq0viYt9CsYJNSJyHXZwR9nKLE2UlWW\n\tpWsqtyK/HSv8jD7v16JbabIo3A+/09W1iaObA6cisW/F1QdFHuzvQknvedeo+eaK/Q\n\tw+WkZJMeg0uBk2rruxHMpuDJVDi8SCyItfFeVd/g="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ehSZSSrB\"; dkim-atps=neutral","Date":"Wed, 20 Jul 2022 00:36:22 +0300","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<Ytcj1hkvuhzUTW0X@pendragon.ideasonboard.com>","References":"<20220719121003.1829916-1-paul.elder@ideasonboard.com>\n\t<20220719121003.1829916-2-paul.elder@ideasonboard.com>\n\t<20220719155432.wo7qcpjsat74gkx4@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220719155432.wo7qcpjsat74gkx4@uno.localdomain>","Subject":"Re: [libcamera-devel] [RFC PATCH 1/2] libcamera: v4l2_videodevice:\n\tGet formats even if no framesizes","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]