From patchwork Thu Jun 1 09:56:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18675 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 C18C3C328F for ; Thu, 1 Jun 2023 09:56:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3521C627CD; Thu, 1 Jun 2023 11:56:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685613395; bh=S2puBFGwZ/w5QwcuK3963B+w3Ph36QunnZY4eLDbHlQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=vM3SUk8W1TIKXhSbFHb7lrn47h0ESs5lkaF7yEYUdJr7KxmmM/gXIjxPXgy153M/e 7QRXzuJqu84+2smpkDkac+Y9VLbCncfbQRkOBOyySjE6/Qr229M0jGJItu4uoymdw4 Apv+/krcHFciGELsuyltNDo1Orno+bCrz2AEqWgqS2b7bBSvT6roVVxd1RRVnPVKzU B6sPORqJnqrnGZf9EU6lKwR6E9hs9+yLuYPMM/SxiVlzsvhLmvA02ufl0+Y+pRebQU 8CkckR6b4isK0jGuvcZJuplfnP4EgEvuRJUXucnUYp5ETUwwQVfhMTE6zQ180i6SJe wPQ5SQ4Wuxzsw== Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 91E22626FA for ; Thu, 1 Jun 2023 11:56:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="jvygl4yv"; dkim-atps=neutral Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-30aa76048fbso592524f8f.2 for ; Thu, 01 Jun 2023 02:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685613392; x=1688205392; 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=99hTf1x62+87E/VKSOzixF+A/Fl9SJ0Rqk6/PYzjbbA=; b=jvygl4yvUNayVZsQuWSE8jBU+6bqyFTc3n7gDv3xdEB68BntvrS2Ry45pJgI0FA0TN fbsyQGb0hgbpAssrAnu8rrRy+uVkTezMXKxp1HOD09L+/ZqYa8PrZHlaaNufVr/K2TRN sqEwvt6hJ1oVrjCWRgPLRZgfvh4sqdQkUUFKrk4OeHN9X1ZF8KT77AHmN0z1UV4LthAW i98J7Ql7dLNzdf//zHg7CyJDi7JqgibunYTTM7gCs7An0uxFOdC+d+Df6p+qZVnAsJ0K H7sx0qMnHpLmYJUShfeoRzD9iRowTVKDQf6/TJly0HcOJaQJ9BDl551efySgfKS8diBm DyPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685613392; x=1688205392; 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=99hTf1x62+87E/VKSOzixF+A/Fl9SJ0Rqk6/PYzjbbA=; b=jHvBzpobexzPX5j57g2Ezov69R0doZZmZJmqJpjkcz0NxckVRn3wUzKJ+2kEfeJswo o0Fs8HntWcvaew8QEx3+vxGkU1dRmuOwlQOAb04JPaEyGfxRHY8ua7xdKSFx2fjfWLml LL6EHUNOykfsnHWaXeb+QKm7PYQJC2B/vATfJogHwYLnIZT1bS1MnU8assNZTTunfLv/ bl3vV5EraKrKCnKSe2+/UjRrjsRMEtUyf+hV25qJ0hBzE18EPjJNU9FUwXegwTCcYFz2 OS6+m5N8G0EYfzg9SqJOMVbsExoCMRjy60xKxunWkZKKuxykUqd1hjxc0dfenMPl9GI7 Rj4A== X-Gm-Message-State: AC+VfDwGyptBogMMO+pjPtgU3v3hrTLSIbw/oBz0hGxTuiqH0J8diL3U GqoRZODJ16s5hIO4iNhM+hBe0YSRx7W5bTfjVHqB6g== X-Google-Smtp-Source: ACHHUZ4DtJoMFgMv2atfqzdRKhETnL8VD3A5rCy1iFUWpg8AoU7Rk3JxmlspqEIzP9S2KvoDWjk4uA== X-Received: by 2002:adf:e4c4:0:b0:309:3a1e:fc54 with SMTP id v4-20020adfe4c4000000b003093a1efc54mr1366679wrm.7.1685613392105; Thu, 01 Jun 2023 02:56:32 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h12-20020a5d6e0c000000b002ca864b807csm9889531wrz.0.2023.06.01.02.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 02:56:31 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jun 2023 10:56:28 +0100 Message-Id: <20230601095630.25443-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230601095630.25443-1-naush@raspberrypi.com> References: <20230601095630.25443-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 1/3] libcamera: controls: Define a default lens position behaviour 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Cc: nick.hollinghurst@raspberrypi.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Update the LensPosition control description to explicitly define a startup/default behaviour. On startup, the IPA will move the lens to the position given by the default value of the LensPosition control. Typically this would be the hyperfocal position of the lens. Signed-off-by: Naushir Patuck --- src/libcamera/control_ids.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index adea5f90acc5..f6dbfd6c0bf0 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -610,6 +610,11 @@ controls: sharp). The minimum will often be zero (meaning infinity), and the maximum value defines the closest focus position. + On startup, the IPA will move the lens position to the default value of + this control. This can be overridden by the application providing an + alternative value though this control, or setting an appropriate AF mode + with controls::AfMode. + \todo Define a property to report the Hyperfocal distance of calibrated lenses. From patchwork Thu Jun 1 09:56:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18676 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 7AA99C31E9 for ; Thu, 1 Jun 2023 09:56:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CAF3862728; Thu, 1 Jun 2023 11:56:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685613395; bh=jabNdxQhE/cZdftzMydsN8IaMWF9JGrkVzkGrMjt2EI=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=GOUM5SzrPZbPHhLUYYi2IzzLLjT1bLXtJ0By78rbdxSB3llbDTR2/sMK0xRyTrYoU pe6gMJ+C8/u0m8kpTPsFIU0+kayfju//SdC2xwI212B3yo3K+4dU4rJ7zdqPYRBPNy GTIOG0kBR/g9WXXklYEBUE4KP1OV+eqnDxf1CCBvc1poK1c5kfyGJLIJU+PiZolVgV JSKjWDRm9mkSRMGAQ1nMi2ANtvoKR+PtMIJL5fyTWLxjsAx/MznLgg4pOKQYoo47Lm ShabMs1WvHgv/0ABXSIpT1lWoZ41oM6mQ9aN67u+jDoUKE09CLJvQ+8asLl7cKlCt8 nOCVt8UfTrCwA== Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D868161EA6 for ; Thu, 1 Jun 2023 11:56:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="BX6gqQ3K"; dkim-atps=neutral Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f4f3ac389eso696882e87.1 for ; Thu, 01 Jun 2023 02:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685613393; x=1688205393; 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=NlJiT1ineFBInzSUOiuRRKdEbpZiPS259mnUIH2WI/U=; b=BX6gqQ3KcR+d14lOFpt4uRDWINf1BhF+WzBW0NN1e2JnaJHcXaOC5aTUl+0Qtp5KML Z8absoi8JHyiRcBLSbVUWvT4r7+hvyvE6HgCrbHLpmEb3SOSRJIUUKNT4btD78X4cyD1 Nqw4+op5P+uBUafjpPcHX4FikM8piezgKETCYiBRrVICteZOBGEhsAKzaEHMip97RkUn zWs93d/y3xfFzKRTO7+HaKu/AVEpJy9g5TchGIub0UT1pgu3CO8Hwo+iLVVMoRvKsRsy vhMhIIEduY0S1VitrBUmacS0cAgYVX4eXDleZBb2YFFLeH2KneGSjn7a4oPpmfu9GKHU Gh4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685613393; x=1688205393; 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=NlJiT1ineFBInzSUOiuRRKdEbpZiPS259mnUIH2WI/U=; b=V6lxnBgN6/de1iYJDkukv8YYkQBsu0XWPz7wU6FyrRCJdH+mG0TraSPhQVC8UE19+e rPd5J3ulyjxbzq6ce8cfxRhqzyO+kCWM2xL3wfuImSlR0umcyJITqgyO1X6E9Do7q6fn BuSBHsIznmVSVE4B7lcq63l7IOYcRsSBD84Yvb4tXNstKINB/CcN5wbPwx3sc5xwtnUR bARnzoPbqpp7/F//tgZ/5gsvE2frkRgdFrtfDiIe0+uJ/tlNlKRqTC1IyS0aXjpcafsm iZFbL4GWcLX6OqDeZkutweHjfu+Rcu3zWR2eNTWuEZZnvhN2cA42rD30IRchhTiX5F0+ 7kXw== X-Gm-Message-State: AC+VfDz+emGSYrfB+MeJlDgoyN9gfJGMjfR9UEuShiznNBz4GEZEpcKh WTHe4zPC30XiiwhqyyXi9npwRGdN22CSND2HeGT2qg== X-Google-Smtp-Source: ACHHUZ76Y66cWKD2qXcW7CQzKUopeB7UOAgGyyyKy2ut2UkLRdHY4ifL6C9wACwfDiUQd6RcsBckTQ== X-Received: by 2002:a19:7604:0:b0:4f5:e688:25c7 with SMTP id c4-20020a197604000000b004f5e68825c7mr540279lff.38.1685613392768; Thu, 01 Jun 2023 02:56:32 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h12-20020a5d6e0c000000b002ca864b807csm9889531wrz.0.2023.06.01.02.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 02:56:32 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jun 2023 10:56:29 +0100 Message-Id: <20230601095630.25443-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230601095630.25443-1-naush@raspberrypi.com> References: <20230601095630.25443-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 2/3] pipeline: ipa: rpi: Return lens controls from ipa->configure() 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Cc: nick.hollinghurst@raspberrypi.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In addition to sensor controls, return lens controls from IpaBase::configure() back to the pipeline handler. If there are lens controls present in the ControlList, action them in the pipeline handler as part of the configure routine. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 3 ++- src/ipa/rpi/common/ipa_base.cpp | 2 +- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index ba786e647ca1..4f20792e4679 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -46,7 +46,8 @@ struct ConfigParams { struct ConfigResult { float modeSensitivity; libcamera.ControlInfoMap controlInfo; - libcamera.ControlList controls; + libcamera.ControlList sensorControls; + libcamera.ControlList lensControls; }; struct StartResult { diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index db7a0eb3a1ca..599ad146a863 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -201,7 +201,7 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa applyAGC(&agcStatus, ctrls); } - result->controls = std::move(ctrls); + result->sensorControls = std::move(ctrls); /* * Apply the correct limits to the exposure, gain and frame duration controls diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 3bb5ec531e4f..2ab0b971149a 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1192,8 +1192,10 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config return -EPIPE; } - if (!result->controls.empty()) - setSensorControls(result->controls); + if (!result->sensorControls.empty()) + setSensorControls(result->sensorControls); + if (!result->lensControls.empty()) + setLensControls(result->lensControls); return 0; } From patchwork Thu Jun 1 09:56:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18677 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 A850AC32AA for ; Thu, 1 Jun 2023 09:56:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3A684627DE; Thu, 1 Jun 2023 11:56:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685613396; bh=TICam9Xow+7nKhdnrxp8fr9f4L4r0ZdGSO5qtTt2U78=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=LMpyK+5tq369FIvtz7jwPS1DHVuaBs7Xo4zoL1OBK3ju1gpruK4LYejDtQrbyek1x y20NzgRS0Tcir93NvourGYz1Pl6us4OBTjphHzFz2vYzlPzTB7xpQQK9DIhfkbOAad joNIrs1hWWVmUynGWw8YP97jHdX61siykyoOgHtN1f03PsYm4fdxDEWNm8ZYhM+uEa drE3q2gp2DjL0T+PIxhwJxIYTDtSNz4NQ7insl5Qa9TOu+FJLCDGokE3JAKr76K2fx 9BQDxJuOVhiu53zh1B5Bj9yx9OGYwkyLzJirey4qfQ6O12tpuMGbDJmJghL3e0Wv9k o22fO2UT6+DNg== Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2214762754 for ; Thu, 1 Jun 2023 11:56:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qcMqZPXI"; dkim-atps=neutral Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-30ae5f2ac94so636538f8f.1 for ; Thu, 01 Jun 2023 02:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685613393; x=1688205393; 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=8ywRezXbvi/BA/1IZZMKl3g8qVoYLTXJyaq0/tA+OrQ=; b=qcMqZPXIgoPMAuH+DmDavoNI6l6LHdmQkJr/YjRM1oBjmq+rKfW/ybFuEQWq9ZvQjA cu5LosUr2Lvjev9/RsQETS61vo6dK3MBlWIaJ6Be6Cu/FjlG8pfZBXuz2AN6evMGqJn/ FaT1eVbkpqaRwHAMxsSjxDNkLNFppsJmrLPs1mU0ghhX+u29svNB78aBIMC9sIhcGya8 IxjSFeeMRoE9i/gyqe9LrHLXEdsHwNfzuLo5O1fneJ9Jz4cfAlrDmKWKInloroJUTu+L sazbNwGGmjx4cg9tYAQPBVMjonm85IlUSupYtPiPddV9ehPjWH1fqvvKU7OOZ9BnyXs3 Pr7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685613393; x=1688205393; 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=8ywRezXbvi/BA/1IZZMKl3g8qVoYLTXJyaq0/tA+OrQ=; b=I8A1owoifdMHGRrWOFwC6xYSz2I/3twgAlLkveophEM/RULxufg+eIM0rC105NbEE+ MR0w5Qo75wD/bIaWVVqhqX1Hhu+sLQsP1L5prIesMghzYliceLBi/ZhX0sJF8RSUvzd3 ocHzctR/LbDgJmQcst09gSoQIsv8713uSlPwjuCVKL3rFttx0MdFnp9kVY1YDXbs/ZSu dIPDMtAv/pDhSQookrnrYLAV5Kh96QmY67SRUyYvmj5tFJtoOhSC46LhCo48cr0jmavZ CNj9WCfCU5IUFVOVwFD/8ki/F7WLY4GxpqC6h0hIVrmoEWDJD45sSP05exaKvgivNeg5 ZhiA== X-Gm-Message-State: AC+VfDyt9PvfLwFsHli/M+jR/P2wiwRL1Dg+nrk+cobfuvHglXQ4oXDi Bsb3fiyUZEnleOZgMOIFOfgCVJ1yVnx2L+PWydgDAg== X-Google-Smtp-Source: ACHHUZ4N7ZzVRFIP7oC5913LksPTOLP2Or05BjXoBi+gjxf+T2QR5uh+BdpJfk89p9pDWp405KzHYw== X-Received: by 2002:adf:e785:0:b0:30a:e87b:515b with SMTP id n5-20020adfe785000000b0030ae87b515bmr1750497wrm.20.1685613393646; Thu, 01 Jun 2023 02:56:33 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h12-20020a5d6e0c000000b002ca864b807csm9889531wrz.0.2023.06.01.02.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 02:56:33 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jun 2023 10:56:30 +0100 Message-Id: <20230601095630.25443-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230601095630.25443-1-naush@raspberrypi.com> References: <20230601095630.25443-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 3/3] ipa: rpi: Set lens position to hyperfocal on startup 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Cc: nick.hollinghurst@raspberrypi.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" On the first ipa->configure() call, set the lens position (if a lens is present) to the default position. Typically this would be the hyperfocal position based on the tuning data. Signed-off-by: Naushir Patuck --- src/ipa/rpi/common/ipa_base.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 599ad146a863..4413689b7bef 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -199,6 +199,19 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa agcStatus.shutterTime = defaultExposureTime; agcStatus.analogueGain = defaultAnalogueGain; applyAGC(&agcStatus, ctrls); + + /* Set the lens to the default (typically hyperfocal) position on first start. */ + RPiController::AfAlgorithm *af = + dynamic_cast(controller_.getAlgorithm("af")); + if (lensPresent_ && af) { + float defaultPos = ipaAfControls.at(&controls::LensPosition).def().get(); + ControlList lensCtrl(lensCtrls_); + int32_t hwpos; + + af->setLensPosition(defaultPos, &hwpos); + lensCtrl.set(V4L2_CID_FOCUS_ABSOLUTE, hwpos); + result->lensControls = std::move(lensCtrl); + } } result->sensorControls = std::move(ctrls);