From patchwork Thu May 12 10:32:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 15901 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 482E8C3256 for ; Thu, 12 May 2022 10:33:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EB8B365669; Thu, 12 May 2022 12:33:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652351594; bh=NmvPGRWZ8BHkKJ+CL/GqZwQR9gt2UjFZgPCTRdQ7tY0=; 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=SJmaAAqcprj8EEBPop/zbjeKA9GIEY0LMJOnYtasTp8QPmjOvcqTPMXCvt7NW5D2/ QOX1BOFjqNnpNm1VEe0lyRrYrUXe1Wnz749BbwyYNmBxPE5XkuVsXv5Xmb1+KIPTUk 7RyrYlg7Wu2rxzVsuCjgw7Mrup9p5XGoDfNcyL78I6NqxyNNG0jdiQCDEnfBZnhkPA hklxmyHIuDEoAAi1k3XrnqvBTMwHUIOf3a7EcuKyVuHOVEjQAEQfVxFiLA9Lg3npkh ukgVUycyBU1kk2M9bA+9Cw1abv55U7Iw0cfds/ornuuLSgwy7DEPZm9vCNKHnbBDvl R0l2W8k65pASw== Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F2EEB65656 for ; Thu, 12 May 2022 12:33:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Y2L6SgJS"; dkim-atps=neutral Received: by mail-pl1-x630.google.com with SMTP id d22so4452922plr.9 for ; Thu, 12 May 2022 03:33:12 -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=wq1C41Z7au0ZywRuZwrAMRj2QMMsSgjjchnT4sVEoaA=; b=Y2L6SgJSWArSGmqA51+l0y0KLmtXa7GAPxQ6yj2rtu9xaH/RJpbbIqF+zWoat7Vrkz Lyuc1WX6f63xXOW5mdFZR2ckI+VdJAAsYiK9uGVdlP3QGqbKh/xn4Nv40EggBz00lND/ 48E93/Gc5AsUYMdZR0h30pHKN5g/BiMvxattI= 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=wq1C41Z7au0ZywRuZwrAMRj2QMMsSgjjchnT4sVEoaA=; b=vX7czXHhl9Dw2BL/NGY9YB7pvDbu+5jtP5kAzC+xTmPGxGVGWuE8G6vn2PCwDNOnoC d2PO8dzJU20ZX6LdTyiBQJzUaH5jt8n/73/HsSqYo6e6XHVTN5+5B2Wc2XhvMzawbcWQ kfGdghspLXREk4qZD5+xn0JUHbsx+fkXKl4xGFL0wHFBBTUnN71yPEigkA5eiEHMHYbR 76XddIuwmEVR4rqcNNgaqcxTcqSbKPNJdkXOlpxNX4c4ZMuRyI3rQcePlpbgyDvE3p9p YcDl4yZz7Q3oicMMc5hzezxRvISmsUTBR1PJ94jKR1vxzoK1SiWHziCxB3SkMrvDSIb0 ar0w== X-Gm-Message-State: AOAM531oHh33p8hXoce2ZLUjoL2XJYDJa6ZLuHstqrkE3/k/u4zvOiK5 weHvdZALhwUdUiU85/dSiuEIxmsDB8Xmwn/Y X-Google-Smtp-Source: ABdhPJx1t5pUAcmb8Dg1BoKKPS7nu+3vq4LBSMGRwaY4SSuTHaGGrtA9Hba2xJNlkI5Gk4sNuIidVA== X-Received: by 2002:a17:90b:33cd:b0:1dc:c9b9:2a6e with SMTP id lk13-20020a17090b33cd00b001dcc9b92a6emr10152025pjb.86.1652351591102; Thu, 12 May 2022 03:33:11 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (174.71.80.34.bc.googleusercontent.com. [34.80.71.174]) by smtp.gmail.com with ESMTPSA id t19-20020a62d153000000b005087c23ad8dsm3402219pfl.0.2022.05.12.03.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 03:33:10 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Thu, 12 May 2022 10:32:55 +0000 Message-Id: <20220512103258.324339-6-chenghaoyang@google.com> X-Mailer: git-send-email 2.36.0.512.ge40c2bad7a-goog In-Reply-To: <20220512103258.324339-1-chenghaoyang@google.com> References: <20220512103258.324339-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/8] 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: Cheng-Hao 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 StillCapture as well. Signed-off-by: Harvey Yang --- include/libcamera/ipa/ipu3.mojom | 2 +- src/ipa/ipu3/ipu3.cpp | 19 ++++++++++++++++--- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- 3 files changed, 18 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..b0cc8cd7 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -146,7 +146,7 @@ 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 +508,13 @@ 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 +537,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 b635976b..8ce1968f 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1420,7 +1420,7 @@ 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)