[{"id":5239,"web_url":"https://patchwork.libcamera.org/comment/5239/","msgid":"<20200617124345.4cg2ozarcnq454kk@uno.localdomain>","date":"2020-06-17T12:43:45","subject":"Re: [libcamera-devel] [PATCH 03/15] v4l2: v4l2_camera_proxy: Fix\n\tv4l2-compliance support for extended formats","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Paul,\n\nOn Tue, Jun 16, 2020 at 10:12:32PM +0900, Paul Elder wrote:\n> Fix the following v4l2-compliance error:\n>\n> fail: v4l2-compliance.cpp(652): !(caps & V4L2_CAP_EXT_PIX_FORMAT)\n>\n> Simply add V4L2_CAP_EXT_PIX_FORMAT to capabilities in querycap.\n\nThis is really a relic from the past, as the V4L2 sets this flag\nunconditionally, but I don't see it used anywhere in mainline :/\n\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\nHowever, let's please the compliance tool\n\nAcked-by: Jacopo Mondi <jacopo@jmondi.org>\n\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 5b74b53..d899853 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -202,7 +202,9 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)\n>  \t\t       sizeof(capabilities_.bus_info));\n>  \t/* \\todo Put this in a header/config somewhere. */\n>  \tcapabilities_.version = KERNEL_VERSION(5, 2, 0);\n\nJust noticed, this could be exposed by the CameraManager by quering\nthe pipeline handlers media devices, I presume this will soon be\nrequired, as hardcoding the kernel version is not optimal :)\n\n> -\tcapabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;\n> +\tcapabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE\n> +\t\t\t\t  | V4L2_CAP_STREAMING\n> +\t\t\t\t  | V4L2_CAP_EXT_PIX_FORMAT;\n>  \tcapabilities_.capabilities = capabilities_.device_caps\n>  \t\t\t\t   | V4L2_CAP_DEVICE_CAPS;\n>  \tmemset(capabilities_.reserved, 0, sizeof(capabilities_.reserved));\n> --\n> 2.27.0\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 relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 82600603BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Jun 2020 14:40:20 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 0CC0EC000E;\n\tWed, 17 Jun 2020 12:40:19 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Wed, 17 Jun 2020 14:43:45 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200617124345.4cg2ozarcnq454kk@uno.localdomain>","References":"<20200616131244.70308-1-paul.elder@ideasonboard.com>\n\t<20200616131244.70308-4-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200616131244.70308-4-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 03/15] v4l2: v4l2_camera_proxy: Fix\n\tv4l2-compliance support for extended formats","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":"Wed, 17 Jun 2020 12:40:20 -0000"}},{"id":5248,"web_url":"https://patchwork.libcamera.org/comment/5248/","msgid":"<20200617153044.GG5838@pendragon.ideasonboard.com>","date":"2020-06-17T15:30:44","subject":"Re: [libcamera-devel] [PATCH 03/15] v4l2: v4l2_camera_proxy: Fix\n\tv4l2-compliance support for extended formats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Wed, Jun 17, 2020 at 02:43:45PM +0200, Jacopo Mondi wrote:\n> On Tue, Jun 16, 2020 at 10:12:32PM +0900, Paul Elder wrote:\n> > Fix the following v4l2-compliance error:\n> >\n> > fail: v4l2-compliance.cpp(652): !(caps & V4L2_CAP_EXT_PIX_FORMAT)\n> >\n> > Simply add V4L2_CAP_EXT_PIX_FORMAT to capabilities in querycap.\n\nDon't you also need to set fmt.pix.priv to V4L2_PIX_FMT_PRIV_MAGIC for\nthe format-related ioctls ? The priv field is documented by\nhttps://linuxtv.org/downloads/v4l-dvb-apis/userspace-api/v4l/pixfmt-v4l2.html#c.v4l2_pix_format\nas\n\n\"This field indicates whether the remaining fields of the struct\nv4l2_pix_format, also called the extended fields, are valid. When set to\nV4L2_PIX_FMT_PRIV_MAGIC, it indicates that the extended fields have been\ncorrectly initialized. When set to any other value it indicates that the\nextended fields contain undefined values.\n\nApplications that wish to use the pixel format extended fields must\nfirst ensure that the feature is supported by querying the device for\nthe V4L2_CAP_EXT_PIX_FORMAT capability. If the capability isn’t set the\npixel format extended fields are not supported and using the extended\nfields will lead to undefined results.\n\nTo use the extended fields, applications must set the priv field to\nV4L2_PIX_FMT_PRIV_MAGIC, initialize all the extended fields and zero the\nunused bytes of the struct v4l2_format raw_data field.\n\nWhen the priv field isn’t set to V4L2_PIX_FMT_PRIV_MAGIC drivers must\nact as if all the extended fields were set to zero. On return drivers\nmust set the priv field to V4L2_PIX_FMT_PRIV_MAGIC and all the extended\nfields to applicable values.\"\n\nAnd the commit that introduces V4L2_CAP_EXT_PIX_FORMAT sets\nV4L2_PIX_FMT_PRIV_MAGIC for the get, set and try format ioctls.\n\n> This is really a relic from the past, as the V4L2 sets this flag\n> unconditionally, but I don't see it used anywhere in mainline :/\n> \n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> However, let's please the compliance tool\n> \n> Acked-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> > ---\n> >  src/v4l2/v4l2_camera_proxy.cpp | 4 +++-\n> >  1 file changed, 3 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > index 5b74b53..d899853 100644\n> > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > @@ -202,7 +202,9 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)\n> >  \t\t       sizeof(capabilities_.bus_info));\n> >  \t/* \\todo Put this in a header/config somewhere. */\n> >  \tcapabilities_.version = KERNEL_VERSION(5, 2, 0);\n> \n> Just noticed, this could be exposed by the CameraManager by quering\n> the pipeline handlers media devices, I presume this will soon be\n> required, as hardcoding the kernel version is not optimal :)\n\nI don't think we should do that. The version field here reports the\nversion of V4L2 API implemented by the device. The version we implement\nis a property of the V4L2 compat layer. When running on a newer kernel,\nthe compat layer won't automatically expose new V4L2 features. I thus\nthink hardcoding the version here is the best option.\n\n> > -\tcapabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;\n> > +\tcapabilities_.device_caps = V4L2_CAP_VIDEO_CAPTURE\n> > +\t\t\t\t  | V4L2_CAP_STREAMING\n> > +\t\t\t\t  | V4L2_CAP_EXT_PIX_FORMAT;\n> >  \tcapabilities_.capabilities = capabilities_.device_caps\n> >  \t\t\t\t   | V4L2_CAP_DEVICE_CAPS;\n> >  \tmemset(capabilities_.reserved, 0, sizeof(capabilities_.reserved));","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 B9FF0603BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Jun 2020 17:31:07 +0200 (CEST)","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 3352EF9;\n\tWed, 17 Jun 2020 17:31:07 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"UpG0CTD/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592407867;\n\tbh=2GLY7/PVbGF5groy6TrGQEnH2Q2PCNyi/yf8Xu3Gzyk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UpG0CTD/ZnxoSb3VOi4bE8X1gHbwxS9K/rQPXoAVf7e9e/f2d8HxprEjyI3cxFUry\n\tvyS4WbOZIPMCneDbyysg0C8XbSl1An7bebeY9PXkXDQ+ALK1VnfAZvDSrp0X3HZtQi\n\tCuP/+fZ0WF+Lf/Ix8Z1gDAaaHJwRY6x2/MXwC7Rg=","Date":"Wed, 17 Jun 2020 18:30:44 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20200617153044.GG5838@pendragon.ideasonboard.com>","References":"<20200616131244.70308-1-paul.elder@ideasonboard.com>\n\t<20200616131244.70308-4-paul.elder@ideasonboard.com>\n\t<20200617124345.4cg2ozarcnq454kk@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200617124345.4cg2ozarcnq454kk@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 03/15] v4l2: v4l2_camera_proxy: Fix\n\tv4l2-compliance support for extended formats","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":"Wed, 17 Jun 2020 15:31:08 -0000"}}]