{"id":18152,"url":"https://patchwork.libcamera.org/api/1.1/patches/18152/?format=json","web_url":"https://patchwork.libcamera.org/patch/18152/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230119104544.9456-5-naush@raspberrypi.com>","date":"2023-01-19T10:45:34","name":"[libcamera-devel,v1,04/14] pipeline: ipa: raspberrypi: Validate lens controls","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7064a2b1f1c87fb07f486b69c37b8e1096eb5442","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18152/mbox/","series":[{"id":3715,"url":"https://patchwork.libcamera.org/api/1.1/series/3715/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3715","date":"2023-01-19T10:45:30","name":"Raspberry Pi: Camera Module 3 support","version":1,"mbox":"https://patchwork.libcamera.org/series/3715/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18152/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18152/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 454C4C3294\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Jan 2023 10:46:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 758DD62601;\n\tThu, 19 Jan 2023 11:46:01 +0100 (CET)","from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1ABAC625E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 11:45:55 +0100 (CET)","by mail-wm1-x32b.google.com with SMTP id q8so1143517wmo.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Jan 2023 02:45:55 -0800 (PST)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbe12-20020a05600c1e8c00b003db06224953sm5332029wmb.41.2023.01.19.02.45.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Jan 2023 02:45:54 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674125161;\n\tbh=pCYDqWG1bzsiLjnS9Uk+VA5sJ5mMkrThp7UsBsHq4y4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=r8Nb+2FULls9ikox7Xt0aG9XPZzhMOLK5TDBcoLP3ZCN4h87OVvW1PfMbbpGYhM+l\n\tfNyea9DlbNcRbnEseKuwRGnq9qHaxT42UKRMvoU98Tl0eDQ7Aq3iRJHKTw50z4Tept\n\tvPK1l+kWDEcTst0mkk8anQvKByKIGdVotqA1yQel25yCcbbYVn9a40pbG7Hz/x9drt\n\tMP31GGzUMeFvEUpIclI93bOFDsYEFjr4594CZjrB43EY9ZAoGeHSnvMV+uUSP0wodK\n\tMj0ogimoN14XQGZHPdefJVHb7ZIQroX02ZASJWGbYJwR+MSqnSLq+SfEFgHhK88g7C\n\tISUrDvX+ld41A==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=gJvgKHIB0yXSef4zLViBaTt2sEAFd85mBvT5BPozY1Q=;\n\tb=kT2iMPgkULlfSgJT/y2xTAr0Xn6BP3vPXJp9j9od7CHhf7xo/WGXdmJnHyI+coOaxE\n\tmgHR5HEPlihGjWxwwH5A91zpnxvOccQnj7W0ikSTozLMsu7ksMmVqqh33hkiic22Lmvp\n\tnSHOXBkvK0kThwW+13DaMKhOWRsvmoK0KsujiCnMJ0CzAO3dltimQV/hLyS8zi/R9TVI\n\t3+xJyKTIejnEPh9CRsDhfNMoIs0XEAuaIU4deR4nGYvRYq4qKC/dVitMRQ2O5ChZ6/i0\n\tmJwXx30SMPNWXREhcLFVx6HXaOLjP6z4twAAw8Y+vRPkm49pp2H4lTcEtvRC8RdWIR7I\n\tYLQw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"kT2iMPgk\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=gJvgKHIB0yXSef4zLViBaTt2sEAFd85mBvT5BPozY1Q=;\n\tb=kswHTM7195VbNS/KzelRRCoXnreDxg3QX8ZcwAH4uPnPWE5WfZ1G3ctekPsKGpybQ1\n\tPpFHzHNhnN4E/AEDxLhwb8P42ucZwHD2Nk2o8qAD6sdvN5UIVlwesdn0V/yzYgrsj9xz\n\tlgvw7nQ3c/iuuz4LzGWuSgNOKn+YN0Hs7qZLL3ZUJj8eaE8mqhR8kBVrKBUqiB6SJ0ej\n\tpV1Lo8dU1F5ANzzEuuXC5PNSrwQ/QWlTciKFoYm70CyidtA/ngJD7h/buE3FP+Ip0O37\n\tSY1CVKam0EC81nfagcO9AR3Dd6a3NoKVSD/EmNVEfJYTv7XmsBZyAjQWnDWYpMjqZNAQ\n\t6vcQ==","X-Gm-Message-State":"AFqh2kpCFRaPuISD24TKxfm+jHFZSWKRBZrPXCKvLOiM8m0pAqT5KScl\n\tdUk5T1fyGHtQonhLB5WIIEfhEJLLf0CHh4PDfjM=","X-Google-Smtp-Source":"AMrXdXuUhmxcxg7d4Y2Gui9n8QfE1CtDdFI9Aun6cixMeXhPR7fsW4UL3veKc5hCsC9NK1B1dGPd4g==","X-Received":"by 2002:a05:600c:4256:b0:3da:1d51:ef9e with SMTP id\n\tr22-20020a05600c425600b003da1d51ef9emr9713938wmm.17.1674125154549; \n\tThu, 19 Jan 2023 02:45:54 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 19 Jan 2023 10:45:34 +0000","Message-Id":"<20230119104544.9456-5-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20230119104544.9456-1-naush@raspberrypi.com>","References":"<20230119104544.9456-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 04/14] pipeline: ipa: raspberrypi:\n\tValidate lens controls","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Pass the available lens controls to the IPA through the configure() function.\nValidate that the V4L2_CID_FOCUS_ABSOLUTE does exist. If it doesn't, log a\nwarning message, and do not advertise focus related controls from the IPA.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom       |  1 +\n src/ipa/raspberrypi/raspberrypi.cpp           | 21 +++++++++++++++++++\n .../pipeline/raspberrypi/raspberrypi.cpp      |  2 ++\n 3 files changed, 24 insertions(+)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 2a4821fbc0ef..bfacd1275bfb 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -38,6 +38,7 @@ struct IPAConfig {\n \tlibcamera.SharedFD lsTableHandle;\n \tlibcamera.ControlInfoMap sensorControls;\n \tlibcamera.ControlInfoMap ispControls;\n+\tlibcamera.ControlInfoMap lensControls;\n };\n \n struct IPAConfigResult {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex aa18ed750370..bbf3c7dc4a69 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -131,6 +131,7 @@ private:\n \tvoid setMode(const IPACameraSensorInfo &sensorInfo);\n \tbool validateSensorControls();\n \tbool validateIspControls();\n+\tbool validateLensControls();\n \tvoid queueRequest(const ControlList &controls);\n \tvoid returnEmbeddedBuffer(unsigned int bufferId);\n \tvoid prepareISP(const ISPConfig &data);\n@@ -155,6 +156,7 @@ private:\n \n \tControlInfoMap sensorCtrls_;\n \tControlInfoMap ispCtrls_;\n+\tControlInfoMap lensCtrls_;\n \tbool lensPresent_;\n \tControlList libcameraMetadata_;\n \n@@ -394,6 +396,15 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ip\n \t\treturn -1;\n \t}\n \n+\tif (lensPresent_) {\n+\t\tlensCtrls_ = ipaConfig.lensControls;\n+\t\tif (!validateLensControls()) {\n+\t\t\tLOG(IPARPI, Warning) << \"Lens validation failed, \"\n+\t\t\t\t\t     << \"no lens control will be available.\";\n+\t\t\tlensPresent_ = false;\n+\t\t}\n+\t}\n+\n \tmaxSensorGainCode_ = sensorCtrls_.at(V4L2_CID_ANALOGUE_GAIN).max().get<int32_t>();\n \n \t/* Setup a metadata ControlList to output metadata. */\n@@ -648,6 +659,16 @@ bool IPARPi::validateIspControls()\n \treturn true;\n }\n \n+bool IPARPi::validateLensControls()\n+{\n+\tif (lensCtrls_.find(V4L2_CID_FOCUS_ABSOLUTE) == lensCtrls_.end()) {\n+\t\tLOG(IPARPI, Error) << \"Unable to find Lens control V4L2_CID_FOCUS_ABSOLUTE\";\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n /*\n  * Converting between enums (used in the libcamera API) and the names that\n  * we use to identify different modes. Unfortunately, the conversion tables\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 9dd36cbaea78..249dedcd8c09 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1617,6 +1617,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA\n \n \tipaConfig.sensorControls = sensor_->controls();\n \tipaConfig.ispControls = isp_[Isp::Input].dev()->controls();\n+\tif (sensor_->focusLens())\n+\t\tipaConfig.lensControls = sensor_->focusLens()->controls();\n \n \t/* Always send the user transform to the IPA. */\n \tipaConfig.transform = static_cast<unsigned int>(config->transform);\n","prefixes":["libcamera-devel","v1","04/14"]}