From patchwork Fri Sep 2 12:08:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17278 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 D0BE0C327D for ; Fri, 2 Sep 2022 12:08:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9CCA361FF0; Fri, 2 Sep 2022 14:08:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662120503; bh=BGta78LDjF7JV8+i1H+doqCf/m6mwDDIL7HTKbqQKc8=; 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=YYE1LfobIO6K4goW5nNAb/RdZR92hE9pid9aQuxrpju6mhG57xWPsNp2RQSnF+Bxz xoJag172oYU+WzDQDuolYx55jwVdlxS7zugjcYzXiYip15z5xnJxCOHwiiIL4dG41A GfSzbajRbKAHT/3NO3ijxzOhTAoIfiCem6oiNaAy/he13+MXY0WeWCjQfs0TAJlA+w g9AXWGiayo8z9eyiiJ1+Z0CTgnh632dvf/bbGUyvm37MLdETJz5jGo4O0qzT/j8PJd rhaXHY2RYjcNEr5Y3ptjZ5yyMMBpvmn5raplHqysOJJ7rJBSC1zsbwTZvTYNI4d78Z 5vQLjC4ESAmZQ== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 59F2961FE4 for ; Fri, 2 Sep 2022 14:08:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="BswpqBIK"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id c131-20020a1c3589000000b003a84b160addso2517947wma.2 for ; Fri, 02 Sep 2022 05:08:20 -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=i4Y4yviSj+cU6g+Xf/dahLktTgYTzN/ra6Hm4N5ijGQ=; b=BswpqBIKUxlQC5/10y9VRzPTNmZPzJLmutsOK1iRmWzvPM42fFW+mo7xwKs43Bvul7 9PwXEhyRT+spaHOexOmHPYmbxT2O4LpvfkQOsMlfgu4yb8yf2Roe55ITtHwL/XDBvb4l z74eG01wdLgEtOJh2lk6K1CCkW5SyozC4oA/0XNh/TdDgGKGebXHMkPk3hP0qDMqPSnR K3x1vH9XTovXhNL2ttB8ZnJKtOjQAZMpoIcma7dGwVm2TSzN/7864cUimltXwSS0JFmk PdueuxfilnE5tFyTdujUM5vrVkO+K/3VtUQXvtSgWRWNS0xBBB3uRaVBbepaEvuN1f7x lJ3w== 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=i4Y4yviSj+cU6g+Xf/dahLktTgYTzN/ra6Hm4N5ijGQ=; b=V48G+eQiC5dGG7Yiy+Y91RfC+305PEp+/DFgH7k21/+e5tF1NN5Rvvhn9EWt0GvqJL tWkblydCAS7eMM8su9teGcrzIr/czmqM/HybqV6mbIdYiu7SKHqz5eJ1yiza62YO8tcP FjXIOsNiCLzAXOwA2g/P2+HSmDxdZEoREBiCDS+x122koSPuvxQa8pp/M0dm8P7mRq9R kLbZaPUGidcIvhrnX38k/W8zWNGcURTEYyjg8Z84YMpL3r0Zi2h3QZcwTYx6lw0WGSmB vG1WwnDbNdeP4Owl1nNZuvTAUwlg4PyUiAwKFM9xcrgtrY/kR93TCSDDeVGzDMZNpR/C 8QLQ== X-Gm-Message-State: ACgBeo0CmkSpaStzhYFxAW5DXErJrEMjLI8iEggdUaVylP4M9ngIGRN+ +GU8ANb3EGTQMF/ZROKF70nz/hPBd6gQtgiP X-Google-Smtp-Source: AA6agR4qCGlBwdtYM2znoHprbOCZPPQbDRdfdSMC54fQTbsqsbNmfGfhG/BFDz1dY3gCxYoSHUJdcw== X-Received: by 2002:a05:600c:582:b0:3a5:4f7b:3146 with SMTP id o2-20020a05600c058200b003a54f7b3146mr2644936wmd.152.1662120499715; Fri, 02 Sep 2022 05:08:19 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h2-20020a5d4302000000b0021e51c039c5sm1397809wrq.80.2022.09.02.05.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 05:08:18 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 2 Sep 2022 13:08:07 +0100 Message-Id: <20220902120808.842-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220902120808.842-1-naush@raspberrypi.com> References: <20220902120808.842-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 5/6] 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 --- 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 424ca6c1c596..3faa3d490606 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);