[{"id":4051,"web_url":"https://patchwork.libcamera.org/comment/4051/","msgid":"<20200317122901.goepjz4xoavdsyab@uno.localdomain>","date":"2020-03-17T12:29:01","subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: v4l2_videodevice:\n\tExpose the device capabilities","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"HI Laurent,\n\nOn Mon, Mar 16, 2020 at 11:43:05PM +0200, Laurent Pinchart wrote:\n> Add a caps() function that exposes the V4L2 capabilities for the device.\n> This is useful for generic code that can't hardcode any a priori\n> knowledge of the device, such as in a simple pipeline handler.\n>\n\nI'm not thrilled by this as it again exposes another piece of V4L2\ninformation to pipeline handlers. THey're anyway dealing with a V4L2\ndevice, so I think it's fine. Also I cannot propose anything better\nthan \"let's define libcamera video device caps\", but that's probably\nnot the right time.\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/include/v4l2_videodevice.h | 2 ++\n>  src/libcamera/v4l2_videodevice.cpp       | 6 ++++++\n>  2 files changed, 8 insertions(+)\n>\n> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> index 7196cabd09c7..16fc6b60de02 100644\n> --- a/src/libcamera/include/v4l2_videodevice.h\n> +++ b/src/libcamera/include/v4l2_videodevice.h\n> @@ -182,6 +182,8 @@ public:\n>  \tconst char *deviceName() const { return caps_.card(); }\n>  \tconst char *busName() const { return caps_.bus_info(); }\n>\n> +\tconst V4L2Capability &caps() const { return caps_; }\n> +\n>  \tint getFormat(V4L2DeviceFormat *format);\n>  \tint setFormat(V4L2DeviceFormat *format);\n>  \tImageFormats formats(uint32_t code = 0);\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 084394fa5380..f5a925d97b63 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -682,6 +682,12 @@ void V4L2VideoDevice::close()\n>   * \\return The string containing the device location\n>   */\n>\n> +/**\n> + * \\fn V4L2VideoDevice::caps()\n> + * \\brief Retrieve the device V4L2 capabilities\n> + * \\return The device V4L2 capabilities\n> + */\n> +\n>  std::string V4L2VideoDevice::logPrefix() const\n>  {\n>  \treturn deviceNode() + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? \"[out]\" : \"[cap]\");\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2477662923\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Mar 2020 13:26:14 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id D237EE0007;\n\tTue, 17 Mar 2020 12:26:06 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 17 Mar 2020 13:29:01 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Martijn Braam <martijn@brixit.nl>, \n\tMickael GUENE <mickael.guene@st.com>,\n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>","Message-ID":"<20200317122901.goepjz4xoavdsyab@uno.localdomain>","References":"<20200316214310.27665-1-laurent.pinchart@ideasonboard.com>\n\t<20200316214310.27665-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200316214310.27665-6-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: v4l2_videodevice:\n\tExpose the device capabilities","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>","X-List-Received-Date":"Tue, 17 Mar 2020 12:26:14 -0000"}},{"id":4058,"web_url":"https://patchwork.libcamera.org/comment/4058/","msgid":"<20200317202618.GG2527@pendragon.ideasonboard.com>","date":"2020-03-17T20:26:18","subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: v4l2_videodevice:\n\tExpose the device capabilities","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, Mar 17, 2020 at 01:29:01PM +0100, Jacopo Mondi wrote:\n> On Mon, Mar 16, 2020 at 11:43:05PM +0200, Laurent Pinchart wrote:\n> > Add a caps() function that exposes the V4L2 capabilities for the device.\n> > This is useful for generic code that can't hardcode any a priori\n> > knowledge of the device, such as in a simple pipeline handler.\n> \n> I'm not thrilled by this as it again exposes another piece of V4L2\n> information to pipeline handlers. THey're anyway dealing with a V4L2\n> device, so I think it's fine. Also I cannot propose anything better\n> than \"let's define libcamera video device caps\", but that's probably\n> not the right time.\n\nI don't think we could hide V4L2 completely from pipeline handlers\nanyway, so it's fine in my opinion to expose V4L2 API elements. The\npurpose of the V4L2 helper classes is to simplify usage of the V4L2 API,\nwe don't need to wrap everything when not needed.\n\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/include/v4l2_videodevice.h | 2 ++\n> >  src/libcamera/v4l2_videodevice.cpp       | 6 ++++++\n> >  2 files changed, 8 insertions(+)\n> >\n> > diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> > index 7196cabd09c7..16fc6b60de02 100644\n> > --- a/src/libcamera/include/v4l2_videodevice.h\n> > +++ b/src/libcamera/include/v4l2_videodevice.h\n> > @@ -182,6 +182,8 @@ public:\n> >  \tconst char *deviceName() const { return caps_.card(); }\n> >  \tconst char *busName() const { return caps_.bus_info(); }\n> >\n> > +\tconst V4L2Capability &caps() const { return caps_; }\n> > +\n> >  \tint getFormat(V4L2DeviceFormat *format);\n> >  \tint setFormat(V4L2DeviceFormat *format);\n> >  \tImageFormats formats(uint32_t code = 0);\n> > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > index 084394fa5380..f5a925d97b63 100644\n> > --- a/src/libcamera/v4l2_videodevice.cpp\n> > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > @@ -682,6 +682,12 @@ void V4L2VideoDevice::close()\n> >   * \\return The string containing the device location\n> >   */\n> >\n> > +/**\n> > + * \\fn V4L2VideoDevice::caps()\n> > + * \\brief Retrieve the device V4L2 capabilities\n> > + * \\return The device V4L2 capabilities\n> > + */\n> > +\n> >  std::string V4L2VideoDevice::logPrefix() const\n> >  {\n> >  \treturn deviceNode() + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? \"[out]\" : \"[cap]\");","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD98B62923\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Mar 2020 21:26:24 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1E3BCF9;\n\tTue, 17 Mar 2020 21:26:24 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584476784;\n\tbh=hPpqOJ6TABUrnw7c6xAEXPxVbWL0VbTM89IIybZOVBM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fBHl2ZPL44qC2blCD5euTxnXOvN+31VCxxpqfDTFMgsHRKZo27xtPZU26UA4Dhpx1\n\twIJdRFgyEpHjgHKLw+IXvahLbnzSKUIcXt1vVZ4UO2CG0E2NSTtdRsW49ApUyUD1DU\n\tGWqm7kQ4U5bS1h6dRri1tS7TJEMMMZPVCu0sdOlQ=","Date":"Tue, 17 Mar 2020 22:26:18 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org, Martijn Braam <martijn@brixit.nl>, \n\tMickael GUENE <mickael.guene@st.com>,\n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>","Message-ID":"<20200317202618.GG2527@pendragon.ideasonboard.com>","References":"<20200316214310.27665-1-laurent.pinchart@ideasonboard.com>\n\t<20200316214310.27665-6-laurent.pinchart@ideasonboard.com>\n\t<20200317122901.goepjz4xoavdsyab@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200317122901.goepjz4xoavdsyab@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: v4l2_videodevice:\n\tExpose the device capabilities","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>","X-List-Received-Date":"Tue, 17 Mar 2020 20:26:24 -0000"}}]