From patchwork Thu Aug 13 00:52:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9294 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 CFF40BD87E for ; Thu, 13 Aug 2020 00:53:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 407FE61365; Thu, 13 Aug 2020 02:53:43 +0200 (CEST) Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 973F3612F7 for ; Thu, 13 Aug 2020 02:53:39 +0200 (CEST) X-Halon-ID: 6c474806-dcff-11ea-92dc-005056917a89 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de [84.172.82.168]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 6c474806-dcff-11ea-92dc-005056917a89; Thu, 13 Aug 2020 02:53:38 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 13 Aug 2020 02:52:37 +0200 Message-Id: <20200813005246.3265807-5-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200813005246.3265807-1-niklas.soderlund@ragnatech.se> References: <20200813005246.3265807-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/13] libcamera: pipeline: rkisp1: Prepare buffer ready handlers for multiple streams 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" The buffer ready handlers are designed for a single application facing stream from the main path. To prepare for multiple application facing streams from main and/or self path the handlers need to be prepared. The data keeping tasks of frame number and advancing the timeline can be moved from the application facing buffer ready handler to the statistics handler. For each request processed there will always be a statistic buffer and as the ISP is inline and is the source of both main, self and statistic paths there is no lose in precision from this. The application facing handler no longer needs a special case for cancelled frames and can be made simpler. With this change the handlers are ready to deal with any combinations of application facing streams. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 38382a6894dac22a..a1cda12d244f2d97 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1074,20 +1074,8 @@ void PipelineHandlerRkISP1::tryCompleteRequest(Request *request) void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer) { ASSERT(activeCamera_); - RkISP1CameraData *data = cameraData(activeCamera_); Request *request = buffer->request(); - if (buffer->metadata().status == FrameMetadata::FrameCancelled) { - completeBuffer(activeCamera_, request, buffer); - completeRequest(activeCamera_, request); - return; - } - - data->timeline_.bufferReady(buffer); - - if (data->frame_ <= buffer->metadata().sequence) - data->frame_ = buffer->metadata().sequence + 1; - completeBuffer(activeCamera_, request, buffer); tryCompleteRequest(request); } @@ -1118,6 +1106,11 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer) if (!info) return; + data->timeline_.bufferReady(buffer); + + if (data->frame_ <= buffer->metadata().sequence) + data->frame_ = buffer->metadata().sequence + 1; + IPAOperationData op; op.operation = RKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER; op.data = { info->frame, info->statBuffer->cookie() };