[{"id":16151,"web_url":"https://patchwork.libcamera.org/comment/16151/","msgid":"<CAO5uPHOf4F85CJOcRVw7bM997sWu=mwE9Kjvk+ohqwp3U_+n4Q@mail.gmail.com>","date":"2021-04-08T09:04:07","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipu3: Report sensor\n\ttimestamp","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo, Thanks for the patch.\n\nOn Thu, Apr 8, 2021 at 1:06 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Report the sensor's timestamp in the Request metadata by using the\n> CIO2 buffer timestamp as a good-enough approximation.\n>\n> The buffer's timestamp is recorded at DMA-transfer time, and it does not\n> theoretically matches the 'start of exposure' definition, but when used\n> to compare two consecutive frames it gives an acceptable estimation of\n> the sensor frame period duration.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 519cad4f8148..d52e24f847a2 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1251,6 +1251,15 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>\n>         Request *request = info->request;\n>\n> +       /*\n> +        * Record the sensor's timestamp in the request metadata.\n> +        *\n> +        * \\todo The sensor timestamp should be better estimated by connecting\n> +        * to the V4L2Device::frameStart signal.\n> +        */\n> +       request->metadata().set(controls::SensorTimestamp,\n> +                               buffer->metadata().timestamp);\n> +\n>         /* If the buffer is cancelled force a complete of the whole request. */\n>         if (buffer->metadata().status == FrameMetadata::FrameCancelled) {\n>                 for (auto it : request->buffers())\n\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> --\n> 2.31.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 CA432BD1F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Apr 2021 09:04:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3DA0E687F3;\n\tThu,  8 Apr 2021 11:04:20 +0200 (CEST)","from mail-ej1-x630.google.com (mail-ej1-x630.google.com\n\t[IPv6:2a00:1450:4864:20::630])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5ED3E687F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Apr 2021 11:04:18 +0200 (CEST)","by mail-ej1-x630.google.com with SMTP id l4so1728634ejc.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 08 Apr 2021 02:04:18 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"a3fA3C9r\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=ZY1BYi1pDOj2fE6ipdhTAt83zMNdOv3LQanAtB1Ub7s=;\n\tb=a3fA3C9rgLrlzbJ1NAK9bGvKieUSKiTc3XC4w0MwZgihw29IL6B/5rTEYvyFXs4ahy\n\trf94YkU+nlqlyTi7miIdoI5tozaBgnHXG0UQCx0bbyBUr4y1Fdk6g7AM6BqPvuO5EfxC\n\tpGWr6GyUv1/QumxPW4j+p+R7E6TuA4wp4C9YA=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=ZY1BYi1pDOj2fE6ipdhTAt83zMNdOv3LQanAtB1Ub7s=;\n\tb=JGakeutVnC53Kj/m7EHUvHhEo64kZPgkVcMOD7RciVYKXW9T9PipKH48wgmo+MdWdm\n\tLh0a/ascycTcD/A6mpySK+q7ljKaU8LNvw0m2Z5TpJahB9sD/c+5qpWbVIW753fmY2SF\n\tI2GMNBA5ZjHet05Crn4134PSCfuf6IrR+NuvDeaeAXqoWsvsqzZRXmgK2TSUmwWucVi9\n\tZ4+i2USouLg7srbfSY+ZPW0CsBFiXvgJzQGGwcd52oHJgx1zqNLCqFU+3kVm5TDxWIit\n\t9li2Znqkb6HREFRP9JjyRPd4yKxIOvlxH2vshex45IZm+3WChv8oh9JupoO2LUsl+X7+\n\t7bdg==","X-Gm-Message-State":"AOAM531E6qEOUZlGxcvLe5sQ95C9jeNsqi0dqfVEV5lvtGoKVuX1SDlf\n\tA0PJjdMx0OWnDtQK9eC9CnIFwrIxqy/J20lIC1H+nw==","X-Google-Smtp-Source":"ABdhPJxoEbDhIBKMHL2aQiKJntwF+wucT5D6jTxGxlEeJT/cdKBwGXimqmhT+VGLgriM5iGHCcQ1+GdJTcC59iyep/0=","X-Received":"by 2002:a17:907:1b06:: with SMTP id\n\tmp6mr9111106ejc.292.1617872657967; \n\tThu, 08 Apr 2021 02:04:17 -0700 (PDT)","MIME-Version":"1.0","References":"<20210407160644.58326-1-jacopo@jmondi.org>\n\t<20210407160644.58326-3-jacopo@jmondi.org>","In-Reply-To":"<20210407160644.58326-3-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Thu, 8 Apr 2021 18:04:07 +0900","Message-ID":"<CAO5uPHOf4F85CJOcRVw7bM997sWu=mwE9Kjvk+ohqwp3U_+n4Q@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipu3: 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 <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":16207,"web_url":"https://patchwork.libcamera.org/comment/16207/","msgid":"<YHUFtA2L+7RRVLwu@pendragon.ideasonboard.com>","date":"2021-04-13T02:45:08","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipu3: 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 Wed, Apr 07, 2021 at 06:06:43PM +0200, Jacopo Mondi wrote:\n> Report the sensor's timestamp in the Request metadata by using the\n> CIO2 buffer timestamp as a good-enough approximation.\n\ns/a good-enough/an initial/\n\nThe \\todo comment below shows that we'll need a better implementation,\nbut it can wait.\n\n> The buffer's timestamp is recorded at DMA-transfer time, and it does not\n> theoretically matches the 'start of exposure' definition, but when used\n> to compare two consecutive frames it gives an acceptable estimation of\n> the sensor frame period duration.\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/ipu3/ipu3.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 519cad4f8148..d52e24f847a2 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1251,6 +1251,15 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>  \n>  \tRequest *request = info->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.\n> +\t */\n> +\trequest->metadata().set(controls::SensorTimestamp,\n> +\t\t\t\tbuffer->metadata().timestamp);\n> +\n>  \t/* If the buffer is cancelled force a complete of the whole request. */\n>  \tif (buffer->metadata().status == FrameMetadata::FrameCancelled) {\n>  \t\tfor (auto it : request->buffers())","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 53C6FBD1F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Apr 2021 02:46:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C0455687FF;\n\tTue, 13 Apr 2021 04:45:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E891687F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 04:45:58 +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 CF7256F2;\n\tTue, 13 Apr 2021 04:45:57 +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=\"maCJzZg0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618281958;\n\tbh=HrtEsfjvn3/En5oizn7VwkmaHImmv6uDuHcnzos2yJs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=maCJzZg0iUnXt/Vm1Dl5f+MXxh9VOAiW4YdW45Lg4+YJ9FqFgISPKlXaPsKi38y7u\n\tSJer1awHcUetZ/HBOFU3NvVnFqnrahyAB+JAxvrvd4GCf3W/MT4xjLOmQpgBPW4vDT\n\tes61LqaUbieTfp0JHt4oOcdo29bhIEC2r6THGVP8=","Date":"Tue, 13 Apr 2021 05:45:08 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YHUFtA2L+7RRVLwu@pendragon.ideasonboard.com>","References":"<20210407160644.58326-1-jacopo@jmondi.org>\n\t<20210407160644.58326-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210407160644.58326-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipu3: 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>"}}]