From patchwork Wed May 26 13:10:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12431 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 AB147BDB80 for ; Wed, 26 May 2021 13:10:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 737B86891D; Wed, 26 May 2021 15:10:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kVDTOFgX"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EF3DA602AB for ; Wed, 26 May 2021 15:10:41 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.203]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8EACC908; Wed, 26 May 2021 15:10:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622034641; bh=o04c/Nzl1D8S6Duv4ApCQbWhapu8DwccTeio07h9eNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVDTOFgXvVxoE+mr9VXGbHvgVu1nnBS4QAMfQ8L7PjUZA3sdUHacfW6Mc+aEv7iUT RFUXh/+2Qu1zcXAj9cd+u1ZP78/3hn/UDmRYlA5+yNzx772Bx7pGy+yoG/pI8Ym61t t5l+aGDwG6SaeYvMA8qv5WlXGm+V+N0+VSgnp29U= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 26 May 2021 18:40:25 +0530 Message-Id: <20210526131025.675024-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210526131025.675024-1-umang.jain@ideasonboard.com> References: <20210526131025.675024-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] ipa: ipu3: Provide frame timestamps through IPU3Event 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Pass in frame timestamps from IPU3 pipeline handler to IPU3 IPA via IPU3Event. Frame timestamps are helpful to IPA algorithms to convergence, by setting them via IPA stats. Signed-off-by: Umang Jain Reviewed-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/ipu3.mojom | 1 + src/ipa/ipu3/ipu3.cpp | 4 +++- src/libcamera/pipeline/ipu3/ipu3.cpp | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 32c046ad..29b4c805 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -21,6 +21,7 @@ enum IPU3Operations { struct IPU3Event { IPU3Operations op; uint32 frame; + int64 frameTimestamp; uint32 bufferId; libcamera.ControlList controls; }; diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 769c24d3..581297be 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -53,6 +53,7 @@ private: void processControls(unsigned int frame, const ControlList &controls); void fillParams(unsigned int frame, ipu3_uapi_params *params); void parseStatistics(unsigned int frame, + int64_t frameTimestamp, const ipu3_uapi_stats_3a *stats); void setControls(unsigned int frame); @@ -214,7 +215,7 @@ void IPAIPU3::processEvent(const IPU3Event &event) const ipu3_uapi_stats_3a *stats = reinterpret_cast(mem.data()); - parseStatistics(event.frame, stats); + parseStatistics(event.frame, event.frameTimestamp, stats); break; } case EventFillParams: { @@ -257,6 +258,7 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params) } void IPAIPU3::parseStatistics(unsigned int frame, + [[maybe_unused]] int64_t frameTimestamp, [[maybe_unused]] const ipu3_uapi_stats_3a *stats) { ControlList ctrls(controls::controls); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 750880ed..58923bc7 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1357,6 +1357,8 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) if (!info) return; + Request *request = info->request; + if (buffer->metadata().status == FrameMetadata::FrameCancelled) { info->metadataProcessed = true; @@ -1364,8 +1366,6 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) * tryComplete() will delete info if it completes the IPU3Frame. * In that event, we must have obtained the Request before hand. */ - Request *request = info->request; - if (frameInfos_.tryComplete(info)) pipe_->completeRequest(request); @@ -1376,6 +1376,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) ev.op = ipa::ipu3::EventStatReady; ev.frame = info->id; ev.bufferId = info->statBuffer->cookie(); + ev.frameTimestamp = request->metadata().get(controls::SensorTimestamp); ipa_->processEvent(ev); }