[{"id":26990,"web_url":"https://patchwork.libcamera.org/comment/26990/","msgid":"<20230428123244.GC13163@pendragon.ideasonboard.com>","date":"2023-04-28T12:32:44","subject":"Re: [libcamera-devel] [PATCH v3 4/6] libcamera: camera_sensor: Add\n\ttryFormat()","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 Thu, Apr 27, 2023 at 04:47:38PM +0200, Jacopo Mondi via libcamera-devel wrote:\n> Add a function to the CameraSensor class that allows to test a format\n> without applying it to the subdevice and without modifying any control\n> value associated with the camera sensor.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  include/libcamera/internal/camera_sensor.h |  1 +\n>  src/libcamera/camera_sensor.cpp            | 17 +++++++++++++++++\n>  2 files changed, 18 insertions(+)\n> \n> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\n> index 928c61af7f4e..02c77ab037da 100644\n> --- a/include/libcamera/internal/camera_sensor.h\n> +++ b/include/libcamera/internal/camera_sensor.h\n> @@ -56,6 +56,7 @@ public:\n>  \t\t\t\t      const Size &size) const;\n>  \tint setFormat(V4L2SubdeviceFormat *format,\n>  \t\t      Transform transform = Transform::Identity);\n> +\tint tryFormat(V4L2SubdeviceFormat *format) const;\n>  \n>  \tconst ControlInfoMap &controls() const;\n>  \tControlList getControls(const std::vector<uint32_t> &ids);\n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index e442b89dacd0..06f315210240 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -795,6 +795,23 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform)\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\brief Try the sensor output format\n> + * \\param[in] format The desired sensor output format\n> + *\n> + * The ranges of any controls associated with the sensor are not updated.\n> + *\n> + * \\todo Add support for Transform by changing the format's Bayer ordering\n> + * before calling subdev_->setFormat().\n\nI'd rather fix the kernel API to handle flips in a saner way :-) We'll\nworry about this later, for now,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int CameraSensor::tryFormat(V4L2SubdeviceFormat *format) const\n> +{\n> +\treturn subdev_->setFormat(pad_, format,\n> +\t\t\t\t  V4L2Subdevice::Whence::TryFormat);\n> +}\n> +\n>  /**\n>   * \\brief Retrieve the supported V4L2 controls and their information\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 29E63BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Apr 2023 12:32:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 554A4627DF;\n\tFri, 28 Apr 2023 14:32:35 +0200 (CEST)","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 8CCD1627D3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Apr 2023 14:32:34 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(133-32-181-51.west.xps.vectant.ne.jp [133.32.181.51])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DA3EA7FC;\n\tFri, 28 Apr 2023 14:32:20 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1682685155;\n\tbh=jVE3+uC/GaJndNBPUHACRs8w/j8OhQC6INkwWG2h8tM=;\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=QAYyCv8f4kavWmFqoXDxEzLKQmwagHJkPYIBvTOXcwo9JcqM4jM840CVdduImYgWy\n\tqcLQrs0wYCTxUmIZ10aELfeTDipnIFIERSLdawArKM2EKCiz6/BJR5YY7h4WS3L0ZA\n\tvcq2TASQoRNqQkifiOfYd/n0itu/V2X82Shry81JH6Tsy+f5qLTiCarxFKgbCSckea\n\tijsJ6l1u+qq+t7i5wTSXlAMGU4ExFebA4liDmAGjDqJxmwNBMQXboOHW1RndCZATkb\n\twrWkH26w0oIo4UIskzBJYkGCae1CUTdx5pscJpVfdjqfoc4rhtrb+FTC2VyXi9b9gq\n\tiZRpv1E1aMLbw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1682685141;\n\tbh=jVE3+uC/GaJndNBPUHACRs8w/j8OhQC6INkwWG2h8tM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oapYWJhZEseaDXbOC22mpWAeFvOecraV9qsdn0dK3m7QdvSTPUL6W+WZNO+D2/qQS\n\tnTO38bW425si/4hQtGlKkFLQKvRvLFQkuaQaOMyrtRl6Ouju+mCi0fDZo3kH6qCOA5\n\ttxHhhxQHK2UTDZgM91MXyoJ+y6qDNvPuxjd3mX6w="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"oapYWJhZ\"; dkim-atps=neutral","Date":"Fri, 28 Apr 2023 15:32:44 +0300","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Message-ID":"<20230428123244.GC13163@pendragon.ideasonboard.com>","References":"<20230427144740.64075-1-jacopo.mondi@ideasonboard.com>\n\t<20230427144740.64075-5-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230427144740.64075-5-jacopo.mondi@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 4/6] libcamera: camera_sensor: Add\n\ttryFormat()","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>"}}]