From patchwork Mon Nov 8 13:13:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 14484 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 0CB25BDB1C for ; Mon, 8 Nov 2021 13:14:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A7C166034A; Mon, 8 Nov 2021 14:14:16 +0100 (CET) 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="XFPLJ0Yg"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 612736036C for ; Mon, 8 Nov 2021 14:14:02 +0100 (CET) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:c2bb:76d0:68d7:a9a5]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1AB971853; Mon, 8 Nov 2021 14:14:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1636377242; bh=47OtOxB8pGy1t3K0IQ656RXKkOy86iLRbjLJf3XaLac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XFPLJ0YgGo4iCIqC9so58FOQcblOGRuVMERkGBDDVkHFOc0Rf5PrTwBiOMwURdNZF MrjjtbJS8N4bOymp9U96rqj8dVwezGd0SL8sNiA49lQ1nxG8ioIu+vvy3KMnwI0GTe alZXnm1OpSK2fh7KgeRLDFkYihcZqE+L71jsrC7I= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Nov 2021 14:13:43 +0100 Message-Id: <20211108131350.130665-16-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211108131350.130665-1-jeanmichel.hautbois@ideasonboard.com> References: <20211108131350.130665-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 15/22] ipa: ipu3: Mark the beginning and and of a frame 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" Introduce the skeleton for two functions which will be used to instantiate a frame context, and do everything needed when a frame is received. Do the same for the other end, once the algorithms have run and updated the frame context to later deallocate the corresponding frame context. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- src/ipa/ipu3/ipu3.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 62df7819..dcf4da65 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -160,6 +160,14 @@ private: void setControls(unsigned int frame); void calculateBdsGrid(const Size &bdsOutputSize); + /* + * Internal events that mark the beginning of processing a new frame + * to the point that it has successfully completed processing its + * statistics. + */ + void frameStarted(unsigned int frame); + void frameCompleted(unsigned int frame); + std::map buffers_; ControlInfoMap ctrls_; @@ -510,6 +518,14 @@ void IPAIPU3::unmapBuffers(const std::vector &ids) } } +void IPAIPU3::frameStarted([[maybe_unused]] unsigned int frame) +{ +} + +void IPAIPU3::frameCompleted([[maybe_unused]] unsigned int frame) +{ +} + /** * \brief Process an event generated by the pipeline handler * \param[in] event The event sent from pipeline handler @@ -525,6 +541,14 @@ void IPAIPU3::processEvent(const IPU3Event &event) { switch (event.op) { case EventProcessControls: { + /* + * To save incurring extra IPC calls, we do not send explicit events + * when a new request is started or completed. + * ProcessControls is the first event handled upon receipt of a new + * request, so we can handle all actions required to start processing + * a new frame. + */ + frameStarted(event.frame); processControls(event.frame, event.controls); break; } @@ -558,6 +582,13 @@ void IPAIPU3::processEvent(const IPU3Event &event) context_.frameContext.agc.gain = camHelper_->gain(event.sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get()); parseStatistics(event.frame, event.frameTimestamp, stats); + /* + * To save incurring extra IPC calls, we do not send explicit events + * when we have completed all handling of a request. + * Once the statistics are fully processed, we will no longer handle this + * frame. + */ + frameCompleted(event.frame); break; } default: