[{"id":16364,"web_url":"https://patchwork.libcamera.org/comment/16364/","msgid":"<cf302625-3f9e-f11e-d09c-06e616bd47c0@ideasonboard.com>","date":"2021-04-19T15:02:02","subject":"Re: [libcamera-devel] [PATCH 03/13] libcamera: uvc: Report sensor\n\ttimestamp","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 19/04/2021 14:14, Jacopo Mondi wrote:\n> Report the sensor's timestamp in the Request metadata using the\n> completed buffer timestamp.\n> \n> The UVC driver does not support the FRAME_SYNC v4l2 event, and the\n> buffer timestamp is the only available approximation of the\n> sensor timestamp.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index b6c6ade5ebaf..b2d2f211e61b 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -662,6 +662,9 @@ void UVCCameraData::bufferReady(FrameBuffer *buffer)\n>  {\n>  \tRequest *request = buffer->request();\n>  \n> +\trequest->metadata().set(controls::SensorTimestamp,\n> +\t\t\t\tbuffer->metadata().timestamp);\n> +\n>  \tpipe_->completeBuffer(request, buffer);\n>  \tpipe_->completeRequest(request);\n>  }\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 2C803BD812\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Apr 2021 15:02:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8168F68838;\n\tMon, 19 Apr 2021 17:02:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 452C468824\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Apr 2021 17:02:06 +0200 (CEST)","from [192.168.0.20]\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 C19F2D4A;\n\tMon, 19 Apr 2021 17:02:05 +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=\"nd5bT103\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618844525;\n\tbh=nc5vZBS00H6DI6qobxjcd0lYMeZEyghkjVefnDabH8w=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=nd5bT103NaWvoQAnD49MFDhErRBEkeUdYj8D4FmbMtK8N9YQ9GW+yiauCXXj3VONl\n\tOP/qF8HeZc6ivYVo3GF3Xh2I1oRJ0EURVUk8UHFIvAfq069WhE374oDc2H1vqlNIjK\n\tbgU/eJIFAUqATXqBSMSEnDq/75NlK5FgaK+UCFqw=","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20210419131433.22920-1-jacopo@jmondi.org>\n\t<20210419131433.22920-4-jacopo@jmondi.org>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Organization":"Ideas on Board","Message-ID":"<cf302625-3f9e-f11e-d09c-06e616bd47c0@ideasonboard.com>","Date":"Mon, 19 Apr 2021 16:02:02 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.7.1","MIME-Version":"1.0","In-Reply-To":"<20210419131433.22920-4-jacopo@jmondi.org>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH 03/13] libcamera: uvc: Report sensor\n\ttimestamp","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>","Reply-To":"kieran.bingham@ideasonboard.com","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":16403,"web_url":"https://patchwork.libcamera.org/comment/16403/","msgid":"<YH9I4B9c1BAXkIAw@pendragon.ideasonboard.com>","date":"2021-04-20T21:34:24","subject":"Re: [libcamera-devel] [PATCH 03/13] libcamera: uvc: Report sensor\n\ttimestamp","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:23PM +0200, Jacopo Mondi wrote:\n> Report the sensor's timestamp in the Request metadata using the\n> completed buffer timestamp.\n> \n> The UVC driver does not support the FRAME_SYNC v4l2 event, and the\n> buffer timestamp is the only available approximation of the\n> sensor timestamp.\n\nThat's actually not the full story, UVC device report timestamp\ninformation in metadata that can be used to recover a SOE timestamp.\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index b6c6ade5ebaf..b2d2f211e61b 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -662,6 +662,9 @@ void UVCCameraData::bufferReady(FrameBuffer *buffer)\n>  {\n>  \tRequest *request = buffer->request();\n>  \n\nI'd add\n\n\t/* \\todo Use the UVC metadata to calculate a more precise timestamp */\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\trequest->metadata().set(controls::SensorTimestamp,\n> +\t\t\t\tbuffer->metadata().timestamp);\n> +\n>  \tpipe_->completeBuffer(request, buffer);\n>  \tpipe_->completeRequest(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 C6614BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Apr 2021 21:34:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5077D68839;\n\tTue, 20 Apr 2021 23:34:31 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 60AAE60516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 23:34:29 +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 3513A411;\n\tTue, 20 Apr 2021 23:34:28 +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=\"wW8sdBWi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618954468;\n\tbh=O6QuBvhLX8TTzou1UWyzi1yE75x72Fl8qDD4ApXJVww=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wW8sdBWiYye/7GUP6/88OkThB4H3VfcHjvA0nbmZpmKXwa9xLGZz6xsyflNA5/vmP\n\tRgyCrFqCIMNojCzgSyxKH7azT1TqBes+ufKxGk7SfGIb+IZT0kTq6u+TUuFF6kSC5Y\n\tzDgE22BHCvYLx9ExywVPb3Rx+3wN7X0cgi0fR+Gk=","Date":"Wed, 21 Apr 2021 00:34:24 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YH9I4B9c1BAXkIAw@pendragon.ideasonboard.com>","References":"<20210419131433.22920-1-jacopo@jmondi.org>\n\t<20210419131433.22920-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210419131433.22920-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 03/13] libcamera: uvc: Report sensor\n\ttimestamp","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>"}}]