From patchwork Mon Sep 5 07:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17302 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 8433FC3272 for ; Mon, 5 Sep 2022 07:40:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1C46862076; Mon, 5 Sep 2022 09:40:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662363611; bh=HepHC9Nxj5KfTuENUVpqffKzK4BBpq4Gyfr3StYe2mw=; 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=aYslv1ZQrN7NJPWnFkd0hYkngRcR7hlQ7IDpS2o43guuW7KP/lEN/aqhQmM/nKQAC r39pA1TN8W9WgI0d+BvVBglghRY8r7JbEyKZDFo2B6sJXqXf4Sm3RBGMQNc+fOr9jO +7i5nlrn4eFhkmMfgldvwsYbfOSm5hjpDdjV9iAd64JkQrRBlIeyMnQZNFcLXyPjqS kriOr2AUFy4YAXi9yTlOEgfHJTNKztksQYdKWGutZlXPtQ0dq1McaDorZUbAOEB8rf LdtXNMkfxM766TUN/hQSLdJZFolUhrMmJhkkxs0F0QOapiAcoJ2uHeoKGdE4fES4Yu 7bOepJOa69XZQ== Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 723A76206A for ; Mon, 5 Sep 2022 09:40:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="KIo9loSJ"; dkim-atps=neutral Received: by mail-wm1-x331.google.com with SMTP id i188-20020a1c3bc5000000b003a7b6ae4eb2so7273595wma.4 for ; Mon, 05 Sep 2022 00:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=wY8QaiimazJlQuDYAQIxMBOCIKxqVsqdc+VzLIYLd4A=; b=KIo9loSJ3iTAMNp3kjzcZff4CxcypzKBTtzoffglQh8hJxMrPOxyTNAio1TWACFtvE YybFm3tcTyxvCQzbSkBsxFk8xJAz+p5VlfEOkc2GpuqkW+O5wod0WF/h3xSR8kkVyZF2 P+iwltl4UlsF3Rs7OyWSTB2E4fg95xLQM9WCipmH9RlGVoId9WzRVG++6lGd6xbw5Kwz taGLHWynSvrLlBIalhzIp6drag8z6p797U+URzgyTeo/gfLGa5gfp/WMljJGBvYHjm5U xEVUhrnuH4P9j2kj6CpmDEwFOIxK6QR/lQbHpw0z5ApSFrZtJ8CO7DG8s+wYYRMuWl47 V51A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=wY8QaiimazJlQuDYAQIxMBOCIKxqVsqdc+VzLIYLd4A=; b=OzI4J+h/rfS1FTf1rYLXQlckG6ymmnl1AAIquHh7kymFV4bn3cD9ZYmjqBLHVIvFaM RTcqtzS2zu0JXtxjfh6jcrkO4oFo6esuJ+R1M0NhxxUqCm8nNijfc3BB+quF46D5kpBe lfHZrzIekWwuw5u/H5yu4j3JB1s96bKSce7dWDCwHGZCYe1+ek9tAIFFvfnFiCB9f/lM he5GnC44YMMwEeLy7iw7schcN0YZ10OC5c/n1BzbYxFev40lW6Ar/iY3SSuJchl1V45h /kR3XUt1fl8/ceMjGinwGrLSk9xHFO+RO7m21n2w0Wz2PeM2nBE3x24nJwUqGARvP8EE PAJQ== X-Gm-Message-State: ACgBeo0HUOhKY65UhgulpEuUTUSQscCRcz61trQBA8+QaLB2C1eRdmY3 X0QaGXXGmYTWG3JK5Y66W5PAcH702J+anSjJ X-Google-Smtp-Source: AA6agR5hSSxGq3UnLJLqJCF0i3e4Qzy+puCMbcgWj9lp8ghT9vYbI9A1xoDGCVgCcqfPHb5Fb7Bcwg== X-Received: by 2002:a05:600c:1c95:b0:3a5:c28a:df3e with SMTP id k21-20020a05600c1c9500b003a5c28adf3emr10117329wms.40.1662363608666; Mon, 05 Sep 2022 00:40:08 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id v16-20020a5d5910000000b00228a6ce17b4sm1342841wrd.37.2022.09.05.00.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:40:07 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Sep 2022 08:39:55 +0100 Message-Id: <20220905073956.7342-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905073956.7342-1-naush@raspberrypi.com> References: <20220905073956.7342-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/7] pipeline: ipa: raspberrypi: Use IPA cookies 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" Pass an IPA cookie from the IPA to the pipeline handler through the setDelayedControls signal. This cookie is the index of the current RPiController::Metadata context used for the frame. The cookie is subsequently passed into DelayedControls together with the controls to action. The IPA cookie is then returned from DelayedControls when the frame with the applied controls has been returned from the sensor, and eventually passed back to the IPA from the signalIspPrepare signal. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Tested-by: David Plowman --- include/libcamera/ipa/raspberrypi.mojom | 3 ++- src/ipa/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index c0de435b7b33..fb806a1518d5 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -36,6 +36,7 @@ struct ISPConfig { uint32 bayerBufferId; bool embeddedBufferPresent; libcamera.ControlList controls; + uint32 ipaCookie; }; struct IPAConfig { @@ -136,5 +137,5 @@ interface IPARPiEventInterface { runIsp(uint32 bufferId); embeddedComplete(uint32 bufferId); setIspControls(libcamera.ControlList controls); - setDelayedControls(libcamera.ControlList controls); + setDelayedControls(libcamera.ControlList controls, uint32 ipaCookie); }; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 63cccda901c1..0e80ef9c7b95 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -1144,7 +1144,7 @@ void IPARPi::processStats(unsigned int bufferId) ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); - setDelayedControls.emit(ctrls); + setDelayedControls.emit(ctrls, metadataIdx_); } } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index d34a906c3cea..4d4c9e1fb9c4 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -208,7 +208,7 @@ public: void runIsp(uint32_t bufferId); void embeddedComplete(uint32_t bufferId); void setIspControls(const ControlList &controls); - void setDelayedControls(const ControlList &controls); + void setDelayedControls(const ControlList &controls, uint32_t ipaCookie); void setSensorControls(ControlList &controls); void unicamTimeout(); @@ -259,6 +259,7 @@ public: struct BayerFrame { FrameBuffer *buffer; ControlList controls; + unsigned int ipaCookie; }; std::queue bayerQueue_; @@ -1784,9 +1785,9 @@ void RPiCameraData::setIspControls(const ControlList &controls) handleState(); } -void RPiCameraData::setDelayedControls(const ControlList &controls) +void RPiCameraData::setDelayedControls(const ControlList &controls, uint32_t ipaCookie) { - if (!delayedCtrls_->push(controls)) + if (!delayedCtrls_->push(controls, ipaCookie)) LOG(RPI, Error) << "V4L2 DelayedControl set failed"; handleState(); } @@ -1848,13 +1849,13 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) * Lookup the sensor controls used for this frame sequence from * DelayedControl and queue them along with the frame buffer. */ - auto [ctrl, cookie] = delayedCtrls_->get(buffer->metadata().sequence); + auto [ctrl, ipaCookie] = delayedCtrls_->get(buffer->metadata().sequence); /* * Add the frame timestamp to the ControlList for the IPA to use * as it does not receive the FrameBuffer object. */ ctrl.set(controls::SensorTimestamp, buffer->metadata().timestamp); - bayerQueue_.push({ buffer, std::move(ctrl) }); + bayerQueue_.push({ buffer, std::move(ctrl), ipaCookie }); } else { embeddedQueue_.push(buffer); } @@ -2148,6 +2149,7 @@ void RPiCameraData::tryRunPipeline() ipa::RPi::ISPConfig ispPrepare; ispPrepare.bayerBufferId = ipa::RPi::MaskBayerData | bayerId; ispPrepare.controls = std::move(bayerFrame.controls); + ispPrepare.ipaCookie = bayerFrame.ipaCookie; if (embeddedBuffer) { unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);