[{"id":16406,"web_url":"https://patchwork.libcamera.org/comment/16406/","msgid":"<YH9LwsSE7/A1OK7W@pendragon.ideasonboard.com>","date":"2021-04-20T21:46:42","subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: simple: Report\n\tsensor timestamp","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, Apr 19, 2021 at 03:14:26PM +0200, Jacopo Mondi wrote:\n> Report the sensor's timestamp in the Request metadata using the\n> completed buffer timestamp.\n> \n> The buffer's timestamp is recorded at DMA-transfer time, and it does not\n> theoretically matches the 'start of exposure' definition. Record this with\n> a \\todo entry.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 11 +++++++++++\n>  1 file changed, 11 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index f6095d38e97a..149bd91f1956 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -22,6 +22,7 @@\n>  #include <linux/media-bus-format.h>\n>  \n>  #include <libcamera/camera.h>\n> +#include <libcamera/control_ids.h>\n>  #include <libcamera/request.h>\n>  #include <libcamera/stream.h>\n>  \n> @@ -1134,6 +1135,16 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)\n>  \n>  \t/* Otherwise simply complete the request. */\n>  \tRequest *request = buffer->request();\n> +\n> +\t/*\n> +\t * Record the sensor's timestamp in the request metadata.\n> +\t *\n> +\t * \\todo The sensor timestamp should be better estimated by connecting\n> +\t * to the V4L2Device::frameStart signal if the platform provides it.\n> +\t */\n> +\trequest->metadata().set(controls::SensorTimestamp,\n> +\t\t\t\tbuffer->metadata().timestamp);\n> +\n>  \tcompleteBuffer(request, buffer);\n>  \tcompleteRequest(request);\n>  }","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 9E1B9BDB15\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Apr 2021 21:46:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63B0360516;\n\tTue, 20 Apr 2021 23:46:49 +0200 (CEST)","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 25E6860516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 23:46:47 +0200 (CEST)","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 AA977411;\n\tTue, 20 Apr 2021 23:46:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hKDMbx9C\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618955206;\n\tbh=24QEpxQJa2xUIf9ma9CxH2SWGwESORDJ11/1ntHNKTY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hKDMbx9C0c5KAcLMbHRIv5/DbYTpvK0iMTCAcX+us5fsIY/IVXFVf7G43GH8P9oYN\n\tqIROX26x21gzSVVYyaZVrbweC1Qf0MIOjceaQVnv/p3BIjG+48GfGMouWTMIQ2Pbnq\n\tbHh10xJKRx70Y4oAk7KF9sBgxSdJZ8qEIo62b94c=","Date":"Wed, 21 Apr 2021 00:46:42 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YH9LwsSE7/A1OK7W@pendragon.ideasonboard.com>","References":"<20210419131433.22920-1-jacopo@jmondi.org>\n\t<20210419131433.22920-7-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210419131433.22920-7-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: simple: Report\n\tsensor 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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":16407,"web_url":"https://patchwork.libcamera.org/comment/16407/","msgid":"<YH9MbiVNRz/VkU0h@pendragon.ideasonboard.com>","date":"2021-04-20T21:49:34","subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: simple: Report\n\tsensor timestamp","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Actually...\n\nOn Wed, Apr 21, 2021 at 12:46:43AM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n> \n> Thank you for the patch.\n> \n> On Mon, Apr 19, 2021 at 03:14:26PM +0200, Jacopo Mondi wrote:\n> > Report the sensor's timestamp in the Request metadata using the\n> > completed buffer timestamp.\n> > \n> > The buffer's timestamp is recorded at DMA-transfer time, and it does not\n> > theoretically matches the 'start of exposure' definition. Record this with\n> > a \\todo entry.\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > ---\n> >  src/libcamera/pipeline/simple/simple.cpp | 11 +++++++++++\n> >  1 file changed, 11 insertions(+)\n> > \n> > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> > index f6095d38e97a..149bd91f1956 100644\n> > --- a/src/libcamera/pipeline/simple/simple.cpp\n> > +++ b/src/libcamera/pipeline/simple/simple.cpp\n> > @@ -22,6 +22,7 @@\n> >  #include <linux/media-bus-format.h>\n> >  \n> >  #include <libcamera/camera.h>\n> > +#include <libcamera/control_ids.h>\n> >  #include <libcamera/request.h>\n> >  #include <libcamera/stream.h>\n> >  \n> > @@ -1134,6 +1135,16 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)\n> >  \n> >  \t/* Otherwise simply complete the request. */\n> >  \tRequest *request = buffer->request();\n> > +\n> > +\t/*\n> > +\t * Record the sensor's timestamp in the request metadata.\n> > +\t *\n> > +\t * \\todo The sensor timestamp should be better estimated by connecting\n> > +\t * to the V4L2Device::frameStart signal if the platform provides it.\n> > +\t */\n> > +\trequest->metadata().set(controls::SensorTimestamp,\n> > +\t\t\t\tbuffer->metadata().timestamp);\n> > +\n\nThis will not run if a converter (similar to an offline ISP) is in use.\nYou should move this block higher up, either before the FrameSuccess\ntest, or after it. Do we want to fill the timestamp if an error occurs ?\n\n> >  \tcompleteBuffer(request, buffer);\n> >  \tcompleteRequest(request);\n> >  }","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 76794BDB15\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Apr 2021 21:49:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED50968840;\n\tTue, 20 Apr 2021 23:49:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D175860516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 23:49:38 +0200 (CEST)","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 452E9411;\n\tTue, 20 Apr 2021 23:49:38 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"T18eS1VC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618955378;\n\tbh=+oPfon+42C6WvMlpFeo4ig+DfaPgUUdYceisF+G2YMI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=T18eS1VCfungv4J5UnI0ei5mLGPEHRYQzeYCXBYU0KpbqJOaLlhLhbMOf76Cn5Yrc\n\t0oyH9J6f1nA/OnNGrWpBJHihrxFokHgugahZRLOwopvXtaGRYLuQLq4sj0osFIpE6i\n\tDUFiME3Wn7CkUpEzR+m68dBNiHsl4+S8myr17GRQ=","Date":"Wed, 21 Apr 2021 00:49:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YH9MbiVNRz/VkU0h@pendragon.ideasonboard.com>","References":"<20210419131433.22920-1-jacopo@jmondi.org>\n\t<20210419131433.22920-7-jacopo@jmondi.org>\n\t<YH9LwsSE7/A1OK7W@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<YH9LwsSE7/A1OK7W@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 06/13] libcamera: simple: Report\n\tsensor 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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]