[{"id":19484,"web_url":"https://patchwork.libcamera.org/comment/19484/","msgid":"<85a6a5d3-44c3-7f10-0cb1-88dcffcdc17f@ideasonboard.com>","date":"2021-09-06T23:34:40","subject":"Re: [libcamera-devel] [PATCH v3 11/30] libcamera: v4l2_videodevice:\n\tDocument plane handling in createBuffer()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 06/09/2021 23:56, Laurent Pinchart wrote:\n> The V4L2VideoDevice::createBuffer() calculates offsets manually when\n> using a multi-planar pixel format and a single-planar V4L2 format. The\n> process isn't trivial, document it.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> ---\n>  src/libcamera/v4l2_videodevice.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 1483181a0856..88535f5a07c7 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1334,10 +1334,19 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)\n>  \t}\n>  \n>  \t/*\n> +\t * If we have a multi-planar format with a V4L2 single-planar buffer,\n> +\t * split the single V4L2 plane into multiple FrameBuffer planes by\n> +\t * computing the offsets manually.\n> +\t *\n>  \t * The format info is not guaranteed to be valid, as there are no\n>  \t * PixelFormatInfo for metadata formats, so check it first.\n>  \t */\n>  \tif (formatInfo_->isValid() && formatInfo_->numPlanes() != numPlanes) {\n> +\t\t/*\n> +\t\t * There's no valid situation where the number of colour planes\n> +\t\t * differs from the number of V4L2 planes and the V4L2 buffer\n> +\t\t * has more than one plane.\n> +\t\t */\n\nI think that helps a lot on that assert.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>  \t\tASSERT(numPlanes == 1u);\n>  \n>  \t\tplanes.resize(formatInfo_->numPlanes());\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 06AC5BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Sep 2021 23:34:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8181669167;\n\tTue,  7 Sep 2021 01:34:45 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5FF3260253\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 01:34:43 +0200 (CEST)","from [192.168.0.20]\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 DCFD1891;\n\tTue,  7 Sep 2021 01:34:42 +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=\"J8AwAcNj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630971283;\n\tbh=UYo1g04Qqxfk2v/e2MxoSIvVLuL831N98LHFCqnI56Y=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=J8AwAcNjePZaSBxoQhPClWPDgAbVMmDMksabSWy2Ht6JdQlLa78i/vcu4MLQbyUgT\n\t7w2074erAyzwMXI+Q0d+tC8khApdgy+J8VndqSyTd1zI7QajOb05EsRt/ZqvHcNM+h\n\tneQdQo70ehBztOMG0bg+PDbMzYfp+XwGGwI7MMvU=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210906225420.13275-1-laurent.pinchart@ideasonboard.com>\n\t<20210906225636.14683-11-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<85a6a5d3-44c3-7f10-0cb1-88dcffcdc17f@ideasonboard.com>","Date":"Tue, 7 Sep 2021 00:34:40 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210906225636.14683-11-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 11/30] libcamera: v4l2_videodevice:\n\tDocument plane handling in createBuffer()","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>"}}]