From patchwork Thu Apr 21 15:11:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15698 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 88BB2C3260 for ; Thu, 21 Apr 2022 15:11:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4987B65647; Thu, 21 Apr 2022 17:11:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1650553887; bh=/srzPELWhNOwQikox14BL88h8/TLnOjVs/takO03HQw=; 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=OGf2w9qTsmXPofD+bMTMfmCavCrGDtSBuoFkmsMK2VNJSlOLsXTjcqBIwyGK4fa/I iqhwFg76NlSi2fFHvgI3dRGc3qG60/1EyNy3EiVqP1NjqC5Mw4LAvUNxfEImluXDU6 ceARELBNxD3+YY5O6S+Z3UGIA9QQO50d+jc4y1xNW1Rwg2XWEpXu3fe1Z6jQzqhOkd ExPUTYvGDLAQ0X1s4PcSe1L+NSrRz064P+lXSGtZl1TtTDFkZKypTAdsXL4LiDjXOm 3B0RLUxMWTg2nfLujUSxSx9f6CsKQNUwCK4BhApGrvZCm10ZwGKn1GkDBS1YWkLqSp QVDfz3DV0juiw== Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C2D3665641 for ; Thu, 21 Apr 2022 17:11:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="jYPLMRY5"; dkim-atps=neutral Received: by mail-wr1-x431.google.com with SMTP id bv16so7105491wrb.9 for ; Thu, 21 Apr 2022 08:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zIfYpFNk3DA5BdEjHx98vV37+ytEtgwFyTClAn2at/M=; b=jYPLMRY5J74L3ipW/cgdB+HpvSmvLZEXK3IqrViu39gtp4TkTSTrLwdgugTGU4y3B8 Gpg7pOfiOtabipQ5ovE7ODNxj+NDtI/yPdA2tb+YNYXQqPvpLyWsY3P/rPTrrEs8gkGw N0d2guBrzgQSYgNmFsSmeFiKLBImata7LTWDch423H1mNXjNNcDVkI4j2o9tbTACRc1j qh2Z6fuDBWWPNaOSg0IPYcLKJESxxsT4oqTqi7kfmM0xsXl4wsw1JufbC/wR4e1qYxue U3228c7cJKerWhccKENa4gBn8AcIw9Wympc5fpnh1dCRK0qr19XnPHC6BAn/UnOoRqAW JO2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zIfYpFNk3DA5BdEjHx98vV37+ytEtgwFyTClAn2at/M=; b=BtYosTRLSfjCdZh6k/vvMbsfSy9HcXOfG565z5nSPzwLuR2rOBAR0lvqwRMEmUYjW9 SEuYGZD2ApkkRIKRh1xklssFgVKjOQyi7S3+QqIxm3JC9jQt7hFgKjtNBgAP4KFlvaQr LIwFdtcB18HiLjEIlWK1Hn1/QpWfCl8m9snCBlq/18IuaCSDDbYYiwNMGZ46agMnaw/n dDa54g6Rkn39Jqu6mZKDqRXhwsd9NVXr0VpO/DvZsCjQSsnrJBtweC1VuRDi1IDVLaP3 fAVFxDEtPToU9+7ZZFDLxAVS8T1vf2Dq5Xd//7IUj7j4R5kS/PehOrtlreyMmLadEjit mnYQ== X-Gm-Message-State: AOAM532iieuG7iEbantyp5VO/2twnrDNujvJb13juRqDU0rQUXf5pnj5 uJsgiqgfLQZqNS8t9EVA4p4//IqlLYd8ng== X-Google-Smtp-Source: ABdhPJxHj1Les6XrzxUoDZ4wj/5NY/xSLOoQ1qY+yVYJpDUM4nrClk/7D6ogDtAKssV7eZsIGIxX9w== X-Received: by 2002:adf:e194:0:b0:207:b4c9:31c6 with SMTP id az20-20020adfe194000000b00207b4c931c6mr181723wrb.102.1650553884289; Thu, 21 Apr 2022 08:11:24 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:6bd1:8370:773e:357e]) by smtp.gmail.com with ESMTPSA id k63-20020a1ca142000000b0038ff2c38e85sm2267683wme.39.2022.04.21.08.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:11:23 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 21 Apr 2022 16:11:16 +0100 Message-Id: <20220421151117.703956-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421151117.703956-1-naush@raspberrypi.com> References: <20220421151117.703956-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/2] libcamera: Add a SensorSensitivity property 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 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The SensorSensitivity property is a scaling factor that describes how sensitive the selected sensor mode is compared to other readout modes of the same sensor. For example, a binned mode might have twice the sensitivity of the full resolution mode, meaning you would get double the signal level for the same exposure and gains. Signed-off-by: David Plowman Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/libcamera/property_ids.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 12ecbce5eed4..11b7ebdc3105 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -678,6 +678,18 @@ controls: \todo Turn this property into a "maximum control value" for the ScalerCrop control once "dynamic" controls have been implemented. + - SensorSensitivity: + type: float + description: | + The relative sensitivity of the chosen sensor mode. + + Some sensors have readout modes with different sensitivities. For example, + a binned camera mode might, with the same exposure and gains, produce + twice the signal level of the full resolution readout. This would be + signalled by the binned mode, when it is chosen, indicating a value here + that is twice that of the full resolution mode. This value will be valid + after the configure method has returned successfully. + # ---------------------------------------------------------------------------- # Draft properties section From patchwork Thu Apr 21 15:11:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15699 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 AED58C0F1B for ; Thu, 21 Apr 2022 15:11:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E027265643; Thu, 21 Apr 2022 17:11:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1650553887; bh=FH9HwTxI2zR2s6gKBno1xln6YDAMrA+ZJRK8kIYgIUs=; 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=wi6WtQQuHca7DNjUxDPsFuUYWFaM6dnNN8j+R8GdMEmd8AbkVjQ2hs8BG2fuELE8w azuxPuBAzphH8Hk2S1PzHMDDlqvGxNDOyUL9V9nVmqZfd3G+YdBXyU7bFZImU+5Ihm Lvo0Gl0SHfx7uTAMViKsUlc9DE9ZyWyc0mT7Kk19nh53JhUSk8BYlHdL0+NuxY6MtB pcOGh2zcSFmd8WK6ili8gzDjN9UyhoRzjqh2svWb96XrdhLmspkMAGn1PdSMr3D6Cs zsuSc75qxlYD5TYrjfKiJ6TZESxOTtjymuUQrJNZL3PXUvkmme5nbkJneUtQjKI7v/ xn3gWPYFf3OPA== Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 00F3665647 for ; Thu, 21 Apr 2022 17:11:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LRXktL+O"; dkim-atps=neutral Received: by mail-wr1-x42c.google.com with SMTP id m14so7140250wrb.6 for ; Thu, 21 Apr 2022 08:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VSSQqddBWkmu1M6Jzvuc7bPiw0rI0ZF6bsGb/4SZnFI=; b=LRXktL+O0tpWDantCr62INtckuga/bEcRl5ra6xi4sXlwwlu1owDKnGf0VDKjkMaSG tNfr8M+by7IrOXvt1XYXJb56N9iPDJNFbY5azvHJ6xAkV8EeoatIUv9r+P616xiMfKv/ G2AN3xl6GaHOFg7Vn43K6bpGWwqsrsLgF+We6jM1UiksXllQYLN6GGb0rKHSA3SS6tbC HweHtenbxrtHiIwNLT4Z+XcOaBb5o2Mgu3tU1qlsXvdQo/gzOpZXp44r2k8D5TpzEpz9 VaFywVCimYmnC8zN1d2GOle71DucvA9eB7Ag2ctlspbFZTLzR1CLrRTWhm+LTflNya7p jaXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VSSQqddBWkmu1M6Jzvuc7bPiw0rI0ZF6bsGb/4SZnFI=; b=hULfGLgqeQD+rgBdpNxEL5mm9Z+zX1OSA7LjeQLIFRJxcxzBTBFIoRwRMVVAK0BwyR DeDc4QGlvtxjWtxiEkRSOllzOtJvi4+fuzKeregJKPJw9xeTyvTKCuSON6J6UdkeI8Oi gdn6iJrG+G6E7VD+/Bdy4glBiqsiiGYT2dqyuDK7uIrQk9eA2jg7WHLEzXZXrwoqlB1t VjN1rAMqRJbuc/I6EcWjTEQYFCZudv74Kx6QEBynrKO7YLRGNDgY31186+cTPra1VHnh IOxS2XeA/iTGBNws15jXZSyFJGP38cd3OgAuegHq+PRRK1X1rMIRmhszKY6EXapIACVS oRSQ== X-Gm-Message-State: AOAM532N/qTN4KjebeKK2Mj96I/4hfjkSB2y2GCt+Yl0BgKzeeilvBD4 vIouzfOuNwz8yxmvTTJMU6C568EBIZG0sA== X-Google-Smtp-Source: ABdhPJyDqYibuAspfZfZ6cxfaIq50n3L5Tx+oKHJtk/XLmEckzY1OMkr3ey5emyHv91rT4UgU3NZAw== X-Received: by 2002:a05:6000:111:b0:207:ac77:3d07 with SMTP id o17-20020a056000011100b00207ac773d07mr181929wrx.136.1650553885156; Thu, 21 Apr 2022 08:11:25 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:6bd1:8370:773e:357e]) by smtp.gmail.com with ESMTPSA id k63-20020a1ca142000000b0038ff2c38e85sm2267683wme.39.2022.04.21.08.11.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:11:24 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 21 Apr 2022 16:11:17 +0100 Message-Id: <20220421151117.703956-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421151117.703956-1-naush@raspberrypi.com> References: <20220421151117.703956-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/2] libcamera: raspberrypi: Fetch correct value for SensorSensitivity 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 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: David Plowman These changes retrieve the correct value for sensitivity of the mode selected for the sensor. This value is known to the CamHelper which passes it across to the pipeline handler so that it can be set correctly in the camera properties. Signed-off-by: David Plowman Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- include/libcamera/ipa/raspberrypi.mojom | 7 ++++++- src/ipa/raspberrypi/raspberrypi.cpp | 7 +++++-- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 5a228b75cd2f..a60c3bb43d3c 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -38,6 +38,10 @@ struct IPAConfig { libcamera.SharedFD lsTableHandle; }; +struct IPAConfigResult { + float modeSensitivity; +}; + struct StartConfig { libcamera.ControlList controls; int32 dropFrameCount; @@ -58,6 +62,7 @@ interface IPARPiInterface { * \param[in] entityControls Controls provided by the pipeline entities * \param[in] ipaConfig Pipeline-handler-specific configuration data * \param[out] controls Controls to apply by the pipeline entity + * \param[out] result Other results that the pipeline handler may require * * This function shall be called when the camera is configured to inform * the IPA of the camera's streams and the sensor settings. @@ -72,7 +77,7 @@ interface IPARPiInterface { map streamConfig, map entityControls, IPAConfig ipaConfig) - => (int32 ret, libcamera.ControlList controls); + => (int32 ret, libcamera.ControlList controls, IPAConfigResult result); /** * \fn mapBuffers() diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 5efd051bdd13..fd66cfeee087 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -99,7 +99,7 @@ public: const std::map &streamConfig, const std::map &entityControls, const IPAConfig &data, - ControlList *controls) override; + ControlList *controls, IPAConfigResult *result) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; void signalStatReady(const uint32_t bufferId) override; @@ -344,7 +344,7 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, [[maybe_unused]] const std::map &streamConfig, const std::map &entityControls, const IPAConfig &ipaConfig, - ControlList *controls) + ControlList *controls, IPAConfigResult *result) { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; @@ -404,6 +404,9 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, */ ControlList ctrls(sensorCtrls_); + /* The pipeline handler passes out the mode's sensitivity. */ + result->modeSensitivity = mode_.sensitivity; + if (firstStart_) { /* Supply initial values for frame durations. */ applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration); diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index acc0becaa5c0..b2489005120c 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -200,7 +200,7 @@ public: void frameStarted(uint32_t sequence); int loadIPA(ipa::RPi::SensorConfig *sensorConfig); - int configureIPA(const CameraConfiguration *config); + int configureIPA(const CameraConfiguration *config, ipa::RPi::IPAConfigResult *result); void enumerateVideoDevices(MediaLink *link); @@ -898,7 +898,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) data->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop); - ret = data->configureIPA(config); + ipa::RPi::IPAConfigResult result; + ret = data->configureIPA(config, &result); if (ret) LOG(RPI, Error) << "Failed to configure the IPA: " << ret; @@ -937,6 +938,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) */ data->properties_.set(properties::ScalerCropMaximum, data->sensorInfo_.analogCrop); + /* Store the mode sensitivity for the application. */ + data->properties_.set(properties::SensorSensitivity, result.modeSensitivity); + /* Setup the Video Mux/Bridge entities. */ for (auto &[device, link] : data->bridgeDevices_) { /* @@ -1528,7 +1532,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig) return ipa_->init(settings, sensorConfig); } -int RPiCameraData::configureIPA(const CameraConfiguration *config) +int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPAConfigResult *result) { std::map streamConfig; std::map entityControls; @@ -1574,7 +1578,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) /* Ready the IPA - it must know about the sensor resolution. */ ControlList controls; ret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, - &controls); + &controls, result); if (ret < 0) { LOG(RPI, Error) << "IPA configuration failed!"; return -EPIPE;