[{"id":5249,"web_url":"https://patchwork.libcamera.org/comment/5249/","msgid":"<20200617153637.cpr4abn43qoaeo7u@uno.localdomain>","date":"2020-06-17T15:36:37","subject":"Re: [libcamera-devel] [PATCH 12/15] v4l2: v4l2_camera_proxy: Add\n\tsequence number","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:41PM +0900, Paul Elder wrote:\n> Populate the sequence number field in the V4L2 buffers. Reset upon\n> streamon.\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 4 +++-\n>  src/v4l2/v4l2_camera_proxy.h   | 2 ++\n>  2 files changed, 5 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index 079961a..81f9282 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -33,7 +33,7 @@ LOG_DECLARE_CATEGORY(V4L2Compat);\n>  V4L2CameraProxy::V4L2CameraProxy(unsigned int index,\n>  \t\t\t\t std::shared_ptr<Camera> camera)\n>  \t: refcount_(0), index_(index), bufferCount_(0), currentBuf_(0),\n> -\t  vcam_(std::make_unique<V4L2Camera>(camera)), efd_(-1),\n> +\t  sequence_(0), vcam_(std::make_unique<V4L2Camera>(camera)), efd_(-1),\n\nWhy not use the sequence number reported by the video device and\navailable in the frame metadata ?\n\n>  \t  v4l2RecordPriorityFd_(-1), acquiredFd_(-1), initialized_(false),\n>  \t  streaming_(false)\n>  {\n> @@ -665,6 +665,7 @@ int V4L2CameraProxy::vidioc_dqbuf(int fd, struct v4l2_buffer *arg)\n>\n>  \tbuf.flags &= ~V4L2_BUF_FLAG_QUEUED;\n>  \tbuf.length = sizeimage_;\n> +\tbuf.sequence = sequence_++;\n>  \t*arg = buf;\n>\n>  \tcurrentBuf_ = (currentBuf_ + 1) % bufferCount_;\n> @@ -696,6 +697,7 @@ int V4L2CameraProxy::vidioc_streamon(int fd, int *arg)\n>\n>  \tcurrentBuf_ = 0;\n>  \tstreaming_ = true;\n> +\tsequence_ = 0;\n>\n>  \treturn vcam_->streamOn();\n>  }\n> diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\n> index 28b2fa0..1d8e9a6 100644\n> --- a/src/v4l2/v4l2_camera_proxy.h\n> +++ b/src/v4l2/v4l2_camera_proxy.h\n> @@ -82,6 +82,8 @@ private:\n>  \tunsigned int currentBuf_;\n>  \tunsigned int sizeimage_;\n>\n> +\tuint32_t sequence_;\n> +\n>  \tstd::vector<struct v4l2_buffer> buffers_;\n>  \tstd::map<void *, unsigned int> mmaps_;\n>\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 relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9DCE2603BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Jun 2020 17:33:16 +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 relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 302652000F;\n\tWed, 17 Jun 2020 15:33:15 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Wed, 17 Jun 2020 17:36:37 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200617153637.cpr4abn43qoaeo7u@uno.localdomain>","References":"<20200616131244.70308-1-paul.elder@ideasonboard.com>\n\t<20200616131244.70308-13-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200616131244.70308-13-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 12/15] v4l2: v4l2_camera_proxy: Add\n\tsequence number","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:33:16 -0000"}},{"id":5269,"web_url":"https://patchwork.libcamera.org/comment/5269/","msgid":"<20200618091240.GB2095@jade.amanokami.net>","date":"2020-06-18T09:12:40","subject":"Re: [libcamera-devel] [PATCH 12/15] v4l2: v4l2_camera_proxy: Add\n\tsequence number","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Wed, Jun 17, 2020 at 05:36:37PM +0200, Jacopo Mondi wrote:\n> Hi Paul,\n> \n> On Tue, Jun 16, 2020 at 10:12:41PM +0900, Paul Elder wrote:\n> > Populate the sequence number field in the V4L2 buffers. Reset upon\n> > streamon.\n> >\n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > ---\n> >  src/v4l2/v4l2_camera_proxy.cpp | 4 +++-\n> >  src/v4l2/v4l2_camera_proxy.h   | 2 ++\n> >  2 files changed, 5 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > index 079961a..81f9282 100644\n> > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > @@ -33,7 +33,7 @@ LOG_DECLARE_CATEGORY(V4L2Compat);\n> >  V4L2CameraProxy::V4L2CameraProxy(unsigned int index,\n> >  \t\t\t\t std::shared_ptr<Camera> camera)\n> >  \t: refcount_(0), index_(index), bufferCount_(0), currentBuf_(0),\n> > -\t  vcam_(std::make_unique<V4L2Camera>(camera)), efd_(-1),\n> > +\t  sequence_(0), vcam_(std::make_unique<V4L2Camera>(camera)), efd_(-1),\n> \n> Why not use the sequence number reported by the video device and\n> available in the frame metadata ?\n\nHuh, apparently I already was. I don't know why v4l2-compliance\ncomplained.\n\n\nPaul\n\n> >  \t  v4l2RecordPriorityFd_(-1), acquiredFd_(-1), initialized_(false),\n> >  \t  streaming_(false)\n> >  {\n> > @@ -665,6 +665,7 @@ int V4L2CameraProxy::vidioc_dqbuf(int fd, struct v4l2_buffer *arg)\n> >\n> >  \tbuf.flags &= ~V4L2_BUF_FLAG_QUEUED;\n> >  \tbuf.length = sizeimage_;\n> > +\tbuf.sequence = sequence_++;\n> >  \t*arg = buf;\n> >\n> >  \tcurrentBuf_ = (currentBuf_ + 1) % bufferCount_;\n> > @@ -696,6 +697,7 @@ int V4L2CameraProxy::vidioc_streamon(int fd, int *arg)\n> >\n> >  \tcurrentBuf_ = 0;\n> >  \tstreaming_ = true;\n> > +\tsequence_ = 0;\n> >\n> >  \treturn vcam_->streamOn();\n> >  }\n> > diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\n> > index 28b2fa0..1d8e9a6 100644\n> > --- a/src/v4l2/v4l2_camera_proxy.h\n> > +++ b/src/v4l2/v4l2_camera_proxy.h\n> > @@ -82,6 +82,8 @@ private:\n> >  \tunsigned int currentBuf_;\n> >  \tunsigned int sizeimage_;\n> >\n> > +\tuint32_t sequence_;\n> > +\n> >  \tstd::vector<struct v4l2_buffer> buffers_;\n> >  \tstd::map<void *, unsigned int> mmaps_;\n> >\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":"<paul.elder@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 D4C2561167\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Jun 2020 11:12:50 +0200 (CEST)","from jade.amanokami.net (unknown\n\t[IPv6:2400:4051:61:600:a17c:96b8:ddb0:63b7])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3CD3CF9;\n\tThu, 18 Jun 2020 11:12:48 +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=\"BXeCUYKb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592471570;\n\tbh=0EPFRsk8V9BV3Jlt0RYVhGp7jFwQf4ItKluI5XUlSio=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BXeCUYKb0wciJNMlzaLGxQLue6+sWF85Cymu7PdQ9fFXnZI48OYZjuyS5s0L9BA6z\n\tI22TYJtyTqntoyAP/TzbgPGtiEUBnxIPhoUCXayGchhtqw44FYHbKfw/3zAjbnkEag\n\tcxbAPkVVMmPiZi7GKD9dX5mTHQ0fe8HJjQE0QRJQ=","Date":"Thu, 18 Jun 2020 18:12:40 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200618091240.GB2095@jade.amanokami.net>","References":"<20200616131244.70308-1-paul.elder@ideasonboard.com>\n\t<20200616131244.70308-13-paul.elder@ideasonboard.com>\n\t<20200617153637.cpr4abn43qoaeo7u@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20200617153637.cpr4abn43qoaeo7u@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 12/15] v4l2: v4l2_camera_proxy: Add\n\tsequence number","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":"Thu, 18 Jun 2020 09:12:51 -0000"}}]