From patchwork Fri Jul 1 10:32:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 16510 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 1CF28BE173 for ; Fri, 1 Jul 2022 10:32:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 57A8F65632; Fri, 1 Jul 2022 12:32:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656671570; bh=fWMvY6f6viU7vfLZ77gU0Y+1WiEzdMlr9rZueVuCvKg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tA07RfB8UGWKSZpgWTVQaJ9fmE9HupOtbxhyDqo1tjlQ9kaUxJNERJr2D0dBDhj7I zfdW3LTieVa49AS97bu4gdgSxjcRg/zI8ozzv8aAMqYiQJrbXVJNO9wN3tFg9bU9E5 UOj5wX4ObWmWV/WTacspoU3PfwYogSaPo+eQ/xbhKuRmKstrsmxE7a9jJnflmQTO9E g4mSXu9ZDr+9QEMKJaELGM0OVLdhHdNcmhUkWMQG0C1gGYuUujIyt8HxNmZK90fz9q By0asQEgyLZqMmryTmtfIFUbyTUcI9RjUCWTsEa9vujoeAIzDYJZKJoS3UNnR33Cim 2l0nm2oWk4A6g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C18F260552 for ; Fri, 1 Jul 2022 12:32:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="sGoFCR/x"; dkim-atps=neutral Received: from perceval.ideasonboard.com (unknown [IPv6:2401:4900:1f3f:ca21:e286:106b:5da4:9482]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1F12E25C; Fri, 1 Jul 2022 12:32:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656671568; bh=fWMvY6f6viU7vfLZ77gU0Y+1WiEzdMlr9rZueVuCvKg=; h=From:To:Cc:Subject:Date:From; b=sGoFCR/xpVHXb7cR9vpgUI/JR3JXdB83KsLsncLI5y4Qs/0QWKr7Z09hSVPeRtAy4 cqXbIPflzfw8mnqnypmbDd2kkt1zWEQGH2SF4HH4Rb8KBRR1uSedoGBMw26ulj0Qtw 0x+Or5CmE5piDQ1hIQkte21XKQ4V0/viM5OFrC8U= To: libcamera-devel@lists.libcamera.org Date: Fri, 1 Jul 2022 16:02:36 +0530 Message-Id: <20220701103236.1007698-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: camera: Reset request sequence number on stop/start 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: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" We now have V4L2VideoDevice ensuring that sensor sequence numbers start from zero [1], and we desire that these should match the Request sequence number as well. [1] 1c9dc0fd89cf ("libcamera: v4l2_videodevice: Identify non-zero stream starts") Signed-off-by: Umang Jain Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/camera.cpp | 4 +++- src/libcamera/pipeline_handler.cpp | 2 ++ src/libcamera/request.cpp | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 713543fd..f8150dcd 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -497,7 +497,7 @@ Camera::Private::~Private() * facilitate debugging of internal request usage. * * The requestSequence_ tracks the number of requests queued to a camera - * over its lifetime. + * over a single capture session. */ static const char *const camera_state_names[] = { @@ -1181,6 +1181,8 @@ int Camera::start(const ControlList *controls) LOG(Camera, Debug) << "Starting capture"; + ASSERT(d->requestSequence_ == 0); + ret = d->pipe_->invokeMethod(&PipelineHandler::start, ConnectionTypeBlocking, this, controls); if (ret) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 7ebd76ad..67540533 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -312,6 +312,8 @@ void PipelineHandler::stop(Camera *camera) /* Make sure no requests are pending. */ Camera::Private *data = camera->_d(); ASSERT(data->queuedRequests_.empty()); + + data->requestSequence_ = 0; } /** diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 51d74b29..07613cb3 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -526,8 +526,8 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const * * When requests are queued, they are given a sequential number to track the * order in which requests are queued to a camera. This number counts all - * requests given to a camera through its lifetime, and is not reset to zero - * between camera stop/start sequences. + * requests given to a camera and is reset to zero between camera stop/start + * sequences. * * It can be used to support debugging and identifying the flow of requests * through a pipeline, but does not guarantee to represent the sequence number