From patchwork Fri Mar 31 08:19:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 18507 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1AD34C0F2A for ; Fri, 31 Mar 2023 08:19:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A4DFD62765; Fri, 31 Mar 2023 10:19:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1680250791; bh=Xlqry35QGeFgO4MUhQSMCzZgAwW0xH4op2wpXaof5SI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=28JzW9ojSIzqM50aLuUkV/1ST0HiMM93gmi7gVQ6eo5trE7som0bojToXw2Ok15zO 5Lt1HdanUE3+DS6yVyb/dnzEdhef80iNccFMgCpDdsybvUUWr9oWY+DFMw5LNWKT69 S4v2V2WO9Ii1ipMX4YLVWsUr3xL0jxSpPxDGbPy56004h5NBbYtphpP8yDvvhwXsCp 5L5XNssvxSi9vE41/5JKFJXMtS5OX6xsdCdERnGZEtX8K2DuB3hbo0nMsGRGeuNmqb lXvwhXT6x0WT9MDDsj+tVxbHp6KrE+yNvCCIiQ3J+YBbqbYBksX6EJgnBzQIRUJI3N JyOW4duvi7yKQ== Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3943B62722 for ; Fri, 31 Mar 2023 10:19:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=thaumatec-com.20210112.gappssmtp.com header.i=@thaumatec-com.20210112.gappssmtp.com header.b="XXo306x9"; dkim-atps=neutral Received: by mail-lf1-x12f.google.com with SMTP id x17so27907439lfu.5 for ; Fri, 31 Mar 2023 01:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; t=1680250787; x=1682842787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0mu1r/8wM3TSeApccdh7KohQ9GGVjjXXDk4nYZ77Uw4=; b=XXo306x9bzwQhtX18eYwi0leWk1OQXZJzW8ehBwAudTiBsjQACBtkvidqz/QhDk47p Aarj+YlpVDrwM7/Kx3FezVu/tbL1Lsb4gJX9NgKJ42Fer38RWMBIREQ/68C9EP/UbZZ6 HrPI8idfzW8X0dfzhSYodQx2+r/jOpqQOMRUCKSpaxE3UxT+l7BzfisfDAGpu0Ka6G9c qgssZUf2VtaG/STFz5NxmINBrWAr/YVD/TtsEcledhbBpFZTj9H0tvpnbgFbwvuxm4S/ blfjneDvX3DlvapcRvj4JSX7E8ezDIgJX1o/qs9xmsOh/kybEAGzx4svIbKRKnvQu/sZ vlkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680250787; x=1682842787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0mu1r/8wM3TSeApccdh7KohQ9GGVjjXXDk4nYZ77Uw4=; b=mxXwJtlD44ZqYDTry20AtB3B1fh1FMeVxJA0FjkSddCNnxWOb6KNW2V+9uFc2ZIpd7 y26cIyya7oefsMSjo8911PG3EhopZ6mPR/IX8O8ZSogZLTqIbonFChN2dwYyWD5zMdF5 iu0Fw5yf3AJhfucld5XcNwtrjFwdou0a4rAtZKa/fJ4Pl8vPu0YETEBZtyM0u5ZrnAea 7ll2sNt+n2XxEH5eW3P+6hLh/jaKnBaHvwlfjssVbuqnItik+MgflnxFXP2irh2ycBWI lpKDl4hHHu7y4HxcDIaR0N+k1RrX0WVUgvKqrwEmN4UQAitp4ZcYZ7im3mTd+TszpPgo OCqw== X-Gm-Message-State: AAQBX9caMck2hn54AV43s9gq4I132bYm3M0E4htEtW7jVaSpNnxSxFCu 8ZadB/nPX5VOhTcqQgGt0s5rH5IjdtZPLM/dvIu6Pw== X-Google-Smtp-Source: AKy350YdiPXfx3nTDhJ0x1Uvr9yCk1ifa+etFlfDLBYqW/8foVk4q81chuKXPp+422qVb4QXJPLf6g== X-Received: by 2002:ac2:5983:0:b0:4eb:30f9:eeca with SMTP id w3-20020ac25983000000b004eb30f9eecamr160713lfn.28.1680250787615; Fri, 31 Mar 2023 01:19:47 -0700 (PDT) Received: from localhost.localdomain ([91.90.166.178]) by smtp.gmail.com with ESMTPSA id t1-20020ac24c01000000b004e84a8c3d86sm281459lfq.42.2023.03.31.01.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 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 Subject: [libcamera-devel] [PATCH v6 01/10] rkisp1: Add camera lens to PH and expose it to the IPA X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Daniel Semkowicz via libcamera-devel From: Daniel Semkowicz Reply-To: Daniel Semkowicz Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Extend the IPA init() function by additional lensControls input parameter. Check in pipeline handler if camera lens exists, and expose its controls to the IPA using the new parameter. Signed-off-by: Daniel Semkowicz Reviewed-by: Jacopo Mondi --- include/libcamera/ipa/rkisp1.mojom | 3 ++- src/ipa/rkisp1/rkisp1.cpp | 7 +++++++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 ++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom index 1009e970..d4ff1230 100644 --- a/include/libcamera/ipa/rkisp1.mojom +++ b/include/libcamera/ipa/rkisp1.mojom @@ -17,7 +17,8 @@ interface IPARkISP1Interface { init(libcamera.IPASettings settings, uint32 hwRevision, libcamera.IPACameraSensorInfo sensorInfo, - libcamera.ControlInfoMap sensorControls) + libcamera.ControlInfoMap sensorControls, + libcamera.ControlInfoMap lensControls) => (int32 ret, libcamera.ControlInfoMap ipaControls); start() => (int32 ret); stop(); diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 6544c925..d338d374 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,7 @@ public: int init(const IPASettings &settings, unsigned int hwRevision, const IPACameraSensorInfo &sensorInfo, const ControlInfoMap &sensorControls, + const ControlInfoMap &lensControls, ControlInfoMap *ipaControls) override; int start() override; void stop() override; @@ -80,6 +82,7 @@ private: std::map mappedBuffers_; ControlInfoMap sensorControls_; + std::optional lensControls_; /* revision-specific data */ rkisp1_cif_isp_version hwRevision_; @@ -123,6 +126,7 @@ std::string IPARkISP1::logPrefix() const int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision, const IPACameraSensorInfo &sensorInfo, const ControlInfoMap &sensorControls, + const ControlInfoMap &lensControls, ControlInfoMap *ipaControls) { /* \todo Add support for other revisions */ @@ -160,6 +164,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision, context_.configuration.sensor.lineDuration = sensorInfo.minLineLength * 1.0s / sensorInfo.pixelRate; + if (!lensControls.empty()) + lensControls_ = lensControls; + /* Load the tuning data file. */ File file(settings.configurationFile); if (!file.open(File::OpenModeFlag::ReadOnly)) { diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 8a30fe06..f966254a 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -32,6 +32,7 @@ #include #include "libcamera/internal/camera.h" +#include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -367,8 +368,14 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision) return ret; } + ControlInfoMap lensControls; + CameraLens *lens = sensor_->focusLens(); + if (lens) + lensControls = lens->controls(); + ret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision, - sensorInfo, sensor_->controls(), &controlInfo_); + sensorInfo, sensor_->controls(), lensControls, + &controlInfo_); if (ret < 0) { LOG(RkISP1, Error) << "IPA initialization failure"; return ret;