[{"id":22298,"web_url":"https://patchwork.libcamera.org/comment/22298/","msgid":"<164751050165.123014.11504854986376187807@Monstersaurus>","date":"2022-03-17T09:48:21","subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: raspberrypi:\n\tControl the lens from pipeline","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Quoting Jean-Michel Hautbois via libcamera-devel (2022-03-17 09:19:37)\n> The lens focus is controled by a VCM, which is linked to the sensor\n> using the ancillary links.\n> Pass the control to the config info structure and make it possible to\n> update by the IPA.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  include/libcamera/ipa/raspberrypi.mojom         |  1 +\n>  .../pipeline/raspberrypi/raspberrypi.cpp        | 17 +++++++++++++++++\n>  2 files changed, 18 insertions(+)\n> \n> diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\n> index acd3cafe..0c3922b0 100644\n> --- a/include/libcamera/ipa/raspberrypi.mojom\n> +++ b/include/libcamera/ipa/raspberrypi.mojom\n> @@ -125,4 +125,5 @@ interface IPARPiEventInterface {\n>         embeddedComplete(uint32 bufferId);\n>         setIspControls(libcamera.ControlList controls);\n>         setDelayedControls(libcamera.ControlList controls);\n> +       setLensControls(libcamera.ControlList controls);\n>  };\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index c2230199..41be10ff 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -33,6 +33,7 @@\n>  \n>  #include \"libcamera/internal/bayer_format.h\"\n>  #include \"libcamera/internal/camera.h\"\n> +#include \"libcamera/internal/camera_lens.h\"\n>  #include \"libcamera/internal/camera_sensor.h\"\n>  #include \"libcamera/internal/delayed_controls.h\"\n>  #include \"libcamera/internal/device_enumerator.h\"\n> @@ -202,6 +203,7 @@ public:\n>         void setIspControls(const ControlList &controls);\n>         void setDelayedControls(const ControlList &controls);\n>         void setSensorControls(ControlList &controls);\n> +       void setLensControls(const ControlList &controls);\n>  \n>         /* bufferComplete signal handlers. */\n>         void unicamBufferDequeue(FrameBuffer *buffer);\n> @@ -1483,6 +1485,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n>         ipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete);\n>         ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);\n>         ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);\n> +       ipa_->setLensControls.connect(this, &RPiCameraData::setLensControls);\n>  \n>         /*\n>          * The configuration (tuning file) is made from the sensor name unless\n> @@ -1519,6 +1522,10 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n>         entityControls.emplace(0, sensor_->controls());\n>         entityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n>  \n> +       CameraLens *lens = sensor_->focusLens();\n> +       if (lens)\n> +               entityControls.emplace(2, lens->controls());\n> +\n>         /* Always send the user transform to the IPA. */\n>         ipaConfig.transform = static_cast<unsigned int>(config->transform);\n>  \n> @@ -1735,6 +1742,16 @@ void RPiCameraData::setDelayedControls(const ControlList &controls)\n>         handleState();\n>  }\n>  \n> +void RPiCameraData::setLensControls(const ControlList &controls)\n> +{\n> +       ControlList ctrls = controls;\n\nIs this required? Is it a copy? Or is it just to save 3 chars?\n\n> +\n> +       CameraLens *lens = sensor_->focusLens();\n> +       if (lens)\n> +               lens->setFocusPosition(ctrls.get(V4L2_CID_FOCUS_ABSOLUTE).get<int32_t>());\n\nI suspect it's fine, but what happens if there are no lens control\nchanges - is anything required to be handled in the State below?\n\nAs it's 'setLensControls' perhaps\n\n\tif (!lens)\n\t\treturn;\n\nwould be more appropriate?\n\n--\nKieran\n\n\n> +       handleState();\n> +}\n> +\n>  void RPiCameraData::setSensorControls(ControlList &controls)\n>  {\n>         /*\n> -- \n> 2.32.0\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 3F2F5BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 09:48:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9AE65610F8;\n\tThu, 17 Mar 2022 10:48:25 +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 72C82604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 10:48:24 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0AEC7493;\n\tThu, 17 Mar 2022 10:48:24 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647510505;\n\tbh=yAX3Q7OULr7NIZoHQf/XGQtCNfbINN2Er+2v9kuJGrk=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=gSpT8mFB+sm7QCmYZz8t9DSZ2f9lJGbPvk9MfxNKMFB+sRAuKuJQPwPZzOt9BVN11\n\t41X+vX5Os1Y6uU1l5tGpEfdKXRHYOlw5kY1pRIZGgAXWoMTFnY08gvQPaQzaG+ZiJ/\n\tRXjX8wB19O1iyfitePuOcJePBms7Ap/IcqDTUH9j/OR+HmKMSBfdhsYf4fv1OxpFI6\n\tXvYLbH3Iu2fYrsDtmgL5NwPM6DvbfAGlRjtk9xn0vL2Ape2Fduh5xUt/Cdn6+CQLiX\n\tyvxX1ofytjhOx9bGPXm7f8G+75pCue1fGiYoq7+l+a36q/Iv6pflZf0PjUeDbih5BD\n\teW0pLOIZCdTmA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647510504;\n\tbh=yAX3Q7OULr7NIZoHQf/XGQtCNfbINN2Er+2v9kuJGrk=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=aoptf06wjZsNEl88mGzXDsS14bBVotwC/6p67m0UJU3zm/UlKKE3OkRrJTwxyOvse\n\tGRewWLDulEgbvfNv1L+0+P1V+dSeHBlymJ2uYH6LcxHA6+MlA37UTUaySGUsAWkfU4\n\tLwdnyRCTS9kbuV78ty5ynE/PH464KU/FPqLk84n4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aoptf06w\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220317091937.168527-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20220317091937.168527-1-jeanmichel.hautbois@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 17 Mar 2022 09:48:21 +0000","Message-ID":"<164751050165.123014.11504854986376187807@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: raspberrypi:\n\tControl the lens from pipeline","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22318,"web_url":"https://patchwork.libcamera.org/comment/22318/","msgid":"<CAEmqJPpBALEOeKJp1m=WcV+7qdxTwrMXb3auFSCxidGYwH4ofw@mail.gmail.com>","date":"2022-03-17T13:55:12","subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: raspberrypi:\n\tControl the lens from pipeline","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Jean-Michel,\n\nOn Thu, 17 Mar 2022 at 09:20, Jean-Michel Hautbois via libcamera-devel <\nlibcamera-devel@lists.libcamera.org> wrote:\n\n> The lens focus is controled by a VCM, which is linked to the sensor\n> using the ancillary links.\n> Pass the control to the config info structure and make it possible to\n> update by the IPA.\n>\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  include/libcamera/ipa/raspberrypi.mojom         |  1 +\n>  .../pipeline/raspberrypi/raspberrypi.cpp        | 17 +++++++++++++++++\n>  2 files changed, 18 insertions(+)\n>\n> diff --git a/include/libcamera/ipa/raspberrypi.mojom\n> b/include/libcamera/ipa/raspberrypi.mojom\n> index acd3cafe..0c3922b0 100644\n> --- a/include/libcamera/ipa/raspberrypi.mojom\n> +++ b/include/libcamera/ipa/raspberrypi.mojom\n> @@ -125,4 +125,5 @@ interface IPARPiEventInterface {\n>         embeddedComplete(uint32 bufferId);\n>         setIspControls(libcamera.ControlList controls);\n>         setDelayedControls(libcamera.ControlList controls);\n> +       setLensControls(libcamera.ControlList controls);\n>  };\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index c2230199..41be10ff 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -33,6 +33,7 @@\n>\n>  #include \"libcamera/internal/bayer_format.h\"\n>  #include \"libcamera/internal/camera.h\"\n> +#include \"libcamera/internal/camera_lens.h\"\n>  #include \"libcamera/internal/camera_sensor.h\"\n>  #include \"libcamera/internal/delayed_controls.h\"\n>  #include \"libcamera/internal/device_enumerator.h\"\n> @@ -202,6 +203,7 @@ public:\n>         void setIspControls(const ControlList &controls);\n>         void setDelayedControls(const ControlList &controls);\n>         void setSensorControls(ControlList &controls);\n> +       void setLensControls(const ControlList &controls);\n>\n>         /* bufferComplete signal handlers. */\n>         void unicamBufferDequeue(FrameBuffer *buffer);\n> @@ -1483,6 +1485,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig\n> *sensorConfig)\n>         ipa_->embeddedComplete.connect(this,\n> &RPiCameraData::embeddedComplete);\n>         ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);\n>         ipa_->setDelayedControls.connect(this,\n> &RPiCameraData::setDelayedControls);\n> +       ipa_->setLensControls.connect(this,\n> &RPiCameraData::setLensControls);\n>\n>         /*\n>          * The configuration (tuning file) is made from the sensor name\n> unless\n> @@ -1519,6 +1522,10 @@ int RPiCameraData::configureIPA(const\n> CameraConfiguration *config)\n>         entityControls.emplace(0, sensor_->controls());\n>         entityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n>\n> +       CameraLens *lens = sensor_->focusLens();\n> +       if (lens)\n> +               entityControls.emplace(2, lens->controls());\n> +\n>         /* Always send the user transform to the IPA. */\n>         ipaConfig.transform = static_cast<unsigned int>(config->transform);\n>\n> @@ -1735,6 +1742,16 @@ void RPiCameraData::setDelayedControls(const\n> ControlList &controls)\n>         handleState();\n>  }\n>\n> +void RPiCameraData::setLensControls(const ControlList &controls)\n> +{\n> +       ControlList ctrls = controls;\n> +\n> +       CameraLens *lens = sensor_->focusLens();\n> +       if (lens)\n> +\n>  lens->setFocusPosition(ctrls.get(V4L2_CID_FOCUS_ABSOLUTE).get<int32_t>());\n> +       handleState();\n>\n\nhandleState() should not be needed heere.\n\nRegards,\nNaush\n\n\n> +}\n> +\n>  void RPiCameraData::setSensorControls(ControlList &controls)\n>  {\n>         /*\n> --\n> 2.32.0\n>\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 AE02ABD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 13:55:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 101A9601F8;\n\tThu, 17 Mar 2022 14:55:32 +0100 (CET)","from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com\n\t[IPv6:2a00:1450:4864:20::12e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A1AF601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 14:55:29 +0100 (CET)","by mail-lf1-x12e.google.com with SMTP id w12so9126212lfr.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 06:55:28 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647525332;\n\tbh=/yvKnfaAYTC9bkCriYgT5DD2u2V8mxHsvtz/XZ2AcNk=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=xHPyjC3l4QQ1EhIASeDX69mxQQ9d3n9EqvufUG2IeUcyPAYk4KArB1Gkz9pWObhiJ\n\ty2Y4MYz2PG0tVm8KRLP8wCXrRCKQuNsoi7o7b/MvXSYbXRjnQ69ZeXaVhpU8dBy/S7\n\tTXGSJ5iOwjnxu2jTrSyas9qaZWoBn5FtfoMQ7Bl/vJ1Yx+SvOCn4mKiZjNi4vT2+M9\n\tUFv+qKjI60b9hfGHONC/+JlvmtfeMa6TqGvEknhuC+RDbcaJzKutuMRpEF9sDpWYPx\n\tdKbdGEmo4d/tKx6ez5r1kuHf9FJCM1OuIMz/JL1cZj9Ct1WCx27SA8r7HJaNyjUGN6\n\tGVeU1u6xipeQA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=GHQ8J61Ts3OQx7M6jUamtERRYnE7PYRPRbmz34kCSac=;\n\tb=rIl9jZ1up+aerA8KiK5WnoRusNkY5UGuWUqHx31/FFNM6X2tuy2L76k914LbD7CR4m\n\tvUbVijjTNS7h1lsYyG8/L2NxnpHpCbnYGvGL1yDyjvMTfy63SlGH5QxHh0QyA3MPjAj2\n\tUzAWsLHtwEpCWAJqB5n/R+Hhrzv0cSSk+ka+ZUUB2/lqXx4vbThiFxa+2YgoI1Bq1bSZ\n\tKdZhiM4+hsQXHKpne3yzho6aiPVfJUVA7piRnemKl7tEwE2Z6K0wVwib9L+CePyxj2HC\n\tUChspyYGDcpr/k2L5J0Q6DL9J4PigKNOk9i+zYa8m8bdnUbG+p+ZpkwLYBN7BiyTCxoq\n\twLmg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"rIl9jZ1u\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=GHQ8J61Ts3OQx7M6jUamtERRYnE7PYRPRbmz34kCSac=;\n\tb=t1VADTkV/SJPjOERWaRCm1y6BiQx6CncgBF+7pcj7/GRYr7okOTqOMLNOLLLFM2zV1\n\tPOc1F4wEwMg01VqnaIJJvJr28j2/zFRV5Va+rvo0sxoouEjgD6CqyjgHoc0L2hRrgUmv\n\tXtvBgOq7HP6UHHQihsD/3ooisKCSX9bLSj4JDQ3BZMxtrRF/okbUp7Z5mbm3v4CRy/5z\n\tgmJu0Dx/+0TrZP1/DmxQ7lUp38UIBd1Br8jnsAUNe1z6eh6BK9gpTC/uxBkV8+MJ/wA2\n\t7klqGW8Xa/AMWF7nmN/szuOi2MVtBMtJxkm4JZ4M+nuE2XIa1aigt0ENuC7dWUqc68Od\n\teTLw==","X-Gm-Message-State":"AOAM531//pFJ3w/pQlTHsLJAUbOLSpPpWrMyZteAgQpIrWf587vUyNjM\n\t4P9JfY4MaXef06z/LqOWjBE89WpuGse0rreNja7N+g==","X-Google-Smtp-Source":"ABdhPJygFUk5OelsJ0WQgToFwqCZgTABavCsR0D0AbjQWnnO3SLPsFs20vy3Alu7+C2BfdfaUVaAG6upnww9aizJDX8=","X-Received":"by 2002:a05:6512:230d:b0:449:fadf:4e39 with SMTP id\n\to13-20020a056512230d00b00449fadf4e39mr1517933lfu.315.1647525328150;\n\tThu, 17 Mar 2022 06:55:28 -0700 (PDT)","MIME-Version":"1.0","References":"<20220317091937.168527-1-jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<20220317091937.168527-1-jeanmichel.hautbois@ideasonboard.com>","Date":"Thu, 17 Mar 2022 13:55:12 +0000","Message-ID":"<CAEmqJPpBALEOeKJp1m=WcV+7qdxTwrMXb3auFSCxidGYwH4ofw@mail.gmail.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000f220e505da6a618e\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: raspberrypi:\n\tControl the lens from pipeline","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]