[{"id":20379,"web_url":"https://patchwork.libcamera.org/comment/20379/","msgid":"<20211022102106.GI2066071@pyrite.rasen.tech>","date":"2021-10-22T10:21:06","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_videodevice: Explain\n\tmultiplanar bytesused reasoning","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Fri, Oct 22, 2021 at 11:00:42AM +0100, Kieran Bingham wrote:\n> The ternary operation used to get the total bytesused of a V4L2 single\n> planar format which is stored in a multiplanar buffer can easily be\n> mis-read to think it's a bug, and appears to be reading the value of the\n> first of N planes as the total.\n> \n> Directly explain the reasoning for why it looks like the condition is\n> inverted, as it is correct that the total bytes used is stored in only\n> the first plane of the multiplanar buffer.\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> v2:\n>  - Update with more descriptive text from Laurent\n> \n>  src/libcamera/v4l2_videodevice.cpp | 7 +++++++\n>  1 file changed, 7 insertions(+)\n> \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 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> -- \n> 2.30.2\n>","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 9303FBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 10:21:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E7E768F59;\n\tFri, 22 Oct 2021 12:21:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 067036012A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 12:21:14 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7670B276;\n\tFri, 22 Oct 2021 12:21:12 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dEXVBL00\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634898073;\n\tbh=y2tl142lDDzMd+sAijSZAUX77NookWgtRTo/kncuFqo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=dEXVBL00nlvYKSqo7WHy5owFJScHY+QMOFcCJy6a8rlawVpIsts7TM7HdWFtIphZV\n\tEM59Goa1ecQTdDAS9vDaov4OcNdsW6h3wFueFr+Zv22EnbsitolXtqFfBApkGFHpmA\n\tHF5PyBE6jtceWOreAwc7/kdb9Lvl8CTMmz8Pac5E=","Date":"Fri, 22 Oct 2021 19:21:06 +0900","From":"paul.elder@ideasonboard.com","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20211022102106.GI2066071@pyrite.rasen.tech>","References":"<20211022100042.4187349-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211022100042.4187349-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]