From patchwork Thu Feb 18 12:48:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11331 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 37186BD1F6 for ; Thu, 18 Feb 2021 12:48:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DE4C0689B3; Thu, 18 Feb 2021 13:48:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="tvAsibqV"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5911F68110 for ; Thu, 18 Feb 2021 13:48:33 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id f7so1686965wrt.12 for ; Thu, 18 Feb 2021 04:48:33 -0800 (PST) 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=BxgoKMN/TClcFlvFt8c9k+4ExYPEZI7X8fMcpxmrXJw=; b=tvAsibqVXRDQgZcO7iB2zHvE429SQP/db8y5X/g/i8+Hr7sY+XquiRS/4LXFi1i3HZ pibpYu2CsSZQSt4/jtib2t3UpvfKbbzYzSdtb3JrkZWM3FB9WiSCy8JXQD0HMp+ZgAAz Pi1y2b2HWXV/YO69XT8T2NbfpABuhTreMPSPf1M+Yf2Ysf8FVM4Qivcol0rYzapOtZ9O WbHO+7bZ7wr1ep+h+6tP1YmBD9eGfJNcGgEuF2d06kSVDvCg9pxU97uKie1zLYsdBose skqAjD6nwvISEnJU0gaEq8fo3bMAJEmG3oSwKkCzYqK+sLaiEr5pykRbNeOOnrSfjRtz eHKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BxgoKMN/TClcFlvFt8c9k+4ExYPEZI7X8fMcpxmrXJw=; b=ikGGJJvucFFsh7myGb4DUtroZESSEZXVb6zPNu1QONAykGHZo54a7Mtz9Xeaga7YD7 /kw3ixXpGUF/FsISXsEhWy/Z5nXF1b6jefLS2evXyr6JmwjuiyKC+dIZN5jn5/cXrB9b jdzto6Bp4uk7OxTErwdhVE+p3fftR06FvdhZBBhAb7lpkJnZDEAFY26w4dKwRyvtU/dS LFLA7Nj2kqe1jGf5T+ZE1l/vB9rQDVGgCpeO3FBzTJFxr+6QS9wGo02kNcRRzc4+MOSn 9gqWZpenEfX1nOtQfr9ZxBJbgzQOQ0TjzzAniFOT4dudMRGQt0d7FulYpNBiWeVwLGf1 w07w== X-Gm-Message-State: AOAM5326oIi+16bf6U76poTr04djAGfF8lcYj1XmVd0P5t4MZuniXufU FQm/gJyK8kMQkqD6TPgcxovUi9ippvidQRrE X-Google-Smtp-Source: ABdhPJzeHhvgr2ZI0iXyAJqklT9K78KXUZsApJh8SyU94Uf74L/yS3/9F6JEv1sA65BNilcOO4Db4g== X-Received: by 2002:adf:ebcb:: with SMTP id v11mr4112543wrn.231.1613652512820; Thu, 18 Feb 2021 04:48:32 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:c37b:2722:9ed2:1d58]) by smtp.gmail.com with ESMTPSA id z63sm7675876wme.8.2021.02.18.04.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:48:32 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Feb 2021 12:48:21 +0000 Message-Id: <20210218124824.1825418-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210218124824.1825418-1-naush@raspberrypi.com> References: <20210218124824.1825418-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/4] pipeline: ipa: raspberrypi: Fix pipeline running on in a stopped state 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" With the recent IPAInterface changes, the signal handlers statsMetadataComplete(), runISP() and embeddedComplete() would run unconditionally when called. They should only run when state != Stopped. Signed-off-by: Naushir Patuck Fixes: e201cb4f5450 ("libcamera: IPAInterface: Replace C API with the new C++-only API") Tested-by: David Plowman Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 15aa600ed581..75d57c2a2ffd 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1281,7 +1281,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &controls) { if (state_ == State::Stopped) - handleState(); + return; FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId); @@ -1314,7 +1314,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList & void RPiCameraData::runIsp(uint32_t bufferId) { if (state_ == State::Stopped) - handleState(); + return; FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId); @@ -1329,7 +1329,7 @@ void RPiCameraData::runIsp(uint32_t bufferId) void RPiCameraData::embeddedComplete(uint32_t bufferId) { if (state_ == State::Stopped) - handleState(); + return; FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId); handleStreamBuffer(buffer, &unicam_[Unicam::Embedded]); From patchwork Thu Feb 18 12:48:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11332 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 7310CBD1F6 for ; Thu, 18 Feb 2021 12:48:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 38C1B689BA; Thu, 18 Feb 2021 13:48:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="heWje3J7"; dkim-atps=neutral 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 705366836F for ; Thu, 18 Feb 2021 13:48:34 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id a4so617020wro.8 for ; Thu, 18 Feb 2021 04:48:34 -0800 (PST) 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=jCN620akcDzN1LauegtIxBd2MKYranhSb0eYGC8Zu7g=; b=heWje3J77xCsr4cJN+5C4UBuRCca9HBEiMfrn0B9PvDJcVILNlFH0tryeryDAB1lpn KTpAiV0jnzxaLUCYJqKtXzdyoQUo6Qsi6n1x8Rj2DCYB9e1J3KS7FMhUX5nypw2cdKZD ecfgVojxhaWIdB4gWwLcF+IxbBPnXvuNuKJQqvC0+fCdX44FGugPdR/A0uWK7YQrO9RT YJTsWm1nKG8EGmXyKFvq5xnx8nwtZsXSMYfDftWKn8ddPSC7yw5AYPbZEjHMfU9UJqzL +/F0LGZUkKjxc9RbEjOOrzMMXg9JuZQsCfvhvRfuAtqvuiTyPCTg+OwSCYgVpPR8qevp uoNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jCN620akcDzN1LauegtIxBd2MKYranhSb0eYGC8Zu7g=; b=A1L19qazr1avHU8EeLGRVJgp1cxtYKrNkw3qf4lCYRkmqSp08FUrhjGw8r5WncZs2y a8y/P0+cDVtlQ/AFPWtIuqWPv8OyPl9TTDUgbimeijGvvbjiJDROGuSTT1WvoeHiknPX yAs7g/I+A3LziK08QjxLk1YflWiCQYbTmQpczO7elV2Hxf5DJatnM6M3UBu8yobx1ysG +24lRCrDFUzAjGRQ49uzFUVIvbor5hAo4acWd8vXn2f0Db3Lj8Aq6cPSoQeGTc5g8eId 5MUp/Wbf0JhlBbStU10a5YMrZ8vj24DuNAXVAiq8wSqHguQRhjZ3dPACiQWylbs42a2r Mkbg== X-Gm-Message-State: AOAM530X/xDtk25K+duswNeU38kHjbG/RVvjiSxjVqtuLo+oXgYDMVCV bBen9gdCeWXWiHp7hhcvPjzarjvfRxLPDsQp X-Google-Smtp-Source: ABdhPJx6htA1Iv0GBqEJju5JP1ZHeUatnAmppcHd2U8NOH5p4G0zf3XAlAQyOiSNug5KPW9Xq53gqA== X-Received: by 2002:adf:c6c1:: with SMTP id c1mr4209010wrh.326.1613652513793; Thu, 18 Feb 2021 04:48:33 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:c37b:2722:9ed2:1d58]) by smtp.gmail.com with ESMTPSA id z63sm7675876wme.8.2021.02.18.04.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:48:33 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Feb 2021 12:48:22 +0000 Message-Id: <20210218124824.1825418-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210218124824.1825418-1-naush@raspberrypi.com> References: <20210218124824.1825418-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/4] pipeline: ipa: raspberrypi: Tidy-ups after IPAInterface changes 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This commit addresses a couple of tidy-ups after the IPAInterface rework: - Rename ConfigStaggeredWrite -> ConfigSensorParams - Rename setIsp -> setIspControls There is no functional change in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- include/libcamera/ipa/raspberrypi.mojom | 8 ++++---- src/ipa/raspberrypi/raspberrypi.cpp | 8 ++++---- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index bab19a946e18..9c05cc68cceb 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -16,7 +16,7 @@ enum BufferMask { const uint32 MaxLsGridSize = 0x8000; enum ConfigOutputParameters { - ConfigStaggeredWrite = 0x01, + ConfigSensorParams = 0x01, }; struct SensorConfig { @@ -27,8 +27,8 @@ struct SensorConfig { }; struct ISPConfig { - uint32 embeddedbufferId; - uint32 bayerbufferId; + uint32 embeddedBufferId; + uint32 bayerBufferId; }; struct ConfigInput { @@ -126,6 +126,6 @@ interface IPARPiEventInterface { statsMetadataComplete(uint32 bufferId, ControlList controls); runIsp(uint32 bufferId); embeddedComplete(uint32 bufferId); - setIsp(ControlList controls); + setIspControls(ControlList controls); setDelayedControls(ControlList controls); }; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 81a3195c82e9..974f4ec63058 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -344,7 +344,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, helper_->GetDelays(exposureDelay, gainDelay); sensorMetadata = helper_->SensorEmbeddedDataPresent(); - result->params |= ipa::rpi::ConfigStaggeredWrite; + result->params |= ipa::rpi::ConfigSensorParams; result->sensorConfig.gainDelay = gainDelay; result->sensorConfig.exposureDelay = exposureDelay; result->sensorConfig.vblank = exposureDelay; @@ -447,11 +447,11 @@ void IPARPi::signalIspPrepare(const ipa::rpi::ISPConfig &data) * avoid running the control algos for a few frames in case * they are "unreliable". */ - prepareISP(data.embeddedbufferId); + prepareISP(data.embeddedBufferId); frameCount_++; /* Ready to push the input buffer into the ISP. */ - runIsp.emit(data.bayerbufferId & ipa::rpi::MaskID); + runIsp.emit(data.bayerBufferId & ipa::rpi::MaskID); } void IPARPi::reportMetadata() @@ -968,7 +968,7 @@ void IPARPi::prepareISP(unsigned int bufferId) applyDPC(dpcStatus, ctrls); if (!ctrls.empty()) - setIsp.emit(ctrls); + setIspControls.emit(ctrls); } } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 75d57c2a2ffd..aac285b44748 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -152,7 +152,7 @@ public: void statsMetadataComplete(uint32_t bufferId, const ControlList &controls); void runIsp(uint32_t bufferId); void embeddedComplete(uint32_t bufferId); - void setIsp(const ControlList &controls); + void setIspControls(const ControlList &controls); void setDelayedControls(const ControlList &controls); /* bufferComplete signal handlers. */ @@ -1172,7 +1172,7 @@ int RPiCameraData::loadIPA() ipa_->statsMetadataComplete.connect(this, &RPiCameraData::statsMetadataComplete); ipa_->runIsp.connect(this, &RPiCameraData::runIsp); ipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete); - ipa_->setIsp.connect(this, &RPiCameraData::setIsp); + ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls); ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls); IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json")); @@ -1241,7 +1241,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) return -EPIPE; } - if (result.params & ipa::rpi::ConfigStaggeredWrite) { + if (result.params & ipa::rpi::ConfigSensorParams) { /* * Setup our delayed control writer with the sensor default * gain and exposure delays. @@ -1336,7 +1336,7 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId) handleState(); } -void RPiCameraData::setIsp(const ControlList &controls) +void RPiCameraData::setIspControls(const ControlList &controls) { ControlList ctrls = controls; @@ -1692,8 +1692,8 @@ void RPiCameraData::tryRunPipeline() << " Embedded buffer id: " << embeddedId; ipa::rpi::ISPConfig ispPrepare; - ispPrepare.embeddedbufferId = ipa::rpi::MaskEmbeddedData | embeddedId; - ispPrepare.bayerbufferId = ipa::rpi::MaskBayerData | bayerId; + ispPrepare.embeddedBufferId = ipa::rpi::MaskEmbeddedData | embeddedId; + ispPrepare.bayerBufferId = ipa::rpi::MaskBayerData | bayerId; ipa_->signalIspPrepare(ispPrepare); } From patchwork Thu Feb 18 12:48:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11333 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 00CFABD1F6 for ; Thu, 18 Feb 2021 12:48:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AD15B689B6; Thu, 18 Feb 2021 13:48:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="OgwJcUC1"; dkim-atps=neutral Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 607DB689B5 for ; Thu, 18 Feb 2021 13:48:35 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id a132so3556150wmc.0 for ; Thu, 18 Feb 2021 04:48:35 -0800 (PST) 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=tWbYymExjdFC1yv8KSs1CjjsFt8R6XwxYz+zqsbboC8=; b=OgwJcUC1hozXA3euLu1bzRE5moodtU0xvCojGKBT0OxoaH3tKgoYR4ZHoB4Xi1KkY7 AmVOsCQYf2tdYTOa6w6T76anYrDcCUnAXWQ73U4ZSvwURVT7uJHkFQwlBUITbR8WOUEu fXF2mqp7DmAiVLtYCo+77gGQ+gTMmjF/JaU2lS252LAVZDZX+zS0R1pkI7TVQh5ax2kV o8H/Rn9kYq3EpIUvqZiEu2Y+7t3Hvf/z6YGELsY5fdGhRCJOt3FsQaZHqFJBAs47+z6F zmKEGIquS2dIsD/V+QzDfIm/RLwjsLyCPa0MfFNjSJA8WwQAVDJ+HN1zDI3WMMRsv5E2 AheQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tWbYymExjdFC1yv8KSs1CjjsFt8R6XwxYz+zqsbboC8=; b=ufiugZPE7sNIKOMKVMW+707yzIDJSrG+o6zN56tJiKeV3RbhTqnxdy5MKngO4l0ZV9 tjiboVjP9lN7vE/s3smVU2i4+o0tJBqoZaJvcx6ekEUlbW2lVGy1sJWOT7ipeHsH1tjJ YQjSDC3ql0flgMKw8hNilMLKAb95g7aWtm63ETiLRQDXEL9t4hsxNds5NRPKa8AJffRg 0DiUfc5m+RIhhhOH9YNd7g7XfiRO7uZsWHqwKNjmQNMZpo4BrCChTM0c9icSYt/qUoGz 1Gw0QAHuLSi2AYxqN5L1r0NqSGg5LH4FHe7bA7rt2+gE5uEGyyEk0Fw7TDp1sa8Tfn7F ElmA== X-Gm-Message-State: AOAM530FROHREnvT8sZyyw672n1JwInArPvFn12M6oB2rhbL7Qct75LY gOFXs/KznE2Veiyh9SnKuosDPHlQd83Rf/PP X-Google-Smtp-Source: ABdhPJyXSG6f+/syigJdvlpo/1Ph8kqJEUyDdgH4vTBLhqGNNoqVF7uizyhvoyrgtSWGf1RNA29/YA== X-Received: by 2002:a05:600c:1552:: with SMTP id f18mr3466426wmg.149.1613652514666; Thu, 18 Feb 2021 04:48:34 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:c37b:2722:9ed2:1d58]) by smtp.gmail.com with ESMTPSA id z63sm7675876wme.8.2021.02.18.04.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:48:34 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Feb 2021 12:48:23 +0000 Message-Id: <20210218124824.1825418-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210218124824.1825418-1-naush@raspberrypi.com> References: <20210218124824.1825418-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/4] pipeline: ipa: raspberrypi: Rename IPA Interface namespace to ipa::RPi 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Rename the IPA interface namespace to ipa::RPi for consistency with the libcamera::RPi namespace label. There is no functional change in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- include/libcamera/ipa/raspberrypi.mojom | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 38 +++++++++---------- .../pipeline/raspberrypi/raspberrypi.cpp | 30 +++++++-------- .../pipeline/raspberrypi/rpi_stream.cpp | 4 +- .../pipeline/raspberrypi/rpi_stream.h | 4 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 9c05cc68cceb..5a27b1e4fc2d 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -module ipa.rpi; +module ipa.RPi; import "include/libcamera/ipa/core.mojom"; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 974f4ec63058..1226ea514521 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -63,7 +63,7 @@ constexpr double defaultMaxFrameDuration = 1e6 / 0.01; LOG_DEFINE_CATEGORY(IPARPI) -class IPARPi : public ipa::rpi::IPARPiInterface +class IPARPi : public ipa::RPi::IPARPiInterface { public: IPARPi() @@ -76,24 +76,24 @@ public: ~IPARPi() { if (lsTable_) - munmap(lsTable_, ipa::rpi::MaxLsGridSize); + munmap(lsTable_, ipa::RPi::MaxLsGridSize); } int init(const IPASettings &settings) override; - void start(const ipa::rpi::StartControls &data, - ipa::rpi::StartControls *result) override; + void start(const ipa::RPi::StartControls &data, + ipa::RPi::StartControls *result) override; void stop() override {} void configure(const CameraSensorInfo &sensorInfo, const std::map &streamConfig, const std::map &entityControls, - const ipa::rpi::ConfigInput &data, - ipa::rpi::ConfigOutput *response, int32_t *ret) override; + const ipa::RPi::ConfigInput &data, + ipa::RPi::ConfigOutput *response, int32_t *ret) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; void signalStatReady(const uint32_t bufferId) override; void signalQueueRequest(const ControlList &controls) override; - void signalIspPrepare(const ipa::rpi::ISPConfig &data) override; + void signalIspPrepare(const ipa::RPi::ISPConfig &data) override; private: void setMode(const CameraSensorInfo &sensorInfo); @@ -168,8 +168,8 @@ int IPARPi::init(const IPASettings &settings) return 0; } -void IPARPi::start(const ipa::rpi::StartControls &data, - ipa::rpi::StartControls *result) +void IPARPi::start(const ipa::RPi::StartControls &data, + ipa::RPi::StartControls *result) { RPiController::Metadata metadata; @@ -291,8 +291,8 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo) void IPARPi::configure(const CameraSensorInfo &sensorInfo, [[maybe_unused]] const std::map &streamConfig, const std::map &entityControls, - const ipa::rpi::ConfigInput &ipaConfig, - ipa::rpi::ConfigOutput *result, int32_t *ret) + const ipa::RPi::ConfigInput &ipaConfig, + ipa::RPi::ConfigOutput *result, int32_t *ret) { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; @@ -344,7 +344,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, helper_->GetDelays(exposureDelay, gainDelay); sensorMetadata = helper_->SensorEmbeddedDataPresent(); - result->params |= ipa::rpi::ConfigSensorParams; + result->params |= ipa::RPi::ConfigSensorParams; result->sensorConfig.gainDelay = gainDelay; result->sensorConfig.exposureDelay = exposureDelay; result->sensorConfig.vblank = exposureDelay; @@ -360,14 +360,14 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (ipaConfig.lsTableHandle.isValid()) { /* Remove any previous table, if there was one. */ if (lsTable_) { - munmap(lsTable_, ipa::rpi::MaxLsGridSize); + munmap(lsTable_, ipa::RPi::MaxLsGridSize); lsTable_ = nullptr; } /* Map the LS table buffer into user space. */ lsTableHandle_ = std::move(ipaConfig.lsTableHandle); if (lsTableHandle_.isValid()) { - lsTable_ = mmap(nullptr, ipa::rpi::MaxLsGridSize, PROT_READ | PROT_WRITE, + lsTable_ = mmap(nullptr, ipa::RPi::MaxLsGridSize, PROT_READ | PROT_WRITE, MAP_SHARED, lsTableHandle_.fd(), 0); if (lsTable_ == MAP_FAILED) { @@ -432,7 +432,7 @@ void IPARPi::signalStatReady(uint32_t bufferId) reportMetadata(); - statsMetadataComplete.emit(bufferId & ipa::rpi::MaskID, libcameraMetadata_); + statsMetadataComplete.emit(bufferId & ipa::RPi::MaskID, libcameraMetadata_); } void IPARPi::signalQueueRequest(const ControlList &controls) @@ -440,7 +440,7 @@ void IPARPi::signalQueueRequest(const ControlList &controls) queueRequest(controls); } -void IPARPi::signalIspPrepare(const ipa::rpi::ISPConfig &data) +void IPARPi::signalIspPrepare(const ipa::RPi::ISPConfig &data) { /* * At start-up, or after a mode-switch, we may want to @@ -451,7 +451,7 @@ void IPARPi::signalIspPrepare(const ipa::rpi::ISPConfig &data) frameCount_++; /* Ready to push the input buffer into the ISP. */ - runIsp.emit(data.bayerBufferId & ipa::rpi::MaskID); + runIsp.emit(data.bayerBufferId & ipa::RPi::MaskID); } void IPARPi::reportMetadata() @@ -906,7 +906,7 @@ void IPARPi::queueRequest(const ControlList &controls) void IPARPi::returnEmbeddedBuffer(unsigned int bufferId) { - embeddedComplete.emit(bufferId & ipa::rpi::MaskID); + embeddedComplete.emit(bufferId & ipa::RPi::MaskID); } void IPARPi::prepareISP(unsigned int bufferId) @@ -1271,7 +1271,7 @@ void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) .gain_format = GAIN_FORMAT_U4P10 }; - if (!lsTable_ || w * h * 4 * sizeof(uint16_t) > ipa::rpi::MaxLsGridSize) { + if (!lsTable_ || w * h * 4 * sizeof(uint16_t) > ipa::RPi::MaxLsGridSize) { LOG(IPARPI, Error) << "Do not have a correctly allocate lens shading table!"; return; } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index aac285b44748..acf2d56cddb2 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -166,7 +166,7 @@ public: void handleState(); void applyScalerCrop(const ControlList &controls); - std::unique_ptr ipa_; + std::unique_ptr ipa_; std::unique_ptr sensor_; /* Array of Unicam and ISP device streams and associated buffers/streams. */ @@ -778,8 +778,8 @@ int PipelineHandlerRPi::start(Camera *camera, ControlList *controls) data->applyScalerCrop(*controls); /* Start the IPA. */ - ipa::rpi::StartControls ipaData; - ipa::rpi::StartControls result; + ipa::RPi::StartControls ipaData; + ipa::RPi::StartControls result; if (controls) ipaData.controls = *controls; data->ipa_->start(ipaData, &result); @@ -1114,8 +1114,8 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) * Pass the stats and embedded data buffers to the IPA. No other * buffers need to be passed. */ - mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), ipa::rpi::MaskStats); - mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), ipa::rpi::MaskEmbeddedData); + mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), ipa::RPi::MaskStats); + mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), ipa::RPi::MaskEmbeddedData); return 0; } @@ -1164,7 +1164,7 @@ void RPiCameraData::frameStarted(uint32_t sequence) int RPiCameraData::loadIPA() { - ipa_ = IPAManager::createIPA(pipe_, 1, 1); + ipa_ = IPAManager::createIPA(pipe_, 1, 1); if (!ipa_) return -ENOENT; @@ -1188,7 +1188,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) std::map streamConfig; std::map entityControls; - ipa::rpi::ConfigInput ipaConfig; + ipa::RPi::ConfigInput ipaConfig; /* Get the device format to pass to the IPA. */ V4L2DeviceFormat sensorFormat; @@ -1211,7 +1211,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) /* Allocate the lens shading table via dmaHeap and pass to the IPA. */ if (!lsTable_.isValid()) { - lsTable_ = dmaHeap_.alloc("ls_grid", ipa::rpi::MaxLsGridSize); + lsTable_ = dmaHeap_.alloc("ls_grid", ipa::RPi::MaxLsGridSize); if (!lsTable_.isValid()) return -ENOMEM; @@ -1231,7 +1231,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) } /* Ready the IPA - it must know about the sensor resolution. */ - ipa::rpi::ConfigOutput result; + ipa::RPi::ConfigOutput result; ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, &result, &ret); @@ -1241,7 +1241,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) return -EPIPE; } - if (result.params & ipa::rpi::ConfigSensorParams) { + if (result.params & ipa::RPi::ConfigSensorParams) { /* * Setup our delayed control writer with the sensor default * gain and exposure delays. @@ -1455,7 +1455,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer) * application until after the IPA signals so. */ if (stream == &isp_[Isp::Stats]) { - ipa_->signalStatReady(ipa::rpi::MaskStats | static_cast(index)); + ipa_->signalStatReady(ipa::RPi::MaskStats | static_cast(index)); } else { /* Any other ISP output can be handed back to the application now. */ handleStreamBuffer(buffer, stream); @@ -1559,7 +1559,7 @@ void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *strea { unsigned int id = stream->getBufferId(buffer); - if (!(id & ipa::rpi::MaskExternalBuffer)) + if (!(id & ipa::RPi::MaskExternalBuffer)) return; /* Stop the Stream object from tracking the buffer. */ @@ -1691,9 +1691,9 @@ void RPiCameraData::tryRunPipeline() << " Bayer buffer id: " << bayerId << " Embedded buffer id: " << embeddedId; - ipa::rpi::ISPConfig ispPrepare; - ispPrepare.embeddedBufferId = ipa::rpi::MaskEmbeddedData | embeddedId; - ispPrepare.bayerBufferId = ipa::rpi::MaskBayerData | bayerId; + ipa::RPi::ISPConfig ispPrepare; + ispPrepare.embeddedBufferId = ipa::RPi::MaskEmbeddedData | embeddedId; + ispPrepare.bayerBufferId = ipa::RPi::MaskBayerData | bayerId; ipa_->signalIspPrepare(ispPrepare); } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index 496dd36fabbc..f2430415d32d 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -72,7 +72,7 @@ int Stream::getBufferId(FrameBuffer *buffer) const void Stream::setExternalBuffer(FrameBuffer *buffer) { - bufferMap_.emplace(ipa::rpi::MaskExternalBuffer | id_.get(), buffer); + bufferMap_.emplace(ipa::RPi::MaskExternalBuffer | id_.get(), buffer); } void Stream::removeExternalBuffer(FrameBuffer *buffer) @@ -80,7 +80,7 @@ void Stream::removeExternalBuffer(FrameBuffer *buffer) int id = getBufferId(buffer); /* Ensure we have this buffer in the stream, and it is marked external. */ - ASSERT(id != -1 && (id & ipa::rpi::MaskExternalBuffer)); + ASSERT(id != -1 && (id & ipa::RPi::MaskExternalBuffer)); bufferMap_.erase(id); } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h index 701110d04bdb..f1ac715f4221 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h @@ -32,13 +32,13 @@ class Stream : public libcamera::Stream { public: Stream() - : id_(ipa::rpi::MaskID) + : id_(ipa::RPi::MaskID) { } Stream(const char *name, MediaEntity *dev, bool importOnly = false) : external_(false), importOnly_(importOnly), name_(name), - dev_(std::make_unique(dev)), id_(ipa::rpi::MaskID) + dev_(std::make_unique(dev)), id_(ipa::RPi::MaskID) { } From patchwork Thu Feb 18 12:48:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11334 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 7C756BD1F6 for ; Thu, 18 Feb 2021 12:48:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 470F2689B1; Thu, 18 Feb 2021 13:48:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ixh7zVIm"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 24D586836F for ; Thu, 18 Feb 2021 13:48:36 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id a132so3556222wmc.0 for ; Thu, 18 Feb 2021 04:48:36 -0800 (PST) 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=Llu3rk37nadcwxNGL+VmmMCkZ76r0uhevYyMgruKdMM=; b=ixh7zVImuYVQm3dfx9FS9LrHMiqgEhlqtSVMA2NGkfghuWQhomOwjN/zau352CRSCu NGlY0kPdHrs6YprqIiRlp6gI7Tt1fu07iSO5LzzQZPF0jsJhd1Qs4FONbtQkNoEfMhv5 gzfv1dM7/lqdE3K9kTDyTuL8LRV2W5mQYIar+yX/fJ7A1X8emXaB6SQoTWj7DfYkPDUe eZIH05M8gHrEUOnrufxCKbiZLpt5JRZSPk1YmMqyVSS5j+NJ3xe0t4WkdLgdpaUOP/71 IhK9yE2lG/CWEP1iIn6fRyuXHbxqDGmXTps6nPYPQ4pgIyRfON+Aoe7gGGFrSm8cvJR6 4itg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Llu3rk37nadcwxNGL+VmmMCkZ76r0uhevYyMgruKdMM=; b=V+bh9DcYXCn4fHkHkN3IG8P+8Qb0ghmOJ1aOUMaC4HWw+YecXEDrtC25rldvmRAj95 Zg+H4Sr1dcV7PykeCnjxlpe/tpVmMoMSn5aLa1h4bSbMGI+HNCoAHB+qYMVW58/HjEZ6 VzaJf3WtUhJf4WRUKYmoXDKV2R1oHfHmjdMsMmYgix0zffZikjb2TtJMGx4RtefJJhNA np6NkTLuVfajKFOuUcsgNk27uKCcf5S5Jffvkxjnrhu7Svjm3z1fWVxto5lJWVMzZUD3 t8u760Ite5seeXJpnGKCq8mNEMUPaurAkeDdxZ9kq/cyct+adusft27htXUAXIuW40V0 zjgA== X-Gm-Message-State: AOAM5306UmuAcrdVimtmqtzYc6KdBcRNJfeAQoqebujRJAdPUM/qp3VK 3mkUQDMPdvOZiQ2o0h9XmOZUBItfIpLc52HT X-Google-Smtp-Source: ABdhPJxIZYN9JsRczykAOfZioHU0/4pMG35rP7hM84q5mxVlu6YIbBYzuLs/WRiADO6tZVntp5EQ/A== X-Received: by 2002:a1c:23c2:: with SMTP id j185mr3459528wmj.96.1613652515677; Thu, 18 Feb 2021 04:48:35 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:c37b:2722:9ed2:1d58]) by smtp.gmail.com with ESMTPSA id z63sm7675876wme.8.2021.02.18.04.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:48:34 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Feb 2021 12:48:24 +0000 Message-Id: <20210218124824.1825418-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210218124824.1825418-1-naush@raspberrypi.com> References: <20210218124824.1825418-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Update the lens shading control in-place 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Only update the lens shading control if it is present in the ControlList. Add the dmabuf file descriptor to the lens shading control in-place rather than taking a copy. Signed-off-by: Naushir Patuck Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index acf2d56cddb2..a60415d93705 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1338,17 +1338,16 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId) void RPiCameraData::setIspControls(const ControlList &controls) { - ControlList ctrls = controls; - - Span s = - ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING).data(); - bcm2835_isp_lens_shading ls = - *reinterpret_cast(s.data()); - ls.dmabuf = lsTable_.fd(); - - ControlValue c(Span{ reinterpret_cast(&ls), - sizeof(ls) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING, c); + ControlList ctrls = std::move(controls); + + if (ctrls.contains(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)) { + ControlValue &value = + const_cast(ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)); + Span s = value.data(); + bcm2835_isp_lens_shading *ls = + reinterpret_cast(s.data()); + ls->dmabuf = lsTable_.fd(); + } isp_[Isp::Input].dev()->setControls(&ctrls); handleState();