From patchwork Thu Apr 14 07:43:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15672 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 8C37EC3260 for ; Thu, 14 Apr 2022 07:44:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 00D746564C; Thu, 14 Apr 2022 09:44:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922248; bh=PyW+bGU1SmxQjx/hYyZl+q7hgY6meSbOypmRASKhcy8=; 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=Vwf9xFkj0LW8prHUfJyfW5I8KUN9T4Col5cJgTTGBfakuNvu3ACjkq2ArTv+p8hVl kzia3HYQVT5OlEplLlv2hW/9dCOQ1RYWY3Exf0QUwtUIYX/70MCwmainjuGIXP1Y+A YOuauJKy+pUzPFihS5lBCsFg2PSyGhtYLhs22t4LZ03bhhPcdJYAeEQq/qug+m3i2E wvwP8aojaXh7kjd8kq2v950lLYK7o/3NIZALom0RxdJcRNv1HIQeGCYT43yQ6UlZie GPur+lOmoVqhKRVk2dnTCJt42dN4vXk3WWPVYqGiunNQ0ohan50noXF74oXVAcjdD+ nUu3oBrt+aImQ== 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 1E28965645 for ; Thu, 14 Apr 2022 09:44:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="OEMK4Plp"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922245; 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=tC/C2lez66xZ9LADfw7zvXSambvgPNfB4konHKWScS8=; b=OEMK4Plp7dPmQUqcno9bfQoLriMWypO6qlkm4IQKpGRdKVy3QWfULhk8uI/7sBKO0ou4JY BVwr8yN2DcAd2NBk64WYPyFpuqfb+4c6womvdzDWiFya27s9lRU8fvXCPsAXVSq7HarFFC 6NImy/P4BXx0WVFAGl82DOTZNfeJaP8= 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-453-CIYn7r2HO0eu6ru3OwQXbA-1; Thu, 14 Apr 2022 03:44:04 -0400 X-MC-Unique: CIYn7r2HO0eu6ru3OwQXbA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 87A983C02B60 for ; Thu, 14 Apr 2022 07:44:04 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC0E9111E3EA; Thu, 14 Apr 2022 07:44:02 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:38 +0800 Message-Id: <20220414074342.7455-2-hpa@redhat.com> In-Reply-To: <20220414074342.7455-1-hpa@redhat.com> References: <20220414074342.7455-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 v1 1/5] libcamera: v4l2_device: VIDIOC_QUERYCTRL call to fetch device attributes 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" VIDIOC_QUERYCTRL can be used to get the device attributes. It can be used to get the attributes for a given control list and store them in it. Fianlly, the maximum capacity of the device can be found in the control list. Signed-off-by: Kate Hsuan --- include/libcamera/internal/v4l2_device.h | 2 ++ src/libcamera/v4l2_device.cpp | 37 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index a52a5f2c..d93a72a0 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -37,6 +37,8 @@ public: ControlList getControls(const std::vector &ids); int setControls(ControlList *ctrls); + int getAttributes(ControlList *ctrls); + const struct v4l2_query_ext_ctrl *controlInfo(uint32_t id) const; const std::string &deviceNode() const { return deviceNode_; } diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 3fc8438f..eda429be 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -364,6 +364,43 @@ int V4L2Device::setControls(ControlList *ctrls) return ret; } +/** + * \brief Get capacity for a given control list + * + * This function will get device maximum capacity through VIDIOC_QUERYCTRL and + * store the maximum value to the \a ctrls. If a non-support control is found, + * it will return -EINVAL. + * + * \param ctrls The list of controls to get the capacity + * \return 0 or non-zero on success or a empty control list + * \retval -EINVAL One of the control is not supported or not accessible + */ +int V4L2Device::getAttributes(ControlList *ctrls) +{ + int ret = 0; + if (ctrls->empty()) + return 0; + + struct v4l2_queryctrl query_ctrl; + for (auto [ctrl, i] = std::pair(ctrls->begin(), 0u); i < ctrls->size(); ctrl++, i++) { + const unsigned int id = ctrl->first; + const auto iter = controls_.find(id); + if (iter == controls_.end()) { + LOG(V4L2, Error) + << "Control " << utils::hex(id) << " not found"; + return -EINVAL; + } + + memset(&query_ctrl, 0, sizeof(struct v4l2_queryctrl)); + query_ctrl.id = id; + query_ctrl.type = V4L2_CTRL_TYPE_INTEGER; + ret = ioctl(VIDIOC_QUERYCTRL, &query_ctrl); + ctrls->set(id, query_ctrl.maximum); + } + + return ret; +} + /** * \brief Retrieve the v4l2_query_ext_ctrl information for the given control * \param[in] id The V4L2 control id From patchwork Thu Apr 14 07:43:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15673 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 C5ECDC3256 for ; Thu, 14 Apr 2022 07:44:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90D2765648; Thu, 14 Apr 2022 09:44:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922253; bh=5WrnUPfv19o/t1MFDhkrcQ1eGxdOFEDaclVjh/Fk94M=; 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=FsKWaOfpZmCV7nhlUr3lUkmxm9eIV5q6ihDV7Wnqmaqth5H9DK1FgVnvgWwdvOboG M9HTFGl/WlTR6/ghSu+OvwWh/21N3FXBa+kCKItefIPmDsibyB5m5ts5vMgH+9LTjB ef2aIwTh1bgDhmQBw9v+oBQjxHsFoscgRq1ODJCbForJzfIOCoEwM0wKKdagiN9eCq ZeRU1MqURuvjJLsYiFytF/rTxzLKx39k37J0qsS3ftwmzomhNOI7umYe6vZnqpI5pQ OxagMrW3Aj2yxA3Oo5S5Kd7/1Xwxq8B+An0PY+5f5YXZGNMCsfxWHOZU19UoRtNbTC cFq1Xm9DlgzBQ== 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 A5D6B604B6 for ; Thu, 14 Apr 2022 09:44:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="YF4Q63Gq"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922250; 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=h/X8ab9dNzFIsJJFINlvfhZZ1bxiqednUkqjJ2P7aFE=; b=YF4Q63GqBzT5T85/b0eDZ1G7Tki0SME1IRnJ+gy7wHx4h5IUzwtGLnVKtFTq/xZscJ5vG8 2OPMGFughZhxjjaTkdYz0TKSROSNFT36LuLWEHqGED0p+zdQ981/nTo+3Yv7t1RmsdSikj f/dlOW7V1hOd8GvQgNCi37GAscpzwbk= 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-474-OSy-dEgUPpOWKJlL_2GTWg-1; Thu, 14 Apr 2022 03:44:09 -0400 X-MC-Unique: OSy-dEgUPpOWKJlL_2GTWg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28420805F6B for ; Thu, 14 Apr 2022 07:44:09 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CC88111E3EA; Thu, 14 Apr 2022 07:44:07 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:39 +0800 Message-Id: <20220414074342.7455-3-hpa@redhat.com> In-Reply-To: <20220414074342.7455-1-hpa@redhat.com> References: <20220414074342.7455-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 v1 2/5] 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 first creates a control list and set V4L2_CID_FOCUS_ABSOLUTE control to it. Then, it calls a lower layer call, getAttributes() to get the maximum VCM steps from the kernel. Signed-off-by: Kate Hsuan --- include/libcamera/internal/camera_lens.h | 1 + src/libcamera/camera_lens.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h index 277417da..48761d68 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 getFocusCapabilityies(); const std::string &model() const { return model_; } diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp index b3d48199..5d00652d 100644 --- a/src/libcamera/camera_lens.cpp +++ b/src/libcamera/camera_lens.cpp @@ -73,6 +73,10 @@ int CameraLens::init() return ret; model_ = subdev_->model(); + + ControlList lensCtrls(subdev_->controls()); + subdev_->getAttributes(&lensCtrls); + return 0; } @@ -95,6 +99,20 @@ int CameraLens::setFocusPosition(int32_t position) return 0; } +int CameraLens::getFocusCapabilityies() +{ + ControlValue retVal; + ControlList lensCtrls(subdev_->controls()); + int32_t ret = 2023; + + lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, static_cast(ret)); + subdev_->getAttributes(&lensCtrls); + retVal = lensCtrls.get(V4L2_CID_FOCUS_ABSOLUTE); + ret = retVal.get(); + + return ret; +} + int CameraLens::validateLensDriver() { int ret = 0; From patchwork Thu Apr 14 07:43:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15674 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 8786AC3260 for ; Thu, 14 Apr 2022 07:44:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1C6EA65652; Thu, 14 Apr 2022 09:44:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922260; bh=sXMb4eLDXUVlHPYIgZiv0Jd48uFq3r0UN0wZ2jRiNTA=; 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=iIQ0JAAJXsvJ1eYnGHV/2qi80jEvUSHwh2t+f7yKdUp6d5lNaVi6fT8OFhdKEzJqx YOvd5uz/UerKzV/Z0irdt3MAyrbpSgm33tGeLHy6PUAuOith7zORjPXY70iXTgaw/6 SCEpDpwY1rHmLp+KHad+fxvUc19pSvr2gS7HulNgROupqI8KW0GDJ/FSW9He/4sXik 6z/vLmJJIIkJgHsrs0FxyNyqYAyEVOd6M47z6JjHCqi1DnuNIFc6QIXDMnnRqEzBp5 KrNw6OeBUm6lhyp4ACLnR1RZFR8XbjxS8O7uZNI0yyKqapKHocFYa4zQmrrts85SSH ARoFdlk4HzZEw== 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 00870604B6 for ; Thu, 14 Apr 2022 09:44:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="P3BJwizP"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922257; 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=HbrOgi7hRpPZtf1mMNVx5/GFcUx+Gk7TPBKICdHgX5o=; b=P3BJwizPBfvpSGQv7PRgN5+ILrC17NrGuvygcOu6v4bnO/HV2PP4XIbetfL/6pPnlVGEgq hC4nNUlFRvx6nH+tCWzSfpRgLyZVcbii5dFEesIu7GRowqjxjVRat+iEQsWfx+wCQjZ0H4 4Lhxal7D9XITYEtOpu2P5YXfqKEUNd0= 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-86-owyS_KvlMKaILcvvX5bmWA-1; Thu, 14 Apr 2022 03:44:17 -0400 X-MC-Unique: owyS_KvlMKaILcvvX5bmWA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF71C803FF2 for ; Thu, 14 Apr 2022 07:44:16 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67FEF111D3CC; Thu, 14 Apr 2022 07:44:12 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:40 +0800 Message-Id: <20220414074342.7455-4-hpa@redhat.com> In-Reply-To: <20220414074342.7455-1-hpa@redhat.com> References: <20220414074342.7455-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 v1 3/5] 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 | 2 ++ src/ipa/ipu3/ipa_context.h | 1 + 2 files changed, 3 insertions(+) diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 74f3339e..5378ec0c 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -221,6 +221,8 @@ struct IPACameraSensorInfo { uint32 minFrameLength; uint32 maxFrameLength; + + uint32 maxVcmSteps; }; /** diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h index 103498ef..3b8aa621 100644 --- a/src/ipa/ipu3/ipa_context.h +++ b/src/ipa/ipu3/ipa_context.h @@ -27,6 +27,7 @@ struct IPASessionConfiguration { struct { ipu3_uapi_grid_config afGrid; + int32_t maxVcmSteps; } af; struct { From patchwork Thu Apr 14 07:43:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15675 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 5DD55C326C for ; Thu, 14 Apr 2022 07:44:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D58CC65646; Thu, 14 Apr 2022 09:44:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922264; bh=l4XnZBrTsOrJDZqmr7XhZrNOHW0j4uiGQmJ0T/jtQQY=; 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=qUNG539M4IQbOCM841EFAfUF5heWN0nbg4Og5ZaIULi6Cw+jKY/VfxL595AQqjZV0 Q7W041smQAYWH1UGaqj6B88IukRkYEmfmAU+Un3SGvNQD5ah/+iN9OQIK8r09nupng XoWCkbW2mCVChcEKEc/V37v9RT7+pZFQynCCgaIdg3Nxyf9sSKNstF+rhK4jVMQAaK Lru4+OgFHL6LdTX3qByodMY/cTiQcaPWsXorXSRBZ/+8Qdr/GVIzcQD0qakdAI43LT Y0jm4A1Oa2UAW7w2sJyvnmCqFuql0c17Qgw7Zi50ahw0iOeO0zFAJPiT6VGg+ct5kZ fhO2ASOXxZtMg== 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 1C361604B6 for ; Thu, 14 Apr 2022 09:44:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="AQm/irHQ"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922262; 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=kx0RgqLy/pWaTJbhrBn1BMiLaOpK1EP6tVd6cMmj48Y=; b=AQm/irHQuUwziuK5ML2mb2YawmRQvpVIzoWc6Yb3V9OG5lkQnYBGVYqwYAKmoIaHkV60Ek qpqfHhR+pt/ww+sVgAdfN5NhSt8YBekDiSvEp7Wxx3gvKZ0eqRBb7i8NSZ57QySSUmg/s+ QfdSpqZXBdqcQTiRtNC7B5I0oCh5IcI= 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-345-i0Ky0PrgMuSKBDcFyNuPEQ-1; Thu, 14 Apr 2022 03:44:21 -0400 X-MC-Unique: i0Ky0PrgMuSKBDcFyNuPEQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA6DB3C11C73 for ; Thu, 14 Apr 2022 07:44:20 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D16E111D3CC; Thu, 14 Apr 2022 07:44:18 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:41 +0800 Message-Id: <20220414074342.7455-5-hpa@redhat.com> In-Reply-To: <20220414074342.7455-1-hpa@redhat.com> References: <20220414074342.7455-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 v1 4/5] libcamera: pipeline: ipu3: Get 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 9f113171..9cc12e4c 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -85,6 +85,8 @@ public: ControlInfoMap ipaControls_; + int getSensorControls(); + private: void metadataReady(unsigned int id, const ControlList &metadata); void paramsBufferReady(unsigned int id); @@ -670,6 +672,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) configInfo.sensorInfo = sensorInfo; configInfo.bdsOutputSize = config->imguConfig().bds; configInfo.iif = config->imguConfig().iif; + configInfo.sensorInfo.maxVcmSteps = data->getSensorControls(); ret = data->ipa_->configure(configInfo, &data->ipaControls_); if (ret) { @@ -1271,6 +1274,18 @@ void IPU3CameraData::setSensorControls([[maybe_unused]] unsigned int id, focusLens->setFocusPosition(focusValue.get()); } +int IPU3CameraData::getSensorControls() +{ + int ret = 0; + + CameraLens *focusLens = cio2_.sensor()->focusLens(); + if (!focusLens) + return 0; + + ret = focusLens->getFocusCapabilityies(); + return ret; +} + void IPU3CameraData::paramsBufferReady(unsigned int id) { IPU3Frames::Info *info = frameInfos_.find(id); From patchwork Thu Apr 14 07:43:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15676 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 CB93CC3256 for ; Thu, 14 Apr 2022 07:44:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E4A365657; Thu, 14 Apr 2022 09:44:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922271; bh=xTjNR3ealMX/ay+mWesY1mmQU4WV6lkwj0YLN4RJFoI=; 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=QU2yNBm6jtc93uPaGpsICHSfTAd5nPleZoelZv9vDCPTVK6OByWjiw/6TSh67SzIn RjrAE7rcF9hRG610P8hJ+w1+R9Btsw2srbC2b2Q/nD3nC/j+0ySlWfIgU0Mll6C52p ZtljXwjCNmaJX6/kv79Z2xApw/aT0qsdErwjSLPHuazHNCsI6cihdee4okWywuO4OM wqLuNqKMjqOH3ajdqS0slWMH8Nsy1fB/Z7eC7iec8iuoFYP4LP3yrDt9KO7Yw4exUS qmnNPwEzLbMWNTd0HB7BJ93S4ukvgdbs9OP+nW3phNdBBcDiJPDjQI4SwWYNCV1Ob4 mV/RSnVKRMT9w== 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 46AF96564A for ; Thu, 14 Apr 2022 09:44:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="Eny11BpH"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922269; 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=oTiYx9TtVywnsP8GpOnyQDdDpbhGdKtxn/jF98TEPIE=; b=Eny11BpH3qTEjGLjoY7zRedVj2ZCtz5YclnEWa0USPIO5Xz0wOrHNyolpeefZbVXXQFJtj gCd9kIEDkf1gENjTOtjjxWqUwKJyK7Q/VKvQL5CEFtzvL/zYUqyHA6vfFLp+FaqlDpiIHI ufVPcrgyisl7n/8acFIeT8eoc67yD/Y= 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-211-th2srw_wM8eK3pLpY946yw-1; Thu, 14 Apr 2022 03:44:27 -0400 X-MC-Unique: th2srw_wM8eK3pLpY946yw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EFD0A80418A for ; Thu, 14 Apr 2022 07:44:26 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 503E6111D3CC; Thu, 14 Apr 2022 07:44:24 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:42 +0800 Message-Id: <20220414074342.7455-6-hpa@redhat.com> In-Reply-To: <20220414074342.7455-1-hpa@redhat.com> References: <20220414074342.7455-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 v1 5/5] 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 context configuration. Signed-off-by: Kate Hsuan --- src/ipa/ipu3/algorithms/af.cpp | 6 +++--- src/ipa/ipu3/ipu3.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ipa/ipu3/algorithms/af.cpp b/src/ipa/ipu3/algorithms/af.cpp index addf98af..95fb39f5 100644 --- a/src/ipa/ipu3/algorithms/af.cpp +++ b/src/ipa/ipu3/algorithms/af.cpp @@ -179,7 +179,7 @@ int Af::configure(IPAContext &context, const IPAConfigInfo &configInfo) grid.y_start |= IPU3_UAPI_GRID_Y_START_EN; /* Initial max focus step */ - maxStep_ = kMaxFocusSteps; + maxStep_ = context.configuration.af.maxVcmSteps; /* Initial focus value */ context.frameContext.af.focus = 0; @@ -214,7 +214,7 @@ void Af::afCoarseScan(IPAContext &context) context.frameContext.af.focus = focus_; previousVariance_ = 0; maxStep_ = std::clamp(focus_ + static_cast((focus_ * kFineRange)), - 0U, kMaxFocusSteps); + 0U, static_cast(context.configuration.af.maxVcmSteps)); } } @@ -259,7 +259,7 @@ void Af::afReset(IPAContext &context) previousVariance_ = 0.0; coarseCompleted_ = false; fineCompleted_ = false; - maxStep_ = kMaxFocusSteps; + maxStep_ = context.configuration.af.maxVcmSteps; } /** diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index dd6cfd79..d46f7853 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -456,6 +456,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, /* Clean frameContext at each reconfiguration. */ context_.frameContext = {}; + context_.configuration.af.maxVcmSteps = configInfo.sensorInfo.maxVcmSteps; if (!validateSensorControls()) { LOG(IPAIPU3, Error) << "Sensor control validation failed.";