[{"id":460,"web_url":"https://patchwork.libcamera.org/comment/460/","msgid":"<20190121203159.GD4439@pendragon.ideasonboard.com>","date":"2019-01-21T20:31:59","subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Jan 21, 2019 at 06:27:02PM +0100, Jacopo Mondi wrote:\n> Add functions to V4L2Capability to identify if a V4L2 device supports\n> single or multiplane APIs.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_device.h |  6 +++--\n>  src/libcamera/v4l2_device.cpp       | 37 +++++++++++++++++++++++++----\n>  2 files changed, 37 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 2787847..0101a4b 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -27,8 +27,10 @@ struct V4L2Capability final : v4l2_capability {\n>  \t\treturn reinterpret_cast<const char *>(v4l2_capability::bus_info);\n>  \t}\n>  \n> -\tbool isCapture() const { return capabilities & V4L2_CAP_VIDEO_CAPTURE; }\n> -\tbool isOutput() const { return capabilities & V4L2_CAP_VIDEO_OUTPUT; }\n> +\tbool isSinglePlane() const;\n> +\tbool isMultiPlane() const;\n\nMaybe s/Plane/Planar/ ?\n\n> +\tbool isCapture() const;\n> +\tbool isOutput() const;\n\nIs there a reason to stop inlining the functions ? They should just\ngenerate a load and an and operation, which should be less costly than a\nfunction call.\n\n>  \tbool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }\n>  };\n>  \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index aef0996..7cd89d7 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -47,17 +47,46 @@ namespace libcamera {\n>   * \\return The string containing the device location\n>   */\n>  \n> +\n> +/**\n> + * \\brief Identify if the device implements V4L2 single plane APIs\n\ns/implements/implements the/\ns/plane/planar/ ?\n\nand for the following line too.\n\n> + * \\return true if the device supports single plane APIs\n\nDon't we start all the return descriptions with a capital letter ?\n\nThose comments hold for the other functions below.\n\n> + */\n> +bool V4L2Capability::isSinglePlane() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT);\n\nYou could write this\n\n\treturn capabilities & (V4L2_CAP_VIDEO_CAPTURE |\n\t\t\t       V4L2_CAP_VIDEO_OUTPUT);\n\nI would expect the compiler to perform that optimization itself, but it\nalso doesn't hurt to be explicit.\n\n> +}\n> +\n> +/**\n> + * \\brief Identify if the device implements V4L2 multiplanar APIs\n> + * \\return true if the device supports multiplanar APIs\n> + */\n> +bool V4L2Capability::isMultiPlane() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> +}\n> +\n>  /**\n> - * \\fn bool V4L2Capability::isCapture()\n>   * \\brief Identify if the device is capable of capturing video\n> - * \\return True if the device can capture video frames\n> + * \\return true if the device can capture video frames\n>   */\n> +bool V4L2Capability::isCapture() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE);\n> +}\n>  \n>  /**\n> - * \\fn bool V4L2Capability::isOutput()\n>   * \\brief Identify if the device is capable of outputting video\n> - * \\return True if the device can output video frames\n> + * \\return true if the device can capture video frames\n>   */\n> +bool V4L2Capability::isOutput() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_OUTPUT) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> +}\n>  \n>  /**\n>   * \\fn bool V4L2Capability::hasStreaming()","headers":{"Return-Path":"<laurent.pinchart@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 79CD960B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jan 2019 21:32:00 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DEF2753E;\n\tMon, 21 Jan 2019 21:31:59 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548102720;\n\tbh=ja8eW3E8G6nkAoYt7bsbjPYWJZpsiqTKfoUA5zdDDQ0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oZGl+WjUxFrqdej0SZtwcADzPdFXtv0ikuYf8PsFySPZeyBH5EfXOEy2PyR1XJWCr\n\tEmTu1R+MGLBXDsT34961aKEZcwCDtWgDmrw22kyyxUATDuFQPqyHkRYqa+vtj888Ra\n\t9LSwns6FsNY/QP4gcNq4aLMPA3w/tdVJ/U0ks47k=","Date":"Mon, 21 Jan 2019 22:31:59 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190121203159.GD4439@pendragon.ideasonboard.com>","References":"<20190121172705.19985-1-jacopo@jmondi.org>\n\t<20190121172705.19985-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190121172705.19985-4-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Mon, 21 Jan 2019 20:32:00 -0000"}},{"id":479,"web_url":"https://patchwork.libcamera.org/comment/479/","msgid":"<20190122113324.GK6484@bigcity.dyn.berto.se>","date":"2019-01-22T11:33:24","subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-01-21 18:27:02 +0100, Jacopo Mondi wrote:\n> Add functions to V4L2Capability to identify if a V4L2 device supports\n> single or multiplane APIs.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_device.h |  6 +++--\n>  src/libcamera/v4l2_device.cpp       | 37 +++++++++++++++++++++++++----\n>  2 files changed, 37 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> index 2787847..0101a4b 100644\n> --- a/src/libcamera/include/v4l2_device.h\n> +++ b/src/libcamera/include/v4l2_device.h\n> @@ -27,8 +27,10 @@ struct V4L2Capability final : v4l2_capability {\n>  \t\treturn reinterpret_cast<const char *>(v4l2_capability::bus_info);\n>  \t}\n>  \n> -\tbool isCapture() const { return capabilities & V4L2_CAP_VIDEO_CAPTURE; }\n> -\tbool isOutput() const { return capabilities & V4L2_CAP_VIDEO_OUTPUT; }\n> +\tbool isSinglePlane() const;\n> +\tbool isMultiPlane() const;\n> +\tbool isCapture() const;\n> +\tbool isOutput() const;\n>  \tbool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }\n>  };\n>  \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index aef0996..7cd89d7 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -47,17 +47,46 @@ namespace libcamera {\n>   * \\return The string containing the device location\n>   */\n>  \n> +\n> +/**\n> + * \\brief Identify if the device implements V4L2 single plane APIs\n> + * \\return true if the device supports single plane APIs\n> + */\n> +bool V4L2Capability::isSinglePlane() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT);\n> +}\n> +\n> +/**\n> + * \\brief Identify if the device implements V4L2 multiplanar APIs\n> + * \\return true if the device supports multiplanar APIs\n> + */\n> +bool V4L2Capability::isMultiPlane() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> +}\n> +\n>  /**\n> - * \\fn bool V4L2Capability::isCapture()\n>   * \\brief Identify if the device is capable of capturing video\n> - * \\return True if the device can capture video frames\n> + * \\return true if the device can capture video frames\n>   */\n> +bool V4L2Capability::isCapture() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE);\n> +}\n>  \n>  /**\n> - * \\fn bool V4L2Capability::isOutput()\n>   * \\brief Identify if the device is capable of outputting video\n> - * \\return True if the device can output video frames\n> + * \\return true if the device can capture video frames\n\nThis looks odd, s/capture/output/ right?\n\n>   */\n> +bool V4L2Capability::isOutput() const\n> +{\n> +\treturn (capabilities & V4L2_CAP_VIDEO_OUTPUT) ||\n> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> +}\n>  \n>  /**\n>   * \\fn bool V4L2Capability::hasStreaming()\n> -- \n> 2.20.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 709C960B21\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 12:33:26 +0100 (CET)","by mail-lf1-x141.google.com with SMTP id c16so17791169lfj.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 03:33:26 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tt19-v6sm2815833lje.23.2019.01.22.03.33.24\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 22 Jan 2019 03:33:24 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=8hDgYx4wwlpyS7R/jFzAGy9PIMTK3S7yqhCZu1jkDQ8=;\n\tb=Wd/UKqeLeLNQwstSIQZMhprlWFU/rBtxAVIPobhTC/AyTuS4IzLATUMCzGxR9ofmKi\n\tndf+/nQy+sjm1IxmEOkGOkCftwdP2jQ7YE0lwZ1ZHxUF/MSV8PTqyq7cmL0KcpppFEQN\n\tISjQzQ26JM5QkODkKt4yDJvtvUPbf26/72WitALI+rusI3i1E75TMsuagjPmLZjqzzNp\n\txMUjCGxagcbm73FAzPXne+zGPxD8j7h88BTGOeLWhO1DJhFnPVWFgwopSWzxPOydXEqk\n\thTML2Xg7MMMg9W9gKElkkOe8apV8nfCkIB02WGM5EhPihYjXdSkLSOMsPw5ik6kKPZyo\n\tsigQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=8hDgYx4wwlpyS7R/jFzAGy9PIMTK3S7yqhCZu1jkDQ8=;\n\tb=RwrY7DLUDOwn0uiiXui5iMqYKTKTZ3Q+vU/KROpO1YW3RIXj7XsVPN2i08BlQMmje7\n\tzE8ltpdyckhBALYyhMqZLiyTSMq6E5VJGGVYIl8MyMMawXCzvhihoNpZhhp/uODokg91\n\ttmEzQQZnAVPoV9cPiHpiQnddHQkAWjDjme+rKnZ7n6TpV2gN4VwOLBOD+9pRdfXVOww5\n\tf9SXQNEd40EZgbA7lYCMMmXsYutnXn2CmbHkP4ZTvPQysiQCtrh3xeh08noPbE/Cb4Nq\n\t4auh8uNLwqr1C3N9l980Rd9vRcArcCbCe6mXIBMjjefULOPXYpkj8Pef91Sa6hRGbIej\n\t2Mjg==","X-Gm-Message-State":"AJcUukcvR9EdomqaU8ff9nsMOoMXOF4sXEvlnDusO5vfr7aTbL068ERi\n\tThUQjAQa7koewzwEEsH5qctDAg==","X-Google-Smtp-Source":"ALg8bN6Oym2mj2DoZmus6cfrk7pQWwWbzLtoIEC/VssxkypWLUQCFCyY4R8C4gN2fGTtESMdbCo5cQ==","X-Received":"by 2002:a19:518d:: with SMTP id\n\tg13mr19819466lfl.143.1548156805605; \n\tTue, 22 Jan 2019 03:33:25 -0800 (PST)","Date":"Tue, 22 Jan 2019 12:33:24 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190122113324.GK6484@bigcity.dyn.berto.se>","References":"<20190121172705.19985-1-jacopo@jmondi.org>\n\t<20190121172705.19985-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190121172705.19985-4-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Tue, 22 Jan 2019 11:33:26 -0000"}},{"id":490,"web_url":"https://patchwork.libcamera.org/comment/490/","msgid":"<20190122134416.il6c3ghbvyachsty@uno.localdomain>","date":"2019-01-22T13:44:16","subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Jan 21, 2019 at 10:31:59PM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Mon, Jan 21, 2019 at 06:27:02PM +0100, Jacopo Mondi wrote:\n> > Add functions to V4L2Capability to identify if a V4L2 device supports\n> > single or multiplane APIs.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/include/v4l2_device.h |  6 +++--\n> >  src/libcamera/v4l2_device.cpp       | 37 +++++++++++++++++++++++++----\n> >  2 files changed, 37 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> > index 2787847..0101a4b 100644\n> > --- a/src/libcamera/include/v4l2_device.h\n> > +++ b/src/libcamera/include/v4l2_device.h\n> > @@ -27,8 +27,10 @@ struct V4L2Capability final : v4l2_capability {\n> >  \t\treturn reinterpret_cast<const char *>(v4l2_capability::bus_info);\n> >  \t}\n> >\n> > -\tbool isCapture() const { return capabilities & V4L2_CAP_VIDEO_CAPTURE; }\n> > -\tbool isOutput() const { return capabilities & V4L2_CAP_VIDEO_OUTPUT; }\n> > +\tbool isSinglePlane() const;\n> > +\tbool isMultiPlane() const;\n>\n> Maybe s/Plane/Planar/ ?\n>\n\nOk\n\n> > +\tbool isCapture() const;\n> > +\tbool isOutput() const;\n>\n> Is there a reason to stop inlining the functions ? They should just\n> generate a load and an and operation, which should be less costly than a\n> function call.\n>\n\nI moved them in the cpp unit, then realized I could have moved them back\nbut I thought it was preferred to have them in the cpp file, as\neverytime I suggested inlining something it got pushed back.\n\nI'll move them back.\n\n\n> >  \tbool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }\n> >  };\n> >\n> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > index aef0996..7cd89d7 100644\n> > --- a/src/libcamera/v4l2_device.cpp\n> > +++ b/src/libcamera/v4l2_device.cpp\n> > @@ -47,17 +47,46 @@ namespace libcamera {\n> >   * \\return The string containing the device location\n> >   */\n> >\n> > +\n> > +/**\n> > + * \\brief Identify if the device implements V4L2 single plane APIs\n>\n> s/implements/implements the/\n> s/plane/planar/ ?\n>\n> and for the following line too.\n>\n> > + * \\return true if the device supports single plane APIs\n>\n> Don't we start all the return descriptions with a capital letter ?\n>\n> Those comments hold for the other functions below.\n\nI had looked around and the boolean 'true' is usually spelled with a\nlower case 't'.\n\n>\n> > + */\n> > +bool V4L2Capability::isSinglePlane() const\n> > +{\n> > +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> > +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT);\n>\n> You could write this\n>\n> \treturn capabilities & (V4L2_CAP_VIDEO_CAPTURE |\n> \t\t\t       V4L2_CAP_VIDEO_OUTPUT);\n>\n> I would expect the compiler to perform that optimization itself, but it\n> also doesn't hurt to be explicit.\n>\n\nok\n\nThanks\n  j\n\n> > +}\n> > +\n> > +/**\n> > + * \\brief Identify if the device implements V4L2 multiplanar APIs\n> > + * \\return true if the device supports multiplanar APIs\n> > + */\n> > +bool V4L2Capability::isMultiPlane() const\n> > +{\n> > +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) ||\n> > +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> > +}\n> > +\n> >  /**\n> > - * \\fn bool V4L2Capability::isCapture()\n> >   * \\brief Identify if the device is capable of capturing video\n> > - * \\return True if the device can capture video frames\n> > + * \\return true if the device can capture video frames\n> >   */\n> > +bool V4L2Capability::isCapture() const\n> > +{\n> > +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> > +\t       (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE);\n> > +}\n> >\n> >  /**\n> > - * \\fn bool V4L2Capability::isOutput()\n> >   * \\brief Identify if the device is capable of outputting video\n> > - * \\return True if the device can output video frames\n> > + * \\return true if the device can capture video frames\n> >   */\n> > +bool V4L2Capability::isOutput() const\n> > +{\n> > +\treturn (capabilities & V4L2_CAP_VIDEO_OUTPUT) ||\n> > +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> > +}\n> >\n> >  /**\n> >   * \\fn bool V4L2Capability::hasStreaming()\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 38DF860B1B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 14:44:04 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BEE041C0017;\n\tTue, 22 Jan 2019 13:44:03 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 22 Jan 2019 14:44:16 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190122134416.il6c3ghbvyachsty@uno.localdomain>","References":"<20190121172705.19985-1-jacopo@jmondi.org>\n\t<20190121172705.19985-4-jacopo@jmondi.org>\n\t<20190121203159.GD4439@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"mbwjzghdpd7zhyz3\"","Content-Disposition":"inline","In-Reply-To":"<20190121203159.GD4439@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Tue, 22 Jan 2019 13:44:05 -0000"}},{"id":491,"web_url":"https://patchwork.libcamera.org/comment/491/","msgid":"<20190122134901.GD4455@pendragon.ideasonboard.com>","date":"2019-01-22T13:49:01","subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Tue, Jan 22, 2019 at 02:44:16PM +0100, Jacopo Mondi wrote:\n> On Mon, Jan 21, 2019 at 10:31:59PM +0200, Laurent Pinchart wrote:\n> > On Mon, Jan 21, 2019 at 06:27:02PM +0100, Jacopo Mondi wrote:\n> >> Add functions to V4L2Capability to identify if a V4L2 device supports\n> >> single or multiplane APIs.\n> >>\n> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >> ---\n> >>  src/libcamera/include/v4l2_device.h |  6 +++--\n> >>  src/libcamera/v4l2_device.cpp       | 37 +++++++++++++++++++++++++----\n> >>  2 files changed, 37 insertions(+), 6 deletions(-)\n> >>\n> >> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\n> >> index 2787847..0101a4b 100644\n> >> --- a/src/libcamera/include/v4l2_device.h\n> >> +++ b/src/libcamera/include/v4l2_device.h\n> >> @@ -27,8 +27,10 @@ struct V4L2Capability final : v4l2_capability {\n> >>  \t\treturn reinterpret_cast<const char *>(v4l2_capability::bus_info);\n> >>  \t}\n> >>\n> >> -\tbool isCapture() const { return capabilities & V4L2_CAP_VIDEO_CAPTURE; }\n> >> -\tbool isOutput() const { return capabilities & V4L2_CAP_VIDEO_OUTPUT; }\n> >> +\tbool isSinglePlane() const;\n> >> +\tbool isMultiPlane() const;\n> >\n> > Maybe s/Plane/Planar/ ?\n> \n> Ok\n> \n> >> +\tbool isCapture() const;\n> >> +\tbool isOutput() const;\n> >\n> > Is there a reason to stop inlining the functions ? They should just\n> > generate a load and an and operation, which should be less costly than a\n> > function call.\n> >\n> \n> I moved them in the cpp unit, then realized I could have moved them back\n> but I thought it was preferred to have them in the cpp file, as\n> everytime I suggested inlining something it got pushed back.\n\nInlines should be used with caution as they can generate a fair amount\nof code in C++, for instance when they copy full objects behind the\nscene, or for virtual destructors. In this specific case I think they're\nfine.\n\n> I'll move them back.\n> \n> >>  \tbool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }\n> >>  };\n> >>\n> >> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> >> index aef0996..7cd89d7 100644\n> >> --- a/src/libcamera/v4l2_device.cpp\n> >> +++ b/src/libcamera/v4l2_device.cpp\n> >> @@ -47,17 +47,46 @@ namespace libcamera {\n> >>   * \\return The string containing the device location\n> >>   */\n> >>\n> >> +\n> >> +/**\n> >> + * \\brief Identify if the device implements V4L2 single plane APIs\n> >\n> > s/implements/implements the/\n> > s/plane/planar/ ?\n> >\n> > and for the following line too.\n> >\n> >> + * \\return true if the device supports single plane APIs\n> >\n> > Don't we start all the return descriptions with a capital letter ?\n> >\n> > Those comments hold for the other functions below.\n> \n> I had looked around and the boolean 'true' is usually spelled with a\n> lower case 't'.\n\n6 cases of \\return true, and 6 cases of \\return True :-) I'd go for the\nlater to capitalize all \\return expressions.\n\n> >> + */\n> >> +bool V4L2Capability::isSinglePlane() const\n> >> +{\n> >> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> >> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT);\n> >\n> > You could write this\n> >\n> > \treturn capabilities & (V4L2_CAP_VIDEO_CAPTURE |\n> > \t\t\t       V4L2_CAP_VIDEO_OUTPUT);\n> >\n> > I would expect the compiler to perform that optimization itself, but it\n> > also doesn't hurt to be explicit.\n> \n> ok\n> \n> >> +}\n> >> +\n> >> +/**\n> >> + * \\brief Identify if the device implements V4L2 multiplanar APIs\n> >> + * \\return true if the device supports multiplanar APIs\n> >> + */\n> >> +bool V4L2Capability::isMultiPlane() const\n> >> +{\n> >> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) ||\n> >> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> >> +}\n> >> +\n> >>  /**\n> >> - * \\fn bool V4L2Capability::isCapture()\n> >>   * \\brief Identify if the device is capable of capturing video\n> >> - * \\return True if the device can capture video frames\n> >> + * \\return true if the device can capture video frames\n> >>   */\n> >> +bool V4L2Capability::isCapture() const\n> >> +{\n> >> +\treturn (capabilities & V4L2_CAP_VIDEO_CAPTURE) ||\n> >> +\t       (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE);\n> >> +}\n> >>\n> >>  /**\n> >> - * \\fn bool V4L2Capability::isOutput()\n> >>   * \\brief Identify if the device is capable of outputting video\n> >> - * \\return True if the device can output video frames\n> >> + * \\return true if the device can capture video frames\n> >>   */\n> >> +bool V4L2Capability::isOutput() const\n> >> +{\n> >> +\treturn (capabilities & V4L2_CAP_VIDEO_OUTPUT) ||\n> >> +\t       (capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE);\n> >> +}\n> >>\n> >>  /**\n> >>   * \\fn bool V4L2Capability::hasStreaming()","headers":{"Return-Path":"<laurent.pinchart@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 E64AC60B1B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 14:49:01 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yyyyyyyyyyyyyby-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00::2])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A34D53E;\n\tTue, 22 Jan 2019 14:49:01 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548164941;\n\tbh=8a//wnz5C3Sw7hseibM/dSLfzsOjDh8EYBS76V0vfpo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uZfjsBmFDdYjqe5ZrzoGqy4zzcO9L8LZ5F5SvRr8SDiNIoS/Xt5s/GhtZW6i+N7Um\n\tcL8umAHn2uvDrUlc768nTGv/sjvYIEB6Fv6y26jj4Wu+W43IKitI3LlRx3GkgrB34A\n\tEkZ47olEYDKxet9eo9Ygue9ZR2JHxUbI09G1M0kI=","Date":"Tue, 22 Jan 2019 15:49:01 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190122134901.GD4455@pendragon.ideasonboard.com>","References":"<20190121172705.19985-1-jacopo@jmondi.org>\n\t<20190121172705.19985-4-jacopo@jmondi.org>\n\t<20190121203159.GD4439@pendragon.ideasonboard.com>\n\t<20190122134416.il6c3ghbvyachsty@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190122134416.il6c3ghbvyachsty@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Identify\n\tsingle/multiplane","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Tue, 22 Jan 2019 13:49:02 -0000"}}]