[{"id":22374,"web_url":"https://patchwork.libcamera.org/comment/22374/","msgid":"<YjpmR/zhxjn13XxT@pendragon.ideasonboard.com>","date":"2022-03-23T00:13:59","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_videodevice:\n\tClarify setting of v4l2_buffer timestamp","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Thu, Mar 17, 2022 at 04:17:39PM +0530, Umang Jain via libcamera-devel wrote:\n> Add a comment to clarify why we set v4l2_buffer timestamp while\n> queuing the buffer (VIDIOC_QBUF). The timstamps are required to\n> be supplied for memory-to-memory devices for output streams which\n> then are copied to capture stream buffers with the help of\n> V4L2_BUF_FLAG_TIMESTAMP_COPY (set by the driver).\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  src/libcamera/v4l2_videodevice.cpp | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n> \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 5580269f..a6c54b19 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1600,6 +1600,14 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n>  \t\t\tbuf.length = planes[0].length;\n>  \t\t}\n>  \n> +\t\t/*\n> +\t\t * Timestamps are to be supplied if the device is a mem-to-mem\n> +\t\t * device. The drivers will have V4L2_BUF_FLAG_TIMESTAMP_COPY\n> +\t\t * set hence these timestamps will be copied from the output\n> +\t\t * buffers to capture buffers. If the device is not mem-to-men,\n\ns/mem-to-men/mem-to-mem/\n\n> +\t\t * there is no harm in setting the timestamps as they will be\n> +\t\t * ignored (and over-written).\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\t */\n>  \t\tbuf.timestamp.tv_sec = metadata.timestamp / 1000000000;\n>  \t\tbuf.timestamp.tv_usec = (metadata.timestamp / 1000) % 1000000;\n>  \t}","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 9E0FEC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Mar 2022 00:14:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE6EC604DB;\n\tWed, 23 Mar 2022 01:14:17 +0100 (CET)","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 2067B604C6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Mar 2022 01:14:17 +0100 (CET)","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 9007A9DE;\n\tWed, 23 Mar 2022 01:14:16 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647994457;\n\tbh=vRtx1WREw0htknQOjMASQIvGyRC+2TOUo49MhxX8iNo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=HUYRKeJWObYC1zuM6WQAx9veaZtnirzVem9kVoJmP4yNP/cxKjZHwKof0i5Ftaowy\n\t+YakV+cQykK6i0p781SHoiRDSXPC9+akBsF8iI32YbIN39HiG0liox90Q1w1OSGeKE\n\tPKAtfUDEd+1xVT76OJy+7xOMopIGIyZ4lk0sPRyHQWG+C5lWUg0hk9JVeKpz3NVwxK\n\tJFsDWlk/57f44N4NyDf/NXRKVL3FnmWrg7ZVStWD8KhlCGFL1rqBufEESAxymtoJsA\n\tnyFbEVvOXUUIBMU20KE//ejStT3itzwzSy/uLM6RjidC23ovXYe5ft1fXbuM7JiSpX\n\tABO2Ed1OtkjwA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647994456;\n\tbh=vRtx1WREw0htknQOjMASQIvGyRC+2TOUo49MhxX8iNo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Nvcppcrr4OqPck5Bl2XNoUte6s0WgC03et9x1DDy+HXOyT4ek+gDVmdm2snusbCIq\n\tujL4gEDWt8njW9XNXZnIFwLVSpno2xtEXwYD5WAZsx6LjfmxHIMQt8YWJA8swKpgqX\n\t3EMA8D+IOTNroKwP50CpI8VgW65ymlDsvP1x0HxI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Nvcppcrr\"; dkim-atps=neutral","Date":"Wed, 23 Mar 2022 02:13:59 +0200","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<YjpmR/zhxjn13XxT@pendragon.ideasonboard.com>","References":"<20220317104740.569310-1-umang.jain@ideasonboard.com>\n\t<20220317104740.569310-3-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220317104740.569310-3-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_videodevice:\n\tClarify setting of v4l2_buffer timestamp","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22398,"web_url":"https://patchwork.libcamera.org/comment/22398/","msgid":"<164803158578.2130830.9163952365000828289@Monstersaurus>","date":"2022-03-23T10:33:05","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_videodevice:\n\tClarify setting of v4l2_buffer timestamp","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2022-03-23 00:13:59)\n> Hi Umang,\n> \n> Thank you for the patch.\n> \n> On Thu, Mar 17, 2022 at 04:17:39PM +0530, Umang Jain via libcamera-devel wrote:\n> > Add a comment to clarify why we set v4l2_buffer timestamp while\n> > queuing the buffer (VIDIOC_QBUF). The timstamps are required to\n> > be supplied for memory-to-memory devices for output streams which\n> > then are copied to capture stream buffers with the help of\n> > V4L2_BUF_FLAG_TIMESTAMP_COPY (set by the driver).\n> > \n> > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> > ---\n> >  src/libcamera/v4l2_videodevice.cpp | 8 ++++++++\n> >  1 file changed, 8 insertions(+)\n> > \n> > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > index 5580269f..a6c54b19 100644\n> > --- a/src/libcamera/v4l2_videodevice.cpp\n> > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > @@ -1600,6 +1600,14 @@ int V4L2VideoDevice::queueBuffer(FrameBuffer *buffer)\n> >                       buf.length = planes[0].length;\n> >               }\n> >  \n> > +             /*\n> > +              * Timestamps are to be supplied if the device is a mem-to-mem\n> > +              * device. The drivers will have V4L2_BUF_FLAG_TIMESTAMP_COPY\n> > +              * set hence these timestamps will be copied from the output\n> > +              * buffers to capture buffers. If the device is not mem-to-men,\n> \n> s/mem-to-men/mem-to-mem/\n> \n> > +              * there is no harm in setting the timestamps as they will be\n> > +              * ignored (and over-written).\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> > +              */\n> >               buf.timestamp.tv_sec = metadata.timestamp / 1000000000;\n> >               buf.timestamp.tv_usec = (metadata.timestamp / 1000) % 1000000;\n> >       }\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 473E8BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Mar 2022 10:33:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED5DE604D5;\n\tWed, 23 Mar 2022 11:33:10 +0100 (CET)","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 04A70601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Mar 2022 11:33:09 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B09E09DE;\n\tWed, 23 Mar 2022 11:33:08 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648031590;\n\tbh=lSFp3/svU8QGG42EGnWagidP2KP9eWGnIkLvSKFPUE0=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=XHWcp/V/Ktl9SWs2504LDtJW1UY6Z3hKRR0ZUXcTu7JObGudqqTVys8idah59Kx4u\n\tRPV4EZ++ClPIMrOowN6IGNne8X0/bbPj+RouyAMfKZax4OxXlg7l8cXUcFzjQc77Bh\n\t0oX3GSrAz6sbDNJ1dLNZ9G4VeXuEMKeqwHH7Q+3xmvrebr5ASWmySTdXnM80+jW7P/\n\tj9YkehCvUCZ5lzXnOk4DZ8AsNJna2N/PK25EBUsYzgsJAWptP6a26Sw9QLz1FtkvON\n\t0MCrUT5l7T1G9MQ5olAopAtxzizW583XY0+uzJ7dcgBtZlbvKW2LpUHKy2MmiH/j4I\n\tIDqKYPvaIGRug==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648031588;\n\tbh=lSFp3/svU8QGG42EGnWagidP2KP9eWGnIkLvSKFPUE0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=NvYOkP+2vT7nXTQmXGDfFPiDrcmDLuAs34q6YGbStZQPC2CJEjwDRZ3SAieUNUYaC\n\tQZD9KkYG2U1ZjMnvIf5M3P0xu7EblYlKzRzFrKuqug8bCsZY5p2lm525An4D1DKB2u\n\tkHjU1j73KMJKpy8TBeKFYLZ6uT3FwlpDtWQaJ5HM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"NvYOkP+2\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<YjpmR/zhxjn13XxT@pendragon.ideasonboard.com>","References":"<20220317104740.569310-1-umang.jain@ideasonboard.com>\n\t<20220317104740.569310-3-umang.jain@ideasonboard.com>\n\t<YjpmR/zhxjn13XxT@pendragon.ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tLaurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>, \n\tUmang Jain <umang.jain@ideasonboard.com>","Date":"Wed, 23 Mar 2022 10:33:05 +0000","Message-ID":"<164803158578.2130830.9163952365000828289@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_videodevice:\n\tClarify setting of v4l2_buffer timestamp","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]