{"id":18507,"url":"https://patchwork.libcamera.org/api/patches/18507/?format=json","web_url":"https://patchwork.libcamera.org/patch/18507/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20230331081930.19289-2-dse@thaumatec.com>","date":"2023-03-31T08:19:21","name":"[libcamera-devel,v6,01/10] rkisp1: Add camera lens to PH and expose it to the IPA","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a1f70b6ab1f1c158dcf0e2fbf55758723672beb9","submitter":{"id":126,"url":"https://patchwork.libcamera.org/api/people/126/?format=json","name":"Daniel Semkowicz","email":"dse@thaumatec.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18507/mbox/","series":[{"id":3831,"url":"https://patchwork.libcamera.org/api/series/3831/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3831","date":"2023-03-31T08:19:21","name":"ipa: rkisp1: Add autofocus algorithm","version":6,"mbox":"https://patchwork.libcamera.org/series/3831/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18507/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18507/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 1AD34C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Mar 2023 08:19:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A4DFD62765;\n\tFri, 31 Mar 2023 10:19:51 +0200 (CEST)","from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com\n\t[IPv6:2a00:1450:4864:20::12f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3943B62722\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 10:19:48 +0200 (CEST)","by mail-lf1-x12f.google.com with SMTP id x17so27907439lfu.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Mar 2023 01:19:48 -0700 (PDT)","from localhost.localdomain ([91.90.166.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tt1-20020ac24c01000000b004e84a8c3d86sm281459lfq.42.2023.03.31.01.19.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 31 Mar 2023 01:19:47 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680250791;\n\tbh=Xlqry35QGeFgO4MUhQSMCzZgAwW0xH4op2wpXaof5SI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=28JzW9ojSIzqM50aLuUkV/1ST0HiMM93gmi7gVQ6eo5trE7som0bojToXw2Ok15zO\n\t5Lt1HdanUE3+DS6yVyb/dnzEdhef80iNccFMgCpDdsybvUUWr9oWY+DFMw5LNWKT69\n\tS4v2V2WO9Ii1ipMX4YLVWsUr3xL0jxSpPxDGbPy56004h5NBbYtphpP8yDvvhwXsCp\n\t5L5XNssvxSi9vE41/5JKFJXMtS5OX6xsdCdERnGZEtX8K2DuB3hbo0nMsGRGeuNmqb\n\tlXvwhXT6x0WT9MDDsj+tVxbHp6KrE+yNvCCIiQ3J+YBbqbYBksX6EJgnBzQIRUJI3N\n\tJyOW4duvi7yKQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1680250787;\n\tx=1682842787; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=0mu1r/8wM3TSeApccdh7KohQ9GGVjjXXDk4nYZ77Uw4=;\n\tb=XXo306x9bzwQhtX18eYwi0leWk1OQXZJzW8ehBwAudTiBsjQACBtkvidqz/QhDk47p\n\tAarj+YlpVDrwM7/Kx3FezVu/tbL1Lsb4gJX9NgKJ42Fer38RWMBIREQ/68C9EP/UbZZ6\n\tHrPI8idfzW8X0dfzhSYodQx2+r/jOpqQOMRUCKSpaxE3UxT+l7BzfisfDAGpu0Ka6G9c\n\tqgssZUf2VtaG/STFz5NxmINBrWAr/YVD/TtsEcledhbBpFZTj9H0tvpnbgFbwvuxm4S/\n\tblfjneDvX3DlvapcRvj4JSX7E8ezDIgJX1o/qs9xmsOh/kybEAGzx4svIbKRKnvQu/sZ\n\tvlkg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"XXo306x9\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1680250787; x=1682842787;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=0mu1r/8wM3TSeApccdh7KohQ9GGVjjXXDk4nYZ77Uw4=;\n\tb=mxXwJtlD44ZqYDTry20AtB3B1fh1FMeVxJA0FjkSddCNnxWOb6KNW2V+9uFc2ZIpd7\n\ty26cIyya7oefsMSjo8911PG3EhopZ6mPR/IX8O8ZSogZLTqIbonFChN2dwYyWD5zMdF5\n\tiu0Fw5yf3AJhfucld5XcNwtrjFwdou0a4rAtZKa/fJ4Pl8vPu0YETEBZtyM0u5ZrnAea\n\t7ll2sNt+n2XxEH5eW3P+6hLh/jaKnBaHvwlfjssVbuqnItik+MgflnxFXP2irh2ycBWI\n\tlpKDl4hHHu7y4HxcDIaR0N+k1RrX0WVUgvKqrwEmN4UQAitp4ZcYZ7im3mTd+TszpPgo\n\tOCqw==","X-Gm-Message-State":"AAQBX9caMck2hn54AV43s9gq4I132bYm3M0E4htEtW7jVaSpNnxSxFCu\n\t8ZadB/nPX5VOhTcqQgGt0s5rH5IjdtZPLM/dvIu6Pw==","X-Google-Smtp-Source":"AKy350YdiPXfx3nTDhJ0x1Uvr9yCk1ifa+etFlfDLBYqW/8foVk4q81chuKXPp+422qVb4QXJPLf6g==","X-Received":"by 2002:ac2:5983:0:b0:4eb:30f9:eeca with SMTP id\n\tw3-20020ac25983000000b004eb30f9eecamr160713lfn.28.1680250787615; \n\tFri, 31 Mar 2023 01:19:47 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 31 Mar 2023 10:19:21 +0200","Message-Id":"<20230331081930.19289-2-dse@thaumatec.com>","X-Mailer":"git-send-email 2.39.2","In-Reply-To":"<20230331081930.19289-1-dse@thaumatec.com>","References":"<20230331081930.19289-1-dse@thaumatec.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v6 01/10] rkisp1: Add camera lens to PH\n\tand expose it to the IPA","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":"Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Daniel Semkowicz <dse@thaumatec.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Extend the IPA init() function by additional lensControls input\nparameter. Check in pipeline handler if camera lens exists, and expose\nits controls to the IPA using the new parameter.\n\nSigned-off-by: Daniel Semkowicz <dse@thaumatec.com>\n---\n include/libcamera/ipa/rkisp1.mojom       | 3 ++-\n src/ipa/rkisp1/rkisp1.cpp                | 7 +++++++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 ++++++++-\n 3 files changed, 17 insertions(+), 2 deletions(-)","diff":"diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 1009e970..d4ff1230 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -17,7 +17,8 @@ interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n \t     uint32 hwRevision,\n \t     libcamera.IPACameraSensorInfo sensorInfo,\n-\t     libcamera.ControlInfoMap sensorControls)\n+\t     libcamera.ControlInfoMap sensorControls,\n+\t     libcamera.ControlInfoMap lensControls)\n \t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n \tstart() => (int32 ret);\n \tstop();\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 6544c925..d338d374 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -7,6 +7,7 @@\n \n #include <algorithm>\n #include <math.h>\n+#include <optional>\n #include <queue>\n #include <stdint.h>\n #include <string.h>\n@@ -52,6 +53,7 @@ public:\n \tint init(const IPASettings &settings, unsigned int hwRevision,\n \t\t const IPACameraSensorInfo &sensorInfo,\n \t\t const ControlInfoMap &sensorControls,\n+\t\t const ControlInfoMap &lensControls,\n \t\t ControlInfoMap *ipaControls) override;\n \tint start() override;\n \tvoid stop() override;\n@@ -80,6 +82,7 @@ private:\n \tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n \n \tControlInfoMap sensorControls_;\n+\tstd::optional<ControlInfoMap> lensControls_;\n \n \t/* revision-specific data */\n \trkisp1_cif_isp_version hwRevision_;\n@@ -123,6 +126,7 @@ std::string IPARkISP1::logPrefix() const\n int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \t\t    const IPACameraSensorInfo &sensorInfo,\n \t\t    const ControlInfoMap &sensorControls,\n+\t\t    const ControlInfoMap &lensControls,\n \t\t    ControlInfoMap *ipaControls)\n {\n \t/* \\todo Add support for other revisions */\n@@ -160,6 +164,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \tcontext_.configuration.sensor.lineDuration = sensorInfo.minLineLength\n \t\t\t\t\t\t   * 1.0s / sensorInfo.pixelRate;\n \n+\tif (!lensControls.empty())\n+\t\tlensControls_ = lensControls;\n+\n \t/* Load the tuning data file. */\n \tFile file(settings.configurationFile);\n \tif (!file.open(File::OpenModeFlag::ReadOnly)) {\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 8a30fe06..f966254a 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -32,6 +32,7 @@\n #include <libcamera/ipa/rkisp1_ipa_proxy.h>\n \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@@ -367,8 +368,14 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \t\treturn ret;\n \t}\n \n+\tControlInfoMap lensControls;\n+\tCameraLens *lens = sensor_->focusLens();\n+\tif (lens)\n+\t\tlensControls = lens->controls();\n+\n \tret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision,\n-\t\t\t sensorInfo, sensor_->controls(), &controlInfo_);\n+\t\t\t sensorInfo, sensor_->controls(), lensControls,\n+\t\t\t &controlInfo_);\n \tif (ret < 0) {\n \t\tLOG(RkISP1, Error) << \"IPA initialization failure\";\n \t\treturn ret;\n","prefixes":["libcamera-devel","v6","01/10"]}