From patchwork Wed Jun 29 10:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 16431 X-Patchwork-Delegate: umang.jain@ideasonboard.com 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 3CA51BE173 for ; Wed, 29 Jun 2022 10:30:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C59D365635; Wed, 29 Jun 2022 12:30:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656498636; bh=522BI9487O+gF2B9gn8dxLTi51VfnY5JKZuEg2Hrl6s=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ax3wUw8A7jb7kgPgX4ZAd/G9p76W3dnI3yDs6BSkCJASTKJ50sBS7RzYRlr+9tthw DzcSq5XE1pUEOJErP/SD+fLqYVTpkYsuuEXkJ0Til7B5FFX7XyE7If0Wv4vJXPeivD a1NDKeAp77Pq86IHpiQVKZoFFWbn0QLR1yfEcLCIU3KmkNHqWc/lTg+q7JnazoRrYx 83OtGyYPNaM6KX12of+1Q1y+O9HDqBcPn5fw189dcsuWwfBml571HBXbUtFOeezbIy i2FjBAUfRzt5bC3TTyTZibuIc9xlHkd1dZahmDtQxVetu4QhtadLDWB66b6d9RLQNu caFfC0tldMKqQ== Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D10E65631 for ; Wed, 29 Jun 2022 12:30:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZkixFWKu"; dkim-atps=neutral Received: by mail-pj1-x1031.google.com with SMTP id h9-20020a17090a648900b001ecb8596e43so15576075pjj.5 for ; Wed, 29 Jun 2022 03:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UbbNcnO9GasdwFGniWaaPqU96QfmrN4OHi5sJ44cEWE=; b=ZkixFWKuTl31TE0ksaDMc1LJzK+RFqvuM+Unu7bHtR7psKqQ2AwNtb0cLndRbi0+uz 4ikyaw5IIQX/KCBMQq0TdX54n1qe5HiFfTaypAtF5rGOtOJHSzk8tvvrxMu/VAcdB4bF V1uOawpkESW2lV4MVQmEq5O4t3Ye8V+2OH9EA= 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=UbbNcnO9GasdwFGniWaaPqU96QfmrN4OHi5sJ44cEWE=; b=QFm1x7aord0x37IqipJY2QrJrXdal8k6sd4IRafRIYqFYL+lOzzHLBeABG5FChQKpC oUaPJx7DaVd027OWNq2tH3XnqvaigFAuzDj8IAmDwm3FEJ2cZ/1iih+n/OY4vJyDoNkK IRJqyyYjM5tbxQjwdEH+wpW/Qi55v/MNwlt7f8mEfylp9c3+hfvKhtU2/SrL1QJ4XCM+ COVwILrQU2+w6HLwNhTcogz67BPwj0F66OA0CMM7S/FX8RLiW0HWUGsq5jG0z/Ydy2k+ xjrKZfUfseRgPcAX6q1lzpFEJFKGpQmGPxkT5kzmFoBfNDSSD1eqjMUneo6wCWro1ngh mlJA== X-Gm-Message-State: AJIora/2J3U4Ya6AGzZ7hOzU8hSI3wwjTokdkEzNx0zBrgwSwycwSRDS FPAL64jdlyNINOghJxFv3bAZ+MdcL/THw56e X-Google-Smtp-Source: AGRyM1tUH9bdW8jbk9nkNuSyAi4GITFqr9+u4HHNaEQ0WElQ6BAKQeIklzffvGmz0tPhNbX50xPKgg== X-Received: by 2002:a17:90b:4b41:b0:1ec:cb06:2fa3 with SMTP id mi1-20020a17090b4b4100b001eccb062fa3mr3045199pjb.55.1656498628641; Wed, 29 Jun 2022 03:30:28 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (208.158.221.35.bc.googleusercontent.com. [35.221.158.208]) by smtp.gmail.com with ESMTPSA id jb4-20020a170903258400b00169071538a0sm10946059plb.267.2022.06.29.03.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 03:30:28 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Wed, 29 Jun 2022 10:30:14 +0000 Message-Id: <20220629103018.4025635-6-chenghaoyang@google.com> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220629103018.4025635-1-chenghaoyang@google.com> References: <20220629103018.4025635-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 5/9] ipu3: Update IPAIPU3Interface::fillParamsBuffer with captureBufferId 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: Harvey Yang via libcamera-devel From: Harvey Yang Reply-To: Harvey Yang Cc: Harvey Yang Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Harvey Yang This patch updates the ipa interface |IPAIPU3Interface::fillParamsBuffer| with additional |captureBufferId| to fill the param buffer for the StillCapture stream as well. Signed-off-by: Harvey Yang --- include/libcamera/ipa/ipu3.mojom | 2 +- src/ipa/ipu3/ipu3.cpp | 21 ++++++++++++++++++--- src/libcamera/pipeline/ipu3/ipu3.cpp | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index d1b1c6b8..d94c344e 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -31,7 +31,7 @@ interface IPAIPU3Interface { unmapBuffers(array ids); [async] queueRequest(uint32 frame, libcamera.ControlList controls); - [async] fillParamsBuffer(uint32 frame, uint32 bufferId); + [async] fillParamsBuffer(uint32 frame, uint32 bufferId, uint32 captureBufferId); [async] processStatsBuffer(uint32 frame, int64 frameTimestamp, uint32 bufferId, libcamera.ControlList sensorControls); }; diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index dd6cfd79..149a3958 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -146,7 +146,8 @@ public: void unmapBuffers(const std::vector &ids) override; void queueRequest(const uint32_t frame, const ControlList &controls) override; - void fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) override; + void fillParamsBuffer(const uint32_t frame, const uint32_t bufferId, + const uint32_t captureBufferId) override; void processStatsBuffer(const uint32_t frame, const int64_t frameTimestamp, const uint32_t bufferId, const ControlList &sensorControls) override; @@ -508,12 +509,14 @@ void IPAIPU3::unmapBuffers(const std::vector &ids) /** * \brief Fill and return a buffer with ISP processing parameters for a frame * \param[in] frame The frame number - * \param[in] bufferId ID of the parameter buffer to fill + * \param[in] bufferId ID of the video parameter buffer to fill + * \param[in] captureBufferId ID of the capture parameter buffer to fill * * Algorithms are expected to fill the IPU3 parameter buffer for the next * frame given their most recent processing of the ImgU statistics. */ -void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) +void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId, + const uint32_t captureBufferId) { auto it = buffers_.find(bufferId); if (it == buffers_.end()) { @@ -536,6 +539,18 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) */ params->use = {}; + for (auto const &algo : algorithms_) + algo->prepare(context_, params); + + // TODO: use different algorithms to set StillCapture params. + it = buffers_.find(captureBufferId); + if (it == buffers_.end()) { + LOG(IPAIPU3, Error) << "Could not find capture param buffer!"; + return; + } + mem = it->second.planes()[0]; + params = reinterpret_cast(mem.data()); + params->use = {}; for (auto const &algo : algorithms_) algo->prepare(context_, params); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index a201c5ca..a13fb881 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1424,7 +1424,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) if (request->findBuffer(&rawStream_)) pipe()->completeBuffer(request, buffer); - ipa_->fillParamsBuffer(info->id, info->paramBuffer->cookie()); + ipa_->fillParamsBuffer(info->id, info->paramBuffer->cookie(), + info->captureParamBuffer->cookie()); } void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)