From patchwork Thu Apr 14 07:43:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 15671 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 57602C3256 for ; Thu, 14 Apr 2022 07:44:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9150165647; Thu, 14 Apr 2022 09:44:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1649922240; bh=CT66shc5wCnSQ501VvSe2HFNAdsjm7fZ+GCYAdrRmZE=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=L6joT/yNox9zDDqipE8WH+nwRH2Ec3rkFyOa4J6Kx151A9Aism5qgYjJ7kKN+EhIV F2OS0UlNXqajttKFczrWwp8lnRC7grKRn4TrDMscicvU7iejO1ZO3Gjs6F1cxVxnby do97Bm3XtjRBokUcj5TBUMPj2rmI47H1lB9L2dJOoSWnGd/S5ivFItVx+iV4GIDxdW R4vy055otc4rYwZSrkXGKDYbj4S5/e5rYARF++6/rQFKJIBTfBkvwo+wCZQoIJ8kFb 8aj0BNmgUqoq+GE2EyJ9MIB2RBkigfzimUqEBJAc0tv5ok2OVW2Lz5lzQLrqVP1ic9 l0RABE8qT+eWA== 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 1B3B8604B6 for ; Thu, 14 Apr 2022 09:43:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="cP+1mh14"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649922237; 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; bh=uM43MuhFm6GQ1H3tcKjQj9BYsT+elk+vvlfHuESqdZg=; b=cP+1mh14NX/jUXsGveFm0OO74tOg1UHnU4o514wIYIqqcpIhf7M1BS7qWOCK/yzsNhW7s6 zXWrC6hDzyvtaW5MbBf+FwRqvBKdWj8yrIlw6a/KOyYzrKRgMZex/E02ej+e//p1xP+XvB cdhPtLGANob5SQajHLeBKCf+w9ZRK8A= 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-265-pEhN2x4oMGWgC2C-bqZ7lw-1; Thu, 14 Apr 2022 03:43:56 -0400 X-MC-Unique: pEhN2x4oMGWgC2C-bqZ7lw-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 8B57480346F for ; Thu, 14 Apr 2022 07:43:56 +0000 (UTC) Received: from fedora.rhtw.internal (unknown [10.39.193.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 833DA111E3EA; Thu, 14 Apr 2022 07:43:51 +0000 (UTC) To: libcamera devel Date: Thu, 14 Apr 2022 15:43:37 +0800 Message-Id: <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 0/5] Enabling AF algorithm to get the VCM attributes from the device driver 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" Some of the algorithm, such as autofocus needs the information from the device to configure the range of the search or the maximum values of the configurations. Currently, this information, such as VCM attributes was hardcoded in the code so it can only be used for specific hardware. If the device attributes can be got through the codes, the algorithm can be dynamically configured based on the device attributes got from the kernel. This work proposed an implementation that can be used to get the device attribute from the kernel and allows the algorithm has a method to get the device attribute without a specific call. Therefore, for example, the AF algorithm can get the necessary maximum VCM steps value to configure itself. First, VIDIOC_QUERYCTRL is used to get the device attributes for a given control list. in other words, we can generate a control list and set a control ID, such as V4L2_CID_FOCUS_ABSOLUTE to the list and then this function will get the attribute and put maximum results to the control list. Based on this, the interface can be implemented in each layer and pass the values to the algorithms. Camara_lens is an entry to get the maximum VCM steps value. Next, this action can be triggered in the pipeline and the results will be stored in the "configInfo" before the IPA object is created. Finally, after the IPA is created and initiated, the algorithm can get the value from IPAContext. Kate Hsuan (5): libcamera: v4l2_device: VIDIOC_QUERYCTRL call to fetch device attributes libcamera: camera_lens: Get maximum VCM steps ipa: ipu3: Variables to hold the maximum VCM steps libcamera: pipeline: ipu3: Get VCM information ipa: ipu3: af: Remove hardcoded maximum VCM steps include/libcamera/internal/camera_lens.h | 1 + include/libcamera/internal/v4l2_device.h | 2 ++ include/libcamera/ipa/core.mojom | 2 ++ src/ipa/ipu3/algorithms/af.cpp | 6 ++-- src/ipa/ipu3/ipa_context.h | 1 + src/ipa/ipu3/ipu3.cpp | 1 + src/libcamera/camera_lens.cpp | 18 ++++++++++++ src/libcamera/pipeline/ipu3/ipu3.cpp | 15 ++++++++++ src/libcamera/v4l2_device.cpp | 37 ++++++++++++++++++++++++ 9 files changed, 80 insertions(+), 3 deletions(-)