[{"id":32287,"web_url":"https://patchwork.libcamera.org/comment/32287/","msgid":"<dcmwl2pq3mf7sqcvp3nmzjjxgucy4uoieuanb2hxlyfzopiabm@hzmrb7i4shua>","date":"2024-11-19T16:02:39","subject":"Re: [PATCH v4 2/2] libcamera: pipelines: Draw control delays from\n\tCameraSensor properties","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Dan\n\nOn Tue, Nov 19, 2024 at 01:03:01PM +0000, Daniel Scally wrote:\n> Rather than hard coding default delays for control values in the\n> pipeline handlers, pick up the ones defined in the CameraSensor\n> properties.\n>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n> Changes in v4:\n>\n> \t- Used the struct reference rather than values directly\n>\n> Changes in v3:\n>\n> \t- Fixed some broken alignment\n>\n> Changes in v2:\n>\n> \t- Switched to use the new getSensorDelays() function\n>\n>  src/libcamera/pipeline/ipu3/ipu3.cpp     | 10 +++-------\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++++-------\n>  src/libcamera/pipeline/simple/simple.cpp |  6 ++++--\n>  3 files changed, 11 insertions(+), 16 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 0069d5e2..f4e33830 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1077,14 +1077,10 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\tif (ret)\n>  \t\t\tcontinue;\n>\n> -\t\t/*\n> -\t\t * \\todo Read delay values from the sensor itself or from a\n> -\t\t * a sensor database. For now use generic values taken from\n> -\t\t * the Raspberry Pi and listed as 'generic values'.\n> -\t\t */\n> +\t\tconst CameraSensorProperties::SensorDelays &delays = cio2->sensor()->sensorDelays();\n\ncamera_sensor_properties.h is included by camera_sensor.h, but I\nwonder if we should include it explicitly\n\n>  \t\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> -\t\t\t{ V4L2_CID_ANALOGUE_GAIN, { 1, false } },\n> -\t\t\t{ V4L2_CID_EXPOSURE, { 2, false } },\n> +\t\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> +\t\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n>  \t\t};\n>\n>  \t\tdata->delayedCtrls_ =\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 6c6d711f..9118d893 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -24,6 +24,7 @@\n>  #include <libcamera/control_ids.h>\n>  #include <libcamera/formats.h>\n>  #include <libcamera/framebuffer.h>\n> +#include <libcamera/property_ids.h>\n\nleftover possibily\n\n>  #include <libcamera/request.h>\n>  #include <libcamera/stream.h>\n>  #include <libcamera/transform.h>\n> @@ -1239,14 +1240,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>  \t/* Initialize the camera properties. */\n>  \tdata->properties_ = data->sensor_->properties();\n>\n> -\t/*\n> -\t * \\todo Read delay values from the sensor itself or from a\n> -\t * a sensor database. For now use generic values taken from\n> -\t * the Raspberry Pi and listed as generic values.\n> -\t */\n> +\tconst CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays();\n>  \tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> -\t\t{ V4L2_CID_ANALOGUE_GAIN, { 1, false } },\n> -\t\t{ V4L2_CID_EXPOSURE, { 2, false } },\n> +\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n> +\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n>  \t};\n>\n>  \tdata->delayedCtrls_ =\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 41fdf84c..9e759bf8 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -26,6 +26,7 @@\n>\n>  #include <libcamera/camera.h>\n>  #include <libcamera/control_ids.h>\n> +#include <libcamera/property_ids.h>\n\nditto\n\n>  #include <libcamera/request.h>\n>  #include <libcamera/stream.h>\n>\n> @@ -1290,9 +1291,10 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>  \tif (outputCfgs.empty())\n>  \t\treturn 0;\n>\n> +\tconst CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays();\n>  \tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n> -\t\t{ V4L2_CID_ANALOGUE_GAIN, { 2, false } },\n> -\t\t{ V4L2_CID_EXPOSURE, { 2, false } },\n> +\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n\nI wonder if we shouldn't make the 'priorityWrite' argument internal to\nDelayedControls, it actually only applies to VBLANK. Nothing of\nconcern of this patch though.\n\n> +\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n\nIncludes apart, this looks good to me.\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n>  \t};\n>  \tdata->delayedCtrls_ =\n>  \t\tstd::make_unique<DelayedControls>(data->sensor_->device(),\n> --\n> 2.34.1\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 E1FE8C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 16:02:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F569658A2;\n\tTue, 19 Nov 2024 17:02:50 +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 4C3A8658A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 17:02:47 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E6F18D52;\n\tTue, 19 Nov 2024 17:02:26 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"BtTbRbAk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732032147;\n\tbh=VDlu+4u7aact+Dg3ilCWC9RdGkSApLmrxZscEWn9SKU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BtTbRbAklb4qyRZXJHJfRV4WIvMFxxls/LIvn+0hXTHL0S66JvuvirgSIRaUYTUKC\n\t2kw9BMJiVeTutAbGA+/q0Ur8Lesv9+pTLUxLTfLp8Tpzt2tzqkAoM5C9mQGSsyruTF\n\tNzgIfTwqO8oCQy2gYrGdWXnYbju+8p3piHd0lx4I=","Date":"Tue, 19 Nov 2024 17:02:39 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, mike.rudenko@gmail.com","Subject":"Re: [PATCH v4 2/2] libcamera: pipelines: Draw control delays from\n\tCameraSensor properties","Message-ID":"<dcmwl2pq3mf7sqcvp3nmzjjxgucy4uoieuanb2hxlyfzopiabm@hzmrb7i4shua>","References":"<20241119130301.264972-1-dan.scally@ideasonboard.com>\n\t<20241119130301.264972-3-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241119130301.264972-3-dan.scally@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]