{"id":22102,"url":"https://patchwork.libcamera.org/api/1.1/patches/22102/?format=json","web_url":"https://patchwork.libcamera.org/patch/22102/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241126151203.108407-3-dan.scally@ideasonboard.com>","date":"2024-11-26T15:12:03","name":"[v5,2/2] libcamera: pipelines: Draw control delays from CameraSensor properties","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"57667a60df41ad47f55c6c7afa9d51f6df8c34ee","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/1.1/people/156/?format=json","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22102/mbox/","series":[{"id":4823,"url":"https://patchwork.libcamera.org/api/1.1/series/4823/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4823","date":"2024-11-26T15:12:01","name":"Add sensor control delays to CameraSensorProperties","version":5,"mbox":"https://patchwork.libcamera.org/series/4823/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22102/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22102/checks/","tags":{},"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 72CDAC3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Nov 2024 15:12:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A64A66075;\n\tTue, 26 Nov 2024 16:12:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B3F5165F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Nov 2024 16:12:13 +0100 (CET)","from mail.ideasonboard.com\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C2A1CE6;\n\tTue, 26 Nov 2024 16:11:51 +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=\"fhGD2j9y\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732633911;\n\tbh=wO66m+ziwPgtfzwaoo4jXHuAz4C1yfEruY/5/HB9WMk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=fhGD2j9yF14Tss1Tqc9c7AWRtd6w3zwyJpgZN0Z5HxMtOKnhNXpb/dwtIDI0lGjT9\n\tdU/mCA5piiXBwUH5MG9FrRnkMbrQ1++TThegvadcJW5lDXPk3tMjQaa5CyKwBVGKin\n\tcjaJ3TRpzJrMNDc71gjvDeu0CuB2KFFSwCvR5dj8=","From":"Daniel Scally <dan.scally@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"mike.rudenko@gmail.com, Daniel Scally <dan.scally@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>","Subject":"[PATCH v5 2/2] libcamera: pipelines: Draw control delays from\n\tCameraSensor properties","Date":"Tue, 26 Nov 2024 15:12:03 +0000","Message-Id":"<20241126151203.108407-3-dan.scally@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20241126151203.108407-1-dan.scally@ideasonboard.com>","References":"<20241126151203.108407-1-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>"},"content":"Rather than hard coding default delays for control values in the\npipeline handlers, pick up the ones defined in the CameraSensor\nproperties.\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\nChanges in v5:\n\n\t- Fixed the includes in each pipeline (remove property_ids.h, added\n\t  camera_sensor_properties.h)\n\nChanges in v4:\n\n\t- Used the struct reference rather than values directly\n\nChanges in v3:\n\n\t- Fixed some broken alignment \n\nChanges in v2:\n\n\t- Switched to use the new getSensorDelays() function\n\n src/libcamera/pipeline/ipu3/ipu3.cpp     | 11 ++++-------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++++-------\n src/libcamera/pipeline/simple/simple.cpp |  6 ++++--\n 3 files changed, 12 insertions(+), 16 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 0069d5e2..e31e3879 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -28,6 +28,7 @@\n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_lens.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n+#include \"libcamera/internal/camera_sensor_properties.h\"\n #include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n #include \"libcamera/internal/framebuffer.h\"\n@@ -1077,14 +1078,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 \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_ =\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 6c6d711f..908724e2 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -34,6 +34,7 @@\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n+#include \"libcamera/internal/camera_sensor_properties.h\"\n #include \"libcamera/internal/converter/converter_v4l2_m2m.h\"\n #include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.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_ =\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 41fdf84c..dae9f31f 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -31,6 +31,7 @@\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n+#include \"libcamera/internal/camera_sensor_properties.h\"\n #include \"libcamera/internal/converter.h\"\n #include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\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+\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n \t};\n \tdata->delayedCtrls_ =\n \t\tstd::make_unique<DelayedControls>(data->sensor_->device(),\n","prefixes":["v5","2/2"]}