From patchwork Thu May 26 08:27:33 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: 16054 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 0A561BD160 for ; Thu, 26 May 2022 08:27:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AF59765674; Thu, 26 May 2022 10:27:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653553677; bh=9kwnulspX2JdSQLq+n+ENLikAD05iVOpEntcGl8F45M=; 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=dH4Pwc5BqiMN2b0pIzyZ2VB87m/fQSidaTVpMZ8iviLYuqB5J/VVZNr/Q1mAKFSTz W0JIR80tueP6YXeYBzZHzlaB+FP/uVz+Cbw8kQIBFRwlsnsBPBuHg9buoSVxPV92sH GuBnF6P83xSP+ubgRkr5DijYS5V1mWlQVgZVMtOefJxHC4ipfeDpN2DElhVEi8x4aG 5638n17F/lqkbQE1TtZbZIRMvKIlPdGeNFT9t8PwLo6mDxn9ZAilk/kxM0tAALhnsc 1jmxlOINbdT9749qRDHarNunq1s1RQ/THcL48hMiZCAil0aLaJDVgphTdQ59H38mMm juubHneu6kofw== Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D40265662 for ; Thu, 26 May 2022 10:27:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YOHv6UmX"; dkim-atps=neutral Received: by mail-pj1-x102b.google.com with SMTP id nn3-20020a17090b38c300b001e0e091cf03so512361pjb.1 for ; Thu, 26 May 2022 01:27:54 -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=tQ4Bk1UrTuHyfOQZJWawRUAEwBR8cQQ227PIgGGKTiw=; b=YOHv6UmXZoebsEk+Wlf+2cN9ugSFnYsLpRNy9Pv1nvDokjDuu72dPM/LJUbYprSfBl mcUtYWYKiXzmrlZhUXQoi2UBGq/+7W0lx2+y046H1nFcjfUFJVGmnHKIijc7Zzaie8bB kEvBTVnY7yXzy47ofFf83V8+SOZfWWeNpuHqM= 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=tQ4Bk1UrTuHyfOQZJWawRUAEwBR8cQQ227PIgGGKTiw=; b=17V82rnk6fuRO2Gjb0cCiIEw91xnU40LV9v77l12oTvc781WwqqVExrFuCE/3s33Ra Cb3tn3cl48Wb/Z2Z26PNACw8ojzl5qKo4EK7D5ksQ0w7HQSf76X1Ocp5HTV8+qZff2et A4C+wW+O082ekjt8QOmClxHdb9dlH/QCDu+z9nixo9mElyE33OiVL9aaJ9cHKo/clbcs brfToKrcKTBq4dR6W0q1mIvyCSM6EVfGfFRJnFFJK87g7B2Xq5cy+CN2i4rZaQ9bUvgV MkqHh3wuNW43eNFgkQodUK6aGcUiLvNqI2zCfSIF1FrUjdwHr+TZwh6GTmO+4IkaKs8I vsaQ== X-Gm-Message-State: AOAM5321EUN51EZdCvGr5gRL8l1TNgk+vrJJdP5KTvHaNSW1nNLYuGW6 4DQ/nKbFbZNwDNvkXuoqqtY+crPJRgc3A6Yo X-Google-Smtp-Source: ABdhPJzpuBPVUwRfD2XKeTMi9Azj9wc40pxC+tPBLdG8WzdqL87cyh3NrD+uis5uadVtGcwL3ZCosA== X-Received: by 2002:a17:902:8693:b0:161:e28f:f85f with SMTP id g19-20020a170902869300b00161e28ff85fmr34083178plo.17.1653553672682; Thu, 26 May 2022 01:27:52 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (21.160.199.104.bc.googleusercontent.com. [104.199.160.21]) by smtp.gmail.com with ESMTPSA id m2-20020a170902bb8200b0016191b843e2sm834429pls.235.2022.05.26.01.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 01:27:52 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Thu, 26 May 2022 08:27:33 +0000 Message-Id: <20220526082737.1081262-6-chenghaoyang@google.com> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220526082737.1081262-1-chenghaoyang@google.com> References: <20220526082737.1081262-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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: 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 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)