From patchwork Fri Oct 18 15:42:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2198 Return-Path: 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 6EFB1600FD for ; Fri, 18 Oct 2019 17:42:06 +0200 (CEST) Received: from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0DA1C3FDE; Fri, 18 Oct 2019 17:42:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1571413326; bh=AjBOhWlDStrE0wqKfG6W7nlfHCpb9Dbaq081Y+pDRGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lGK9sUfkwQGheu6IoScT+da78bGvORYRZhG5paXFzcpse5nW7nsJef8igdsNQI68z 9PcC3eaQm9ZkUwM656IIxrXEG0ObNcFDSTzn0Zjv7JTSCiaJe8UVAiDdmNWMhHgKYO PkttDSOTUSD8C7Ie2ctbouYRROPJ9Of/efmBJcb0= From: Kieran Bingham To: LibCamera Devel Date: Fri, 18 Oct 2019 16:42:01 +0100 Message-Id: <20191018154201.13540-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191018154201.13540-1-kieran.bingham@ideasonboard.com> References: <20191018154201.13540-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: v4l2_videodevice: Update bytesused when dq'ing MPLANE buffers 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: Fri, 18 Oct 2019 15:42:07 -0000 When we dequeue a buffer using the MPLANE API, we currently set our buffer->bytesused field to zero due to the zero entry in the V4L2 buffer bytesused field. The bytesused field is only really tracked for debug purposes currently, so store the total bytese used from each plane in our local statistics to identify actual data flow. Signed-off-by: Kieran Bingham --- This patch comes with a pinch of salt, we could also add a bytesused field to the Plane class and intead update all the debug prints to report the bytesused on a per-plane basis. --- src/libcamera/v4l2_videodevice.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 37f61b90ac46..71f141e7b511 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1124,13 +1124,20 @@ Buffer *V4L2VideoDevice::dequeueBuffer() fdEvent_->setEnabled(false); buffer->index_ = buf.index; - buffer->bytesused_ = buf.bytesused; buffer->timestamp_ = buf.timestamp.tv_sec * 1000000000ULL + buf.timestamp.tv_usec * 1000ULL; buffer->sequence_ = buf.sequence; buffer->status_ = buf.flags & V4L2_BUF_FLAG_ERROR ? Buffer::BufferError : Buffer::BufferSuccess; + if (multiPlanar_) { + buffer->bytesused_ = 0; + for (unsigned int p = 0; p < buf.length; ++p) + buffer->bytesused_ += planes[p].bytesused; + } else { + buffer->bytesused_ = buf.bytesused; + } + return buffer; }