From patchwork Thu Apr 21 07:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15692 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 53579C0F1B for ; Thu, 21 Apr 2022 07:29:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0260465647; Thu, 21 Apr 2022 09:29:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1650526148; bh=aIK5y/CRTitPbOUv2hTstU9AVpsNnwSzCUO+YxUB29U=; 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=nYHYf2yspt1+8WNv0TpQWHg+7tu98BmAF6J7PQIehO0aC3QenOOH6ziiELX5ZhtMs z+35R7LQHkMRoHT4evXHhpv+v2ESb8oHz8qhqEQuaxXZcBODOmwzrkftkV8WtvPHxe HtWtrudheAWRdh5T6NaIID8uiYScHewH/fPwQW+5cPNWbi55o8/h044UxgbtTeOPWs v9YG/WAWdlVMq7tU11Ram4ZVCKh0oW7Gpu6wDXw7HZFern4FMMZPLceRwH+XU2sG7p t71CYWPXYRVvzethDtu6oC6XQWSKUBH9WXG9OXyi4wudIZdgBpJEVUe9yqaQ4eU7oX z8R6DeT98iC0w== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BB5C8604AD for ; Thu, 21 Apr 2022 09:29:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="ELtV7G1C"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650526144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q/lZpI3i9nFEM+07FrNOPFemLziJApnaTZY0q4BLc90=; b=ELtV7G1C1jkeUeBROc1Zr6dF2IUqY2V/RhlsBxalEPk5ACs7saRQC++hlHi0xE7Odnyxxb 52QN0S+yKzQZq1KK4IhzqubXvNzFk2CeRyG1cJcAE7XI2x4KGxlL6U67cZmGjBeTaZ+fLE bzNCAezThxjNlqfhwoXUvkLun43Rht8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-201-9epY96IZMaCXBBodsV3Q6A-1; Thu, 21 Apr 2022 03:29:03 -0400 X-MC-Unique: 9epY96IZMaCXBBodsV3Q6A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 36C6386B8A4 for ; Thu, 21 Apr 2022 07:29:03 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.194.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B3DCC3597A; Thu, 21 Apr 2022 07:29:01 +0000 (UTC) To: libcamera devel Date: Thu, 21 Apr 2022 15:28:45 +0800 Message-Id: <20220421072848.6752-2-hpa@redhat.com> In-Reply-To: <20220421072848.6752-1-hpa@redhat.com> References: <20220421072848.6752-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [RFC PATCH v2 1/4] ipa: ipu3: Variables to hold the maximum VCM steps 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: Kate Hsuan via libcamera-devel From: Kate Hsuan Reply-To: Kate Hsuan Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" They are used to place the maximum VCM steps. Signed-off-by: Kate Hsuan --- include/libcamera/ipa/core.mojom | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 74f3339e..2e99e999 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -207,6 +207,11 @@ module libcamera; frameDuration(s) = maxFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second) \endverbatim */ + +/** + * \var IPACameraSensorInfo::maxVcmSteps + * \brief The maximum VCM steps + */ struct IPACameraSensorInfo { string model; @@ -221,6 +226,8 @@ struct IPACameraSensorInfo { uint32 minFrameLength; uint32 maxFrameLength; + + uint32 maxVcmSteps; }; /** From patchwork Thu Apr 21 07:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15693 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 A9DF4C0F1B for ; Thu, 21 Apr 2022 07:29:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6CC136564A; Thu, 21 Apr 2022 09:29:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1650526152; bh=F2y+L6vE3qfEbBj7N92mo37hhxc8Nd5vp5+8wcu29mw=; 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=rnlHuPw8UJyWlQMq0PFDvZFTB21771Uyhmm4IjRCSwUcpD/dSP0u53/VI5FKdXux7 Eo85duHojnwBQl7J85/XPq+gDclIIoTNtZU/IUcfR7AP7Rf3/MbTeN0Cp1i2p1gPfo RiCcd8PHkVQMX0zq6qXlXe7fz5pNfqVtOA06ACZ8E7HanUOceFzcJ+VnWNyx0ImvcU 7DZtnZSOhUcWVcK2RraKYDDb6A8eI/Kcljz/zSiUQgw4iDd37a3aQi5+TZx6MfluCm c1enGtOLMLYfTe9bz+pFdac3puRkfPdZ6h+4khSnaGoe8xb31uMkebsAdl7XJO4cAl rctgaLoPkQYPw== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C1C0565643 for ; Thu, 21 Apr 2022 09:29:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="gdYG+v8T"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650526149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGfsVSJOvG0lJQ4ZxO5jD55efCr/5Wy/6avz9J/1qi0=; b=gdYG+v8Tbd7EDm5VAep+sCw79pobtQ3oT0rhmhZWN5a23aI81M6oX6W16tBk7Oq+Wkf515 sYa4RaT7YmYbISvAiMMZjAAgzlf0089ayB/kNsQSSFYyQ3iy2tIa6kCzq+NBK3LNsp/ig0 5A4J/qsSXpTVNbQs0GzK1WbJnkuN3Og= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-43-YdiIO9yhNvGY6hW9RdlrCQ-1; Thu, 21 Apr 2022 03:29:08 -0400 X-MC-Unique: YdiIO9yhNvGY6hW9RdlrCQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8CB3A811E80 for ; Thu, 21 Apr 2022 07:29:08 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.194.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94201C33AE9; Thu, 21 Apr 2022 07:29:06 +0000 (UTC) To: libcamera devel Date: Thu, 21 Apr 2022 15:28:46 +0800 Message-Id: <20220421072848.6752-3-hpa@redhat.com> In-Reply-To: <20220421072848.6752-1-hpa@redhat.com> References: <20220421072848.6752-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [RFC PATCH v2 2/4] libcamera: camera_lens: Get maximum VCM steps 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: Kate Hsuan via libcamera-devel From: Kate Hsuan Reply-To: Kate Hsuan Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It allows other components to get the maximum VCM steps. It get the device information from subdev and return it's maximum value. Signed-off-by: Kate Hsuan --- include/libcamera/internal/camera_lens.h | 1 + src/libcamera/camera_lens.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h index 277417da..84b3c884 100644 --- a/include/libcamera/internal/camera_lens.h +++ b/include/libcamera/internal/camera_lens.h @@ -27,6 +27,7 @@ public: int init(); int setFocusPosition(int32_t position); + int getMaxFocusStep(); const std::string &model() const { return model_; } diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp index b3d48199..b9810551 100644 --- a/src/libcamera/camera_lens.cpp +++ b/src/libcamera/camera_lens.cpp @@ -95,6 +95,19 @@ int CameraLens::setFocusPosition(int32_t position) return 0; } +/** + * \brief Get maximum lens steps + * \return The maximum lens steps. + */ +int CameraLens::getMaxFocusStep() +{ + const ControlInfoMap &infoMap_ = subdev_->controls(); + const ControlInfo devInfo = infoMap_.find(V4L2_CID_FOCUS_ABSOLUTE)->second; + int32_t maxFocus = devInfo.max().get(); + + return maxFocus; +} + int CameraLens::validateLensDriver() { int ret = 0; From patchwork Thu Apr 21 07:28:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15695 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 7A9EAC0F1B for ; Thu, 21 Apr 2022 07:29:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 399EC65643; Thu, 21 Apr 2022 09:29:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1650526165; bh=3brjNfEMVi4fNBM+q1GgveHOZLC3tl5UCUiJR9RL4Kk=; 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=iQQ6OMfV9G8EOJ58r2I2VAPPkMgANbvZiEX1413ZGBL4AN0tgc+U3E397zo7hARGU EOhB0Mt6Y4BaauU1jHcm6ulNRyihzl3ICfRLGMI/gCpK2bfO0D1vsw+l2gE5KBwLzP 4L8TBNBY0oOD3lGZnyJlTlDv6YS9ciOZnsw5QAz2LmoEHQMvzJmUTGnBkIXPzmWR3f mqI/ll826nZrU0xHc5ev4s43ApZ+g1YBWQSpcPVv7EpadbuWTTMf4Ohn55DeuOpyJk mBQJL1p7DeMY3F0mBKQ0xP8x/w/YhYHubaCnVG2uyu4facZjOD0gIOGdvnbf9syYM0 U/rAG4bI0yXXA== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 93D63604AD for ; Thu, 21 Apr 2022 09:29:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="bWURX8fb"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650526162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fjliiKMSaNBSJfgiA+GlP4iuFlsmfUhgwA7sTtmmodQ=; b=bWURX8fbgicwyE7DqFlENqYi0QIN395ie+OWWySXACNhjTaQiMQY8DeHxXFxvTKCuiwSit fK1a9Cfr4olgL02H60cQFlfguMlRgPpPUzr1Qh9T3r7jzSoks7WoLA43fZ84v0QMGTsHS1 kmrlZAYN0Pla5lTdG9MaPFShkGt5ve8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-cVr4P0diMqySHuSU_GuLPQ-1; Thu, 21 Apr 2022 03:29:14 -0400 X-MC-Unique: cVr4P0diMqySHuSU_GuLPQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F23202805339 for ; Thu, 21 Apr 2022 07:29:13 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.194.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C806C33AE9; Thu, 21 Apr 2022 07:29:11 +0000 (UTC) To: libcamera devel Date: Thu, 21 Apr 2022 15:28:47 +0800 Message-Id: <20220421072848.6752-4-hpa@redhat.com> In-Reply-To: <20220421072848.6752-1-hpa@redhat.com> References: <20220421072848.6752-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [RFC PATCH v2 3/4] libcamera: pipeline: ipu3: Get and set VCM information 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: Kate Hsuan via libcamera-devel From: Kate Hsuan Reply-To: Kate Hsuan Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It is an interface of CameraData to get the VCM steps. Also, the VCM step value is stored in ConfigInfo. Signed-off-by: Kate Hsuan --- src/libcamera/pipeline/ipu3/ipu3.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index fd989e61..d1a1d21c 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -86,6 +86,8 @@ public: ControlInfoMap ipaControls_; + int getMaxLensSteps(); + private: void metadataReady(unsigned int id, const ControlList &metadata); void paramsBufferReady(unsigned int id); @@ -667,6 +669,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) CameraLens *lens = data->cio2_.sensor()->focusLens(); if (lens) configInfo.lensControls = lens->controls(); + sensorInfo.maxVcmSteps = data->getMaxLensSteps(); configInfo.sensorInfo = sensorInfo; configInfo.bdsOutputSize = config->imguConfig().bds; @@ -1272,6 +1275,18 @@ void IPU3CameraData::setSensorControls([[maybe_unused]] unsigned int id, focusLens->setFocusPosition(focusValue.get()); } +int IPU3CameraData::getMaxLensSteps() +{ + int ret = 0; + + CameraLens *focusLens = cio2_.sensor()->focusLens(); + if (!focusLens) + return 0; + + ret = focusLens->getMaxFocusStep(); + return ret; +} + void IPU3CameraData::paramsBufferReady(unsigned int id) { IPU3Frames::Info *info = frameInfos_.find(id); From patchwork Thu Apr 21 07:28:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15694 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 1D3C1C0F1B for ; Thu, 21 Apr 2022 07:29:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C863B65645; Thu, 21 Apr 2022 09:29:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1650526161; bh=uThgyHjDnC+lEe99mYtFrOliYIAAEhRoIck9nWog638=; 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=05JZDwRrL1el8L7etcTsvCzuVA+0LKSzLAAFFlnMO6zHfYYh8PMOT+0evX29z8yQB /giy2LdYvYp9MqxeIi+H5vybEHSAhP2xY2YZ83f05sNn76k1OdkqsX9a9E4pRsZVYW IwrcQRHu9DmTzK/WWA0GUUzqfLvmeCOFqiskom38ajw6XJZ/sRgGSj73o8piiJ+Hr1 fcScjUUPMjm5ayPXi1DIOrMb9MzgQJ7iSCwk5ikVrezZVJx1DMG98IbeSSGh+jrian fACRtG8EsvgDdXkkzRWlvm1uccEAlbQVt8794LQiLTTTmDzuFni8e8fop3Suz9moDn MxZ26bEKTDKXw== Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B96D604AD for ; Thu, 21 Apr 2022 09:29:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="U0KKiZvb"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650526159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yAiQvw5R+MG2sBMTBHOEpOULc3I1Ns2d+x8NgzRMtSA=; b=U0KKiZvbut9sLYUoVxXM8jZr0vTqaHjF89JVUYWjMFEJ6Gp2a4I37AdCS9Ijc6CT+7us+Q 5gT2vQimQQ34gp8jLQM3ZPS0lj5/NjVueregTnTuPbV3/ltwFAT2JgNv9jLm4FBLyZi4kh wgrWknpj2hogqNcsbzKw1yooBOP0j4g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-shDRrt0qM1mkJZgwJ9TmLA-1; Thu, 21 Apr 2022 03:29:18 -0400 X-MC-Unique: shDRrt0qM1mkJZgwJ9TmLA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11B1180159B for ; Thu, 21 Apr 2022 07:29:18 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.194.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08C8BC3598E; Thu, 21 Apr 2022 07:29:15 +0000 (UTC) To: libcamera devel Date: Thu, 21 Apr 2022 15:28:48 +0800 Message-Id: <20220421072848.6752-5-hpa@redhat.com> In-Reply-To: <20220421072848.6752-1-hpa@redhat.com> References: <20220421072848.6752-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hpa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [RFC PATCH v2 4/4] ipa: ipu3: af: Remove hardcoded maximum VCM steps 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: Kate Hsuan via libcamera-devel From: Kate Hsuan Reply-To: Kate Hsuan Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The hardcoded VCM step variable was removed and was replaced by the configInfo. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/af.cpp | 13 ++++--------- src/ipa/ipu3/algorithms/af.h | 2 ++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index f700b01f..4faf0bd8 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -62,12 +62,6 @@ namespace ipa::ipu3::algorithms { LOG_DEFINE_CATEGORY(IPU3Af) -/** - * Maximum focus steps of the VCM control - * \todo should be obtained from the VCM driver - */ -static constexpr uint32_t kMaxFocusSteps = 1023; - /* Minimum focus step for searching appropriate focus */ static constexpr uint32_t kCoarseSearchStep = 30; static constexpr uint32_t kFineSearchStep = 1; @@ -179,7 +173,8 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo) grid.y_start |= IPU3_UAPI_GRID_Y_START_EN; /* Initial max focus step */ - maxStep_ = kMaxFocusSteps; + maxStep_ = configInfo.sensorInfo.maxVcmSteps; + maxFocusSteps_ = configInfo.sensorInfo.maxVcmSteps; /* Initial frame ignore counter */ afIgnoreFrameReset(); @@ -217,7 +212,7 @@ void Af::afCoarseScan(IPAContext &context) context.frameContext.af.focus = focus_; previousVariance_ = 0; maxStep_ = std::clamp(focus_ + static_cast((focus_ * kFineRange)), - 0U, kMaxFocusSteps); + 0U, maxFocusSteps_); } } @@ -262,7 +257,7 @@ void Af::afReset(IPAContext &context) previousVariance_ = 0.0; coarseCompleted_ = false; fineCompleted_ = false; - maxStep_ = kMaxFocusSteps; + maxStep_ = maxFocusSteps_; } /** diff --git a/src/ipa/ipu3/algorithms/af.h b/src/ipa/ipu3/algorithms/af.h index b85cf941..a1cf561c 100644 --- a/src/ipa/ipu3/algorithms/af.h +++ b/src/ipa/ipu3/algorithms/af.h @@ -45,6 +45,8 @@ private: bool afIsOutOfFocus(IPAContext context); + /* Maximum VCM steps */ + uint32_t maxFocusSteps_; /* VCM step configuration. It is the current setting of the VCM step. */ uint32_t focus_; /* The best VCM step. It is a local optimum VCM step during scanning. */