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;