[{"id":14505,"web_url":"https://patchwork.libcamera.org/comment/14505/","msgid":"<X/uLKWuvpLmUwuvo@pendragon.ideasonboard.com>","date":"2021-01-10T23:18:01","subject":"Re: [libcamera-devel] [PATCH 06/12] libcamera: ipu3: Initialize\n\tScalerCropMaximum property","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 08:05:16PM +0100, Jacopo Mondi wrote:\n> Initialize the camera properties by registering the sensor provided\n\ns/sensor provided/sensor-provided/\n\n> ones and the ScalerCropMaximum property computed by the pipeline\n> handler by using the analogue crop rectangle of the sensor resolution.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 43 +++++++++++++++++++++++++++-\n>  1 file changed, 42 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 879057dab328..418301b33a5e 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -14,6 +14,7 @@\n>  #include <libcamera/camera.h>\n>  #include <libcamera/control_ids.h>\n>  #include <libcamera/formats.h>\n> +#include <libcamera/property_ids.h>\n>  #include <libcamera/request.h>\n>  #include <libcamera/stream.h>\n>  \n> @@ -121,6 +122,7 @@ private:\n>  \t\t\tPipelineHandler::cameraData(camera));\n>  \t}\n>  \n> +\tint initProperties(IPU3CameraData *data);\n>  \tint initControls(IPU3CameraData *data);\n>  \tint registerCameras();\n>  \n> @@ -734,6 +736,43 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n>  \treturn ret == 0;\n>  }\n>  \n> +/*\n> + * \\brief Initialize the camera properties\n> + * \\param[in] data The camera data\n> + *\n> + * Initialize the camera properties by registering the pipeline handler\n> + * ones along with the properties assembled by inspecting the sensor\n> + * capabilities.\n\nThat seems to be a copy&paste from patch 03/12, and doesn't really match\nthe implementation. How about the following ?\n\n * Initialize the camera properties by combining the properties reported by the\n * camera sensor with pipeline properties dynamically created based on device\n * capabilities.\n\nOr something along those lines.\n\n> + *\n> + * \\return 0 on success or a negative error code for error\n\ns/for error/otherwise/\n\n> + */\n> +int PipelineHandlerIPU3::initProperties(IPU3CameraData *data)\n> +{\n> +\tCameraSensor *sensor = data->cio2_.sensor();\n> +\tdata->properties_ = sensor->properties();\n> +\n> +\t/*\n> +\t * \\todo The ScalerCropMaximum property depends on the sensor\n> +\t * configuration. Initialize the property using the analogue crop\n> +\t * rectangle of the largest sensor resolution. To be updated later when\n> +\t * a new one is applied.\n> +\t */\n> +\tV4L2SubdeviceFormat format;\n> +\tformat.size = sensor->resolution();\n> +\tint ret = sensor->setFormat(&format);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tCameraSensorInfo sensorInfo{};\n> +\tret = sensor->sensorInfo(&sensorInfo);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tdata->properties_.set(properties::ScalerCropMaximum, sensorInfo.analogCrop);\n\nUnless I'm mistaken, you don't use this property in the HAL. How about\nhandling it the same way as in the RPi pipeline handler, initializing it\nto Rectangle{} here, and updating it in configure() ? That's not great,\nbut it will be easier (I think) to improve the implementation if all\npipeline handlers implement the same hack.\n\n> +\n> +\treturn 0;\n> +}\n> +\n>  /*\n>   * \\brief Initialize the camera controls\n>   * \\param[in] data The camera data\n> @@ -831,7 +870,9 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\t\tcontinue;\n>  \n>  \t\t/* Initialize the camera properties. */\n> -\t\tdata->properties_ = cio2->sensor()->properties();\n> +\t\tret = initProperties(data.get());\n> +\t\tif (ret)\n> +\t\t\tcontinue;\n>  \n>  \t\tret = initControls(data.get());\n>  \t\tif (ret)","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 66D7EBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 10 Jan 2021 23:18:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D82BC68082;\n\tMon, 11 Jan 2021 00:18:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBEF960317\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jan 2021 00:18:15 +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 4C4C6EC;\n\tMon, 11 Jan 2021 00:18:15 +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=\"kaeU+DHb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1610320695;\n\tbh=yp+kA86ZLiXOviX+8V35NrMKf+7RI9PDuGFuslUhJ4k=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kaeU+DHbOTi9Pgoe7XKijQb+ipzzl07eYz/mQ4+lwNLdrONCg+QO45pA1iRw0ox+A\n\tb9Mot/BwRMU2rU3lEd3OtFB62hRHCAhN+y4qgyG68HrnwM3htvXRsQEpRgnLss1X9s\n\t1rN5tIhB5pvK9A3v/e/ztgOs9P3r1mwkX0zW9R08=","Date":"Mon, 11 Jan 2021 01:18:01 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X/uLKWuvpLmUwuvo@pendragon.ideasonboard.com>","References":"<20210105190522.682324-1-jacopo@jmondi.org>\n\t<20210105190522.682324-7-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210105190522.682324-7-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 06/12] libcamera: ipu3: Initialize\n\tScalerCropMaximum property","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>"}}]