From patchwork Mon Sep 26 09:57:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17403 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 8B405BD16B for ; Mon, 26 Sep 2022 09:58:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 433B06225D; Mon, 26 Sep 2022 11:58:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664186294; bh=Pm0asb9k6Zx7lke8Ff6P78qNyo908O1gaFveL/DwuZo=; 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=Vp04PZgI6Tp+hjYK6HjnzuGRnL6W0iYpIN4dzZqqjAYBztSIm6XnVnu8A13Z0UmPj GXoSNKxpN6VXGFkKBKEp6+8m50isld1t493aEFGEjXxtfKIOHRJh+8fISHsVvXBYIF OwFMhWWmvjPWvxrweJJyHeEtczh72T0uGFY1Paf+Qbp3FsJvJ0pS+PvwjzTxmLj1sU mzWM4a4nOXgACdUopMWqEYnQXTrTFk0r+X+rV8trA8fIK4J1RWsdcxFaCBD90lpaWB +yvg3o0zn9Dz1Rxc/ViO+zrbNx9okS2i2VzHXV8/c62CrYuumtXzH8ZWJZv7f0L4jy qsVT1HmQlkUGQ== Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3CF7962257 for ; Mon, 26 Sep 2022 11:58:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Sdu/urem"; dkim-atps=neutral Received: by mail-wm1-x32d.google.com with SMTP id t4so4096411wmj.5 for ; Mon, 26 Sep 2022 02:58:13 -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=L7BGo9XsieqoGsVj+4OcyYvMZVvrKWhrge2dYXTBIuo=; b=Sdu/uremNEz5jvfA2T9sEo0BH99rJQVkDhZvGc6jh2PLCzguVTCOUnxVJuG18I/Vzr 364ftmWggUnmrhCpBQD8g95hnxDI6mNvSNppix7Ed0+YAJwksBRWRSqJKZcmcPUztsp+ +NqgTFInznc9JLT1XhJQv0FUDa8TXDWDkmgW5KrXmm4eeXjWsIu+tiahmR5ztFIVVqZU JH5NLoUCdZdlxEGHfeuDtaNDDInpSpZj5uj4/dQFaf4zalQZC6gFBaNI117F1zTYkn0z jjAdUdYnpVGc8lDYV8qAMBAcrwMXyVPm85TwEj9ifQiMyH3wRZn2tqyOr2iMRAkMjZH4 w1/g== 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=L7BGo9XsieqoGsVj+4OcyYvMZVvrKWhrge2dYXTBIuo=; b=h+elmFFDa3pdYrqalrxq3r5q434otUuSUWXFjtll77+wr4AVxqFDqvUFH9Z781C1pw I4JhqtUH+IKzdA68AedTXKtbbZ5qfcYEi6zJIS/WjATvhUf+ABknUWS+RH4CZGTj9jaj JNvtY3oZfywRrkXenVALGUP3CnwFKaZAW8rBMoiqkeO6PlaySGRsc7mtG45tBzHHOt8t nPNtd0RxGupqKJQKHNPbWD2UAh/3qZyf19HDPm/t5U/cRhA0UsK4H7TukQJEjl8A8tu/ 9XHaIPJ8aP32Qly+H3gRHDG4IRQ9zoczZaOLLp2DViAIPiLmGpgz4Owb4h/RD7kf6IUY qRtA== X-Gm-Message-State: ACrzQf3U4N5S5uTWaq+cM23IMVuAvfEVcELosHEgfOImLBAHJXHuGyNy sU1wyfvKXr3K3yuNStSaWtxgv9ppEzq94K4P X-Google-Smtp-Source: AMsMyM6q1LUnJLKdpjXBc9ftbZsRF19nVHUQFftl7l4qR4jzwOibb8JrS4JXCJ9vQNQvgTCT5p3N4A== X-Received: by 2002:a05:600c:5114:b0:3b5:428:cf67 with SMTP id o20-20020a05600c511400b003b50428cf67mr14209848wms.80.1664186292827; Mon, 26 Sep 2022 02:58:12 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id p22-20020a05600c419600b003a4efb794d7sm10160671wmh.36.2022.09.26.02.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:58:11 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 26 Sep 2022 10:57:36 +0100 Message-Id: <20220926095737.30506-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220926095737.30506-1-naush@raspberrypi.com> References: <20220926095737.30506-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 39e69d748693..09680a72f58a 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(); @@ -264,6 +264,7 @@ public: struct BayerFrame { FrameBuffer *buffer; ControlList controls; + unsigned int ipaCookie; }; std::queue bayerQueue_; @@ -1789,9 +1790,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(); } @@ -1864,13 +1865,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); } @@ -2165,6 +2166,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);