From patchwork Tue Jun 16 13:12:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 4056 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C43E61F24 for ; Tue, 16 Jun 2020 15:13:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="aMYA9Shz"; dkim-atps=neutral Received: from jade.flets-east.jp (unknown [IPv6:2400:4051:61:600:2807:bdfa:f6a:8e53]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A6854F9; Tue, 16 Jun 2020 15:13:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1592313202; bh=nJZWEniJHxfwcC9SzvRwPbm3r/26GoPB7tpGWPcRba4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aMYA9ShzUOwDCRYCud3DWMnf8hFgBiIf7gIIgCn+hTSO2zF4BchalVW2dFEm7mFeT QHMgKUxT/RMgbknrUiwoDMbjjpLkFK7w/BpAe9mE4V8uYfy2MOWgq+3yJuUxnsMlZY wkub+1WGUQw94Lks6d1PfS617VA7jSBKrCIz51bQ= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Jun 2020 22:12:41 +0900 Message-Id: <20200616131244.70308-13-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616131244.70308-1-paul.elder@ideasonboard.com> References: <20200616131244.70308-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 12/15] v4l2: v4l2_camera_proxy: Add sequence number 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-List-Received-Date: Tue, 16 Jun 2020 13:13:23 -0000 Populate the sequence number field in the V4L2 buffers. Reset upon streamon. Signed-off-by: Paul Elder --- src/v4l2/v4l2_camera_proxy.cpp | 4 +++- src/v4l2/v4l2_camera_proxy.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 079961a..81f9282 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -33,7 +33,7 @@ LOG_DECLARE_CATEGORY(V4L2Compat); V4L2CameraProxy::V4L2CameraProxy(unsigned int index, std::shared_ptr camera) : refcount_(0), index_(index), bufferCount_(0), currentBuf_(0), - vcam_(std::make_unique(camera)), efd_(-1), + sequence_(0), vcam_(std::make_unique(camera)), efd_(-1), v4l2RecordPriorityFd_(-1), acquiredFd_(-1), initialized_(false), streaming_(false) { @@ -665,6 +665,7 @@ int V4L2CameraProxy::vidioc_dqbuf(int fd, struct v4l2_buffer *arg) buf.flags &= ~V4L2_BUF_FLAG_QUEUED; buf.length = sizeimage_; + buf.sequence = sequence_++; *arg = buf; currentBuf_ = (currentBuf_ + 1) % bufferCount_; @@ -696,6 +697,7 @@ int V4L2CameraProxy::vidioc_streamon(int fd, int *arg) currentBuf_ = 0; streaming_ = true; + sequence_ = 0; return vcam_->streamOn(); } diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h index 28b2fa0..1d8e9a6 100644 --- a/src/v4l2/v4l2_camera_proxy.h +++ b/src/v4l2/v4l2_camera_proxy.h @@ -82,6 +82,8 @@ private: unsigned int currentBuf_; unsigned int sizeimage_; + uint32_t sequence_; + std::vector buffers_; std::map mmaps_;