{"id":14251,"url":"https://patchwork.libcamera.org/api/patches/14251/?format=json","web_url":"https://patchwork.libcamera.org/patch/14251/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20211022100042.4187349-1-kieran.bingham@ideasonboard.com>","date":"2021-10-22T10:00:42","name":"[libcamera-devel] libcamera: v4l2_videodevice: Explain multiplanar bytesused reasoning","commit_ref":"1402152ad35017a817b1ead55e60ace9353efbdb","pull_url":null,"state":"accepted","archived":false,"hash":"bd7f916f9aaa775b0d34ba0965e8cf61f6ebd2b0","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14251/mbox/","series":[{"id":2648,"url":"https://patchwork.libcamera.org/api/series/2648/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2648","date":"2021-10-22T10:00:42","name":"[libcamera-devel] libcamera: v4l2_videodevice: Explain multiplanar bytesused reasoning","version":1,"mbox":"https://patchwork.libcamera.org/series/2648/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14251/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14251/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 19B64BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 10:00:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B46AB68F59;\n\tFri, 22 Oct 2021 12:00:47 +0200 (CEST)","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 95B4D6012A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 12:00:46 +0200 (CEST)","from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2312151D;\n\tFri, 22 Oct 2021 12:00:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"usNk7lnU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634896846;\n\tbh=GT8Ow8uX5CdCgghgqzSKmR+t8bR+dN+bg8hXROaco78=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=usNk7lnU7Di9wjA5grKXKDcr3vlSiNBtqSgQGM4CeMbjZyArpP0zLyeiVwpBg7/dS\n\t2zYj9VrDd2LqyeeGIe+Zn2C7YSw154ajn/OnO/PnChUjRGSy2D0G1zrtZ25ZRyIeVL\n\tnyMTtsRs6WIxpUWwqVrYE9t4c2XKcsKyuNsWoYuo=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 22 Oct 2021 11:00:42 +0100","Message-Id":"<20211022100042.4187349-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: v4l2_videodevice: Explain\n\tmultiplanar bytesused reasoning","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The ternary operation used to get the total bytesused of a V4L2 single\nplanar format which is stored in a multiplanar buffer can easily be\nmis-read to think it's a bug, and appears to be reading the value of the\nfirst of N planes as the total.\n\nDirectly explain the reasoning for why it looks like the condition is\ninverted, as it is correct that the total bytes used is stored in only\nthe first plane of the multiplanar buffer.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nv2:\n - Update with more descriptive text from Laurent\n\n src/libcamera/v4l2_videodevice.cpp | 7 +++++++\n 1 file changed, 7 insertions(+)","diff":"diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 2745e5798419..0cc622f91f2d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1711,6 +1711,13 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \t\t\treturn buffer;\n \t\t}\n \n+\t\t/*\n+\t\t * With a V4L2 single-planar format, all the data is stored in\n+\t\t * a single memory plane. The number of bytes used is conveyed\n+\t\t * through that plane when using the V4L2 multi-planar API, or\n+\t\t * set directly in the buffer when using the V4L2 single-planar\n+\t\t * API.\n+\t\t */\n \t\tunsigned int bytesused = multiPlanar ? planes[0].bytesused\n \t\t\t\t       : buf.bytesused;\n \t\tunsigned int remaining = bytesused;\n","prefixes":["libcamera-devel"]}