[{"id":13154,"web_url":"https://patchwork.libcamera.org/comment/13154/","msgid":"<20201009224028.GJ25040@pendragon.ideasonboard.com>","date":"2020-10-09T22:40:28","subject":"Re: [libcamera-devel] [PATCH v2] libcamera: pipeline: simple:\n\tenable mplane devices using contiguous memory","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Andrey,\n\nThank you for the patch.\n\nOn Fri, Oct 09, 2020 at 02:17:39PM +0300, Andrey Konovalov wrote:\n> The current simple pipeline handler refuses to work with capture devices\n> which have V4L2_CAP_VIDEO_CAPTURE_MPLANE flag set in the device capabilities\n> field. This is too restrictive, as devices supporting the multi-planar API\n> can be using contiguous memory for semi-planar and planar formats, and this\n> would just work without any changes to libcamera.\n> \n> Drop the guard against MPLANE devices, and replace it with the check of\n> the number of planes in the format the simple pipeline handler is going to\n> use for capture. This will let MPLANE devices which don't use non-contiguous\n> memory for frame buffers to work with the simple pipeline handler.\n> \n> The following code in SimpleCameraData::init() filters out the pixel formats\n> libcamera doesn't support:\n> \n> \tPixelFormat pixelFormat = videoFormat.first.toPixelFormat();\n> \tif (!pixelFormat)\n> \t\tcontinue;\n> \n> So the check for the number of memory planes this patch adds would not\n> trigger until non-contiguous planar formats becomes supported in libcamera,\n> and video devices using these formats are enabled in the simple pipeline\n> handler. Then this check will remind one to review the simple pipeline\n> handler code.\n\nPerfect :-)\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  Changes in v2:\n>  - The commit message extended to explain how the simple pipeline handler\n>    filters out pixel formats not supported in libcamera. No changes to\n>    the code vs v1.\n> \n>  src/libcamera/pipeline/simple/simple.cpp | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 10223a9b..8dc23623 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -592,6 +592,12 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>  \tif (ret)\n>  \t\treturn ret;\n>  \n> +\tif (captureFormat.planesCount != 1) {\n> +\t\tLOG(SimplePipeline, Error)\n> +\t\t\t<<  \"Planar formats using non-contiguous memory not supported\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n>  \tif (captureFormat.fourcc != videoFormat ||\n>  \t    captureFormat.size != pipeConfig.captureSize) {\n>  \t\tLOG(SimplePipeline, Error)\n> @@ -845,12 +851,6 @@ V4L2VideoDevice *SimplePipelineHandler::video(const MediaEntity *entity)\n>  \tif (video->open() < 0)\n>  \t\treturn nullptr;\n>  \n> -\tif (video->caps().isMultiplanar()) {\n> -\t\tLOG(SimplePipeline, Error)\n> -\t\t\t<< \"V4L2 multiplanar devices are not supported\";\n> -\t\treturn nullptr;\n> -\t}\n> -\n>  \tvideo->bufferReady.connect(this, &SimplePipelineHandler::bufferReady);\n>  \n>  \tauto element = videos_.emplace(entity, std::move(video));","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 95B10BEEE0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Oct 2020 22:41:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2AEBF60361;\n\tSat, 10 Oct 2020 00:41:14 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E914060359\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 10 Oct 2020 00:41:11 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6D97B528;\n\tSat, 10 Oct 2020 00:41:11 +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=\"i6x4bn2+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602283271;\n\tbh=84TZWaDWq9a1jg4eAFWLrQ9vEBpn7G56nm47r46AbJ0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=i6x4bn2+3DOMVAtadT3CwlQia6oR8xpO28ZalErPzzgmPrMgJMvSfDk30ozN+Uo1/\n\trEGWa50Nwg9OxlJAs9aVGl94an32JF/e7pdWmCzydf/nPlc2D9JepjE/sXJ4TvIbsd\n\tAGt+VoLZ6WwSlIcv7oPE+rQj9H3UHaP+ljiY3plY=","Date":"Sat, 10 Oct 2020 01:40:28 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<20201009224028.GJ25040@pendragon.ideasonboard.com>","References":"<20201009111739.10824-1-andrey.konovalov@linaro.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201009111739.10824-1-andrey.konovalov@linaro.org>","Subject":"Re: [libcamera-devel] [PATCH v2] libcamera: pipeline: simple:\n\tenable mplane devices using contiguous memory","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@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13155,"web_url":"https://patchwork.libcamera.org/comment/13155/","msgid":"<20201009224233.GK25040@pendragon.ideasonboard.com>","date":"2020-10-09T22:42:33","subject":"Re: [libcamera-devel] [PATCH v2] libcamera: pipeline: simple:\n\tenable mplane devices using contiguous memory","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Sat, Oct 10, 2020 at 01:40:28AM +0300, Laurent Pinchart wrote:\n> Hi Andrey,\n> \n> Thank you for the patch.\n> \n> On Fri, Oct 09, 2020 at 02:17:39PM +0300, Andrey Konovalov wrote:\n> > The current simple pipeline handler refuses to work with capture devices\n> > which have V4L2_CAP_VIDEO_CAPTURE_MPLANE flag set in the device capabilities\n> > field. This is too restrictive, as devices supporting the multi-planar API\n> > can be using contiguous memory for semi-planar and planar formats, and this\n> > would just work without any changes to libcamera.\n> > \n> > Drop the guard against MPLANE devices, and replace it with the check of\n> > the number of planes in the format the simple pipeline handler is going to\n> > use for capture. This will let MPLANE devices which don't use non-contiguous\n> > memory for frame buffers to work with the simple pipeline handler.\n> > \n> > The following code in SimpleCameraData::init() filters out the pixel formats\n> > libcamera doesn't support:\n> > \n> > \tPixelFormat pixelFormat = videoFormat.first.toPixelFormat();\n> > \tif (!pixelFormat)\n> > \t\tcontinue;\n> > \n> > So the check for the number of memory planes this patch adds would not\n> > trigger until non-contiguous planar formats becomes supported in libcamera,\n> > and video devices using these formats are enabled in the simple pipeline\n> > handler. Then this check will remind one to review the simple pipeline\n> > handler code.\n> \n> Perfect :-)\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  Changes in v2:\n> >  - The commit message extended to explain how the simple pipeline handler\n> >    filters out pixel formats not supported in libcamera. No changes to\n> >    the code vs v1.\n> > \n> >  src/libcamera/pipeline/simple/simple.cpp | 12 ++++++------\n> >  1 file changed, 6 insertions(+), 6 deletions(-)\n> > \n> > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> > index 10223a9b..8dc23623 100644\n> > --- a/src/libcamera/pipeline/simple/simple.cpp\n> > +++ b/src/libcamera/pipeline/simple/simple.cpp\n> > @@ -592,6 +592,12 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n> >  \tif (ret)\n> >  \t\treturn ret;\n> >  \n> > +\tif (captureFormat.planesCount != 1) {\n> > +\t\tLOG(SimplePipeline, Error)\n> > +\t\t\t<<  \"Planar formats using non-contiguous memory not supported\";\n\nActually, s/  / /\n\nI'll fix when applying. May I recommend using the checkstyle.py script\nas a post-commit or pre-commit git hook ? The hooks can be found in\nutils/hook/, you can just copy the one you prefer to .git/hooks/\n\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> >  \tif (captureFormat.fourcc != videoFormat ||\n> >  \t    captureFormat.size != pipeConfig.captureSize) {\n> >  \t\tLOG(SimplePipeline, Error)\n> > @@ -845,12 +851,6 @@ V4L2VideoDevice *SimplePipelineHandler::video(const MediaEntity *entity)\n> >  \tif (video->open() < 0)\n> >  \t\treturn nullptr;\n> >  \n> > -\tif (video->caps().isMultiplanar()) {\n> > -\t\tLOG(SimplePipeline, Error)\n> > -\t\t\t<< \"V4L2 multiplanar devices are not supported\";\n> > -\t\treturn nullptr;\n> > -\t}\n> > -\n> >  \tvideo->bufferReady.connect(this, &SimplePipelineHandler::bufferReady);\n> >  \n> >  \tauto element = videos_.emplace(entity, std::move(video));","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 1E158BEEDF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Oct 2020 22:43:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A706960725;\n\tSat, 10 Oct 2020 00:43:18 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 51AF260359\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 10 Oct 2020 00:43:17 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B2BD5528;\n\tSat, 10 Oct 2020 00:43:16 +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=\"aeS/aPnj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602283396;\n\tbh=Db0AmmmZk76oEJEjOxNlsVbEKkFoacYRgo//xlZweNs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aeS/aPnjUf8jONH1PX/X0FSpGC2d9TA4KzAjxoOEJjhpAtAu+hbB5ajxl7ilZe5O8\n\tfeIFdN7ukwG3gcBzztiaCd5aUelxteGR2mj0190fPezyqqNflasU6L1UF/ThxNv5NL\n\tBvdlhrMJWCnrPZVLxVDNFIRYV1HmFYbEaP/J/vco=","Date":"Sat, 10 Oct 2020 01:42:33 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<20201009224233.GK25040@pendragon.ideasonboard.com>","References":"<20201009111739.10824-1-andrey.konovalov@linaro.org>\n\t<20201009224028.GJ25040@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201009224028.GJ25040@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2] libcamera: pipeline: simple:\n\tenable mplane devices using contiguous memory","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@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]