{"id":2198,"url":"https://patchwork.libcamera.org/api/1.1/patches/2198/?format=json","web_url":"https://patchwork.libcamera.org/patch/2198/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191018154201.13540-3-kieran.bingham@ideasonboard.com>","date":"2019-10-18T15:42:01","name":"[libcamera-devel,2/2] libcamera: v4l2_videodevice: Update bytesused when dq'ing MPLANE buffers","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b4699add861385f828a573d6c9003af83dc27687","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2198/mbox/","series":[{"id":538,"url":"https://patchwork.libcamera.org/api/1.1/series/538/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=538","date":"2019-10-18T15:41:59","name":"V4L2 Video Device MPLANE improvements","version":1,"mbox":"https://patchwork.libcamera.org/series/538/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2198/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2198/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6EFB1600FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Oct 2019 17:42:06 +0200 (CEST)","from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net\n\t[86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0DA1C3FDE;\n\tFri, 18 Oct 2019 17:42:06 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571413326;\n\tbh=AjBOhWlDStrE0wqKfG6W7nlfHCpb9Dbaq081Y+pDRGk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=lGK9sUfkwQGheu6IoScT+da78bGvORYRZhG5paXFzcpse5nW7nsJef8igdsNQI68z\n\t9PcC3eaQm9ZkUwM656IIxrXEG0ObNcFDSTzn0Zjv7JTSCiaJe8UVAiDdmNWMhHgKYO\n\tPkttDSOTUSD8C7Ie2ctbouYRROPJ9Of/efmBJcb0=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/2] libcamera: v4l2_videodevice: Update\n\tbytesused when dq'ing MPLANE buffers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 18 Oct 2019 15:42:07 -0000"},"content":"When we dequeue a buffer using the MPLANE API, we currently set our\nbuffer->bytesused field to zero due to the zero entry in the V4L2 buffer\nbytesused field.\n\nThe bytesused field is only really tracked for debug purposes currently,\nso store the total bytese used from each plane in our local statistics\nto identify actual data flow.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\n\nThis patch comes with a pinch of salt, we could also add a bytesused\nfield to the Plane class and intead update all the debug prints to\nreport the bytesused on a per-plane basis.\n---\n src/libcamera/v4l2_videodevice.cpp | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 37f61b90ac46..71f141e7b511 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1124,13 +1124,20 @@ Buffer *V4L2VideoDevice::dequeueBuffer()\n \t\tfdEvent_->setEnabled(false);\n \n \tbuffer->index_ = buf.index;\n-\tbuffer->bytesused_ = buf.bytesused;\n \tbuffer->timestamp_ = buf.timestamp.tv_sec * 1000000000ULL\n \t\t\t   + buf.timestamp.tv_usec * 1000ULL;\n \tbuffer->sequence_ = buf.sequence;\n \tbuffer->status_ = buf.flags & V4L2_BUF_FLAG_ERROR\n \t\t\t? Buffer::BufferError : Buffer::BufferSuccess;\n \n+\tif (multiPlanar_) {\n+\t\tbuffer->bytesused_ = 0;\n+\t\tfor (unsigned int p = 0; p < buf.length; ++p)\n+\t\t\tbuffer->bytesused_ += planes[p].bytesused;\n+\t} else {\n+\t\tbuffer->bytesused_ = buf.bytesused;\n+\t}\n+\n \treturn buffer;\n }\n \n","prefixes":["libcamera-devel","2/2"]}